forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The reactive messaging extension has its own customized configuration layer to configure reactive messaging to use the Quarkus built time mechanism. This layer didn't support @Incomings. This commit adds support for it. Fix quarkusio#19562
- Loading branch information
1 parent
2be9adf
commit c9ef124
Showing
3 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...loyment/src/test/java/io/quarkus/smallrye/reactivemessaging/signatures/IncomingsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package io.quarkus.smallrye.reactivemessaging.signatures; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.awaitility.Awaitility.await; | ||
|
||
import java.util.List; | ||
import java.util.concurrent.CopyOnWriteArrayList; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.inject.Inject; | ||
|
||
import org.eclipse.microprofile.reactive.messaging.Incoming; | ||
import org.eclipse.microprofile.reactive.messaging.Outgoing; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
import org.reactivestreams.Publisher; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.smallrye.mutiny.Multi; | ||
|
||
public class IncomingsTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(ProducerOnA.class, ProducerOnB.class, MyBeanUsingMultipleIncomings.class)); | ||
|
||
@Inject | ||
MyBeanUsingMultipleIncomings bean; | ||
|
||
@Test | ||
public void testIncomingsWithTwoSources() { | ||
await().until(() -> bean.list().size() == 6); | ||
assertThat(bean.list()).containsExactlyInAnyOrder("a", "b", "c", "d", "e", "f"); | ||
} | ||
|
||
@ApplicationScoped | ||
public static class ProducerOnA { | ||
|
||
@Outgoing("a") | ||
public Publisher<String> produce() { | ||
return Multi.createFrom().items("a", "b", "c"); | ||
} | ||
|
||
} | ||
|
||
@ApplicationScoped | ||
public static class ProducerOnB { | ||
|
||
@Outgoing("b") | ||
public Publisher<String> produce() { | ||
return Multi.createFrom().items("d", "e", "f"); | ||
} | ||
|
||
} | ||
|
||
@ApplicationScoped | ||
public static class MyBeanUsingMultipleIncomings { | ||
|
||
private final List<String> list = new CopyOnWriteArrayList<>(); | ||
|
||
@Incoming("a") | ||
@Incoming("b") | ||
public void consume(String s) { | ||
list.add(s); | ||
} | ||
|
||
public List<String> list() { | ||
return list; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters