use of org.kie.kogito.event.cloudevents.CloudEventMeta in project kogito-runtimes by kiegroup.
the class TopicInformationResourceIT method verifyTopicsInformation.
@Test
void verifyTopicsInformation() {
final List<Topic> topics = Arrays.asList(given().get("/messaging/topics").as(Topic[].class));
LOGGER.info("Topics registered in the service are {}", topics);
assertThat(topics).isNotEmpty();
assertThat(topics.stream().anyMatch(t -> t.getType() == ChannelType.INCOMING && t.getName().equals("kogito_it_test") && t.getEventsMeta().contains(new CloudEventMeta("pong_end", "", EventKind.CONSUMED)))).isTrue();
}
use of org.kie.kogito.event.cloudevents.CloudEventMeta 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.cloudevents.CloudEventMeta in project kogito-runtimes by kiegroup.
the class KogitoAddOnKnativeEventingProcessorTest method checkKogitoFileIsGeneratedWithDefaultConfig.
@Test
void checkKogitoFileIsGeneratedWithDefaultConfig() {
final OutputTargetBuildItem outputTargetBuildItem = new OutputTargetBuildItem(Paths.get("/"), "", false, null, Optional.empty());
final Set<CloudEventMeta> ces = new HashSet<>();
ces.add(new CloudEventMeta("myProducedEvent", "/local/test", EventKind.PRODUCED));
ces.add(new CloudEventMeta("myConsumedEvent", "/local/test", EventKind.CONSUMED));
final KogitoServiceDeploymentTarget deploymentTarget = new KogitoServiceDeploymentTarget("apps", "v1", "Deployment", "kogito-service");
final KogitoKnativeResourcesMetadataBuildItem resourcesMetadataBuildItem = new KogitoKnativeResourcesMetadataBuildItem(ces, deploymentTarget);
final KogitoAddOnKnativeEventingProcessor eventingProcessor = buildTestProcessorWithDefaultConfig();
final MockGeneratedFSProducer producer = new MockGeneratedFSProducer();
eventingProcessor.generate(outputTargetBuildItem, Optional.of(resourcesMetadataBuildItem), producer);
assertNotNull(producer.getItem().getData());
assertTrue(producer.getItem().getData().length > 0);
assertTrue(new String(producer.getItem().getData()).contains("SinkBinding"));
assertFalse(new String(producer.getItem().getData()).contains("KogitoSource"));
assertTrue(new String(producer.getItem().getData()).contains("Trigger"));
assertTrue(new String(producer.getItem().getData()).contains("Broker"));
}
use of org.kie.kogito.event.cloudevents.CloudEventMeta in project kogito-runtimes by kiegroup.
the class KogitoAddOnKnativeEventingProcessorTest method checkKogitoFileIsGeneratedWithKogitoSource.
@Test
void checkKogitoFileIsGeneratedWithKogitoSource() {
final OutputTargetBuildItem outputTargetBuildItem = new OutputTargetBuildItem(Paths.get("/"), "", false, null, Optional.empty());
final Set<CloudEventMeta> ces = new HashSet<>();
ces.add(new CloudEventMeta("myProducedEvent", "/local/test", EventKind.PRODUCED));
final KogitoServiceDeploymentTarget deploymentTarget = new KogitoServiceDeploymentTarget("apps", "v1", "Deployment", "kogito-service");
final KogitoKnativeResourcesMetadataBuildItem resourcesMetadataBuildItem = new KogitoKnativeResourcesMetadataBuildItem(ces, deploymentTarget);
final KogitoAddOnKnativeEventingProcessor eventingProcessor = buildTestProcessorWithDefaultConfig();
eventingProcessor.config.generateKogitoSource = true;
final MockGeneratedFSProducer producer = new MockGeneratedFSProducer();
eventingProcessor.generate(outputTargetBuildItem, Optional.of(resourcesMetadataBuildItem), producer);
assertNotNull(producer.getItem().getData());
assertTrue(producer.getItem().getData().length > 0);
assertFalse(new String(producer.getItem().getData()).contains("SinkBinding"));
assertTrue(new String(producer.getItem().getData()).contains("KogitoSource"));
assertFalse(new String(producer.getItem().getData()).contains("Trigger"));
assertTrue(new String(producer.getItem().getData()).contains("Broker"));
}
use of org.kie.kogito.event.cloudevents.CloudEventMeta in project kogito-runtimes by kiegroup.
the class KogitoAddOnKnativeEventingProcessorTest method checkKogitoFileIsGeneratedOnlyProduced.
@Test
void checkKogitoFileIsGeneratedOnlyProduced() {
final OutputTargetBuildItem outputTargetBuildItem = new OutputTargetBuildItem(Paths.get("/"), "", false, null, Optional.empty());
final Set<CloudEventMeta> ces = new HashSet<>();
ces.add(new CloudEventMeta("myProducedEvent", "/local/test", EventKind.PRODUCED));
final KogitoServiceDeploymentTarget deploymentTarget = new KogitoServiceDeploymentTarget("apps", "v1", "Deployment", "kogito-service");
final KogitoKnativeResourcesMetadataBuildItem resourcesMetadataBuildItem = new KogitoKnativeResourcesMetadataBuildItem(ces, deploymentTarget);
final KogitoAddOnKnativeEventingProcessor eventingProcessor = buildTestProcessorWithDefaultConfig();
final MockGeneratedFSProducer producer = new MockGeneratedFSProducer();
eventingProcessor.generate(outputTargetBuildItem, Optional.of(resourcesMetadataBuildItem), producer);
assertNotNull(producer.getItem().getData());
assertTrue(producer.getItem().getData().length > 0);
assertTrue(new String(producer.getItem().getData()).contains("SinkBinding"));
assertFalse(new String(producer.getItem().getData()).contains("KogitoSource"));
assertFalse(new String(producer.getItem().getData()).contains("Trigger"));
assertTrue(new String(producer.getItem().getData()).contains("Broker"));
}
Aggregations