use of io.smallrye.reactive.messaging.providers.MediatorConfigurationSupport in project smallrye-reactive-messaging by smallrye.
the class MediatorConfigurationSupportTest method testSubscribers.
@Test
public void testSubscribers() {
MediatorConfigurationSupport support = create("subscriberSubscriberOfMessage");
MediatorConfigurationSupport.ValidationOutput output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.STREAM_OF_MESSAGE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSubscriberOfPayload");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.STREAM_OF_PAYLOAD);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSubscriberBuilderOfMessage");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.STREAM_OF_MESSAGE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isTrue();
support = create("subscriberSubscriberBuilderOfPayload");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.STREAM_OF_PAYLOAD);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isTrue();
assertThatThrownBy(() -> create("subscriberSinkOfMessage").validate(Shape.SUBSCRIBER, null)).isInstanceOf(DefinitionException.class);
support = create("subscriberSinkOfPayload");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.PAYLOAD);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSinkOfMessageCompletionStage");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.MESSAGE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSinkOfPayloadCompletionStage");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.PAYLOAD);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSinkOfMessageUni");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.MESSAGE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSinkOfPayloadUni");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.PAYLOAD);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSinkOfRawMessageCompletionStage");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.MESSAGE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(null);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSinkOfWildcardMessageCompletionStage");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.MESSAGE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(null);
assertThat(output.getUseBuilderTypes()).isFalse();
}
use of io.smallrye.reactive.messaging.providers.MediatorConfigurationSupport in project smallrye-reactive-messaging by smallrye.
the class MediatorConfigurationSupportTest method testProcessMerge.
@Test
void testProcessMerge() {
MediatorConfigurationSupport support = new MediatorConfigurationSupport("mymethod", String.class, new Class[] { String.class }, null, null);
assertThat(support.processMerge(Arrays.asList("a", "b"), () -> Merge.Mode.MERGE)).isEqualTo(Merge.Mode.MERGE);
assertThatThrownBy(() -> support.processMerge(Collections.emptyList(), () -> Merge.Mode.MERGE)).isInstanceOf(DefinitionException.class);
assertThatThrownBy(() -> support.processMerge(null, () -> Merge.Mode.MERGE)).isInstanceOf(DefinitionException.class);
assertThat(support.processMerge(Collections.emptyList(), () -> null)).isEqualTo(null);
}
use of io.smallrye.reactive.messaging.providers.MediatorConfigurationSupport in project smallrye-reactive-messaging by smallrye.
the class MediatorConfigurationSupportTest method testProcessSuppliedAcknowledgement.
@Test
void testProcessSuppliedAcknowledgement() {
MediatorConfigurationSupport support = new MediatorConfigurationSupport("mymethod", String.class, new Class[] { String.class }, null, null);
assertThat(support.processSuppliedAcknowledgement(Collections.singletonList("hello"), () -> Acknowledgment.Strategy.MANUAL)).isEqualTo(Acknowledgment.Strategy.MANUAL);
assertThat(support.processSuppliedAcknowledgement(Collections.singletonList("hello"), () -> null)).isNull();
assertThat(support.processSuppliedAcknowledgement(Collections.emptyList(), () -> null)).isNull();
assertThatThrownBy(() -> support.processSuppliedAcknowledgement(Collections.emptyList(), () -> Acknowledgment.Strategy.MANUAL)).isInstanceOf(DefinitionException.class);
}
use of io.smallrye.reactive.messaging.providers.MediatorConfigurationSupport in project smallrye-reactive-messaging by smallrye.
the class MediatorConfigurationSupportTest method testPublishers.
@Test
public void testPublishers() {
MediatorConfigurationSupport support = create("publisherPublisherOfMessage");
MediatorConfigurationSupport.ValidationOutput output = support.validate(Shape.PUBLISHER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.NONE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.STREAM_OF_MESSAGE);
assertThat(output.getIngestedPayloadType()).isNull();
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("publisherMultiOfMessage");
output = support.validate(Shape.PUBLISHER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.NONE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.STREAM_OF_MESSAGE);
assertThat(output.getIngestedPayloadType()).isNull();
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("publisherPublisherOfPayload");
output = support.validate(Shape.PUBLISHER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.NONE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.STREAM_OF_PAYLOAD);
assertThat(output.getIngestedPayloadType()).isNull();
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("publisherMultiOfPayload");
output = support.validate(Shape.PUBLISHER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.NONE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.STREAM_OF_PAYLOAD);
assertThat(output.getIngestedPayloadType()).isNull();
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("publisherPublisherBuilderOfMessage");
output = support.validate(Shape.PUBLISHER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.NONE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.STREAM_OF_MESSAGE);
assertThat(output.getIngestedPayloadType()).isNull();
assertThat(output.getUseBuilderTypes()).isTrue();
support = create("publisherPublisherBuilderOfPayload");
output = support.validate(Shape.PUBLISHER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.NONE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.STREAM_OF_PAYLOAD);
assertThat(output.getIngestedPayloadType()).isNull();
assertThat(output.getUseBuilderTypes()).isTrue();
support = create("publisherGeneratePayload");
output = support.validate(Shape.PUBLISHER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.NONE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.INDIVIDUAL_PAYLOAD);
assertThat(output.getIngestedPayloadType()).isNull();
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("publisherGenerateMessage");
output = support.validate(Shape.PUBLISHER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.NONE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.INDIVIDUAL_MESSAGE);
assertThat(output.getIngestedPayloadType()).isNull();
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("publisherGenerateCompletionStagePayload");
output = support.validate(Shape.PUBLISHER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.NONE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.COMPLETION_STAGE_OF_PAYLOAD);
assertThat(output.getIngestedPayloadType()).isNull();
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("publisherGenerateCompletionStageMessage");
output = support.validate(Shape.PUBLISHER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.NONE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.COMPLETION_STAGE_OF_MESSAGE);
assertThat(output.getIngestedPayloadType()).isNull();
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("publisherGenerateUniPayload");
output = support.validate(Shape.PUBLISHER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.NONE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.UNI_OF_PAYLOAD);
assertThat(output.getIngestedPayloadType()).isNull();
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("publisherGenerateUniMessage");
output = support.validate(Shape.PUBLISHER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.NONE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.UNI_OF_MESSAGE);
assertThat(output.getIngestedPayloadType()).isNull();
assertThat(output.getUseBuilderTypes()).isFalse();
}
use of io.smallrye.reactive.messaging.providers.MediatorConfigurationSupport in project quarkus by quarkusio.
the class MediatorConfigurationSupportTest method testSubscribers.
@Test
public void testSubscribers() {
MediatorConfigurationSupport support = create("subscriberSubscriberOfMessage");
MediatorConfigurationSupport.ValidationOutput output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.STREAM_OF_MESSAGE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSubscriberOfPayload");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.STREAM_OF_PAYLOAD);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSubscriberBuilderOfMessage");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.STREAM_OF_MESSAGE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isTrue();
support = create("subscriberSubscriberBuilderOfPayload");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.STREAM_OF_PAYLOAD);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isTrue();
assertThatThrownBy(() -> create("subscriberSinkOfMessage").validate(Shape.SUBSCRIBER, null)).isInstanceOf(DefinitionException.class);
support = create("subscriberSinkOfPayload");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.PAYLOAD);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSinkOfMessageCompletionStage");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.MESSAGE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSinkOfPayloadCompletionStage");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.PAYLOAD);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSinkOfMessageUni");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.MESSAGE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSinkOfPayloadUni");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.PAYLOAD);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(Person.class);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSinkOfRawMessageCompletionStage");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.MESSAGE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(null);
assertThat(output.getUseBuilderTypes()).isFalse();
support = create("subscriberSinkOfWildcardMessageCompletionStage");
output = support.validate(Shape.SUBSCRIBER, null);
assertThat(output.getConsumption()).isEqualTo(MediatorConfiguration.Consumption.MESSAGE);
assertThat(output.getProduction()).isEqualTo(MediatorConfiguration.Production.NONE);
assertThat(output.getIngestedPayloadType()).isEqualTo(null);
assertThat(output.getUseBuilderTypes()).isFalse();
}
Aggregations