Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Clement Escoffier <clement.escoffier@gmail.com>
- Loading branch information
1 parent
de66f17
commit d7d549f
Showing
10 changed files
with
470 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
~ Copyright (c) 2018 Contributors to the Eclipse Foundation | ||
~ | ||
~ See the NOTICE file(s) distributed with this work for additional | ||
~ information regarding copyright ownership. | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ You may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.eclipse.microprofile.reactive.messaging</groupId> | ||
<artifactId>microprofile-reactive-messaging-parent</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>microprofile-reactive-messaging-core-tck</artifactId> | ||
<name>MicroProfile Reactive Messaging Core TCK</name> | ||
|
||
<properties> | ||
<arquillian.version>1.4.1.Final</arquillian.version> | ||
<assertj-core.version>3.11.1</assertj-core.version> | ||
<hamcrest-all.version>1.3</hamcrest-all.version> | ||
<junit.version>4.12</junit.version> | ||
<shrinkwrap-api.version>1.2.6</shrinkwrap-api.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jboss.arquillian</groupId> | ||
<artifactId>arquillian-bom</artifactId> | ||
<version>${arquillian.version}</version> | ||
<scope>import</scope> | ||
<type>pom</type> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.eclipse.microprofile.reactive.messaging</groupId> | ||
<artifactId>microprofile-reactive-messaging-api</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<!-- This dependency is used to create implementation of Publisher that are not coming from Reactive | ||
Streams Operators --> | ||
<groupId>io.reactivex.rxjava2</groupId> | ||
<artifactId>rxjava</artifactId> | ||
<version>2.2.4</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.eclipse.microprofile.reactive-streams-operators</groupId> | ||
<artifactId>microprofile-reactive-streams-operators-api</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>javax.enterprise</groupId> | ||
<artifactId>cdi-api</artifactId> | ||
<version>2.0.SP1</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jboss.arquillian.container</groupId> | ||
<artifactId>arquillian-container-test-spi</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jboss.arquillian.junit</groupId> | ||
<artifactId>arquillian-junit-container</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-all</artifactId> | ||
<version>${hamcrest-all.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jboss.shrinkwrap</groupId> | ||
<artifactId>shrinkwrap-api</artifactId> | ||
<version>${shrinkwrap-api.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>${assertj-core.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
27 changes: 27 additions & 0 deletions
27
core-tck/src/main/java/org/eclipse/microprofile/reactive/messaging/tck/ArchiveExtender.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,27 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
******************************************************************************/ | ||
package org.eclipse.microprofile.reactive.messaging.tck; | ||
|
||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
|
||
public interface ArchiveExtender { | ||
|
||
void extend(JavaArchive archive); | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
core-tck/src/main/java/org/eclipse/microprofile/reactive/messaging/tck/BeanWithChain.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,62 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
******************************************************************************/ | ||
package org.eclipse.microprofile.reactive.messaging.tck; | ||
|
||
import org.eclipse.microprofile.reactive.messaging.Incoming; | ||
import org.eclipse.microprofile.reactive.messaging.Outgoing; | ||
import org.eclipse.microprofile.reactive.streams.operators.PublisherBuilder; | ||
import org.eclipse.microprofile.reactive.streams.operators.ReactiveStreams; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import java.util.List; | ||
import java.util.concurrent.CopyOnWriteArrayList; | ||
|
||
@ApplicationScoped | ||
public class BeanWithChain { | ||
|
||
private List<String> list = new CopyOnWriteArrayList<>(); | ||
|
||
@Outgoing("source") | ||
public PublisherBuilder<String> source() { | ||
return ReactiveStreams.of("hello", "with","MicroProfile", "reactive", "messaging"); | ||
} | ||
|
||
@Incoming("source") | ||
@Outgoing("processed-a") | ||
public String toUpperCase(String payload) { | ||
return payload.toUpperCase(); | ||
} | ||
|
||
@Incoming("processed-a") | ||
@Outgoing("processed-b") | ||
public PublisherBuilder<String> filter(PublisherBuilder<String> input) { | ||
return input.filter(item -> item.length() > 4); | ||
} | ||
|
||
@Incoming("processed-b") | ||
public void sink(String word) { | ||
list.add(word); | ||
} | ||
|
||
public List<String> list() { | ||
return list; | ||
} | ||
|
||
|
||
} |
55 changes: 55 additions & 0 deletions
55
...tck/src/main/java/org/eclipse/microprofile/reactive/messaging/tck/ProcessorChainTest.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,55 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
******************************************************************************/ | ||
package org.eclipse.microprofile.reactive.messaging.tck; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import javax.inject.Inject; | ||
import java.util.ServiceLoader; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@RunWith(Arquillian.class) | ||
public class ProcessorChainTest { | ||
|
||
@Deployment | ||
public static Archive<JavaArchive> deployment() { | ||
JavaArchive archive = ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(BeanWithChain.class) | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); | ||
|
||
ServiceLoader.load(ArchiveExtender.class).iterator().forEachRemaining(ext -> ext.extend(archive)); | ||
return archive; | ||
} | ||
|
||
@Inject | ||
private BeanWithChain bean; | ||
|
||
@Test | ||
public void test() { | ||
assertThat(bean.list()).containsExactly("HELLO", "MICROPROFILE", "REACTIVE", "MESSAGING"); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...tck/src/main/java/org/eclipse/microprofile/reactive/messaging/tck/SimpleIncomingBean.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,34 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
******************************************************************************/ | ||
package org.eclipse.microprofile.reactive.messaging.tck; | ||
|
||
import org.eclipse.microprofile.reactive.messaging.Incoming; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
@ApplicationScoped | ||
public class SimpleIncomingBean extends ValueCollector { | ||
|
||
|
||
@Incoming("strings") | ||
public void incoming(String s) { | ||
values.add(s); | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
...tck/src/main/java/org/eclipse/microprofile/reactive/messaging/tck/SimpleIncomingTest.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,57 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
******************************************************************************/ | ||
package org.eclipse.microprofile.reactive.messaging.tck; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import javax.inject.Inject; | ||
import java.util.ServiceLoader; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@RunWith(Arquillian.class) | ||
public class SimpleIncomingTest { | ||
|
||
@Deployment | ||
public static Archive<JavaArchive> deployment() { | ||
JavaArchive archive = ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(SimpleIncomingBean.class, ValueCollector.class, StringSource.class) | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); | ||
|
||
ServiceLoader.load(ArchiveExtender.class).iterator().forEachRemaining(ext -> ext.extend(archive)); | ||
return archive; | ||
} | ||
|
||
@Inject | ||
private SimpleIncomingBean simple; | ||
|
||
@Test | ||
public void testReceptionWithValues() { | ||
assertThat(simple.getValues()).containsExactlyElementsOf(StringSource.VALUES); | ||
} | ||
|
||
|
||
} |
39 changes: 39 additions & 0 deletions
39
core-tck/src/main/java/org/eclipse/microprofile/reactive/messaging/tck/StringSource.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,39 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
******************************************************************************/ | ||
package org.eclipse.microprofile.reactive.messaging.tck; | ||
|
||
import io.reactivex.Flowable; | ||
import org.eclipse.microprofile.reactive.messaging.Outgoing; | ||
import org.reactivestreams.Publisher; | ||
|
||
import javax.enterprise.context.Dependent; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
@Dependent | ||
public class StringSource { | ||
|
||
public static final List<String> VALUES = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h", "e", "j"); | ||
|
||
@Outgoing("strings") | ||
public Publisher<String> strings() { | ||
return Flowable.fromIterable(VALUES); | ||
} | ||
|
||
} |
Oops, something went wrong.