use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class JmsSinkTest method testDisablingMessageIdAndTimestamp.
@Test
public void testDisablingMessageIdAndTimestamp() throws JMSException {
MapBasedConfig config = new MapBasedConfig().with("destination", "queue-one").with("disable-message-id", true).with("disable-message-timestamp", true).with("channel-name", "jms");
JmsSink sink = new JmsSink(jms, new JmsConnectorOutgoingConfiguration(config), jsonMapping, executor);
MyJmsClient client = new MyJmsClient(jms.createQueue("queue-one"));
subscriber = sink.getSink().build();
subscriber.onSubscribe(new Subscriptions.EmptySubscription());
AtomicBoolean acked = new AtomicBoolean();
subscriber.onNext(Message.of("hello", () -> CompletableFuture.runAsync(() -> acked.set(true))));
await().until(() -> client.messages.size() >= 1);
assertThat(acked).isTrue();
assertThat(client.messages.get(0).getBody(String.class)).isEqualTo("hello");
assertThat(client.messages.get(0).getJMSMessageID()).isNull();
assertThat(client.messages.get(0).getJMSTimestamp()).isEqualTo(0L);
}
use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class NamedFactoryTest method testWithoutConnectionFactoryAndNameSet.
@Test
public void testWithoutConnectionFactoryAndNameSet() {
initWithoutConnectionFactory();
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);
try {
deploy(PayloadConsumerBean.class, ProducerBean.class);
} catch (DeploymentException de) {
assertThat(de).hasCauseInstanceOf(IllegalStateException.class).hasMessageContaining("javax.jms.ConnectionFactory bean named");
}
}
use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class NamedFactoryTest 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 InMemoryConnectorWithMergeTest method install.
@BeforeEach
public void install() {
Map<String, Object> conf = new HashMap<>();
conf.put("mp.messaging.outgoing.bar.connector", InMemoryConnector.CONNECTOR);
conf.put("mp.messaging.outgoing.bar.merge", "true");
installConfig(new MapBasedConfig(conf));
}
use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class JacksonMappingTest method identityString.
@Test
@DisplayName("Test the conversion from string to object and back")
void identityString() {
MapBasedConfig config = new MapBasedConfig(Collections.emptyMap());
addConfig(config);
WeldContainer container = deploy();
JacksonMapping mapping = container.select(JacksonMapping.class).get();
final String testObjectAsJson = "{\"my_id\": 1, \"my_Payload\": \"Lorem ipsum\"}";
assertThat(mapping.toJson(mapping.fromJson(testObjectAsJson, TestObject.class))).isNotNull();
}
Aggregations