@Override protected void extraServerConfig(Configuration serverConfig) { AddressSettings settings = serverConfig.getAddressesSettings().get("#"); if (settings != null) { settings.setAutoCreateQueues(true); } }
@Override protected void extraServerConfig(Configuration serverConfig) { serverConfig.setJournalType(JournalType.NIO); Map<String, AddressSettings> map = serverConfig.getAddressesSettings(); Map.Entry<String, AddressSettings> entry = map.entrySet().iterator().next(); AddressSettings settings = entry.getValue(); settings.setAutoCreateQueues(true); System.out.println("server cofg, isauto? " + entry.getValue().isAutoCreateQueues()); }
@Override protected void extraServerConfig(Configuration serverConfig) { String match = "#"; Map<String, AddressSettings> asMap = serverConfig.getAddressesSettings(); asMap.get(match).setAutoCreateAddresses(true).setAutoCreateQueues(true); }
@Override protected void configureAddressPolicy(ActiveMQServer server) { Configuration serverConfig = server.getConfiguration(); serverConfig.setJournalType(JournalType.NIO); Map<String, AddressSettings> map = serverConfig.getAddressesSettings(); if (map.size() == 0) { AddressSettings as = new AddressSettings(); map.put("#", as); } Map.Entry<String, AddressSettings> entry = map.entrySet().iterator().next(); AddressSettings settings = entry.getValue(); settings.setAutoCreateQueues(true); System.out.println("server cofg, isauto? " + entry.getValue().isAutoCreateQueues()); }
@Test public void testCreateNonExistentQueue() throws Exception { AddressSettings addressSettings = new AddressSettings(); addressSettings.setAutoCreateQueues(false); getJmsServer().getAddressSettingsRepository().addMatch("#", addressSettings); Connection conn = getConnectionFactory().createConnection(); Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); try { sess.createQueue("QueueThatDoesNotExist"); ProxyAssertSupport.fail(); } catch (JMSException e) { } conn.close(); }
@Test public void testCreateQueueWhileTopicWithSameNameExists() throws Exception { AddressSettings addressSettings = new AddressSettings(); addressSettings.setAutoCreateQueues(false); addressSettings.setAutoCreateAddresses(false); getJmsServer().getAddressSettingsRepository().addMatch("#", addressSettings); Connection conn = getConnectionFactory().createConnection(); Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); try { sess.createQueue("TestTopic"); ProxyAssertSupport.fail("should throw JMSException"); } catch (JMSException e) { // OK } conn.close(); }
protected void configureAddressSettings(Map<String, AddressSettings> addressSettingsMap) { addressSettingsMap.put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setAutoCreateAddresses(true)); }
@Override protected void configureAddressSettings(Map<String, AddressSettings> addressSettingsMap) { addressSettingsMap.put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false). setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL).setMaxSizeBytes(10000)); }
@Test public void testAutoDestinationNoCreationOnConsumer() throws JMSException { AddressSettings addressSetting = new AddressSettings(); addressSetting.setAutoCreateQueues(false); String address = "foo"; server.getAddressSettingsRepository().addMatch(address, addressSetting); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); TextMessage message = session.createTextMessage("bar"); Queue queue = new ActiveMQQueue(address); try { MessageConsumer consumer = session.createConsumer(queue); fail("supposed to throw an exception here"); } catch (JMSException e) { } }
@Test public void testCreateNonExistentTopic() throws Exception { getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateQueues(false)); getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false)); Connection conn = getConnectionFactory().createConnection(); Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); try { sess.createTopic("TopicThatDoesNotExist"); ProxyAssertSupport.fail("should throw JMSException"); } catch (JMSException e) { // OK } conn.close(); }
@Test public void testCreateTopicWhileQueueWithSameNameExists() throws Exception { getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateQueues(false)); getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false)); Connection conn = getConnectionFactory().createConnection(); Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); try { sess.createTopic("TestQueue"); ProxyAssertSupport.fail("should throw JMSException"); } catch (JMSException e) { // OK } conn.close(); }
@Override protected void configureAddressSettings(Map<String, AddressSettings> addressSettingsMap) { addressSettingsMap.put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setAutoCreateAddresses(true)); addressSettingsMap.put(lmDropAddress.toString(), new AddressSettings() .setMaxSizeBytes(15 * 1024 * 1024) .setAddressFullMessagePolicy(AddressFullMessagePolicy.DROP) .setMessageCounterHistoryDayLimit(10) .setRedeliveryDelay(0) .setMaxDeliveryAttempts(0)); }
@Test public void testMulticastOperationsOnAnycastAddress() throws Exception { server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false).setAutoCreateQueues(false)); testRoutingSemantics(RoutingType.MULTICAST.toString(), getQueuePrefix() + getQueueName()); }
@Test public void testAnycastOperationsOnMulticastAddress() throws Exception { server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false).setAutoCreateQueues(false)); testRoutingSemantics(RoutingType.ANYCAST.toString(), getTopicPrefix() + getTopicName()); }
@Override @Before public void setUp() throws Exception { super.setUp(); server = createServer(true, true); Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(true).setAutoCreateAddresses(true).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); server.start(); coreQueue = new SimpleString(queueName); server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false); qpidfactory = new JmsConnectionFactory("amqp://localhost:61616"); }
public void configureBroker() throws Exception { // TODO Add SSL super.setUp(); server = createServerForMQTT(); addCoreConnector(); addMQTTConnector(); AddressSettings addressSettings = new AddressSettings(); addressSettings.setMaxSizeBytes(999999999); addressSettings.setAutoCreateQueues(true); addressSettings.setAutoCreateAddresses(true); configureBrokerSecurity(server); server.getAddressSettingsRepository().addMatch("#", addressSettings); }
@Override @Before public void setUp() throws Exception { super.setUp(); server = createServer(true, true); server.start(); server.waitForActivation(10, TimeUnit.SECONDS); Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false) .setAutoCreateAddresses(false) .setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); coreQueue = new SimpleString(queueName); server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false); }
@Override @Before public void setUp() throws Exception { super.setUp(); server = createServer(true, true); server.start(); server.waitForActivation(10, TimeUnit.SECONDS); Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false) .setAutoCreateAddresses(false) .setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); coreQueue = new SimpleString(queueName); server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false); }
@Override @Before public void setUp() throws Exception { super.setUp(); server = createServer(true, true); server.start(); server.waitForActivation(10, TimeUnit.SECONDS); Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); coreQueue = new SimpleString(queueName); server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false); qpidfactory = new JmsConnectionFactory("amqp://localhost:61616"); }
@Test public void testQueueQueryNoQ() throws Exception { server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateQueues(false)); cf = createSessionFactory(locator); ClientSession clientSession = cf.createSession(false, true, true); QueueQuery resp = clientSession.queueQuery(new SimpleString(queueName)); Assert.assertFalse(resp.isExists()); Assert.assertFalse(resp.isAutoCreateQueues()); Assert.assertEquals(queueName, resp.getAddress().toString()); clientSession.close(); }