http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/java/org/hornetq/core/settings/RepositoryTest.java ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/java/org/hornetq/core/settings/RepositoryTest.java b/hornetq-server/src/test/java/org/hornetq/core/settings/RepositoryTest.java new file mode 100644 index 0000000..7875add --- /dev/null +++ b/hornetq-server/src/test/java/org/hornetq/core/settings/RepositoryTest.java @@ -0,0 +1,281 @@ +/* + * Copyright 2005-2014 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.core.settings; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.concurrent.atomic.AtomicInteger; + +import org.hornetq.core.security.Role; +import org.hornetq.core.settings.impl.HierarchicalObjectRepository; +import org.hornetq.tests.util.UnitTestCase; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * @author <a href="[email protected]">Andy Taylor</a> + */ +public class RepositoryTest extends UnitTestCase +{ + HierarchicalRepository<HashSet<Role>> securityRepository; + + @Override + @Before + public void setUp() throws Exception + { + super.setUp(); + + securityRepository = new HierarchicalObjectRepository<>(); + } + + @Test + public void testDefault() + { + securityRepository.setDefault(new HashSet<Role>()); + HashSet<Role> roles = securityRepository.getMatch("queues.something"); + + Assert.assertEquals(roles.size(), 0); + } + + @Test + public void testMatchingDocs() throws Throwable + { + HierarchicalObjectRepository<String> repo = new HierarchicalObjectRepository<>(); + + repo.addMatch("a.b.#", "ab#"); + repo.addMatch("a.b.d.#", "abd#"); + repo.addMatch("#", "root"); + + Assert.assertEquals("ab#", repo.getMatch("a.b")); + Assert.assertEquals("ab#", repo.getMatch("a.b.c")); + Assert.assertEquals("abd#", repo.getMatch("a.b.d.lll")); + Assert.assertEquals("root", repo.getMatch("z.z.z.z.z")); + } + + @Test + public void testSingleMatch() + { + securityRepository.addMatch("queues.*", new HashSet<Role>()); + HashSet<Role> hashSet = securityRepository.getMatch("queues.something"); + Assert.assertEquals(hashSet.size(), 0); + } + + @Test + public void testSingletwo() + { + securityRepository.addMatch("queues.another.aq.*", new HashSet<Role>()); + HashSet<Role> roles = new HashSet<Role>(2); + roles.add(new Role("test1", true, true, true, true, true, true, true)); + roles.add(new Role("test2", true, true, true, true, true, true, true)); + securityRepository.addMatch("queues.aq", roles); + HashSet<Role> roles2 = new HashSet<Role>(2); + roles2.add(new Role("test1", true, true, true, true, true, true, true)); + roles2.add(new Role("test2", true, true, true, true, true, true, true)); + roles2.add(new Role("test3", true, true, true, true, true, true, true)); + securityRepository.addMatch("queues.another.andanother", roles2); + + HashSet<Role> hashSet = securityRepository.getMatch("queues.another.andanother"); + Assert.assertEquals(hashSet.size(), 3); + } + + @Test + public void testWithoutWildcard() + { + securityRepository.addMatch("queues.1.*", new HashSet<Role>()); + HashSet<Role> roles = new HashSet<Role>(2); + roles.add(new Role("test1", true, true, true, true, true, true, true)); + roles.add(new Role("test2", true, true, true, true, true, true, true)); + securityRepository.addMatch("queues.2.aq", roles); + HashSet<Role> hashSet = securityRepository.getMatch("queues.2.aq"); + Assert.assertEquals(hashSet.size(), 2); + } + + @Test + public void testMultipleWildcards() + { + HierarchicalRepository<String> repository = new HierarchicalObjectRepository<String>(); + repository.addMatch("#", "#"); + repository.addMatch("a", "a"); + repository.addMatch("a.#", "a.#"); + repository.addMatch("a.*", "a.*"); + repository.addMatch("a.b.c", "a.b.c"); + repository.addMatch("a.*.c", "a.*.c"); + repository.addMatch("a.d.c", "a.d.c"); + repository.addMatch("a.b.#", "a.b.#"); + repository.addMatch("a.b", "a.b"); + repository.addMatch("a.b.c.#", "a.b.c.#"); + repository.addMatch("a.b.c.d", "a.b.c.d"); + repository.addMatch("a.*.*.d", "a.*.*.d"); + repository.addMatch("a.*.d.#", "a.*.d.#"); + String val = repository.getMatch("a"); + Assert.assertEquals("a", val); + val = repository.getMatch("a.b"); + Assert.assertEquals("a.b", val); + val = repository.getMatch("a.x"); + Assert.assertEquals("a.*", val); + val = repository.getMatch("a.b.x"); + Assert.assertEquals("a.b.#", val); + val = repository.getMatch("a.b.c"); + Assert.assertEquals("a.b.c", val); + val = repository.getMatch("a.d.c"); + Assert.assertEquals("a.d.c", val); + val = repository.getMatch("a.x.c"); + Assert.assertEquals("a.*.c", val); + val = repository.getMatch("a.b.c.d"); + Assert.assertEquals("a.b.c.d", val); + val = repository.getMatch("a.x.c.d"); + Assert.assertEquals("a.*.*.d", val); + val = repository.getMatch("a.b.x.d"); + Assert.assertEquals("a.*.*.d", val); + val = repository.getMatch("a.d.x.d"); + Assert.assertEquals("a.*.*.d", val); + val = repository.getMatch("a.d.d.g"); + Assert.assertEquals("a.*.d.#", val); + val = repository.getMatch("zzzz.z.z.z.d.r.g.f.sd.s.fsdfd.fsdfs"); + Assert.assertEquals("#", val); + } + + @Test + public void testRepositoryMerge() + { + HierarchicalRepository<DummyMergeable> repository = new HierarchicalObjectRepository<DummyMergeable>(); + repository.addMatch("#", new DummyMergeable(1)); + repository.addMatch("a.#", new DummyMergeable(2)); + repository.addMatch("b.#", new DummyMergeable(3)); + repository.addMatch("a.b.#", new DummyMergeable(4)); + repository.addMatch("b.c.#", new DummyMergeable(5)); + repository.addMatch("a.b.c.#", new DummyMergeable(6)); + repository.addMatch("a.b.*.d", new DummyMergeable(7)); + repository.addMatch("a.b.c.*", new DummyMergeable(8)); + repository.getMatch("a.b.c.d"); + Assert.assertEquals(5, DummyMergeable.timesMerged); + Assert.assertTrue(DummyMergeable.contains(1)); + Assert.assertTrue(DummyMergeable.contains(2)); + Assert.assertTrue(DummyMergeable.contains(4)); + Assert.assertTrue(DummyMergeable.contains(7)); + Assert.assertTrue(DummyMergeable.contains(8)); + DummyMergeable.reset(); + repository.getMatch("a.b.c"); + Assert.assertEquals(3, DummyMergeable.timesMerged); + Assert.assertTrue(DummyMergeable.contains(1)); + Assert.assertTrue(DummyMergeable.contains(2)); + Assert.assertTrue(DummyMergeable.contains(4)); + DummyMergeable.reset(); + repository.getMatch("z"); + Assert.assertEquals(0, DummyMergeable.timesMerged); + DummyMergeable.reset(); + } + + + @Test + public void testAddListener() + { + HierarchicalRepository<String> repository = new HierarchicalObjectRepository<String>(); + repository.addMatch("#", "1"); + repository.addMatch("B", "2"); + + final AtomicInteger called = new AtomicInteger(0); + repository.registerListener(new HierarchicalRepositoryChangeListener() + { + @Override + public void onChange() + { + called.incrementAndGet(); + } + }); + + assertEquals(1, called.get()); + + repository.disableListeners(); + + repository.addMatch("C", "3"); + + assertEquals(1, called.get()); + + repository.enableListeners(); + + assertEquals(2, called.get()); + + repository.addMatch("D", "4"); + + assertEquals(3, called.get()); + + repository.removeMatch("D"); + + assertEquals(4, called.get()); + + repository.disableListeners(); + + repository.removeMatch("C"); + + assertEquals(4, called.get()); + } + + + @Test + public void testIllegalMatches() + { + HierarchicalRepository<String> repository = new HierarchicalObjectRepository<String>(); + try + { + repository.addMatch("hjhjhjhjh.#.hhh", "test"); + fail("expected exception"); + } + catch (IllegalArgumentException e) + { + // pass + } + try + { + repository.addMatch(null, "test"); + fail("expected exception"); + } + catch (IllegalArgumentException e) + { + // pass + } + } + + static class DummyMergeable implements Mergeable + { + static int timesMerged = 0; + + static ArrayList<Integer> merged = new ArrayList<Integer>(); + + private final Integer id; + + static void reset() + { + DummyMergeable.timesMerged = 0; + DummyMergeable.merged = new ArrayList<Integer>(); + } + + static boolean contains(final Integer i) + { + return DummyMergeable.merged.contains(i); + } + + public DummyMergeable(final Integer id) + { + this.id = id; + } + + public void merge(final Object merged) + { + DummyMergeable.timesMerged++; + DummyMergeable.merged.add(id); + DummyMergeable.merged.add(((DummyMergeable)merged).id); + } + } +}
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/java/org/hornetq/tests/util/ColocatedHornetQServer.java ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/java/org/hornetq/tests/util/ColocatedHornetQServer.java b/hornetq-server/src/test/java/org/hornetq/tests/util/ColocatedHornetQServer.java index e8a118e..ecaca04 100644 --- a/hornetq-server/src/test/java/org/hornetq/tests/util/ColocatedHornetQServer.java +++ b/hornetq-server/src/test/java/org/hornetq/tests/util/ColocatedHornetQServer.java @@ -58,7 +58,7 @@ public class ColocatedHornetQServer extends HornetQServerImpl @Override protected NodeManager - createNodeManager(final String directory, final String nodeGroupName, boolean replicatingBackup) + createNodeManager(final String directory, boolean replicatingBackup) { if (replicatingBackup) { @@ -76,12 +76,10 @@ public class ColocatedHornetQServer extends HornetQServerImpl { if (backup) { - nodeManagerBackup.setNodeGroupName(nodeGroupName); return nodeManagerBackup; } else { - nodeManagerLive.setNodeGroupName(nodeGroupName); return nodeManagerLive; } } http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/java/org/hornetq/tests/util/InVMNodeManagerServer.java ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/java/org/hornetq/tests/util/InVMNodeManagerServer.java b/hornetq-server/src/test/java/org/hornetq/tests/util/InVMNodeManagerServer.java index f8ab8c4..b1e45f1 100644 --- a/hornetq-server/src/test/java/org/hornetq/tests/util/InVMNodeManagerServer.java +++ b/hornetq-server/src/test/java/org/hornetq/tests/util/InVMNodeManagerServer.java @@ -64,9 +64,8 @@ public final class InVMNodeManagerServer extends HornetQServerImpl } @Override - protected NodeManager createNodeManager(final String directory, final String nodeGroupName, boolean replicatingBackup) + protected NodeManager createNodeManager(final String directory, boolean replicatingBackup) { - nodeManager.setNodeGroupName(nodeGroupName); return nodeManager; } http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/java/org/hornetq/tests/util/ServiceTestBase.java ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/java/org/hornetq/tests/util/ServiceTestBase.java b/hornetq-server/src/test/java/org/hornetq/tests/util/ServiceTestBase.java index 14425e9..3706c1b 100644 --- a/hornetq-server/src/test/java/org/hornetq/tests/util/ServiceTestBase.java +++ b/hornetq-server/src/test/java/org/hornetq/tests/util/ServiceTestBase.java @@ -61,7 +61,9 @@ import org.hornetq.core.server.NodeManager; import org.hornetq.core.server.Queue; import org.hornetq.core.server.cluster.ClusterConnection; import org.hornetq.core.server.cluster.RemoteQueueBinding; +import org.hornetq.core.server.impl.Activation; import org.hornetq.core.server.impl.HornetQServerImpl; +import org.hornetq.core.server.impl.SharedNothingBackupActivation; import org.hornetq.core.settings.impl.AddressFullMessagePolicy; import org.hornetq.core.settings.impl.AddressSettings; import org.hornetq.spi.core.security.HornetQSecurityManager; @@ -337,7 +339,7 @@ public abstract class ServiceTestBase extends UnitTestCase fail("server didn't start: " + server); } - if (!server.getConfiguration().getHAPolicy().isBackup()) + if (!server.getHAPolicy().isBackup()) { if (!server.waitForActivation(wait, TimeUnit.MILLISECONDS)) fail("Server didn't initialize: " + server); @@ -383,10 +385,35 @@ public abstract class ServiceTestBase extends UnitTestCase final HornetQServerImpl actualServer = (HornetQServerImpl) backup; final long toWait = seconds * 1000; final long time = System.currentTimeMillis(); + int loop = 0; while (true) { + Activation activation = actualServer.getActivation(); + boolean isReplicated = !backup.getHAPolicy().isSharedStore(); + boolean isRemoteUpToDate = true; + if (isReplicated) + { + if (activation instanceof SharedNothingBackupActivation) + { + isRemoteUpToDate = ((SharedNothingBackupActivation) activation).isRemoteBackupUpToDate(); + } + else + { + //we may have already failed over and changed the Activation + if (actualServer.isStarted()) + { + //let it fail a few time to have time to start stopping in the case of waiting to failback + isRemoteUpToDate = loop++ > 10; + } + //we could be waiting to failback or restart if the server is stopping + else + { + isRemoteUpToDate = false; + } + } + } if ((sessionFactory == null || sessionFactory.getBackupConnector() != null) && - (actualServer.isRemoteBackupUpToDate() || !waitForSync) && + (isRemoteUpToDate || !waitForSync) && (!waitForSync || actualServer.getBackupManager() != null && actualServer.getBackupManager().isBackupAnnounced())) { break; @@ -394,7 +421,7 @@ public abstract class ServiceTestBase extends UnitTestCase if (System.currentTimeMillis() > (time + toWait)) { fail("backup started? (" + actualServer.isStarted() + "). Finished synchronizing (" + - actualServer.isRemoteBackupUpToDate() + "). SessionFactory!=null ? " + (sessionFactory != null) + + (activation) + "). SessionFactory!=null ? " + (sessionFactory != null) + " || sessionFactory.getBackupConnector()==" + (sessionFactory != null ? sessionFactory.getBackupConnector() : "not-applicable")); } http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/java/org/hornetq/tests/util/SingleServerTestBase.java ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/java/org/hornetq/tests/util/SingleServerTestBase.java b/hornetq-server/src/test/java/org/hornetq/tests/util/SingleServerTestBase.java index 6fde9f6..06f2e6b 100644 --- a/hornetq-server/src/test/java/org/hornetq/tests/util/SingleServerTestBase.java +++ b/hornetq-server/src/test/java/org/hornetq/tests/util/SingleServerTestBase.java @@ -45,8 +45,8 @@ public abstract class SingleServerTestBase extends ServiceTestBase { super.setUp(); - Configuration configuration = createDefaultConfig(); - configuration.setSecurityEnabled(false); + Configuration configuration = createDefaultConfig() + .setSecurityEnabled(false); server = createServer(false, configuration); server.start(); http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/java/org/hornetq/tests/util/UnitTestCase.java ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/java/org/hornetq/tests/util/UnitTestCase.java b/hornetq-server/src/test/java/org/hornetq/tests/util/UnitTestCase.java index 0e47347..a174014 100644 --- a/hornetq-server/src/test/java/org/hornetq/tests/util/UnitTestCase.java +++ b/hornetq-server/src/test/java/org/hornetq/tests/util/UnitTestCase.java @@ -218,25 +218,32 @@ public abstract class UnitTestCase extends CoreUnitTestCase } } - protected static final void basicClusterConnectionConfig(Configuration mainConfig, String connectorName, - String... connectors) + protected static final ClusterConnectionConfiguration basicClusterConnectionConfig(String connectorName, + String... connectors) { ArrayList<String> connectors0 = new ArrayList<String>(); for (String c : connectors) { connectors0.add(c); } - basicClusterConnectionConfig(mainConfig, connectorName, connectors0); + return basicClusterConnectionConfig(connectorName, connectors0); } - protected static final void basicClusterConnectionConfig(Configuration mainConfig, - String connectorName, - List<String> connectors) + protected static final ClusterConnectionConfiguration basicClusterConnectionConfig(String connectorName, + List<String> connectors) { - ClusterConnectionConfiguration ccc = - new ClusterConnectionConfiguration("cluster1", "jms", connectorName, 10, false, true, 1, 1, connectors, - false); - mainConfig.getClusterConfigurations().add(ccc); + ClusterConnectionConfiguration ccc = new ClusterConnectionConfiguration() + .setName("cluster1") + .setAddress("jms") + .setConnectorName(connectorName) + .setRetryInterval(1000) + .setDuplicateDetection(false) + .setForwardWhenNoConsumers(true) + .setMaxHops(1) + .setConfirmationWindowSize(1) + .setStaticConnectors(connectors); + + return ccc; } protected Configuration createDefaultConfig(final int index, @@ -275,72 +282,65 @@ public abstract class UnitTestCase extends CoreUnitTestCase */ protected final ConfigurationImpl createBasicConfig(final int serverID) { - ConfigurationImpl configuration = new ConfigurationImpl(); - configuration.setSecurityEnabled(false); - configuration.setJournalMinFiles(2); - configuration.setJournalFileSize(100 * 1024); - - configuration.setJournalType(getDefaultJournalType()); + ConfigurationImpl configuration = new ConfigurationImpl() + .setSecurityEnabled(false) + .setJournalMinFiles(2) + .setJournalFileSize(100 * 1024) + .setJournalType(getDefaultJournalType()) + .setJournalDirectory(getJournalDir(serverID, false)) + .setBindingsDirectory(getBindingsDir(serverID, false)) + .setPagingDirectory(getPageDir(serverID, false)) + .setLargeMessagesDirectory(getLargeMessagesDir(serverID, false)) + .setJournalCompactMinFiles(0) + .setJournalCompactPercentage(0) + .setClusterPassword(CLUSTER_PASSWORD); - configuration.setJournalDirectory(getJournalDir(serverID, false)); - configuration.setBindingsDirectory(getBindingsDir(serverID, false)); - configuration.setPagingDirectory(getPageDir(serverID, false)); - configuration.setLargeMessagesDirectory(getLargeMessagesDir(serverID, false)); - - configuration.setJournalCompactMinFiles(0); - configuration.setJournalCompactPercentage(0); - configuration.setClusterPassword(CLUSTER_PASSWORD); return configuration; } public static final ConfigurationImpl createBasicConfig(final String testDir, final int serverID) { - ConfigurationImpl configuration = new ConfigurationImpl(); - configuration.setSecurityEnabled(false); - configuration.setJournalMinFiles(2); - configuration.setJournalFileSize(100 * 1024); - - configuration.setJournalType(getDefaultJournalType()); + ConfigurationImpl configuration = new ConfigurationImpl() + .setSecurityEnabled(false) + .setJournalMinFiles(2) + .setJournalFileSize(100 * 1024) + .setJournalType(getDefaultJournalType()) + .setJournalDirectory(getJournalDir(testDir, serverID, false)) + .setBindingsDirectory(getBindingsDir(testDir, serverID, false)) + .setPagingDirectory(getPageDir(testDir, serverID, false)) + .setLargeMessagesDirectory(getLargeMessagesDir(testDir, serverID, false)) + .setJournalCompactMinFiles(0) + .setJournalCompactPercentage(0) + .setClusterPassword(CLUSTER_PASSWORD); - configuration.setJournalDirectory(getJournalDir(testDir, serverID, false)); - configuration.setBindingsDirectory(getBindingsDir(testDir, serverID, false)); - configuration.setPagingDirectory(getPageDir(testDir, serverID, false)); - configuration.setLargeMessagesDirectory(getLargeMessagesDir(testDir, serverID, false)); - - configuration.setJournalCompactMinFiles(0); - configuration.setJournalCompactPercentage(0); - configuration.setClusterPassword(CLUSTER_PASSWORD); return configuration; } public static final ConfigurationImpl createBasicConfigNoDataFolder() { - ConfigurationImpl configuration = new ConfigurationImpl(); - configuration.setSecurityEnabled(false); - - configuration.setJournalType(getDefaultJournalType()); + ConfigurationImpl configuration = new ConfigurationImpl() + .setSecurityEnabled(false) + .setJournalType(getDefaultJournalType()) + .setJournalCompactMinFiles(0) + .setJournalCompactPercentage(0) + .setClusterPassword(CLUSTER_PASSWORD); - configuration.setJournalCompactMinFiles(0); - configuration.setJournalCompactPercentage(0); - configuration.setClusterPassword(CLUSTER_PASSWORD); return configuration; } - protected Configuration - createDefaultConfig(final Map<String, Object> params, final String... acceptors) throws Exception + protected Configuration createDefaultConfig(final Map<String, Object> params, final String... acceptors) throws Exception { - ConfigurationImpl configuration = createBasicConfig(-1); - - configuration.setFileDeploymentEnabled(false); - configuration.setJMXManagementEnabled(false); - - configuration.getAcceptorConfigurations().clear(); + ConfigurationImpl configuration = createBasicConfig(-1) + .setFileDeploymentEnabled(false) + .setJMXManagementEnabled(false) + .clearAcceptorConfigurations(); for (String acceptor : acceptors) { TransportConfiguration transportConfig = new TransportConfiguration(acceptor, params); - configuration.getAcceptorConfigurations().add(transportConfig); + configuration.addAcceptorConfiguration(transportConfig); } + return configuration; } @@ -1180,6 +1180,12 @@ public abstract class UnitTestCase extends CoreUnitTestCase checkThread = true; } + if (Thread.currentThread().getContextClassLoader() == null) + { + Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); + fail("Thread Context ClassLoader was set to null at some point before this test. We will set to this.getClass().getClassLoader(), but you are supposed to fix your tests"); + } + checkFilesUsage(); } } @@ -1311,7 +1317,7 @@ public abstract class UnitTestCase extends CoreUnitTestCase { return true; } - else if (isSystemThread && threadName.equals("process reaper")) + else if ((javaVendor.contains("IBM") || isSystemThread) && threadName.equals("process reaper")) { return true; } @@ -1659,12 +1665,25 @@ public abstract class UnitTestCase extends CoreUnitTestCase for (QueueBinding qBinding : bindings) { - messageCount += qBinding.getQueue().getMessageCount(); + qBinding.getQueue().flushExecutor(); + messageCount += getMessageCount(qBinding.getQueue()); } return messageCount; } + protected int getMessageCount(final Queue queue) + { + queue.flushExecutor(); + return (int)queue.getMessageCount(); + } + + protected int getMessagesAdded(final Queue queue) + { + queue.flushExecutor(); + return (int)queue.getMessagesAdded(); + } + protected List<QueueBinding> getLocalQueueBindings(final PostOffice postOffice, final String address) throws Exception { ArrayList<QueueBinding> bindingsFound = new ArrayList<QueueBinding>(); @@ -1748,13 +1767,23 @@ public abstract class UnitTestCase extends CoreUnitTestCase protected final ServerLocator createNonHALocator(final boolean isNetty) { - ServerLocator locatorWithoutHA = - isNetty - ? HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(NETTY_CONNECTOR_FACTORY)) - : HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY)); + ServerLocator locatorWithoutHA = internalCreateNonHALocator(isNetty); return addServerLocator(locatorWithoutHA); } + /** + * Creates the Locator without adding it to the list where the tearDown will take place + * This is because we don't want it closed in certain tests where we are issuing failures + * @param isNetty + * @return + */ + protected ServerLocator internalCreateNonHALocator(boolean isNetty) + { + return isNetty + ? HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(NETTY_CONNECTOR_FACTORY)) + : HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY)); + } + protected static final void stopComponent(HornetQComponent component) { if (component == null) @@ -2006,7 +2035,7 @@ public abstract class UnitTestCase extends CoreUnitTestCase } // This can be used to interrupt a thread if it takes more than timeoutMilliseconds - public void runWithTimeout(final RunnerWithEX runner, final long timeoutMilliseconds) throws Throwable + public boolean runWithTimeout(final RunnerWithEX runner, final long timeoutMilliseconds) throws Throwable { class ThreadRunner extends Thread @@ -2044,6 +2073,11 @@ public abstract class UnitTestCase extends CoreUnitTestCase runnerThread.join(timeoutMilliseconds); if (runnerThread.isAlive()) { + System.err.println("Thread still running, interrupting it now:"); + for (Object t : runnerThread.getStackTrace()) + { + System.err.println(t); + } hadToInterrupt = true; runnerThread.interrupt(); } @@ -2051,13 +2085,13 @@ public abstract class UnitTestCase extends CoreUnitTestCase if (runnerThread.t != null) { + runnerThread.t.printStackTrace(); throw runnerThread.t; } - if (hadToInterrupt) - { - fail("Test would have hung. We had to issue an interrupt!"); - } + // we are returning true if it ran ok. + // had to Interrupt is exactly the opposite of what we are returning + return !hadToInterrupt; } http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/ConfigurationTest-full-config.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/ConfigurationTest-full-config.xml b/hornetq-server/src/test/resources/ConfigurationTest-full-config.xml index 1320545..b7545ea 100644 --- a/hornetq-server/src/test/resources/ConfigurationTest-full-config.xml +++ b/hornetq-server/src/test/resources/ConfigurationTest-full-config.xml @@ -161,33 +161,18 @@ <discovery-group-ref discovery-group-name="dg1"/> </bridge> </bridges> - <ha-policy template="COLOCATED_REPLICATED"> - <policy-type>COLOCATED_REPLICATED</policy-type> - <request-backup>true</request-backup> - <backup-request-retries>33</backup-request-retries> - <backup-request-retry-interval>1234</backup-request-retry-interval> - <max-backups>12</max-backups> - <backup-port-offset>1002</backup-port-offset> - <backup-strategy>SCALE_DOWN</backup-strategy> - <scale-down-discovery-group>wahey!</scale-down-discovery-group> - <scale-down-group-name>boo!</scale-down-group-name> - <scale-down-connectors> - <connector-ref>sd-connector1</connector-ref> - <connector-ref>sd-connector2</connector-ref> - </scale-down-connectors> - <backup-group-name>backupGroupName</backup-group-name> - <remote-connectors> - <connector-ref>remote-connector1</connector-ref> - <connector-ref>remote-connector2</connector-ref> - </remote-connectors> - <check-for-live-server>true</check-for-live-server> - <allow-failback>false</allow-failback> - <failback-delay>10000</failback-delay> - <failover-on-shutdown>true</failover-on-shutdown> - <replication-clustername>replicationClustername</replication-clustername> - <scale-down-clustername>scaleDownClustername</scale-down-clustername> - <max-saved-replicated-journals-size>3</max-saved-replicated-journals-size> - <scale-down>true</scale-down> + <ha-policy> + <!--only one of the following--> + <!--on server shutdown scale down to another live server--> + <live-only> + <scale-down> + <!--a grouping of servers that can be scaled down to--> + <group-name>boo!</group-name> + <!--either a discovery group--> + <discovery-group>wahey</discovery-group> + </scale-down> + </live-only> + </ha-policy> <cluster-connections> <cluster-connection name="cluster-connection1"> @@ -267,6 +252,9 @@ <page-size-bytes>81738173872337</page-size-bytes> <page-max-cache-size>10</page-max-cache-size> <message-counter-history-day-limit>4</message-counter-history-day-limit> + <slow-consumer-threshold>10</slow-consumer-threshold> + <slow-consumer-check-period>5</slow-consumer-check-period> + <slow-consumer-policy>NOTIFY</slow-consumer-policy> </address-setting> <address-setting match="a2"> <dead-letter-address>a2.1</dead-letter-address> @@ -276,6 +264,9 @@ <page-size-bytes>7126716262626</page-size-bytes> <page-max-cache-size>20</page-max-cache-size> <message-counter-history-day-limit>8</message-counter-history-day-limit> + <slow-consumer-threshold>20</slow-consumer-threshold> + <slow-consumer-check-period>15</slow-consumer-check-period> + <slow-consumer-policy>KILL</slow-consumer-policy> </address-setting> </address-settings> <connector-services> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/colocated-hapolicy-config.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/colocated-hapolicy-config.xml b/hornetq-server/src/test/resources/colocated-hapolicy-config.xml new file mode 100644 index 0000000..ad1adc5 --- /dev/null +++ b/hornetq-server/src/test/resources/colocated-hapolicy-config.xml @@ -0,0 +1,34 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <replication> + <colocated> + <backup-request-retries>44</backup-request-retries> + <backup-request-retry-interval>33</backup-request-retry-interval> + <max-backups>3</max-backups> + <request-backup>false</request-backup> + <backup-port-offset>33</backup-port-offset> + <master> + <group-name>purple</group-name> + <check-for-live-server>true</check-for-live-server> + <cluster-name>abcdefg</cluster-name> + </master> + <slave> + <group-name>tiddles</group-name> + <max-saved-replicated-journals-size>22</max-saved-replicated-journals-size> + <cluster-name>33rrrrr</cluster-name> + <restart-backup>false</restart-backup> + <scale-down> + <!--a grouping of servers that can be scaled down to--> + <group-name>boo!</group-name> + <!--either a discovery group--> + <discovery-group>wahey</discovery-group> + </scale-down> + </slave> + </colocated> + </replication> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/colocated-hapolicy-config2.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/colocated-hapolicy-config2.xml b/hornetq-server/src/test/resources/colocated-hapolicy-config2.xml new file mode 100644 index 0000000..f970461 --- /dev/null +++ b/hornetq-server/src/test/resources/colocated-hapolicy-config2.xml @@ -0,0 +1,28 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <shared-store> + <colocated> + <backup-request-retries>44</backup-request-retries> + <backup-request-retry-interval>33</backup-request-retry-interval> + <max-backups>3</max-backups> + <request-backup>false</request-backup> + <backup-port-offset>33</backup-port-offset> + <master> + <failback-delay>1234</failback-delay> + <failover-on-shutdown>false</failover-on-shutdown> + </master> + <slave> + <failback-delay>44</failback-delay> + <failover-on-shutdown>false</failover-on-shutdown> + <restart-backup>false</restart-backup> + <scale-down/> + </slave> + </colocated> + + </shared-store> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/live-only-hapolicy-config.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/live-only-hapolicy-config.xml b/hornetq-server/src/test/resources/live-only-hapolicy-config.xml new file mode 100644 index 0000000..6cc3aa4 --- /dev/null +++ b/hornetq-server/src/test/resources/live-only-hapolicy-config.xml @@ -0,0 +1,16 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <live-only> + <scale-down> + <!--a grouping of servers that can be scaled down to--> + <group-name>boo!</group-name> + <!--either a discovery group--> + <discovery-group>wahey</discovery-group> + </scale-down> + </live-only> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/live-only-hapolicy-config2.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/live-only-hapolicy-config2.xml b/hornetq-server/src/test/resources/live-only-hapolicy-config2.xml new file mode 100644 index 0000000..7ae2389 --- /dev/null +++ b/hornetq-server/src/test/resources/live-only-hapolicy-config2.xml @@ -0,0 +1,22 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <!--only one of the following--> + <!--on server shutdown scale down to another live server--> + <live-only> + <scale-down> + <enabled>false</enabled> + <!--a grouping of servers that can be scaled down to--> + <group-name>boo!</group-name> + <!--or some connectors--> + <connectors> + <connector-ref>sd-connector1</connector-ref> + <connector-ref>sd-connector2</connector-ref> + </connectors> + </scale-down> + </live-only> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/live-only-hapolicy-config3.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/live-only-hapolicy-config3.xml b/hornetq-server/src/test/resources/live-only-hapolicy-config3.xml new file mode 100644 index 0000000..2239c78 --- /dev/null +++ b/hornetq-server/src/test/resources/live-only-hapolicy-config3.xml @@ -0,0 +1,11 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <!--only one of the following--> + <!--on server shutdown scale down to another live server--> + <live-only/> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/live-only-hapolicy-config4.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/live-only-hapolicy-config4.xml b/hornetq-server/src/test/resources/live-only-hapolicy-config4.xml new file mode 100644 index 0000000..1ae6dd4 --- /dev/null +++ b/hornetq-server/src/test/resources/live-only-hapolicy-config4.xml @@ -0,0 +1,7 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy/> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/live-only-hapolicy-config5.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/live-only-hapolicy-config5.xml b/hornetq-server/src/test/resources/live-only-hapolicy-config5.xml new file mode 100644 index 0000000..0037115 --- /dev/null +++ b/hornetq-server/src/test/resources/live-only-hapolicy-config5.xml @@ -0,0 +1,6 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/replica-hapolicy-config.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/replica-hapolicy-config.xml b/hornetq-server/src/test/resources/replica-hapolicy-config.xml new file mode 100644 index 0000000..1a2c70d --- /dev/null +++ b/hornetq-server/src/test/resources/replica-hapolicy-config.xml @@ -0,0 +1,24 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <replication> + <slave> + <group-name>tiddles</group-name> + <max-saved-replicated-journals-size>22</max-saved-replicated-journals-size> + <cluster-name>33rrrrr</cluster-name> + <restart-backup>false</restart-backup> + <allow-failback>true</allow-failback> + <failback-delay>9876</failback-delay> + <scale-down> + <!--a grouping of servers that can be scaled down to--> + <group-name>boo!</group-name> + <!--either a discovery group--> + <discovery-group>wahey</discovery-group> + </scale-down> + </slave> + </replication> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/replica-hapolicy-config2.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/replica-hapolicy-config2.xml b/hornetq-server/src/test/resources/replica-hapolicy-config2.xml new file mode 100644 index 0000000..373c8e0 --- /dev/null +++ b/hornetq-server/src/test/resources/replica-hapolicy-config2.xml @@ -0,0 +1,25 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <replication> + <slave> + <group-name>tiddles</group-name> + <max-saved-replicated-journals-size>22</max-saved-replicated-journals-size> + <cluster-name>33rrrrr</cluster-name> + <restart-backup>false</restart-backup> + <scale-down> + <!--a grouping of servers that can be scaled down to--> + <group-name>boo!</group-name> + <!--or some connectors--> + <connectors> + <connector-ref>sd-connector1</connector-ref> + <connector-ref>sd-connector2</connector-ref> + </connectors> + </scale-down> + </slave> + </replication> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/replica-hapolicy-config3.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/replica-hapolicy-config3.xml b/hornetq-server/src/test/resources/replica-hapolicy-config3.xml new file mode 100644 index 0000000..3b6bc23 --- /dev/null +++ b/hornetq-server/src/test/resources/replica-hapolicy-config3.xml @@ -0,0 +1,16 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <replication> + <slave> + <group-name>tiddles</group-name> + <max-saved-replicated-journals-size>22</max-saved-replicated-journals-size> + <cluster-name>33rrrrr</cluster-name> + <restart-backup>false</restart-backup> + </slave> + </replication> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/replicated-hapolicy-config.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/replicated-hapolicy-config.xml b/hornetq-server/src/test/resources/replicated-hapolicy-config.xml new file mode 100644 index 0000000..82537cb --- /dev/null +++ b/hornetq-server/src/test/resources/replicated-hapolicy-config.xml @@ -0,0 +1,15 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <replication> + <master> + <group-name>purple</group-name> + <check-for-live-server>true</check-for-live-server> + <cluster-name>abcdefg</cluster-name> + </master> + </replication> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/shared-store-master-hapolicy-config.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/shared-store-master-hapolicy-config.xml b/hornetq-server/src/test/resources/shared-store-master-hapolicy-config.xml new file mode 100644 index 0000000..68a52d7 --- /dev/null +++ b/hornetq-server/src/test/resources/shared-store-master-hapolicy-config.xml @@ -0,0 +1,14 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <shared-store> + <master> + <failback-delay>3456</failback-delay> + <failover-on-shutdown>false</failover-on-shutdown> + </master> + </shared-store> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/shared-store-slave-hapolicy-config.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/shared-store-slave-hapolicy-config.xml b/hornetq-server/src/test/resources/shared-store-slave-hapolicy-config.xml new file mode 100644 index 0000000..21a86a6 --- /dev/null +++ b/hornetq-server/src/test/resources/shared-store-slave-hapolicy-config.xml @@ -0,0 +1,22 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <shared-store> + <slave> + <allow-failback>true</allow-failback> + <failback-delay>9876</failback-delay> + <failover-on-shutdown>false</failover-on-shutdown> + <restart-backup>false</restart-backup> + <scale-down> + <!--a grouping of servers that can be scaled down to--> + <group-name>boo!</group-name> + <!--either a discovery group--> + <discovery-group>wahey</discovery-group> + </scale-down> + </slave> + </shared-store> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/shared-store-slave-hapolicy-config2.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/shared-store-slave-hapolicy-config2.xml b/hornetq-server/src/test/resources/shared-store-slave-hapolicy-config2.xml new file mode 100644 index 0000000..fdf037a --- /dev/null +++ b/hornetq-server/src/test/resources/shared-store-slave-hapolicy-config2.xml @@ -0,0 +1,24 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <shared-store> + <slave> + <failback-delay>5678</failback-delay> + <failover-on-shutdown>true</failover-on-shutdown> + <restart-backup>true</restart-backup> + <scale-down> + <!--a grouping of servers that can be scaled down to--> + <group-name>boo!</group-name> + <!--or some connectors--> + <connectors> + <connector-ref>sd-connector1</connector-ref> + <connector-ref>sd-connector2</connector-ref> + </connectors> + </scale-down> + </slave> + </shared-store> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/test/resources/shared-store-slave-hapolicy-config3.xml ---------------------------------------------------------------------- diff --git a/hornetq-server/src/test/resources/shared-store-slave-hapolicy-config3.xml b/hornetq-server/src/test/resources/shared-store-slave-hapolicy-config3.xml new file mode 100644 index 0000000..5709cfc --- /dev/null +++ b/hornetq-server/src/test/resources/shared-store-slave-hapolicy-config3.xml @@ -0,0 +1,15 @@ +<configuration + xmlns="urn:hornetq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:hornetq ../../../../hornetq-server/src/main/resources/schema/hornetq-configuration.xsd"> + <ha-policy> + <shared-store> + <slave> + <failback-delay>5678</failback-delay> + <failover-on-shutdown>true</failover-on-shutdown> + <restart-backup>true</restart-backup> + </slave> + </shared-store> + </ha-policy> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-tools/src/main/java/org/hornetq/tools/Main.java ---------------------------------------------------------------------- diff --git a/hornetq-tools/src/main/java/org/hornetq/tools/Main.java b/hornetq-tools/src/main/java/org/hornetq/tools/Main.java index b8da8ff..5ff73f9 100644 --- a/hornetq-tools/src/main/java/org/hornetq/tools/Main.java +++ b/hornetq-tools/src/main/java/org/hornetq/tools/Main.java @@ -21,7 +21,8 @@ public class Main private static final String PRINT_DATA = "print-data"; private static final String PRINT_PAGES = "print-pages"; private static final String DATA_TOOL = "data-tool"; - private static final String OPTIONS = " [" + IMPORT + "|" + EXPORT + "|" + PRINT_DATA + "|" + PRINT_PAGES + "|" + DATA_TOOL + "]"; + private static final String TRANSFER = "transfer-queue"; + private static final String OPTIONS = " [" + IMPORT + "|" + EXPORT + "|" + PRINT_DATA + "|" + PRINT_PAGES + "|" + DATA_TOOL + "|" + TRANSFER + "]"; public static void main(String[] arg) throws Exception { @@ -31,7 +32,13 @@ public class Main System.exit(-1); } - if (DATA_TOOL.equals(arg[0])) + + if (TRANSFER.equals(arg[0])) + { + TransferQueue tool = new TransferQueue(); + tool.process(arg); + } + else if (DATA_TOOL.equals(arg[0])) { DataTool dataTool = new DataTool(); dataTool.process(arg); @@ -90,9 +97,16 @@ public class Main protected static String getJarName() { - Class klass = Main.class; - String url = klass.getResource('/' + klass.getName().replace('.', '/') + ".class").toString(); - String jarName = url.substring(0, url.lastIndexOf('!')); - return jarName.substring(jarName.lastIndexOf('/') + 1); + try + { + Class klass = Main.class; + String url = klass.getResource('/' + klass.getName().replace('.', '/') + ".class").toString(); + String jarName = url.substring(0, url.lastIndexOf('!')); + return jarName.substring(jarName.lastIndexOf('/') + 1); + } + catch (Throwable e) + { + return "tool-jar-name.jar"; + } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-tools/src/main/java/org/hornetq/tools/TransferQueue.java ---------------------------------------------------------------------- diff --git a/hornetq-tools/src/main/java/org/hornetq/tools/TransferQueue.java b/hornetq-tools/src/main/java/org/hornetq/tools/TransferQueue.java new file mode 100644 index 0000000..c7c1084 --- /dev/null +++ b/hornetq-tools/src/main/java/org/hornetq/tools/TransferQueue.java @@ -0,0 +1,243 @@ +/* + * Copyright 2005-2014 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.tools; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; + +import org.hornetq.api.core.SimpleString; +import org.hornetq.api.core.TransportConfiguration; +import org.hornetq.api.core.client.ClientConsumer; +import org.hornetq.api.core.client.ClientMessage; +import org.hornetq.api.core.client.ClientProducer; +import org.hornetq.api.core.client.ClientSession; +import org.hornetq.api.core.client.ClientSessionFactory; +import org.hornetq.api.core.client.HornetQClient; +import org.hornetq.api.core.client.ServerLocator; +import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory; +import org.hornetq.core.remoting.impl.netty.TransportConstants; + +/** + * @author Clebert Suconic + */ + +public class TransferQueue // NO_UCD (unused code) +{ + + public void process(String[] arg) + { + if (arg.length != 13 && arg.length != 14) + { + System.out.println("Invalid number of arguments! " + arg.length); + printUsage(); + System.exit(-1); + } + + String sourceHost; + String sourceUser; + String sourcePass; + int sourcePort; + String queue; + + String targetHost; + int targetPort; + String targetUser; + String targetPassword; + String producingAddress; + + int commit; + + int waitTimeout; + + String filter = null; + + try + { + sourceHost = arg[1]; + sourcePort = Integer.parseInt(arg[2]); + sourceUser = arg[3]; + sourcePass = arg[4]; + queue = arg[5]; + + targetHost = arg[6]; + targetPort = Integer.parseInt(arg[7]); + targetUser = arg[8]; + targetPassword = arg[9]; + producingAddress = arg[10]; + + waitTimeout = Integer.parseInt(arg[11]); + commit = Integer.parseInt(arg[12]); + + if (arg.length == 14) + { + filter = arg[13]; + } + } + catch (Exception e) + { + e.printStackTrace(); + printUsage(); + System.exit(-1); + return; // the compiler doesn't understand exit as leaving the VM + } + + Map<String, Object> sourceParameters = new HashMap<String, Object>(); + sourceParameters.put(TransportConstants.HOST_PROP_NAME, sourceHost); + sourceParameters.put(TransportConstants.PORT_PROP_NAME, sourcePort); + + Map<String, Object> targetParameters = new HashMap<String, Object>(); + sourceParameters.put(TransportConstants.HOST_PROP_NAME, targetHost); + sourceParameters.put(TransportConstants.PORT_PROP_NAME, targetPort); + + + try + { + TransportConfiguration configurationSource = new TransportConfiguration(NettyConnectorFactory.class.getName(), sourceParameters); + + ServerLocator locatorSource = HornetQClient.createServerLocator(false, configurationSource); + + ClientSessionFactory factorySource = locatorSource.createSessionFactory(); + + ClientSession sessionSource = factorySource.createSession(sourceUser, sourcePass, false, false, false, false, 0); + + ClientConsumer consumer; + + if (filter == null) + { + consumer = sessionSource.createConsumer(queue); + } + else + { + consumer = sessionSource.createConsumer(queue, filter); + } + + + TransportConfiguration configurationTarget = new TransportConfiguration(NettyConnectorFactory.class.getName(), targetParameters); + + ServerLocator locatorTarget = HornetQClient.createServerLocatorWithoutHA(configurationTarget); + + + + ClientSessionFactory factoryTarget = locatorTarget.createSessionFactory(); + + ClientSession sessionTarget = factoryTarget.createSession(targetUser, targetPassword, false, false, false, false, 0); + + ClientProducer producer = sessionTarget.createProducer(producingAddress); + + sessionSource.start(); + + int countMessage = 0; + + while (true) + { + ClientMessage message = consumer.receive(waitTimeout); + if (message == null) + { + break; + } + + message.acknowledge(); + + if (!message.containsProperty("_HQ_TOOL_original_address")) + { + message.putStringProperty("_HQ_TOOL_original_address", message.getAddress().toString()); + } + + LinkedList<String> listToRemove = new LinkedList<String>(); + + for (SimpleString name : message.getPropertyNames()) + { + if (name.toString().startsWith("_HQ_ROUTE_TO")) + { + listToRemove.add(name.toString()); + } + } + + for (String str: listToRemove) + { + message.removeProperty(str); + } + + producer.send(message); + + if (countMessage++ % commit == 0) + { + System.out.println("Sent " + countMessage + " messages"); + sessionTarget.commit(); + sessionSource.commit(); + } + + } + + + sessionTarget.commit(); + sessionSource.commit(); + consumer.close(); + producer.close(); + + sessionSource.close(); + sessionTarget.close(); + + locatorSource.close(); + locatorTarget.close(); + + + + + } + catch (Exception e) + { + e.printStackTrace(); + printUsage(); + System.exit(-1); + } + + } + + + public void printUsage() + { + for (int i = 0; i < 10; i++) + { + System.err.println(); + } + System.err.println("This method will transfer messages from one queue into another, while removing internal properties such as ROUTE_TO."); + System.err.println(); + System.err.println(Main.USAGE + " <source-IP> <source-port> <user> <password> <source-queue> <target-IP> <target-port> <user> <password> <target-address> <wait-timeout> <commit-size> [filter]"); + System.err.println(); + System.err.println("source-host: IP/hostname for the originating server for the messages"); + System.err.println("source-port: port for the originating server for the messages"); + System.err.println("user: Username used to connect to the source"); + System.err.println("password: Password used to connect to the source"); + System.err.println("source-port: port for the originating server for the messages"); + + System.err.println("source-queue: originating queue for the messages"); + System.err.println(); + System.err.println("target-host: IP/hostname for the destination server for the messages"); + System.err.println("target-port: port for the destination server for the messages"); + System.err.println("user: Username used to connect to the target"); + System.err.println("password: Password used to connect to the target"); + System.err.println("target-address: address at the destination server"); + System.err.println(); + System.err.println("wait-timeout: time in milliseconds"); + System.err.println("commit-size: batch size for each transaction (in number of messages)"); + System.err.println(); + System.err.println("filter: You can optionally add a filter to the original queue"); + for (int i = 0; i < 10; i++) + { + System.err.println(); + } + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataConstants.java ---------------------------------------------------------------------- diff --git a/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataConstants.java b/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataConstants.java index 70848f0..6cea6ea 100644 --- a/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataConstants.java +++ b/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataConstants.java @@ -117,4 +117,6 @@ public final class XmlDataConstants static final String JMS_JNDI_ENTRY = "entry"; public static final String JNDI_COMPATIBILITY_PREFIX = "java:jboss/exported/"; + + static final String NULL = "_HQ_NULL"; } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataExporter.java ---------------------------------------------------------------------- diff --git a/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataExporter.java b/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataExporter.java index 454b850..99b0d16 100644 --- a/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataExporter.java +++ b/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataExporter.java @@ -135,12 +135,12 @@ public final class XmlDataExporter public XmlDataExporter(OutputStream out, String bindingsDir, String journalDir, String pagingDir, String largeMessagesDir) throws Exception { - config = new ConfigurationImpl(); - config.setBindingsDirectory(bindingsDir); - config.setJournalDirectory(journalDir); - config.setPagingDirectory(pagingDir); - config.setLargeMessagesDirectory(largeMessagesDir); - config.setJournalType(JournalType.NIO); + config = new ConfigurationImpl() + .setBindingsDirectory(bindingsDir) + .setJournalDirectory(journalDir) + .setPagingDirectory(pagingDir) + .setLargeMessagesDirectory(largeMessagesDir) + .setJournalType(JournalType.NIO); final ExecutorService executor = Executors.newFixedThreadPool(1); ExecutorFactory executorFactory = new ExecutorFactory() { @@ -950,7 +950,7 @@ public final class XmlDataExporter } else { - xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_VALUE, value.toString()); + xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_VALUE, value == null ? XmlDataConstants.NULL : value.toString()); } if (value instanceof Boolean) http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataImporter.java ---------------------------------------------------------------------- diff --git a/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataImporter.java b/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataImporter.java index 41a7c08..ae33615 100644 --- a/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataImporter.java +++ b/hornetq-tools/src/main/java/org/hornetq/tools/XmlDataImporter.java @@ -407,6 +407,7 @@ public final class XmlDataImporter String key = ""; String value = ""; String propertyType = ""; + String realValue = null; for (int i = 0; i < reader.getAttributeCount(); i++) { @@ -452,10 +453,18 @@ public final class XmlDataImporter message.putLongProperty(key, Long.parseLong(value)); break; case XmlDataConstants.PROPERTY_TYPE_SIMPLE_STRING: - message.putStringProperty(new SimpleString(key), new SimpleString(value)); + if (!value.equals(XmlDataConstants.NULL)) + { + realValue = value; + } + message.putStringProperty(new SimpleString(key), new SimpleString(realValue)); break; case XmlDataConstants.PROPERTY_TYPE_STRING: - message.putStringProperty(key, value); + if (!value.equals(XmlDataConstants.NULL)) + { + realValue = value; + } + message.putStringProperty(key, realValue); break; } } http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq_doap.rdf ---------------------------------------------------------------------- diff --git a/hornetq_doap.rdf b/hornetq_doap.rdf new file mode 100644 index 0000000..2dd7031 --- /dev/null +++ b/hornetq_doap.rdf @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rdf:RDF xml:lang="en" xmlns="http://usefulinc.com/ns/doap#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> + <Project rdf:about=""> + <name></name> + <homepage rdf:resource="" /> + <shortdesc></shortdesc> + <description></description> + + <maintainer> + <foaf:Person> + <foaf:name>Clebert Suconic</foaf:name> + <foaf:status>Project Lead</foaf:status> + <foaf:firstName>Clebert</foaf:firstName> + <foaf:lastName>Suconic</foaf:lastName> + </foaf:Person> + </maintainer> + <developer> + <foaf:Person> + <foaf:name>Andy Taylor</foaf:name> + <foaf:firstName>Andy</foaf:firstName> + <foaf:lastName>Taylor</foaf:lastName> + </foaf:Person> + </developer> + <developer> + <foaf:Person> + <foaf:name>Howard Gao</foaf:name> + <foaf:firstName>Howard</foaf:firstName> + <foaf:lastName>Gao</foaf:lastName> + </foaf:Person> + </developer> + <developer> + <foaf:Person> + <foaf:name>Justin Bertram</foaf:name> + <foaf:firstName>Justin</foaf:firstName> + <foaf:lastName>Bertram</foaf:lastName> + </foaf:Person> + </developer> + <developer> + <foaf:Person> + <foaf:name>Martyn Taylor</foaf:name> + <foaf:firstName>Martyn</foaf:firstName> + <foaf:lastName>Taylor</foaf:lastName> + </foaf:Person> + </developer> + + <release> + <Version> + <name>2.4.0</name> + <revision>2.4.0.final</revision> + <created>2013-16-12</created> + </Version> + </release> + <license rdf:resource="" /> + + + <programming-language>Java</programming-language> + <programming-language>C/C++</programming-language> + <vendor>Red Hat</vendor> + <implements> + <Specification> + <name>JMS 2.0</name> + <description></description> + <rdfs:seeAlso rdf:resource="" /> + </Specification> + </implements> + <foaf:logo rdf:resource="" /> + <foaf:account> + <foaf:OnlineAccount> + <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/OnlineChatAccount" /> + <foaf:accountServiceHomepage rdf:resource="http://twitter.com/" /> + <foaf:accountName>hornetq</foaf:accountName> + </foaf:OnlineAccount> + </foaf:account> + </Project> +</rdf:RDF> + http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/integration/hornetq-aerogear-integration/pom.xml ---------------------------------------------------------------------- diff --git a/integration/hornetq-aerogear-integration/pom.xml b/integration/hornetq-aerogear-integration/pom.xml index 1840a34..3375f4d 100644 --- a/integration/hornetq-aerogear-integration/pom.xml +++ b/integration/hornetq-aerogear-integration/pom.xml @@ -39,7 +39,7 @@ <dependency> <groupId>org.jboss.aerogear</groupId> <artifactId>unifiedpush-java-client</artifactId> - <version>0.4.0</version> + <version>1.0.0</version> </dependency> <!-- RestEasy's Jackson Plugin --> <dependency> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/integration/hornetq-aerogear-integration/src/main/java/org/hornetq/integration/aerogear/AeroGearConnectorService.java ---------------------------------------------------------------------- diff --git a/integration/hornetq-aerogear-integration/src/main/java/org/hornetq/integration/aerogear/AeroGearConnectorService.java b/integration/hornetq-aerogear-integration/src/main/java/org/hornetq/integration/aerogear/AeroGearConnectorService.java index 031696b..ed5cea7 100644 --- a/integration/hornetq-aerogear-integration/src/main/java/org/hornetq/integration/aerogear/AeroGearConnectorService.java +++ b/integration/hornetq-aerogear-integration/src/main/java/org/hornetq/integration/aerogear/AeroGearConnectorService.java @@ -62,6 +62,10 @@ public class AeroGearConnectorService implements ConnectorService, Consumer, Mes private final String sound; + private final boolean contentAvailable; + + private final String actionCategory; + private String[] variants; private String[] aliases; @@ -96,6 +100,8 @@ public class AeroGearConnectorService implements ConnectorService, Consumer, Mes this.ttl = ConfigurationHelper.getIntProperty(AeroGearConstants.TTL_NAME, AeroGearConstants.DEFAULT_TTL, configuration); this.badge = ConfigurationHelper.getStringProperty(AeroGearConstants.BADGE_NAME, null, configuration); this.sound = ConfigurationHelper.getStringProperty(AeroGearConstants.SOUND_NAME, AeroGearConstants.DEFAULT_SOUND, configuration); + this.contentAvailable = ConfigurationHelper.getBooleanProperty(AeroGearConstants.CONTENT_AVAILABLE_NAME, false, configuration); + this.actionCategory = ConfigurationHelper.getStringProperty(AeroGearConstants.ACTION_CATEGORY_NAME, null, configuration); this.filterString = ConfigurationHelper.getStringProperty(AeroGearConstants.FILTER_NAME, null, configuration); this.retryInterval = ConfigurationHelper.getIntProperty(AeroGearConstants.RETRY_INTERVAL_NAME, AeroGearConstants.DEFAULT_RETRY_INTERVAL, configuration); this.retryAttempts = ConfigurationHelper.getIntProperty(AeroGearConstants.RETRY_ATTEMPTS_NAME, AeroGearConstants.DEFAULT_RETRY_ATTEMPTS, configuration); @@ -202,7 +208,7 @@ public class AeroGearConnectorService implements ConnectorService, Consumer, Mes String alert = message.getTypedProperties().getProperty(AeroGearConstants.AEROGEAR_ALERT).toString(); - JavaSender sender = new SenderClient(endpoint); + JavaSender sender = new SenderClient.Builder(endpoint).build(); UnifiedMessage.Builder builder = new UnifiedMessage.Builder(); @@ -224,6 +230,20 @@ public class AeroGearConnectorService implements ConnectorService, Consumer, Mes builder.badge(badge); } + boolean contentAvailable = message.containsProperty(AeroGearConstants.AEROGEAR_CONTENT_AVAILABLE) ? message.getBooleanProperty(AeroGearConstants.AEROGEAR_CONTENT_AVAILABLE) : this.contentAvailable; + + if (contentAvailable) + { + builder.contentAvailable(); + } + + String actionCategory = message.containsProperty(AeroGearConstants.AEROGEAR_ACTION_CATEGORY) ? message.getStringProperty(AeroGearConstants.AEROGEAR_ACTION_CATEGORY) : this.actionCategory; + + if (actionCategory != null) + { + builder.actionCategory(actionCategory); + } + Integer ttl = message.containsProperty(AeroGearConstants.AEROGEAR_TTL) ? message.getIntProperty(AeroGearConstants.AEROGEAR_TTL) : this.ttl; if (ttl != null) http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/integration/hornetq-aerogear-integration/src/main/java/org/hornetq/integration/aerogear/AeroGearConstants.java ---------------------------------------------------------------------- diff --git a/integration/hornetq-aerogear-integration/src/main/java/org/hornetq/integration/aerogear/AeroGearConstants.java b/integration/hornetq-aerogear-integration/src/main/java/org/hornetq/integration/aerogear/AeroGearConstants.java index aac0a0d..a0349c8 100644 --- a/integration/hornetq-aerogear-integration/src/main/java/org/hornetq/integration/aerogear/AeroGearConstants.java +++ b/integration/hornetq-aerogear-integration/src/main/java/org/hornetq/integration/aerogear/AeroGearConstants.java @@ -29,6 +29,8 @@ public class AeroGearConstants public static final String TTL_NAME = "ttl"; public static final String BADGE_NAME = "badge"; public static final String SOUND_NAME = "sound"; + public static final String CONTENT_AVAILABLE_NAME = "content-available"; + public static final String ACTION_CATEGORY_NAME = "action-category"; public static final String FILTER_NAME = "filter"; public static final String RETRY_INTERVAL_NAME = "retry-interval"; public static final String RETRY_ATTEMPTS_NAME = "retry-attempts"; @@ -39,6 +41,8 @@ public class AeroGearConstants public static final SimpleString AEROGEAR_ALERT = new SimpleString("AEROGEAR_ALERT"); public static final SimpleString AEROGEAR_SOUND = new SimpleString("AEROGEAR_SOUND"); + public static final SimpleString AEROGEAR_CONTENT_AVAILABLE = new SimpleString("AEROGEAR_CONTENT_AVAILABLE"); + public static final SimpleString AEROGEAR_ACTION_CATEGORY = new SimpleString("AEROGEAR_ACTION_CATEGORY"); public static final SimpleString AEROGEAR_BADGE = new SimpleString("AEROGEAR_BADGE"); public static final SimpleString AEROGEAR_TTL = new SimpleString("AEROGEAR_TTL"); public static final SimpleString AEROGEAR_VARIANTS = new SimpleString("AEROGEAR_VARIANTS"); @@ -59,6 +63,8 @@ public class AeroGearConstants ALLOWABLE_PROPERTIES.add(TTL_NAME); ALLOWABLE_PROPERTIES.add(BADGE_NAME); ALLOWABLE_PROPERTIES.add(SOUND_NAME); + ALLOWABLE_PROPERTIES.add(CONTENT_AVAILABLE_NAME); + ALLOWABLE_PROPERTIES.add(ACTION_CATEGORY_NAME); ALLOWABLE_PROPERTIES.add(FILTER_NAME); ALLOWABLE_PROPERTIES.add(RETRY_INTERVAL_NAME); ALLOWABLE_PROPERTIES.add(RETRY_ATTEMPTS_NAME); http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/integration/hornetq-jboss-as-integration/pom.xml ---------------------------------------------------------------------- diff --git a/integration/hornetq-jboss-as-integration/pom.xml b/integration/hornetq-jboss-as-integration/pom.xml index fd11dd1..e159478 100644 --- a/integration/hornetq-jboss-as-integration/pom.xml +++ b/integration/hornetq-jboss-as-integration/pom.xml @@ -45,7 +45,7 @@ </dependency> <dependency> <groupId>org.jboss.spec.javax.transaction</groupId> - <artifactId>jboss-transaction-api_1.1_spec</artifactId> + <artifactId>jboss-transaction-api_1.2_spec</artifactId> </dependency> <dependency> <groupId>org.jboss</groupId> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/integration/hornetq-twitter-integration/src/main/java/org/hornetq/integration/twitter/impl/IncomingTweetsHandler.java ---------------------------------------------------------------------- diff --git a/integration/hornetq-twitter-integration/src/main/java/org/hornetq/integration/twitter/impl/IncomingTweetsHandler.java b/integration/hornetq-twitter-integration/src/main/java/org/hornetq/integration/twitter/impl/IncomingTweetsHandler.java index 3d47c41..d9f1650 100644 --- a/integration/hornetq-twitter-integration/src/main/java/org/hornetq/integration/twitter/impl/IncomingTweetsHandler.java +++ b/integration/hornetq-twitter-integration/src/main/java/org/hornetq/integration/twitter/impl/IncomingTweetsHandler.java @@ -161,7 +161,7 @@ public class IncomingTweetsHandler implements ConnectorService { Status status = (Status) res.get(i); - ServerMessage msg = new ServerMessageImpl(this.storageManager.generateUniqueID(), + ServerMessage msg = new ServerMessageImpl(this.storageManager.generateID(), TwitterConstants.INITIAL_MESSAGE_BUFFER_SIZE); msg.setAddress(new SimpleString(this.queueName)); msg.setDurable(true); http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/integration/hornetq-vertx-integration/pom.xml ---------------------------------------------------------------------- diff --git a/integration/hornetq-vertx-integration/pom.xml b/integration/hornetq-vertx-integration/pom.xml index a060023..3521603 100644 --- a/integration/hornetq-vertx-integration/pom.xml +++ b/integration/hornetq-vertx-integration/pom.xml @@ -37,15 +37,15 @@ <mods.directory>target/mods</mods.directory> <!--Dependency versions--> - <vertx.version>2.1.1</vertx.version> - <vertx.testtools.version>2.0.2-final</vertx.testtools.version> + <vertx.version>2.1.2</vertx.version> + <vertx.testtools.version>2.0.3-final</vertx.testtools.version> <junit.version>4.11</junit.version> <!--Plugin versions--> <maven.compiler.plugin.version>3.0</maven.compiler.plugin.version> <maven.resources.plugin.version>2.6</maven.resources.plugin.version> <maven.clean.plugin.version>2.5</maven.clean.plugin.version> - <maven.vertx.plugin.version>2.0.1-final</maven.vertx.plugin.version> + <maven.vertx.plugin.version>2.0.8-final</maven.vertx.plugin.version> <maven.surefire.plugin.version>2.14</maven.surefire.plugin.version> <maven.failsafe.plugin.version>2.14</maven.failsafe.plugin.version> <maven.surefire.report.plugin.version>2.14</maven.surefire.report.plugin.version> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/integration/hornetq-vertx-integration/src/main/java/org/hornetq/integration/vertx/IncomingVertxEventHandler.java ---------------------------------------------------------------------- diff --git a/integration/hornetq-vertx-integration/src/main/java/org/hornetq/integration/vertx/IncomingVertxEventHandler.java b/integration/hornetq-vertx-integration/src/main/java/org/hornetq/integration/vertx/IncomingVertxEventHandler.java index 667b758..7cb3d14 100644 --- a/integration/hornetq-vertx-integration/src/main/java/org/hornetq/integration/vertx/IncomingVertxEventHandler.java +++ b/integration/hornetq-vertx-integration/src/main/java/org/hornetq/integration/vertx/IncomingVertxEventHandler.java @@ -150,7 +150,7 @@ public class IncomingVertxEventHandler implements ConnectorService @Override public void handle(Message<?> message) { - ServerMessage msg = new ServerMessageImpl(storageManager.generateUniqueID(), + ServerMessage msg = new ServerMessageImpl(storageManager.generateID(), VertxConstants.INITIAL_MESSAGE_BUFFER_SIZE); msg.setAddress(new SimpleString(queueName)); msg.setDurable(true);
