Author: timfox
Date: 2009-09-30 06:23:39 -0400 (Wed, 30 Sep 2009)
New Revision: 8012
Added:
trunk/tests/src/org/hornetq/tests/integration/client/NewDeadLetterAddressTest.java
trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
Removed:
trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingImplTest.java
Modified:
trunk/src/main/org/hornetq/core/postoffice/Bindings.java
trunk/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java
trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
trunk/src/main/org/hornetq/core/postoffice/impl/SimpleAddressManager.java
trunk/src/main/org/hornetq/core/server/ServerMessage.java
trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java
trunk/src/main/org/hornetq/core/settings/impl/AddressSettings.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-28
Modified: trunk/src/main/org/hornetq/core/postoffice/Bindings.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/Bindings.java 2009-09-30 04:04:31 UTC (rev
8011)
+++ trunk/src/main/org/hornetq/core/postoffice/Bindings.java 2009-09-30 10:23:39 UTC (rev
8012)
@@ -32,7 +32,7 @@
{
Collection<Binding> getBindings();
- void route(ServerMessage message, Transaction tx) throws Exception;
+ boolean route(ServerMessage message, Transaction tx) throws Exception;
void addBinding(Binding binding);
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java 2009-09-30 04:04:31
UTC (rev 8011)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java 2009-09-30 10:23:39
UTC (rev 8012)
@@ -56,7 +56,7 @@
private final List<Binding> exclusiveBindings = new
CopyOnWriteArrayList<Binding>();
private volatile boolean routeWhenNoConsumers;
-
+
public void setRouteWhenNoConsumers(final boolean routeWhenNoConsumers)
{
this.routeWhenNoConsumers = routeWhenNoConsumers;
@@ -123,7 +123,7 @@
bindingsMap.remove(binding.getID());
}
- private void routeFromCluster(final ServerMessage message, final Transaction tx)
throws Exception
+ private boolean routeFromCluster(final ServerMessage message, final Transaction tx)
throws Exception
{
byte[] ids = (byte[])message.removeProperty(MessageImpl.HDR_ROUTE_TO_IDS);
@@ -139,10 +139,7 @@
if (binding == null)
{
- // The binding has been closed - we need to route the message somewhere
else...............
- throw new IllegalStateException("Binding not found when routing from
cluster - it must have closed " + bindingID);
-
- // FIXME need to deal with this better
+ return false;
}
binding.willRoute(message);
@@ -159,6 +156,8 @@
{
bindable.route(message, tx);
}
+
+ return true;
}
public boolean redistribute(final ServerMessage message, final Queue originatingQueue,
final Transaction tx) throws Exception
@@ -251,7 +250,7 @@
}
}
- public void route(final ServerMessage message, final Transaction tx) throws Exception
+ public boolean route(final ServerMessage message, final Transaction tx) throws
Exception
{
boolean routed = false;
@@ -272,7 +271,7 @@
{
if (message.getProperty(MessageImpl.HDR_FROM_CLUSTER) != null)
{
- routeFromCluster(message, tx);
+ routed = routeFromCluster(message, tx);
}
else
{
@@ -405,9 +404,13 @@
for (Bindable bindable : chosen)
{
bindable.route(message, tx);
+
+ routed = true;
}
}
}
+
+ return routed;
}
private final int incrementPos(int pos, int length)
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-09-30
04:04:31 UTC (rev 8011)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-09-30
10:23:39 UTC (rev 8012)
@@ -612,10 +612,44 @@
Bindings bindings = addressManager.getBindingsForRoutingAddress(address);
+ boolean routed;
+
if (bindings != null)
{
- bindings.route(message, tx);
+ routed = bindings.route(message, tx);
}
+ else
+ {
+ routed = false;
+ }
+
+ if (!routed)
+ {
+ AddressSettings addressSettings =
addressSettingsRepository.getMatch(address.toString());
+
+ boolean sendToDLA = addressSettings.isSendToDLAOnNoRoute();
+
+ if (sendToDLA)
+ {
+ //Send to the DLA for the address
+
+ SimpleString dlaAddress = addressSettings.getDeadLetterAddress();
+
+ if (dlaAddress == null)
+ {
+ log.warn("Did not route to any bindings for address " + address
+ " and sendToDLAOnNoRoute is true " +
+ "but there is no DLA configured for the address, the message
will be ignored.");
+ }
+ else
+ {
+ message.setOriginalHeaders(message, false);
+
+ message.setDestination(dlaAddress);
+
+ route(message, tx);
+ }
+ }
+ }
if (startedTx)
{
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/SimpleAddressManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/SimpleAddressManager.java 2009-09-30
04:04:31 UTC (rev 8011)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/SimpleAddressManager.java 2009-09-30
10:23:39 UTC (rev 8012)
@@ -147,6 +147,8 @@
Bindings bindings = mappings.get(address);
Bindings prevBindings = null;
+
+
if (bindings == null)
{
Modified: trunk/src/main/org/hornetq/core/server/ServerMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/ServerMessage.java 2009-09-30 04:04:31 UTC (rev
8011)
+++ trunk/src/main/org/hornetq/core/server/ServerMessage.java 2009-09-30 10:23:39 UTC (rev
8012)
@@ -50,6 +50,8 @@
int getRefCount();
+ ServerMessage makeCopyForExpiryOrDLA(long newID, boolean expiry) throws Exception;
- //TODO - we might be able to put this in a better place
+ void setOriginalHeaders(ServerMessage other, boolean expiry);
+
}
Modified: trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java 2009-09-30 04:04:31 UTC
(rev 8011)
+++ trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java 2009-09-30 10:23:39 UTC
(rev 8012)
@@ -1097,31 +1097,10 @@
and original message id
*/
- long newMessageId = storageManager.generateUniqueID();
+ long newID = storageManager.generateUniqueID();
- ServerMessage copy = message.copy(newMessageId);
-
- if (ref.getMessage().getProperty(HDR_ORIG_MESSAGE_ID) != null)
- {
- copy.putStringProperty(HDR_ORIGINAL_DESTINATION, (SimpleString)ref.getMessage()
-
.getProperty(HDR_ORIGINAL_DESTINATION));
- copy.putLongProperty(HDR_ORIG_MESSAGE_ID,
(Long)ref.getMessage().getProperty(HDR_ORIG_MESSAGE_ID));
- }
- else
- {
- SimpleString originalQueue = copy.getDestination();
- copy.putStringProperty(HDR_ORIGINAL_DESTINATION, originalQueue);
- copy.putLongProperty(HDR_ORIG_MESSAGE_ID, message.getMessageID());
- }
- // reset expiry
- copy.setExpiration(0);
- if (expiry)
- {
- long actualExpiryTime = System.currentTimeMillis();
-
- copy.putLongProperty(HDR_ACTUAL_EXPIRY_TIME, actualExpiryTime);
- }
-
+ ServerMessage copy = message.makeCopyForExpiryOrDLA(newID, expiry);
+
return copy;
}
Modified: trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java 2009-09-30 04:04:31
UTC (rev 8011)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java 2009-09-30 10:23:39
UTC (rev 8012)
@@ -21,6 +21,7 @@
import org.hornetq.core.server.MessageReference;
import org.hornetq.core.server.Queue;
import org.hornetq.core.server.ServerMessage;
+import org.hornetq.utils.SimpleString;
/**
*
@@ -34,17 +35,17 @@
public class ServerMessageImpl extends MessageImpl implements ServerMessage
{
private static final Logger log = Logger.getLogger(ServerMessageImpl.class);
-
+
private final AtomicInteger durableRefCount = new AtomicInteger(0);
/** Global reference counts for paging control */
private final AtomicInteger refCount = new AtomicInteger(0);
private volatile boolean stored;
-
- //We cache this
+
+ // We cache this
private volatile int memoryEstimate = -1;
-
+
/*
* Constructor for when reading from network
*/
@@ -87,34 +88,34 @@
{
messageID = id;
}
-
+
public void setType(byte type)
{
this.type = type;
}
-
+
public MessageReference createReference(final Queue queue)
{
MessageReference ref = new MessageReferenceImpl(this, queue);
return ref;
}
-
+
public boolean isStored()
{
return stored;
}
-
+
public void setStored() throws Exception
{
stored = true;
}
-
+
public int incrementRefCount()
{
return refCount.incrementAndGet();
}
-
+
public int incrementDurableRefCount()
{
return durableRefCount.incrementAndGet();
@@ -129,7 +130,7 @@
{
return refCount.decrementAndGet();
}
-
+
public int getRefCount()
{
return refCount.get();
@@ -139,7 +140,7 @@
{
return false;
}
-
+
public long getLargeBodySize()
{
return (long)getBodySize();
@@ -154,26 +155,72 @@
// different from reality
memoryEstimate = getEncodeSize() + (16 + 4) * 2 + 1;
}
-
+
return memoryEstimate;
}
public ServerMessage copy(final long newID) throws Exception
{
ServerMessage m = new ServerMessageImpl(this);
-
+
m.setMessageID(newID);
-
+
return m;
}
-
+
public ServerMessage copy() throws Exception
{
ServerMessage m = new ServerMessageImpl(this);
-
+
return m;
}
+ public ServerMessage makeCopyForExpiryOrDLA(final long newID, final boolean expiry)
throws Exception
+ {
+ /*
+ We copy the message and send that to the dla/expiry queue - this is
+ because otherwise we may end up with a ref with the same message id in the
+ queue more than once which would barf - this might happen if the same message had
been
+ expire from multiple subscriptions of a topic for example
+ We set headers that hold the original message destination, expiry time
+ and original message id
+ */
+
+ ServerMessage copy = copy(newID);
+
+ copy.setOriginalHeaders(this, expiry);
+
+ return copy;
+ }
+
+ public void setOriginalHeaders(final ServerMessage other, final boolean expiry)
+ {
+ if (other.getProperty(HDR_ORIG_MESSAGE_ID) != null)
+ {
+ putStringProperty(HDR_ORIGINAL_DESTINATION,
(SimpleString)other.getProperty(HDR_ORIGINAL_DESTINATION));
+
+ putLongProperty(HDR_ORIG_MESSAGE_ID,
(Long)other.getProperty(HDR_ORIG_MESSAGE_ID));
+ }
+ else
+ {
+ SimpleString originalQueue = other.getDestination();
+
+ putStringProperty(HDR_ORIGINAL_DESTINATION, originalQueue);
+
+ putLongProperty(HDR_ORIG_MESSAGE_ID, other.getMessageID());
+ }
+
+ if (expiry)
+ {
+ // reset expiry
+ setExpiration(0);
+
+ long actualExpiryTime = System.currentTimeMillis();
+
+ putLongProperty(HDR_ACTUAL_EXPIRY_TIME, actualExpiryTime);
+ }
+ }
+
@Override
public String toString()
{
Modified: trunk/src/main/org/hornetq/core/settings/impl/AddressSettings.java
===================================================================
--- trunk/src/main/org/hornetq/core/settings/impl/AddressSettings.java 2009-09-30 04:04:31
UTC (rev 8011)
+++ trunk/src/main/org/hornetq/core/settings/impl/AddressSettings.java 2009-09-30 10:23:39
UTC (rev 8012)
@@ -49,6 +49,8 @@
public static final boolean DEFAULT_LAST_VALUE_QUEUE = false;
public static final long DEFAULT_REDISTRIBUTION_DELAY = -1;
+
+ public static final boolean DEFAULT_SEND_TO_DLA_ON_NO_ROUTE = false;
private Integer maxSizeBytes = null;
@@ -71,6 +73,8 @@
private Boolean lastValueQueue = null;
private Long redistributionDelay = null;
+
+ private Boolean sendToDLAOnNoRoute = null;
public boolean isLastValueQueue()
{
@@ -91,12 +95,12 @@
{
return dropMessagesWhenFull != null ? dropMessagesWhenFull :
DEFAULT_DROP_MESSAGES_WHEN_FULL;
}
-
+
public void setDropMessagesWhenFull(final boolean value)
{
dropMessagesWhenFull = value;
}
-
+
public void setPageSizeBytes(final int pageSize)
{
pageSizeBytes = pageSize;
@@ -172,7 +176,17 @@
{
this.expiryAddress = expiryAddress;
}
+
+ public boolean isSendToDLAOnNoRoute()
+ {
+ return sendToDLAOnNoRoute != null ? sendToDLAOnNoRoute :
DEFAULT_SEND_TO_DLA_ON_NO_ROUTE;
+ }
+ public void setSendToDLAOnNoRoute(final boolean value)
+ {
+ sendToDLAOnNoRoute = value;
+ }
+
public Distributor getDistributionPolicy()
{
try
@@ -248,6 +262,10 @@
{
redistributionDelay = merged.redistributionDelay;
}
+ if (sendToDLAOnNoRoute == null)
+ {
+ sendToDLAOnNoRoute = merged.sendToDLAOnNoRoute;
+ }
}
}
Added: trunk/tests/src/org/hornetq/tests/integration/client/NewDeadLetterAddressTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/NewDeadLetterAddressTest.java
(rev 0)
+++
trunk/tests/src/org/hornetq/tests/integration/client/NewDeadLetterAddressTest.java 2009-09-30
10:23:39 UTC (rev 8012)
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.hornetq.tests.integration.client;
+
+import static org.hornetq.tests.util.RandomUtil.randomSimpleString;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.hornetq.core.client.ClientConsumer;
+import org.hornetq.core.client.ClientMessage;
+import org.hornetq.core.client.ClientProducer;
+import org.hornetq.core.client.ClientSession;
+import org.hornetq.core.client.ClientSessionFactory;
+import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.core.config.TransportConfiguration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.exception.HornetQException;
+import org.hornetq.core.message.impl.MessageImpl;
+import org.hornetq.core.server.HornetQ;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.Queue;
+import org.hornetq.core.settings.impl.AddressSettings;
+import org.hornetq.core.transaction.impl.XidImpl;
+import org.hornetq.tests.util.UnitTestCase;
+import org.hornetq.utils.SimpleString;
+
+/**
+ *
+ * A NewDeadLetterAddressTest
+ *
+ * @author tim fox
+ *
+ *
+ */
+public class NewDeadLetterAddressTest extends UnitTestCase
+{
+ private HornetQServer server;
+
+ private ClientSession clientSession;
+
+ public void testSendToDLAWhenNoRoute() throws Exception
+ {
+ SimpleString dla = new SimpleString("DLA");
+ SimpleString address = new SimpleString("empty_address");
+ AddressSettings addressSettings = new AddressSettings();
+ addressSettings.setDeadLetterAddress(dla);
+ addressSettings.setSendToDLAOnNoRoute(true);
+ server.getAddressSettingsRepository().addMatch(address.toString(),
addressSettings);
+ SimpleString dlq = new SimpleString("DLQ1");
+ clientSession.createQueue(dla, dlq, null, false);
+ ClientProducer producer = clientSession.createProducer(address);
+ producer.send(createTextMessage("heyho!", clientSession));
+ clientSession.start();
+ ClientConsumer clientConsumer = clientSession.createConsumer(dlq);
+ ClientMessage m = clientConsumer.receive(500);
+ m.acknowledge();
+ assertNotNull(m);
+ assertEquals(m.getBody().readString(), "heyho!");
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ ConfigurationImpl configuration = new ConfigurationImpl();
+ configuration.setSecurityEnabled(false);
+ TransportConfiguration transportConfig = new
TransportConfiguration(INVM_ACCEPTOR_FACTORY);
+ configuration.getAcceptorConfigurations().add(transportConfig);
+ server = HornetQ.newHornetQServer(configuration, false);
+ // start the server
+ server.start();
+ // then we create a client as normal
+ ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new
TransportConfiguration(INVM_CONNECTOR_FACTORY));
+ clientSession = sessionFactory.createSession(false, true, false);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ if (clientSession != null)
+ {
+ try
+ {
+ clientSession.close();
+ }
+ catch (HornetQException e1)
+ {
+ //
+ }
+ }
+ if (server != null && server.isStarted())
+ {
+ try
+ {
+ server.stop();
+ }
+ catch (Exception e1)
+ {
+ //
+ }
+ }
+ server = null;
+ clientSession = null;
+ super.tearDown();
+ }
+
+}
Deleted: trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingImplTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingImplTest.java 2009-09-30
04:04:31 UTC (rev 8011)
+++
trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingImplTest.java 2009-09-30
10:23:39 UTC (rev 8012)
@@ -1,1019 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.tests.unit.core.postoffice.impl;
-
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-import javax.transaction.xa.Xid;
-
-import org.hornetq.core.exception.HornetQException;
-import org.hornetq.core.filter.Filter;
-import org.hornetq.core.postoffice.Binding;
-import org.hornetq.core.postoffice.BindingType;
-import org.hornetq.core.postoffice.impl.BindingsImpl;
-import org.hornetq.core.remoting.spi.HornetQBuffer;
-import org.hornetq.core.server.Bindable;
-import org.hornetq.core.server.MessageReference;
-import org.hornetq.core.server.Queue;
-import org.hornetq.core.server.ServerMessage;
-import org.hornetq.core.transaction.Transaction;
-import org.hornetq.core.transaction.TransactionOperation;
-import org.hornetq.tests.util.UnitTestCase;
-import org.hornetq.utils.SimpleString;
-import org.hornetq.utils.TypedProperties;
-
-/**
- * A BindingImplTest
- *
- * @author clebert
- *
- * Created Mar 12, 2009 9:14:46 PM
- *
- *
- */
-public class BindingImplTest extends UnitTestCase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testRemoveWhileRouting() throws Exception
- {
- // It would require many iterations before getting a failure
- for (int i = 0; i < 500; i++)
- {
- internalTest(true);
- }
- }
-
- public void testRemoveWhileRedistributing() throws Exception
- {
- // It would require many iterations before getting a failure
- for (int i = 0; i < 500; i++)
- {
- internalTest(false);
- }
- }
-
- private void internalTest(final boolean route) throws Exception
- {
- final FakeBinding fake = new FakeBinding(new SimpleString("a"));
-
- final BindingsImpl bind = new BindingsImpl();
- bind.addBinding(fake);
- bind.addBinding(new FakeBinding(new SimpleString("a")));
- bind.addBinding(new FakeBinding(new SimpleString("a")));
-
- Thread t = new Thread()
- {
- @Override
- public void run()
- {
- try
- {
- bind.removeBinding(fake);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- };
-
- Queue queue = new FakeQueue(new SimpleString("a"));
- t.start();
-
- for (int i = 0; i < 100; i++)
- {
- if (route)
- {
- bind.route(new FakeMessage(), new FakeTransaction());
- }
- else
- {
- bind.redistribute(new FakeMessage(), queue, new FakeTransaction());
- }
- }
- }
-
- class FakeTransaction implements Transaction
- {
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.transaction.Transaction#addOperation(org.hornetq.core.transaction.TransactionOperation)
- */
- public void addOperation(final TransactionOperation sync)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#commit()
- */
- public void commit() throws Exception
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#commit(boolean)
- */
- public void commit(final boolean onePhase) throws Exception
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#getCreateTime()
- */
- public long getCreateTime()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#getID()
- */
- public long getID()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#getOperationsCount()
- */
- public int getOperationsCount()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#getProperty(int)
- */
- public Object getProperty(final int index)
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#getState()
- */
- public State getState()
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#getXid()
- */
- public Xid getXid()
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.transaction.Transaction#markAsRollbackOnly(org.hornetq.core.exception.HornetQException)
- */
- public void markAsRollbackOnly(final HornetQException exception)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#prepare()
- */
- public void prepare() throws Exception
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#putProperty(int,
java.lang.Object)
- */
- public void putProperty(final int index, final Object property)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.transaction.Transaction#removeOperation(org.hornetq.core.transaction.TransactionOperation)
- */
- public void removeOperation(final TransactionOperation sync)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#resume()
- */
- public void resume()
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#rollback()
- */
- public void rollback() throws Exception
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.transaction.Transaction#setState(org.hornetq.core.transaction.Transaction.State)
- */
- public void setState(final State state)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#suspend()
- */
- public void suspend()
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.transaction.Transaction#getDistinctQueues()
- */
- public Set<Queue> getDistinctQueues()
- {
- return Collections.emptySet();
- }
-
- }
-
- class FakeMessage implements ServerMessage
- {
-
- public Map<String, Object> toMap()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.ServerMessage#copy(long)
- */
- public ServerMessage copy(final long newID) throws Exception
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.ServerMessage#copy()
- */
- public ServerMessage copy() throws Exception
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.server.ServerMessage#createReference(org.hornetq.core.server.Queue)
- */
- public MessageReference createReference(final Queue queue)
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.ServerMessage#decrementDurableRefCount()
- */
- public int decrementDurableRefCount()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.ServerMessage#decrementRefCount()
- */
- public int decrementRefCount()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.ServerMessage#getMemoryEstimate()
- */
- public int getMemoryEstimate()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.ServerMessage#getRefCount()
- */
- public int getRefCount()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.ServerMessage#incrementDurableRefCount()
- */
- public int incrementDurableRefCount()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.ServerMessage#incrementRefCount()
- */
- public int incrementRefCount()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.ServerMessage#isLargeMessage()
- */
- public boolean isLargeMessage()
- {
-
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.ServerMessage#isStored()
- */
- public boolean isStored()
- {
-
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.ServerMessage#setMessageID(long)
- */
- public void setMessageID(final long id)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.ServerMessage#setStored()
- */
- public void setStored()
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#containsProperty(org.hornetq.utils.SimpleString)
- */
- public boolean containsProperty(final SimpleString key)
- {
-
- return false;
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#decode(org.hornetq.core.remoting.spi.HornetQBuffer)
- */
- public void decode(final HornetQBuffer buffer)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#decodeBody(org.hornetq.core.remoting.spi.HornetQBuffer)
- */
- public void decodeBody(final HornetQBuffer buffer)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#decodeProperties(org.hornetq.core.remoting.spi.HornetQBuffer)
- */
- public void decodeProperties(final HornetQBuffer buffer)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#encode(org.hornetq.core.remoting.spi.HornetQBuffer)
- */
- public void encode(final HornetQBuffer buffer)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#encodeBody(org.hornetq.core.remoting.spi.HornetQBuffer,
long, int)
- */
- public void encodeBody(final HornetQBuffer buffer, final long start, final int
size)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#encodeBody(org.hornetq.core.remoting.spi.HornetQBuffer)
- */
- public void encodeBody(final HornetQBuffer buffer)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#encodeProperties(org.hornetq.core.remoting.spi.HornetQBuffer)
- */
- public void encodeProperties(final HornetQBuffer buffer)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getBody()
- */
- public HornetQBuffer getBody()
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getBodySize()
- */
- public int getBodySize()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getDestination()
- */
- public SimpleString getDestination()
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getEncodeSize()
- */
- public int getEncodeSize()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getExpiration()
- */
- public long getExpiration()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getMessageID()
- */
- public long getMessageID()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getPriority()
- */
- public byte getPriority()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getProperties()
- */
- public TypedProperties getProperties()
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getPropertiesEncodeSize()
- */
- public int getPropertiesEncodeSize()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#getProperty(org.hornetq.utils.SimpleString)
- */
- public Object getProperty(final SimpleString key)
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getPropertyNames()
- */
- public Set<SimpleString> getPropertyNames()
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getTimestamp()
- */
- public long getTimestamp()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getType()
- */
- public byte getType()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#isDurable()
- */
- public boolean isDurable()
- {
-
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#isExpired()
- */
- public boolean isExpired()
- {
-
- return false;
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#putBooleanProperty(org.hornetq.utils.SimpleString,
boolean)
- */
- public void putBooleanProperty(final SimpleString key, final boolean value)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#putByteProperty(org.hornetq.utils.SimpleString, byte)
- */
- public void putByteProperty(final SimpleString key, final byte value)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#putBytesProperty(org.hornetq.utils.SimpleString, byte[])
- */
- public void putBytesProperty(final SimpleString key, final byte[] value)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#putDoubleProperty(org.hornetq.utils.SimpleString,
double)
- */
- public void putDoubleProperty(final SimpleString key, final double value)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#putFloatProperty(org.hornetq.utils.SimpleString, float)
- */
- public void putFloatProperty(final SimpleString key, final float value)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#putIntProperty(org.hornetq.utils.SimpleString, int)
- */
- public void putIntProperty(final SimpleString key, final int value)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#putLongProperty(org.hornetq.utils.SimpleString, long)
- */
- public void putLongProperty(final SimpleString key, final long value)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#putShortProperty(org.hornetq.utils.SimpleString, short)
- */
- public void putShortProperty(final SimpleString key, final short value)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#putStringProperty(org.hornetq.utils.SimpleString,
org.hornetq.utils.SimpleString)
- */
- public void putStringProperty(final SimpleString key, final SimpleString value)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#putTypedProperties(org.hornetq.utils.TypedProperties)
- */
- public void putTypedProperties(final TypedProperties properties)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#removeProperty(org.hornetq.utils.SimpleString)
- */
- public Object removeProperty(final SimpleString key)
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#setBody(org.hornetq.core.remoting.spi.HornetQBuffer)
- */
- public void setBody(final HornetQBuffer body)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.message.Message#setDestination(org.hornetq.utils.SimpleString)
- */
- public void setDestination(final SimpleString destination)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#setDurable(boolean)
- */
- public void setDurable(final boolean durable)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#setExpiration(long)
- */
- public void setExpiration(final long expiration)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#setPriority(byte)
- */
- public void setPriority(final byte priority)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#setTimestamp(long)
- */
- public void setTimestamp(final long timestamp)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getBodyInputStream()
- */
- public InputStream getBodyInputStream()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#setBodyInputStream(java.io.InputStream)
- */
- public void setBodyInputStream(InputStream stream)
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getLargeBodySize()
- */
- public long getLargeBodySize()
- {
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#containsProperty(java.lang.String)
- */
- public boolean containsProperty(String key)
- {
-
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getProperty(java.lang.String)
- */
- public Object getProperty(String key)
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#putBooleanProperty(java.lang.String,
boolean)
- */
- public void putBooleanProperty(String key, boolean value)
- {
-
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#putByteProperty(java.lang.String, byte)
- */
- public void putByteProperty(String key, byte value)
- {
-
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#putBytesProperty(java.lang.String,
byte[])
- */
- public void putBytesProperty(String key, byte[] value)
- {
-
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#putDoubleProperty(java.lang.String,
double)
- */
- public void putDoubleProperty(String key, double value)
- {
-
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#putFloatProperty(java.lang.String, float)
- */
- public void putFloatProperty(String key, float value)
- {
-
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#putIntProperty(java.lang.String, int)
- */
- public void putIntProperty(String key, int value)
- {
-
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#putLongProperty(java.lang.String, long)
- */
- public void putLongProperty(String key, long value)
- {
-
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#putShortProperty(java.lang.String, short)
- */
- public void putShortProperty(String key, short value)
- {
-
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#putStringProperty(java.lang.String,
java.lang.String)
- */
- public void putStringProperty(String key, String value)
- {
-
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.message.Message#removeProperty(java.lang.String)
- */
- public Object removeProperty(String key)
- {
-
- return null;
- }
-
- }
-
- class FakeFilter implements Filter
- {
-
- /* (non-Javadoc)
- * @see org.hornetq.core.filter.Filter#getFilterString()
- */
- public SimpleString getFilterString()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.filter.Filter#match(org.hornetq.core.server.ServerMessage)
- */
- public boolean match(final ServerMessage message)
- {
- return false;
- }
-
- }
-
- class FakeBinding implements Binding
- {
-
- final SimpleString name;
-
- FakeBinding(final SimpleString name)
- {
- this.name = name;
- }
-
- public SimpleString getAddress()
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.postoffice.Binding#getBindable()
- */
- public Bindable getBindable()
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.postoffice.Binding#getClusterName()
- */
- public SimpleString getClusterName()
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.postoffice.Binding#getDistance()
- */
- public int getDistance()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.postoffice.Binding#getFilter()
- */
- public Filter getFilter()
- {
- return new FakeFilter();
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.postoffice.Binding#getID()
- */
- public int getID()
- {
-
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.postoffice.Binding#getRoutingName()
- */
- public SimpleString getRoutingName()
- {
- return name;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.postoffice.Binding#getType()
- */
- public BindingType getType()
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.postoffice.Binding#getUniqueName()
- */
- public SimpleString getUniqueName()
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.postoffice.Binding#isExclusive()
- */
- public boolean isExclusive()
- {
-
- return false;
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.postoffice.Binding#isHighAcceptPriority(org.hornetq.core.server.ServerMessage)
- */
- public boolean isHighAcceptPriority(final ServerMessage message)
- {
-
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.postoffice.Binding#setID(int)
- */
- public void setID(final int id)
- {
-
- }
-
- /* (non-Javadoc)
- * @see
org.hornetq.core.postoffice.Binding#willRoute(org.hornetq.core.server.ServerMessage)
- */
- public void willRoute(final ServerMessage message)
- {
-
- }
-
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
(from rev 8006,
trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingImplTest.java)
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
(rev 0)
+++
trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java 2009-09-30
10:23:39 UTC (rev 8012)
@@ -0,0 +1,1036 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.unit.core.postoffice.impl;
+
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.core.exception.HornetQException;
+import org.hornetq.core.filter.Filter;
+import org.hornetq.core.postoffice.Binding;
+import org.hornetq.core.postoffice.BindingType;
+import org.hornetq.core.postoffice.impl.BindingsImpl;
+import org.hornetq.core.remoting.spi.HornetQBuffer;
+import org.hornetq.core.server.Bindable;
+import org.hornetq.core.server.MessageReference;
+import org.hornetq.core.server.Queue;
+import org.hornetq.core.server.ServerMessage;
+import org.hornetq.core.transaction.Transaction;
+import org.hornetq.core.transaction.TransactionOperation;
+import org.hornetq.tests.util.UnitTestCase;
+import org.hornetq.utils.SimpleString;
+import org.hornetq.utils.TypedProperties;
+
+/**
+ * A BindingImplTest
+ *
+ * @author clebert
+ *
+ * Created Mar 12, 2009 9:14:46 PM
+ *
+ *
+ */
+public class BindingsImplTest extends UnitTestCase
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testRemoveWhileRouting() throws Exception
+ {
+ // It would require many iterations before getting a failure
+ for (int i = 0; i < 500; i++)
+ {
+ internalTest(true);
+ }
+ }
+
+ public void testRemoveWhileRedistributing() throws Exception
+ {
+ // It would require many iterations before getting a failure
+ for (int i = 0; i < 500; i++)
+ {
+ internalTest(false);
+ }
+ }
+
+ private void internalTest(final boolean route) throws Exception
+ {
+ final FakeBinding fake = new FakeBinding(new SimpleString("a"));
+
+ final BindingsImpl bind = new BindingsImpl();
+ bind.addBinding(fake);
+ bind.addBinding(new FakeBinding(new SimpleString("a")));
+ bind.addBinding(new FakeBinding(new SimpleString("a")));
+
+ Thread t = new Thread()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ bind.removeBinding(fake);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ };
+
+ Queue queue = new FakeQueue(new SimpleString("a"));
+ t.start();
+
+ for (int i = 0; i < 100; i++)
+ {
+ if (route)
+ {
+ bind.route(new FakeMessage(), new FakeTransaction());
+ }
+ else
+ {
+ bind.redistribute(new FakeMessage(), queue, new FakeTransaction());
+ }
+ }
+ }
+
+ class FakeTransaction implements Transaction
+ {
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.transaction.Transaction#addOperation(org.hornetq.core.transaction.TransactionOperation)
+ */
+ public void addOperation(final TransactionOperation sync)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#commit()
+ */
+ public void commit() throws Exception
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#commit(boolean)
+ */
+ public void commit(final boolean onePhase) throws Exception
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#getCreateTime()
+ */
+ public long getCreateTime()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#getID()
+ */
+ public long getID()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#getOperationsCount()
+ */
+ public int getOperationsCount()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#getProperty(int)
+ */
+ public Object getProperty(final int index)
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#getState()
+ */
+ public State getState()
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#getXid()
+ */
+ public Xid getXid()
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.transaction.Transaction#markAsRollbackOnly(org.hornetq.core.exception.HornetQException)
+ */
+ public void markAsRollbackOnly(final HornetQException exception)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#prepare()
+ */
+ public void prepare() throws Exception
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#putProperty(int,
java.lang.Object)
+ */
+ public void putProperty(final int index, final Object property)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.transaction.Transaction#removeOperation(org.hornetq.core.transaction.TransactionOperation)
+ */
+ public void removeOperation(final TransactionOperation sync)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#resume()
+ */
+ public void resume()
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#rollback()
+ */
+ public void rollback() throws Exception
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.transaction.Transaction#setState(org.hornetq.core.transaction.Transaction.State)
+ */
+ public void setState(final State state)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#suspend()
+ */
+ public void suspend()
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#getDistinctQueues()
+ */
+ public Set<Queue> getDistinctQueues()
+ {
+ return Collections.emptySet();
+ }
+
+ }
+
+ class FakeMessage implements ServerMessage
+ {
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#makeCopyForExpiryOrDLA(long,
boolean)
+ */
+ public ServerMessage makeCopyForExpiryOrDLA(long newID, boolean expiry) throws
Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.server.ServerMessage#setOriginalHeaders(org.hornetq.core.server.ServerMessage,
boolean)
+ */
+ public void setOriginalHeaders(ServerMessage other, boolean expiry)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Map<String, Object> toMap()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#copy(long)
+ */
+ public ServerMessage copy(final long newID) throws Exception
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#copy()
+ */
+ public ServerMessage copy() throws Exception
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.server.ServerMessage#createReference(org.hornetq.core.server.Queue)
+ */
+ public MessageReference createReference(final Queue queue)
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#decrementDurableRefCount()
+ */
+ public int decrementDurableRefCount()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#decrementRefCount()
+ */
+ public int decrementRefCount()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#getMemoryEstimate()
+ */
+ public int getMemoryEstimate()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#getRefCount()
+ */
+ public int getRefCount()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#incrementDurableRefCount()
+ */
+ public int incrementDurableRefCount()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#incrementRefCount()
+ */
+ public int incrementRefCount()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#isLargeMessage()
+ */
+ public boolean isLargeMessage()
+ {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#isStored()
+ */
+ public boolean isStored()
+ {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#setMessageID(long)
+ */
+ public void setMessageID(final long id)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.ServerMessage#setStored()
+ */
+ public void setStored()
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#containsProperty(org.hornetq.utils.SimpleString)
+ */
+ public boolean containsProperty(final SimpleString key)
+ {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#decode(org.hornetq.core.remoting.spi.HornetQBuffer)
+ */
+ public void decode(final HornetQBuffer buffer)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#decodeBody(org.hornetq.core.remoting.spi.HornetQBuffer)
+ */
+ public void decodeBody(final HornetQBuffer buffer)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#decodeProperties(org.hornetq.core.remoting.spi.HornetQBuffer)
+ */
+ public void decodeProperties(final HornetQBuffer buffer)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#encode(org.hornetq.core.remoting.spi.HornetQBuffer)
+ */
+ public void encode(final HornetQBuffer buffer)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#encodeBody(org.hornetq.core.remoting.spi.HornetQBuffer,
long, int)
+ */
+ public void encodeBody(final HornetQBuffer buffer, final long start, final int
size)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#encodeBody(org.hornetq.core.remoting.spi.HornetQBuffer)
+ */
+ public void encodeBody(final HornetQBuffer buffer)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#encodeProperties(org.hornetq.core.remoting.spi.HornetQBuffer)
+ */
+ public void encodeProperties(final HornetQBuffer buffer)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getBody()
+ */
+ public HornetQBuffer getBody()
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getBodySize()
+ */
+ public int getBodySize()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getDestination()
+ */
+ public SimpleString getDestination()
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getEncodeSize()
+ */
+ public int getEncodeSize()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getExpiration()
+ */
+ public long getExpiration()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getMessageID()
+ */
+ public long getMessageID()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getPriority()
+ */
+ public byte getPriority()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getProperties()
+ */
+ public TypedProperties getProperties()
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getPropertiesEncodeSize()
+ */
+ public int getPropertiesEncodeSize()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#getProperty(org.hornetq.utils.SimpleString)
+ */
+ public Object getProperty(final SimpleString key)
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getPropertyNames()
+ */
+ public Set<SimpleString> getPropertyNames()
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getTimestamp()
+ */
+ public long getTimestamp()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getType()
+ */
+ public byte getType()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#isDurable()
+ */
+ public boolean isDurable()
+ {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#isExpired()
+ */
+ public boolean isExpired()
+ {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#putBooleanProperty(org.hornetq.utils.SimpleString,
boolean)
+ */
+ public void putBooleanProperty(final SimpleString key, final boolean value)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#putByteProperty(org.hornetq.utils.SimpleString, byte)
+ */
+ public void putByteProperty(final SimpleString key, final byte value)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#putBytesProperty(org.hornetq.utils.SimpleString, byte[])
+ */
+ public void putBytesProperty(final SimpleString key, final byte[] value)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#putDoubleProperty(org.hornetq.utils.SimpleString,
double)
+ */
+ public void putDoubleProperty(final SimpleString key, final double value)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#putFloatProperty(org.hornetq.utils.SimpleString, float)
+ */
+ public void putFloatProperty(final SimpleString key, final float value)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#putIntProperty(org.hornetq.utils.SimpleString, int)
+ */
+ public void putIntProperty(final SimpleString key, final int value)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#putLongProperty(org.hornetq.utils.SimpleString, long)
+ */
+ public void putLongProperty(final SimpleString key, final long value)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#putShortProperty(org.hornetq.utils.SimpleString, short)
+ */
+ public void putShortProperty(final SimpleString key, final short value)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#putStringProperty(org.hornetq.utils.SimpleString,
org.hornetq.utils.SimpleString)
+ */
+ public void putStringProperty(final SimpleString key, final SimpleString value)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#putTypedProperties(org.hornetq.utils.TypedProperties)
+ */
+ public void putTypedProperties(final TypedProperties properties)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#removeProperty(org.hornetq.utils.SimpleString)
+ */
+ public Object removeProperty(final SimpleString key)
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#setBody(org.hornetq.core.remoting.spi.HornetQBuffer)
+ */
+ public void setBody(final HornetQBuffer body)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.message.Message#setDestination(org.hornetq.utils.SimpleString)
+ */
+ public void setDestination(final SimpleString destination)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#setDurable(boolean)
+ */
+ public void setDurable(final boolean durable)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#setExpiration(long)
+ */
+ public void setExpiration(final long expiration)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#setPriority(byte)
+ */
+ public void setPriority(final byte priority)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#setTimestamp(long)
+ */
+ public void setTimestamp(final long timestamp)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getBodyInputStream()
+ */
+ public InputStream getBodyInputStream()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#setBodyInputStream(java.io.InputStream)
+ */
+ public void setBodyInputStream(InputStream stream)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getLargeBodySize()
+ */
+ public long getLargeBodySize()
+ {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#containsProperty(java.lang.String)
+ */
+ public boolean containsProperty(String key)
+ {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getProperty(java.lang.String)
+ */
+ public Object getProperty(String key)
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#putBooleanProperty(java.lang.String,
boolean)
+ */
+ public void putBooleanProperty(String key, boolean value)
+ {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#putByteProperty(java.lang.String, byte)
+ */
+ public void putByteProperty(String key, byte value)
+ {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#putBytesProperty(java.lang.String,
byte[])
+ */
+ public void putBytesProperty(String key, byte[] value)
+ {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#putDoubleProperty(java.lang.String,
double)
+ */
+ public void putDoubleProperty(String key, double value)
+ {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#putFloatProperty(java.lang.String, float)
+ */
+ public void putFloatProperty(String key, float value)
+ {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#putIntProperty(java.lang.String, int)
+ */
+ public void putIntProperty(String key, int value)
+ {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#putLongProperty(java.lang.String, long)
+ */
+ public void putLongProperty(String key, long value)
+ {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#putShortProperty(java.lang.String, short)
+ */
+ public void putShortProperty(String key, short value)
+ {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#putStringProperty(java.lang.String,
java.lang.String)
+ */
+ public void putStringProperty(String key, String value)
+ {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#removeProperty(java.lang.String)
+ */
+ public Object removeProperty(String key)
+ {
+
+ return null;
+ }
+
+ }
+
+ class FakeFilter implements Filter
+ {
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.filter.Filter#getFilterString()
+ */
+ public SimpleString getFilterString()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.filter.Filter#match(org.hornetq.core.server.ServerMessage)
+ */
+ public boolean match(final ServerMessage message)
+ {
+ return false;
+ }
+
+ }
+
+ class FakeBinding implements Binding
+ {
+
+ final SimpleString name;
+
+ FakeBinding(final SimpleString name)
+ {
+ this.name = name;
+ }
+
+ public SimpleString getAddress()
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.postoffice.Binding#getBindable()
+ */
+ public Bindable getBindable()
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.postoffice.Binding#getClusterName()
+ */
+ public SimpleString getClusterName()
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.postoffice.Binding#getDistance()
+ */
+ public int getDistance()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.postoffice.Binding#getFilter()
+ */
+ public Filter getFilter()
+ {
+ return new FakeFilter();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.postoffice.Binding#getID()
+ */
+ public int getID()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.postoffice.Binding#getRoutingName()
+ */
+ public SimpleString getRoutingName()
+ {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.postoffice.Binding#getType()
+ */
+ public BindingType getType()
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.postoffice.Binding#getUniqueName()
+ */
+ public SimpleString getUniqueName()
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.postoffice.Binding#isExclusive()
+ */
+ public boolean isExclusive()
+ {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.postoffice.Binding#isHighAcceptPriority(org.hornetq.core.server.ServerMessage)
+ */
+ public boolean isHighAcceptPriority(final ServerMessage message)
+ {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.postoffice.Binding#setID(int)
+ */
+ public void setID(final int id)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.hornetq.core.postoffice.Binding#willRoute(org.hornetq.core.server.ServerMessage)
+ */
+ public void willRoute(final ServerMessage message)
+ {
+
+ }
+
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}