use of org.kie.kogito.event.TopicDiscovery in project kogito-runtimes by kiegroup.
the class QuarkusTopicDiscoveryTest method verifyTopicsWithPropertiesAndChannels.
@Test
@ClearSystemProperty(key = "mp.messaging.outgoing.processedtravellers.connector")
@ClearSystemProperty(key = "mp.messaging.outgoing.processedtravellers.url")
@ClearSystemProperty(key = "mp.messaging.outgoing.processedtravellers.topic")
@ClearSystemProperty(key = "mp.messaging.incoming.kogito_incoming_stream.connector")
@ClearSystemProperty(key = "mp.messaging.incoming.kogito_incoming_stream.topic")
void verifyTopicsWithPropertiesAndChannels() {
final TopicDiscovery discovery = new QuarkusTopicDiscovery();
final List<Topic> topics = discovery.getTopics(Collections.emptyList());
assertThat(topics).isEmpty();
}
use of org.kie.kogito.event.TopicDiscovery in project kogito-runtimes by kiegroup.
the class QuarkusTopicDiscoveryTest method verifyTopicsWithPropertiesSet.
@Test
@SetSystemProperty(key = "mp.messaging.outgoing.processedtravellers.connector", value = "quarkus-http")
@SetSystemProperty(key = "mp.messaging.outgoing.processedtravellers.url", value = "http://localhost:8080/")
@SetSystemProperty(key = "mp.messaging.incoming.kogito_incoming_stream.connector", value = "smallrye-kafka")
@SetSystemProperty(key = "mp.messaging.incoming.kogito_incoming_stream.topic", value = "mycooltopic")
void verifyTopicsWithPropertiesSet() {
final List<Topic> expectedTopics = new ArrayList<>();
expectedTopics.add(new Topic("processedtravellers", ChannelType.OUTGOING));
expectedTopics.add(new Topic("mycooltopic", ChannelType.INCOMING));
final TopicDiscovery discovery = new QuarkusTopicDiscovery();
final List<Topic> topics = discovery.getTopics(Collections.emptyList());
assertThat(topics).hasSize(2);
expectedTopics.forEach(e -> assertThat(topics.stream().anyMatch(t -> t.getName().equals(e.getName()) && t.getType() == e.getType())).isTrue());
}
use of org.kie.kogito.event.TopicDiscovery in project kogito-runtimes by kiegroup.
the class QuarkusTopicDiscoveryTest method verifyTopicsWithNoPropertiesSet.
@Test
@ClearSystemProperty(key = "mp.messaging.outgoing.processedtravellers.connector")
@ClearSystemProperty(key = "mp.messaging.outgoing.processedtravellers.url")
@ClearSystemProperty(key = "mp.messaging.outgoing.processedtravellers.topic")
@ClearSystemProperty(key = "mp.messaging.incoming.kogito_incoming_stream.connector")
@ClearSystemProperty(key = "mp.messaging.incoming.kogito_incoming_stream.topic")
void verifyTopicsWithNoPropertiesSet() {
final List<Topic> expectedTopics = new ArrayList<>();
expectedTopics.add(AbstractTopicDiscovery.DEFAULT_OUTGOING_CHANNEL);
expectedTopics.add(AbstractTopicDiscovery.DEFAULT_INCOMING_CHANNEL);
final List<CloudEventMeta> eventsMeta = new ArrayList<>();
eventsMeta.add(new CloudEventMeta("event1", "", EventKind.CONSUMED));
eventsMeta.add(new CloudEventMeta("event2", "", EventKind.PRODUCED));
final TopicDiscovery discovery = new QuarkusTopicDiscovery();
final List<Topic> topics = discovery.getTopics(eventsMeta);
assertThat(topics).hasSize(2);
expectedTopics.forEach(e -> assertThat(topics.stream().anyMatch(t -> t.getName().equals(e.getName()) && t.getType() == e.getType())).isTrue());
}
use of org.kie.kogito.event.TopicDiscovery in project kogito-runtimes by kiegroup.
the class QuarkusTopicDiscoveryTest method verifyTopicsWithPropertiesSameTopic.
@Test
@SetSystemProperty(key = "mp.messaging.outgoing.processedtravellers.connector", value = "quarkus-http")
@SetSystemProperty(key = "mp.messaging.outgoing.processedtravellers.url", value = "http://localhost:8080/")
@SetSystemProperty(key = "mp.messaging.outgoing.processedtravellers.topic", value = "mycooltopic")
@SetSystemProperty(key = "mp.messaging.incoming.kogito_incoming_stream.connector", value = "smallrye-kafka")
@SetSystemProperty(key = "mp.messaging.incoming.kogito_incoming_stream.topic", value = "mycooltopic")
void verifyTopicsWithPropertiesSameTopic() {
final List<Topic> expectedTopics = new ArrayList<>();
expectedTopics.add(new Topic("mycooltopic", ChannelType.OUTGOING));
expectedTopics.add(new Topic("mycooltopic", ChannelType.INCOMING));
final TopicDiscovery discovery = new QuarkusTopicDiscovery();
final List<Topic> topics = discovery.getTopics(Collections.emptyList());
assertThat(topics).hasSize(2);
expectedTopics.forEach(e -> assertThat(topics.stream().anyMatch(t -> t.getName().equals(e.getName()) && t.getType() == e.getType())).isTrue());
}
Aggregations