use of org.apache.activemq.artemis.core.server.impl.AddressInfo in project activemq-artemis by apache.
the class JournalPendingMessageTest method setupAddresses.
@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);
}
use of org.apache.activemq.artemis.core.server.impl.AddressInfo in project activemq-artemis by apache.
the class RestDeserializationTest method testWithoutBlackWhiteListTopic.
@Test
public void testWithoutBlackWhiteListTopic() throws Exception {
jmsServer.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString("ordersTopic"), RoutingType.MULTICAST));
deployAndconfigureRESTService("rest-test.war");
RestMessageContext topicContext = restConnection.createTopicContext("ordersTopic");
topicContext.initPullConsumers();
Order order = new Order();
order.setName("Bill");
order.setItem("iPhone4");
order.setAmount("$199.99");
jmsSendMessage(order, "ordersTopic", false);
String received = topicContext.pullMessage();
Object object = xmlToObject(received);
assertEquals(order, object);
}
use of org.apache.activemq.artemis.core.server.impl.AddressInfo in project activemq-artemis by apache.
the class StompTest method testPrefix.
public void testPrefix(final String prefix, final RoutingType routingType, final boolean send) throws Exception {
int port = 61614;
URI uri = createStompClientUri(scheme, hostname, port);
final String ADDRESS = UUID.randomUUID().toString();
final String PREFIXED_ADDRESS = prefix + ADDRESS;
String param = routingType.toString();
String urlParam = param.toLowerCase() + "Prefix";
server.getActiveMQServer().getRemotingService().createAcceptor("test", "tcp://" + hostname + ":" + port + "?protocols=" + StompProtocolManagerFactory.STOMP_PROTOCOL_NAME + "&" + urlParam + "=" + prefix).start();
StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
conn.connect(defUser, defPass);
// since this queue doesn't exist the broker should create a new address using the routing type matching the prefix
if (send) {
send(conn, PREFIXED_ADDRESS, null, "Hello World", true);
} else {
String uuid = UUID.randomUUID().toString();
ClientStompFrame frame = conn.createFrame(Stomp.Commands.SUBSCRIBE).addHeader(Stomp.Headers.Subscribe.DESTINATION, PREFIXED_ADDRESS).addHeader(Stomp.Headers.RECEIPT_REQUESTED, uuid);
frame = conn.sendFrame(frame);
assertEquals(uuid, frame.getHeader(Stomp.Headers.Response.RECEIPT_ID));
}
AddressInfo addressInfo = server.getActiveMQServer().getAddressInfo(SimpleString.toSimpleString(ADDRESS));
assertNotNull("No address was created with the name " + ADDRESS, addressInfo);
Set<RoutingType> routingTypes = new HashSet<>();
routingTypes.add(RoutingType.valueOf(param));
assertEquals(routingTypes, addressInfo.getRoutingTypes());
conn.disconnect();
}
use of org.apache.activemq.artemis.core.server.impl.AddressInfo in project activemq-artemis by apache.
the class FindDestinationTest method testFindQueue.
@Test
public void testFindQueue() throws Exception {
String testName = "testFindQueue";
server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(testName), RoutingType.MULTICAST));
server.getActiveMQServer().createQueue(new SimpleString(testName), RoutingType.MULTICAST, new SimpleString(testName), null, false, false);
ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/queues/" + testName));
ClientResponse<?> response = request.head();
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("poller: " + consumeNext);
ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
res.releaseConnection();
Assert.assertEquals(201, res.getStatus());
res = consumeNext.request().post(String.class);
Assert.assertEquals(200, res.getStatus());
Assert.assertEquals("1", res.getEntity(String.class));
res.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
Assert.assertEquals(204, session.request().delete().getStatus());
}
use of org.apache.activemq.artemis.core.server.impl.AddressInfo in project activemq-artemis by apache.
the class RawAckTest method setup.
@BeforeClass
public static void setup() throws Exception {
Configuration configuration = new ConfigurationImpl().setPersistenceEnabled(false).setSecurityEnabled(false).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
activeMQServer = ActiveMQServers.newActiveMQServer(configuration);
activeMQServer.start();
HashMap<String, Object> transportConfig = new HashMap<>();
serverLocator = new ServerLocatorImpl(false, new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
sessionFactory = serverLocator.createSessionFactory();
consumerSessionFactory = serverLocator.createSessionFactory();
SimpleString addr = SimpleString.toSimpleString("testQueue");
activeMQServer.addAddressInfo(new AddressInfo(addr, RoutingType.MULTICAST));
activeMQServer.createQueue(addr, RoutingType.MULTICAST, addr, null, false, false);
session = sessionFactory.createSession(true, true);
producer = session.createProducer(addr);
session.start();
}
Aggregations