diff options
author | Martin Ritchie <ritchiem@apache.org> | 2006-09-26 08:10:01 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2006-09-26 08:10:01 +0000 |
commit | 6ce702dfb4ea0e1835804efd328be2eee79e23b3 (patch) | |
tree | f94d94c3a3501c4afa9511eb864295503c2bc6d5 | |
parent | 78ea0dff2fd4876e130ccc351700b4e95ce330a5 (diff) | |
download | qpid-python-6ce702dfb4ea0e1835804efd328be2eee79e23b3.tar.gz |
Changed default instance id to 1 to make getInstance simpler.
Added ability to specify default ApplicationRegistry
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@449942 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/broker/src/org/apache/qpid/server/registry/ApplicationRegistry.java | 12 | ||||
-rw-r--r-- | java/client/test/src/org/apache/qpid/ack/DisconnectAndRedeliverTest.java | 21 |
2 files changed, 19 insertions, 14 deletions
diff --git a/java/broker/src/org/apache/qpid/server/registry/ApplicationRegistry.java b/java/broker/src/org/apache/qpid/server/registry/ApplicationRegistry.java index c70ecf3f91..50f3d711ab 100644 --- a/java/broker/src/org/apache/qpid/server/registry/ApplicationRegistry.java +++ b/java/broker/src/org/apache/qpid/server/registry/ApplicationRegistry.java @@ -41,8 +41,9 @@ public abstract class ApplicationRegistry implements IApplicationRegistry protected final Configuration _configuration; - public static final int DEFAULT_INSTANCE = 0; + public static final int DEFAULT_INSTANCE = 1; public static final String DEFAULT_APPLICATION_REGISTRY = "org.apache.qpid.server.util.NullApplicationRegistry"; + public static String _APPLICATION_REGISTRY = DEFAULT_APPLICATION_REGISTRY; static { @@ -145,8 +146,8 @@ public abstract class ApplicationRegistry implements IApplicationRegistry { try { - _logger.info("Creating DEFAULT_APPLICATION_REGISTRY: " + DEFAULT_APPLICATION_REGISTRY + " : Instance:" + instanceID); - IApplicationRegistry registry = (IApplicationRegistry) Class.forName(DEFAULT_APPLICATION_REGISTRY).getConstructor((Class[]) null).newInstance((Object[]) null); + _logger.info("Creating DEFAULT_APPLICATION_REGISTRY: " + _APPLICATION_REGISTRY + " : Instance:" + instanceID); + IApplicationRegistry registry = (IApplicationRegistry) Class.forName(_APPLICATION_REGISTRY).getConstructor((Class[]) null).newInstance((Object[]) null); ApplicationRegistry.initialise(registry, instanceID); _logger.info("Initialised Application Registry:" + instanceID); return registry; @@ -188,4 +189,9 @@ public abstract class ApplicationRegistry implements IApplicationRegistry } return instance; } + + public static void setDefaultApplicationRegistry(String clazz) + { + _APPLICATION_REGISTRY = clazz; + } } diff --git a/java/client/test/src/org/apache/qpid/ack/DisconnectAndRedeliverTest.java b/java/client/test/src/org/apache/qpid/ack/DisconnectAndRedeliverTest.java index be8cc3c8e4..ae057c0e82 100644 --- a/java/client/test/src/org/apache/qpid/ack/DisconnectAndRedeliverTest.java +++ b/java/client/test/src/org/apache/qpid/ack/DisconnectAndRedeliverTest.java @@ -24,8 +24,8 @@ import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQQueue; import org.apache.qpid.client.transport.TransportConnection; import org.apache.qpid.server.registry.ApplicationRegistry; -import org.apache.qpid.server.util.TestApplicationRegistry; import org.apache.qpid.server.store.TestableMemoryMessageStore; +import org.apache.qpid.server.util.TestApplicationRegistry; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -40,22 +40,21 @@ public class DisconnectAndRedeliverTest static { //DOMConfigurator.configure("../etc/log4j.xml"); - DOMConfigurator.configure("broker/etc/log4j.xml"); + DOMConfigurator.configure("broker/etc/log4j.xml"); } - @After - public void stopVmBroker() + @Before + public void resetAppliactionRegistry() throws Exception { - TransportConnection.killVMBroker(1); + ApplicationRegistry.initialise(new TestApplicationRegistry()); } - @Before - public void configureApplicationRegistry() throws Exception + @After + public void stopVmBroker() { - ApplicationRegistry.initialise(new TestApplicationRegistry(), 1); + TransportConnection.killVMBroker(1); } - /** * This tests that when there are unacknowledged messages on a channel they are requeued for delivery when * the channel is closed. @@ -67,7 +66,7 @@ public class DisconnectAndRedeliverTest { Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test"); - TestableMemoryMessageStore store = (TestableMemoryMessageStore) ApplicationRegistry.getInstance(1).getMessageStore(); + TestableMemoryMessageStore store = (TestableMemoryMessageStore) ApplicationRegistry.getInstance().getMessageStore(); Session consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE); AMQQueue queue = new AMQQueue("someQ", "someQ", false, false); @@ -154,7 +153,7 @@ public class DisconnectAndRedeliverTest { Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test"); - TestableMemoryMessageStore store = (TestableMemoryMessageStore) ApplicationRegistry.getInstance(1).getMessageStore(); + TestableMemoryMessageStore store = (TestableMemoryMessageStore) ApplicationRegistry.getInstance().getMessageStore(); Session consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE); Queue queue = new AMQQueue("someQ", "someQ", false, true); MessageConsumer consumer = consumerSession.createConsumer(queue); |