DummyMessageEndpoint endpoint = new DummyMessageEndpoint(latch);
DummyMessageEndpointFactory endpointFactory = new DummyMessageEndpointFactory(endpoint, false);
qResourceAdapter.endpointActivation(endpointFactory, spec);
ClientSession session = locator.createSessionFactory().createSession();
ClientProducer clientProducer = session.createProducer("jms.topic.mdbTopic");
ClientMessage message = session.createMessage(true);
message.getBodyBuffer().writeString("1");
message.putStringProperty("foo", "bar");
clientProducer.send(message);
latch.await(5, TimeUnit.SECONDS);
assertNotNull(endpoint.lastMessage);
assertEquals(endpoint.lastMessage.getCoreMessage().getBodyBuffer().readString(), "1");
qResourceAdapter.endpointDeactivation(endpointFactory, spec);
message = session.createMessage(true);
message.getBodyBuffer().writeString("2");
message.putStringProperty("foo", "bar");
clientProducer.send(message);
latch = new CountDownLatch(1);
endpoint = new DummyMessageEndpoint(latch);
//change the selector forcing the queue to be recreated
spec.setMessageSelector("foo='abar'");
endpointFactory = new DummyMessageEndpointFactory(endpoint, false);
qResourceAdapter.endpointActivation(endpointFactory, spec);
message = session.createMessage(true);
message.getBodyBuffer().writeString("3");
message.putStringProperty("foo", "abar");
clientProducer.send(message);
latch.await(5, TimeUnit.SECONDS);
assertNotNull(endpoint.lastMessage);
assertEquals(endpoint.lastMessage.getCoreMessage().getBodyBuffer().readString(), "3");