use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class DeprecatedNamedFactoryTest method testNamedConnectionFactory.
@Test
public void testNamedConnectionFactory() {
initWithoutConnectionFactory().addBeanClasses(BarConnectionFactoryBean.class, FooConnectionFactoryBean.class);
Map<String, Object> map = new HashMap<>();
map.put("mp.messaging.connector." + JmsConnector.CONNECTOR_NAME + ".connection-factory-name", "foo");
map.put("mp.messaging.outgoing.queue-one.connector", JmsConnector.CONNECTOR_NAME);
map.put("mp.messaging.incoming.jms.connector", JmsConnector.CONNECTOR_NAME);
map.put("mp.messaging.incoming.jms.destination", "queue-one");
MapBasedConfig config = new MapBasedConfig(map);
addConfig(config);
WeldContainer container = deploy(PayloadConsumerBean.class, ProducerBean.class);
PayloadConsumerBean bean = container.select(PayloadConsumerBean.class).get();
await().until(() -> bean.list().size() > 3);
}
use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class HeaderPropagationTest method testFromAppToJMS.
@Test
public void testFromAppToJMS() {
MyJmsClient client = new MyJmsClient(jms.createQueue("some-queue"));
Map<String, Object> map = new HashMap<>();
map.put("mp.messaging.outgoing.jms.connector", JmsConnector.CONNECTOR_NAME);
map.put("mp.messaging.outgoing.jms.destination", "should-not-be-used");
MapBasedConfig config = new MapBasedConfig(map);
addConfig(config);
deploy(MyAppGeneratingData.class);
await().until(() -> client.messages.size() == 10);
assertThat(client.messages).allSatisfy(entry -> {
try {
assertThat(entry.getBody(String.class)).isNotNull();
assertThat(entry.getJMSCorrelationID()).startsWith("my-correlation-");
assertThat(entry.getStringProperty("prop")).isEqualTo("bar");
} catch (JMSException e) {
fail("unable to read jms data", e);
}
});
}
use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class HeaderPropagationTest method testFromJmsToAppToJms.
@Test
public void testFromJmsToAppToJms() {
MyJmsClient client = new MyJmsClient(jms.createQueue("some-queue"));
Map<String, Object> map = new HashMap<>();
map.put("mp.messaging.incoming.source.connector", JmsConnector.CONNECTOR_NAME);
map.put("mp.messaging.incoming.source.destination", "source");
map.put("mp.messaging.outgoing.jms.connector", JmsConnector.CONNECTOR_NAME);
map.put("mp.messaging.outgoing.jms.destination", "should-not-be-used");
MapBasedConfig config = new MapBasedConfig(map);
addConfig(config);
deploy(MyAppProcessingData.class);
AtomicInteger count = new AtomicInteger();
JMSProducer producer = jms.createProducer();
Queue source = jms.createQueue("source");
for (int i = 0; i < 20; i++) {
ObjectMessage message = jms.createObjectMessage(count.getAndIncrement());
producer.send(source, message);
}
await().until(() -> client.messages.size() >= 10);
assertThat(client.messages).allSatisfy(entry -> {
try {
assertThat(entry.getBody(String.class)).isNotNull();
assertThat(entry.getJMSCorrelationID()).startsWith("my-correlation-");
assertThat(entry.getStringProperty("prop")).isEqualTo("bar");
} catch (JMSException e) {
fail("unable to read jms data", e);
}
});
}
use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class JmsConnectorTest method testWithPerson.
@Test
public void testWithPerson() {
Map<String, Object> map = new HashMap<>();
map.put("mp.messaging.outgoing.queue-one.connector", JmsConnector.CONNECTOR_NAME);
map.put("mp.messaging.incoming.jms.connector", JmsConnector.CONNECTOR_NAME);
map.put("mp.messaging.incoming.jms.destination", "queue-one");
MapBasedConfig config = new MapBasedConfig(map);
addConfig(config);
WeldContainer container = deploy(PersonConsumerBean.class, PersonProducerBean.class);
PersonConsumerBean bean = container.select(PersonConsumerBean.class).get();
await().until(() -> bean.list().size() > 1);
assertThat(bean.list()).isNotEmpty();
}
use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class JmsConnectorTest method testWithInvalidOutgoingDestinationType.
@Test
public void testWithInvalidOutgoingDestinationType() {
Map<String, Object> map = new HashMap<>();
map.put("mp.messaging.outgoing.queue-one.connector", JmsConnector.CONNECTOR_NAME);
map.put("mp.messaging.outgoing.queue-one.destination-type", "invalid");
map.put("mp.messaging.incoming.jms.connector", JmsConnector.CONNECTOR_NAME);
map.put("mp.messaging.incoming.jms.destination-type", "queue");
MapBasedConfig config = new MapBasedConfig(map);
addConfig(config);
assertThatThrownBy(() -> {
deploy(PayloadConsumerBean.class, ProducerBean.class);
}).isInstanceOf(DeploymentException.class);
}
Aggregations