@Override public AddressInfo createAddress(final SimpleString address, RoutingType routingType, final boolean autoCreated) throws Exception { return createAddress(new AddressInfo(address, routingType), autoCreated); }
@Override public synchronized void registerQueue(final Queue queue, final SimpleString address, final StorageManager storageManager) throws Exception { registerQueue(queue, new AddressInfo(address), storageManager); }
public AddressInfo create(SimpleString name, RoutingType routingType) { AddressInfo info = new AddressInfo(name, routingType); info.setInternal(this.internal); return info; }
private AddressInfo mergedRoutingTypes(SimpleString address, AddressInfo... addressInfos) { EnumSet<RoutingType> mergedRoutingTypes = EnumSet.noneOf(RoutingType.class); for (AddressInfo addressInfo : addressInfos) { if (addressInfo != null) { mergedRoutingTypes.addAll(addressInfo.getRoutingTypes()); } } return new AddressInfo(address, mergedRoutingTypes); }
@Override public void activated() { try { ActiveMQServer usedServer = messagingServer; if (usedServer != null) { usedServer.addAddressInfo(new AddressInfo(managementNotificationAddress, RoutingType.MULTICAST)); } } catch (Exception e) { ActiveMQServerLogger.LOGGER.unableToCreateManagementNotificationAddress(managementNotificationAddress, e); } } });
@Override public void initAddresses(Map<Long, AddressBindingInfo> addressBindingInfosMap, List<AddressBindingInfo> addressBindingInfos) throws Exception { for (AddressBindingInfo addressBindingInfo : addressBindingInfos) { addressBindingInfosMap.put(addressBindingInfo.getId(), addressBindingInfo); AddressInfo addressInfo = new AddressInfo(addressBindingInfo.getName()).setRoutingTypes(addressBindingInfo.getRoutingTypes()); addressInfo.setId(addressBindingInfo.getId()); postOffice.reloadAddressInfo(addressInfo); } }
@Override protected void createAddressAndQueues(ActiveMQServer server) throws Exception { super.createAddressAndQueues(server); server.addAddressInfo(new AddressInfo(INITIAL_QUEUE_SS, RoutingType.ANYCAST)); server.createQueue(INITIAL_QUEUE_SS, RoutingType.ANYCAST, INITIAL_QUEUE_SS, null, true, false, -1, false, true); server.addAddressInfo(new AddressInfo(FINAL_QUEUE_SS, RoutingType.ANYCAST)); server.createQueue(FINAL_QUEUE_SS, RoutingType.ANYCAST, FINAL_QUEUE_SS, null, true, false, -1, false, true); }
@Test public void testUpdateAddress() throws Exception { server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.ANYCAST)); server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); verifier.validatePluginMethodsEquals(1, BEFORE_UPDATE_ADDRESS, AFTER_UPDATE_ADDRESS); }
private RoutingType getRoutingType(String typeHeader, String destination) throws Exception { // null is valid to return here so we know when the user didn't provide any routing info RoutingType routingType; if (typeHeader != null) { routingType = RoutingType.valueOf(typeHeader); } else { routingType = connection.getSession().getCoreSession().getAddressAndRoutingType(new AddressInfo(new SimpleString(destination))).getRoutingType(); } return routingType; }
@Test public void testFailDeleteAddressWhenExistsQueues() throws Exception { final String addressName = "address"; final SimpleString addressSimpleString = new SimpleString(addressName); final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST)); server.addAddressInfo(addressInfo); server.createQueue(addressSimpleString, RoutingType.MULTICAST, new SimpleString("queue1"), null, true, false); final DeleteAddress deleteAddress = new DeleteAddress(); deleteAddress.setName(addressName); deleteAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); checkExecutionFailure(deleteAddress, "Address " + addressName + " has bindings"); }
protected void createAddressInfo(final int node, final String address, final RoutingType routingType, final int defaulMaxConsumers, boolean defaultPurgeOnNoConsumers) throws Exception { AddressInfo addressInfo = new AddressInfo(new SimpleString(address)); addressInfo.addRoutingType(routingType); servers[node].addOrUpdateAddressInfo(addressInfo); }
@Test public void testEmptyRoutingTypes() throws Exception { server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString("xy"))); server.stop(); server.start(); server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString("xy"))); server.stop(); } }
@Override @Before public void setUp() throws Exception { super.setUp(); AddressInfo addressInfo = new AddressInfo(new SimpleString("p.IN"), RoutingType.MULTICAST); this.server.addAddressInfo(addressInfo); addressInfo = new AddressInfo(new SimpleString("q.IN"), RoutingType.MULTICAST); this.server.addAddressInfo(addressInfo); }
@Override public AddressInfo createAddress(final SimpleString address, EnumSet<RoutingType> routingTypes, final boolean autoCreated) throws Exception { SimpleString realAddress = CompositeAddress.extractAddressName(address); Pair<SimpleString, EnumSet<RoutingType>> art = getAddressAndRoutingTypes(realAddress, routingTypes); securityCheck(art.getA(), CheckType.CREATE_ADDRESS, this); server.addOrUpdateAddressInfo(new AddressInfo(art.getA(), art.getB()).setAutoCreated(autoCreated)); return server.getAddressInfo(art.getA()); }
@Test public void testAddressQueryOnStaticAddressWithFQQN() throws Exception { SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); SimpleString fqqn = addressName.concat("::").concat(SimpleString.toSimpleString(UUID.randomUUID().toString())); server.addAddressInfo(new AddressInfo(fqqn)); assertEquals(addressName, server.addressQuery(addressName).getName()); assertEquals(addressName, server.addressQuery(fqqn).getName()); }
@Override protected void createAddressAndQueues(ActiveMQServer server) throws Exception { super.createAddressAndQueues(server); //Add Standard Queue server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NORMAL_QUEUE_NAME), RoutingType.ANYCAST)); server.createQueue(SimpleString.toSimpleString(NORMAL_QUEUE_NAME), RoutingType.ANYCAST, SimpleString.toSimpleString(NORMAL_QUEUE_NAME), null, true, false, -1, false, true); }
@Before public void createQueue() throws Exception { server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("queue1"), RoutingType.ANYCAST)); server.createQueue(SimpleString.toSimpleString("queue1"), RoutingType.ANYCAST, SimpleString.toSimpleString("queue1"), null, true, false); }
@Before public void setupAddresses() throws Exception { server.getPostOffice() .addAddressInfo(new AddressInfo(SimpleString.toSimpleString(defaultQueueName), RoutingType.ANYCAST)); server.createQueue(SimpleString.toSimpleString(defaultQueueName), RoutingType.ANYCAST, SimpleString.toSimpleString(defaultQueueName), null, true, false); }
@Before public void setup() throws Exception { server = createServer(true); server.start(); server.waitForActivation(10, TimeUnit.SECONDS); ServerLocator sl = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY)); sessionFactory = sl.createSessionFactory(); addSessionFactory(sessionFactory); addressInfo = new AddressInfo(baseAddress); addressInfo.addRoutingType(RoutingType.ANYCAST); server.addOrUpdateAddressInfo(addressInfo); }
@Before public void setup() throws Exception { server = createServer(true); server.start(); server.waitForActivation(10, TimeUnit.SECONDS); ServerLocator sl = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY)); sessionFactory = sl.createSessionFactory(); addSessionFactory(sessionFactory); addressInfo = new AddressInfo(baseAddress); addressInfo.addRoutingType(RoutingType.MULTICAST); server.addOrUpdateAddressInfo(addressInfo); }