use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class RabbitMQSourceCDIConfigTest method testConfigByCDIIncorrectBean.
@Test
public void testConfigByCDIIncorrectBean() {
Weld weld = new Weld();
weld.addBeanClass(ConsumptionBean.class);
weld.addBeanClass(ClientConfigurationBean.class);
weld.addBeanClass(ExecutionHolder.class);
new MapBasedConfig().with("mp.messaging.incoming.data.queue.name", "data").with("mp.messaging.incoming.data.connector", RabbitMQConnector.CONNECTOR_NAME).with("mp.messaging.incoming.data.host", host).with("mp.messaging.incoming.data.port", port).with("rabbitmq-username", username).with("rabbitmq-password", password).with("mp.messaging.incoming.data.client-options-name", "dummyoptionsnonexistent").with("mp.messaging.incoming.data.tracing-enabled", false).write();
assertThatThrownBy(() -> container = weld.initialize()).isInstanceOf(DeploymentException.class);
}
use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class RabbitMQSourceCDIConfigTest method testConfigByCDICorrect.
@Test
public void testConfigByCDICorrect() {
Weld weld = new Weld();
weld.addBeanClass(ClientConfigurationBean.class);
weld.addBeanClass(ConsumptionBean.class);
new MapBasedConfig().with("mp.messaging.incoming.data.queue.name", "data").with("mp.messaging.incoming.data.connector", RabbitMQConnector.CONNECTOR_NAME).with("mp.messaging.incoming.data.host", host).with("mp.messaging.incoming.data.port", port).with("rabbitmq-username", username).with("rabbitmq-password", password).with("mp.messaging.incoming.data.client-options-name", "myclientoptions").with("mp.messaging.incoming.data.tracing-enabled", false).write();
container = weld.initialize();
await().until(() -> isRabbitMQConnectorAlive(container));
await().until(() -> isRabbitMQConnectorReady(container));
List<Integer> list = container.select(ConsumptionBean.class).get().getResults();
assertThat(list).isEmpty();
AtomicInteger counter = new AtomicInteger();
usage.produceTenIntegers("data", "data", "", counter::getAndIncrement);
await().atMost(2, TimeUnit.MINUTES).until(() -> list.size() >= 10);
assertThat(list).containsExactly(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class RabbitMQSourceCDIConfigTest method testConfigGlobalOptionsByCDIIncorrectBean.
@Test
public void testConfigGlobalOptionsByCDIIncorrectBean() {
Weld weld = new Weld();
weld.addBeanClass(ConsumptionBean.class);
weld.addBeanClass(ClientConfigurationBean.class);
weld.addBeanClass(ExecutionHolder.class);
new MapBasedConfig().with("mp.messaging.incoming.data.queue.name", "data").with("mp.messaging.incoming.data.connector", RabbitMQConnector.CONNECTOR_NAME).with("mp.messaging.incoming.data.host", host).with("mp.messaging.incoming.data.port", port).with("mp.messaging.incoming.data.tracing-enabled", false).with("rabbitmq-username", username).with("rabbitmq-password", password).with("rabbitmq-client-options-name", "dummyoptionsnonexistent").write();
assertThatThrownBy(() -> container = weld.initialize()).isInstanceOf(DeploymentException.class);
}
use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class RabbitMQSourceCDIConfigTest method testConfigGlobalOptionsByCDIMissingBean.
@Test
public void testConfigGlobalOptionsByCDIMissingBean() {
Weld weld = new Weld();
weld.addBeanClass(ConsumptionBean.class);
weld.addBeanClass(ExecutionHolder.class);
new MapBasedConfig().with("mp.messaging.incoming.data.queue.name", "data").with("mp.messaging.incoming.data.connector", RabbitMQConnector.CONNECTOR_NAME).with("mp.messaging.incoming.data.host", host).with("mp.messaging.incoming.data.port", port).with("mp.messaging.incoming.data.tracing-enabled", false).with("rabbitmq-username", username).with("rabbitmq-password", password).with("rabbitmq-client-options-name", "myclientoptions").write();
assertThatThrownBy(() -> container = weld.initialize()).isInstanceOf(DeploymentException.class);
}
use of io.smallrye.reactive.messaging.test.common.config.MapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class RabbitMQSourceCDIConfigTest method testConfigGlobalOptionsByCDICorrect.
@Test
public void testConfigGlobalOptionsByCDICorrect() {
Weld weld = new Weld();
String queueName = UUID.randomUUID().toString();
weld.addBeanClass(ClientConfigurationBean.class);
weld.addBeanClass(ConsumptionBean.class);
new MapBasedConfig().with("mp.messaging.incoming.data.queue.name", queueName).with("mp.messaging.incoming.data.exchange.name", queueName).with("mp.messaging.incoming.data.connector", RabbitMQConnector.CONNECTOR_NAME).with("mp.messaging.incoming.data.host", host).with("mp.messaging.incoming.data.port", port).with("mp.messaging.incoming.data.tracing-enabled", false).with("rabbitmq-username", username).with("rabbitmq-password", password).with("rabbitmq-client-options-name", "myclientoptions").write();
container = weld.initialize();
await().until(() -> isRabbitMQConnectorAlive(container));
await().until(() -> isRabbitMQConnectorReady(container));
List<Integer> list = container.select(ConsumptionBean.class).get().getResults();
assertThat(list).isEmpty();
AtomicInteger counter = new AtomicInteger();
usage.produceTenIntegers(queueName, queueName, "", counter::getAndIncrement);
await().atMost(2, TimeUnit.MINUTES).until(() -> list.size() >= 10);
assertThat(list).containsExactly(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
Aggregations