Merge branch 'master' of github.com:apache/tomee
diff --git a/container/openejb-junit5/pom.xml b/container/openejb-junit5/pom.xml
index 589e573..f4172d2 100644
--- a/container/openejb-junit5/pom.xml
+++ b/container/openejb-junit5/pom.xml
@@ -99,7 +99,8 @@
<goal>test</goal>
</goals>
<configuration>
- <forkCount>0</forkCount>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<includes>
<include>org/apache/openejb/junit5/SingleAppComposerTest</include>
<include>org/apache/openejb/junit5/SingleAppComposerJVMTest</include>
diff --git a/examples/junit5-arquillian-multiple-tomee/README.adoc b/examples/junit5-arquillian-multiple-tomee/README.adoc
new file mode 100644
index 0000000..2d489fd
--- /dev/null
+++ b/examples/junit5-arquillian-multiple-tomee/README.adoc
@@ -0,0 +1,60 @@
+= JUnit 5: Multiple TomEE Arquillian
+:index-group: Arquillian
+:jbake-type: page
+:jbake-status: published
+
+This example shows how to deploy two different applications if the need for it shows.
+That sometimes happens if we need communication between two different web applications. In our
+example we will deploy two applications web resources and test their content.
+
+== Run the application:
+
+[source, bash]
+----
+mvn clean test
+----
+
+This command runs the test where we have specified the two deployments we want to
+test. The test deploys two applications on which we test their content
+that we defined as web resource in our `createDep1()` and createDep2()` method.
+
+== @Deployment annotation
+
+If we want to have two different applications running in the same test it's as
+simple as adding two different `@Deployment` annotated methods to our test class.
+
+[source,java]
+----
+@Deployment(name = "war1", testable = false)
+@TargetsContainer("tomee-1")
+public static WebArchive createDep1() {
+ return ShrinkWrap.create(WebArchive.class, "application1.war")
+ .addAsWebResource(new StringAsset("Hello from TomEE 1"), "index.html");
+}
+
+@Deployment(name = "war2", testable = false)
+@TargetsContainer("tomee-2")
+public static WebArchive createDep2() {
+ return ShrinkWrap.create(WebArchive.class, "application2.war")
+ .addAsWebResource(new StringAsset("Hello from TomEE 2"), "index.html");
+}
+----
+
+== Define `Deployment` context
+
+For each test method we have to define on which `Deployment` context the tests
+should be run. For that we use the `@OperateOnDeployment("war2")` annotation on the related `URL` field.
+
+[source,java]
+----
+
+@ArquillianResource()
+@OperateOnDeployment("war2")
+private URL deployment2;
+
+@Test
+public void testRunningInDep2() throws IOException {
+ final String content = IO.slurp(deployment2);
+ assertEquals("Hello from TomEE 2", content);
+}
+----
diff --git a/examples/junit5-arquillian-multiple-tomee/pom.xml b/examples/junit5-arquillian-multiple-tomee/pom.xml
new file mode 100644
index 0000000..ab1c4c4
--- /dev/null
+++ b/examples/junit5-arquillian-multiple-tomee/pom.xml
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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>
+ <groupId>org.superbiz</groupId>
+ <artifactId>junit5-multiple-tomee-arquillian</artifactId>
+ <packaging>jar</packaging>
+ <version>8.0.7-SNAPSHOT</version>
+ <name>TomEE :: Examples :: JUnit 5 :: Multiple TomEE with Arquillian</name>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <tomee.version>8.0.7-SNAPSHOT</tomee.version>
+ <junit.jupiter.version>5.8.0-M1</junit.jupiter.version>
+
+ <!-- version >= 1.7.0.Alpha5 is required for JUnit5 -->
+ <arquillian.version>1.7.0.Alpha9</arquillian.version>
+ </properties>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <testResources>
+ <testResource>
+ <directory>${project.basedir}/src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.0.0-M5</version>
+ <configuration>
+ <systemPropertyVariables>
+ <arquillian.launch>tomee-cluster</arquillian.launch>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.tomitribe.transformer</groupId>
+ <artifactId>org.eclipse.transformer.maven</artifactId>
+ <version>0.1.1a</version>
+ <configuration>
+ <classifier>jakartaee9</classifier>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>apache-m2-snapshot</id>
+ <name>Apache Snapshot Repository</name>
+ <url>https://repository.apache.org/content/groups/snapshots</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>[8.0,)</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junit.jupiter.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>${junit.jupiter.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <!--
+ The <scope>test</scope> guarantees that non of your runtime
+ code is dependent on any OpenEJB classes.
+ -->
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>openejb-core</artifactId>
+ <version>${tomee.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>arquillian-tomee-remote</artifactId>
+ <version>${tomee.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>ziplock</artifactId>
+ <version>${tomee.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.junit5</groupId>
+ <artifactId>arquillian-junit5-container</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <!--
+ This section allows you to configure where to publish libraries for sharing.
+ It is not required and may be deleted. For more information see:
+ http://maven.apache.org/plugins/maven-deploy-plugin/
+ -->
+ <distributionManagement>
+ <repository>
+ <id>localhost</id>
+ <url>file://${basedir}/target/repo/</url>
+ </repository>
+ <snapshotRepository>
+ <id>localhost</id>
+ <url>file://${basedir}/target/snapshot-repo/</url>
+ </snapshotRepository>
+ </distributionManagement>
+</project>
diff --git a/examples/junit5-arquillian-multiple-tomee/src/test/java/org/superbiz/tomee/arquillian/multiple/MultipleTomEETest.java b/examples/junit5-arquillian-multiple-tomee/src/test/java/org/superbiz/tomee/arquillian/multiple/MultipleTomEETest.java
new file mode 100644
index 0000000..8403519
--- /dev/null
+++ b/examples/junit5-arquillian-multiple-tomee/src/test/java/org/superbiz/tomee/arquillian/multiple/MultipleTomEETest.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.superbiz.tomee.arquillian.multiple;
+
+import org.apache.ziplock.IO;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+import org.jboss.arquillian.junit5.ArquillianExtension;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+import java.io.IOException;
+import java.net.URL;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@ExtendWith(ArquillianExtension.class)
+public class MultipleTomEETest {
+
+ @ArquillianResource()
+ @OperateOnDeployment("war1")
+ private URL deployment1;
+
+ @ArquillianResource()
+ @OperateOnDeployment("war2")
+ private URL deployment2;
+
+ @Deployment(name = "war1", testable = false)
+ @TargetsContainer("tomee-1")
+ public static WebArchive createDep1() {
+ return ShrinkWrap.create(WebArchive.class, "application1.war")
+ .addAsWebResource(new StringAsset("Hello from TomEE 1"), "index.html");
+ }
+
+ @Deployment(name = "war2", testable = false)
+ @TargetsContainer("tomee-2")
+ public static WebArchive createDep2() {
+ return ShrinkWrap.create(WebArchive.class, "application2.war")
+ .addAsWebResource(new StringAsset("Hello from TomEE 2"), "index.html");
+ }
+
+ @Test
+ public void testRunningInDep1() throws IOException {
+ final String content = IO.slurp(deployment1);
+ assertEquals("Hello from TomEE 1", content);
+ }
+
+ @Test
+ public void testRunningInDep2() throws IOException {
+ final String content = IO.slurp(deployment2);
+ assertEquals("Hello from TomEE 2", content);
+ }
+}
diff --git a/examples/junit5-arquillian-multiple-tomee/src/test/resources/arquillian.xml b/examples/junit5-arquillian-multiple-tomee/src/test/resources/arquillian.xml
new file mode 100644
index 0000000..c6e0273
--- /dev/null
+++ b/examples/junit5-arquillian-multiple-tomee/src/test/resources/arquillian.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <group qualifier="tomee-cluster">
+ <container qualifier="tomee-1">
+ <configuration>
+ <property name="httpPort">-1</property>
+ <property name="stopPort">-1</property>
+ <property name="ajpPort">-1</property>
+ <property name="version">${tomee.version}</property>
+ <property name="dir">target/apache-tomee-remote-1</property>
+ <property name="appWorkingDir">target/arquillian-test-working-dir-1</property>
+ </configuration>
+ </container>
+ <container qualifier="tomee-2">
+ <configuration>
+ <property name="httpPort">-1</property>
+ <property name="stopPort">-1</property>
+ <property name="ajpPort">-1</property>
+ <property name="version">${tomee.version}</property>
+ <property name="dir">target/apache-tomee-remote-2</property>
+ <property name="appWorkingDir">target/arquillian-test-working-dir-2</property>
+ </configuration>
+ </container>
+ </group>
+</arquillian>
diff --git a/examples/junit5-arquillian-simple-websockets/README.adoc b/examples/junit5-arquillian-simple-websockets/README.adoc
new file mode 100644
index 0000000..d4e66c4
--- /dev/null
+++ b/examples/junit5-arquillian-simple-websockets/README.adoc
@@ -0,0 +1,19 @@
+= JUnit 5: Simple Websocket Tests with Arquillian
+:index-group: Arquillian
+:jbake-type: page
+:jbake-status: published
+
+
+== junit5-simple-websockets-arquillian
+
+A simple Websocket example project.
+
+This was originally created for TomEE 8.0.7 using Jave EE 8 and Websocket
+API 1.1.
+
+The example was created with a server to server typo of connection in
+mind. For Browser to server connections, you will need to refer to your
+frontend framework of choice but many server side configurations in here
+can be reused.
+
+There is an Arquillian test that will test the connection and sent a message using **JUnit 5**.
\ No newline at end of file
diff --git a/examples/junit5-arquillian-simple-websockets/pom.xml b/examples/junit5-arquillian-simple-websockets/pom.xml
new file mode 100644
index 0000000..5051061
--- /dev/null
+++ b/examples/junit5-arquillian-simple-websockets/pom.xml
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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>
+ <groupId>org.superbiz</groupId>
+ <artifactId>junit5-simple-websockets-arquillian</artifactId>
+ <packaging>jar</packaging>
+ <version>8.0.7-SNAPSHOT</version>
+ <name>TomEE :: Examples :: JUnit 5 :: Simple Websockets with Arquillian</name>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <tomee.version>8.0.7-SNAPSHOT</tomee.version>
+ <tomcat.version>9.0.43</tomcat.version>
+
+ <junit.jupiter.version>5.8.0-M1</junit.jupiter.version>
+ <!-- version >= 1.7.0.Alpha5 is required for JUnit5 -->
+ <arquillian.version>1.7.0.Alpha9</arquillian.version>
+
+ </properties>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <testResources>
+ <testResource>
+ <directory>${project.basedir}/src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.0.0-M5</version>
+ </plugin>
+ <plugin>
+ <groupId>org.tomitribe.transformer</groupId>
+ <artifactId>org.eclipse.transformer.maven</artifactId>
+ <version>0.1.1a</version>
+ <configuration>
+ <classifier>jakartaee9</classifier>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>apache-m2-snapshot</id>
+ <name>Apache Snapshot Repository</name>
+ <url>https://repository.apache.org/content/groups/snapshots</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>[8.0,)</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junit.jupiter.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>${junit.jupiter.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <!--
+ The <scope>test</scope> guarantees that non of your runtime
+ code is dependent on any OpenEJB classes.
+ -->
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>openejb-core</artifactId>
+ <version>${tomee.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>arquillian-tomee-remote</artifactId>
+ <version>${tomee.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- required for the test client to connect -->
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-api</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-websocket</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>ziplock</artifactId>
+ <version>${tomee.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.junit5</groupId>
+ <artifactId>arquillian-junit5-container</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <!--
+ This section allows you to configure where to publish libraries for sharing.
+ It is not required and may be deleted. For more information see:
+ http://maven.apache.org/plugins/maven-deploy-plugin/
+ -->
+ <distributionManagement>
+ <repository>
+ <id>localhost</id>
+ <url>file://${basedir}/target/repo/</url>
+ </repository>
+ <snapshotRepository>
+ <id>localhost</id>
+ <url>file://${basedir}/target/snapshot-repo/</url>
+ </snapshotRepository>
+ </distributionManagement>
+</project>
diff --git a/examples/junit5-arquillian-simple-websockets/src/main/java/org/superbiz/websockets/WebSocketResource.java b/examples/junit5-arquillian-simple-websockets/src/main/java/org/superbiz/websockets/WebSocketResource.java
new file mode 100644
index 0000000..8f78790
--- /dev/null
+++ b/examples/junit5-arquillian-simple-websockets/src/main/java/org/superbiz/websockets/WebSocketResource.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.superbiz.websockets;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.websocket.*;
+import javax.websocket.server.ServerEndpoint;
+import java.io.IOException;
+
+@ApplicationScoped
+@ServerEndpoint("/api/socket")
+public class WebSocketResource {
+
+ @OnOpen
+ public void open(Session session) throws IOException {
+ session.getBasicRemote().sendText("Successfully opened session");
+ }
+
+ @OnMessage
+ public void handleMessage(String payload, Session session) throws IOException {
+ session.getBasicRemote().sendText("Received: " + payload);
+ }
+}
diff --git a/examples/junit5-arquillian-simple-websockets/src/main/resources/META-INF/beans.xml b/examples/junit5-arquillian-simple-websockets/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..1729372
--- /dev/null
+++ b/examples/junit5-arquillian-simple-websockets/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
\ No newline at end of file
diff --git a/examples/junit5-arquillian-simple-websockets/src/main/webapp/WEB-INF/web.xml b/examples/junit5-arquillian-simple-websockets/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..72612f9
--- /dev/null
+++ b/examples/junit5-arquillian-simple-websockets/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+ <display-name>TomEE :: Examples :: JUnit5 :: Simple Websockets with Arquillian</display-name>
+
+</web-app>
\ No newline at end of file
diff --git a/examples/junit5-arquillian-simple-websockets/src/test/java/org/superbiz/websockets/MyWebSocketClientObject.java b/examples/junit5-arquillian-simple-websockets/src/test/java/org/superbiz/websockets/MyWebSocketClientObject.java
new file mode 100644
index 0000000..f4893d9
--- /dev/null
+++ b/examples/junit5-arquillian-simple-websockets/src/test/java/org/superbiz/websockets/MyWebSocketClientObject.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.superbiz.websockets;
+
+import javax.websocket.ClientEndpoint;
+import javax.websocket.OnMessage;
+import java.util.concurrent.CountDownLatch;
+
+@ClientEndpoint
+public class MyWebSocketClientObject {
+
+ public static CountDownLatch latch = new CountDownLatch(1);
+ public static CountDownLatch payloadLatch = new CountDownLatch(1);
+ public static String response;
+
+ @OnMessage
+ public void processMessage(String message) {
+
+ if(message.equals("Successfully opened session")) {
+ response = message;
+ latch.countDown();
+ }
+
+ if(message.contains("Received:")) {
+ payloadLatch.countDown();
+ response = message;
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/junit5-arquillian-simple-websockets/src/test/java/org/superbiz/websockets/WebSocketResourceTest.java b/examples/junit5-arquillian-simple-websockets/src/test/java/org/superbiz/websockets/WebSocketResourceTest.java
new file mode 100644
index 0000000..d5fa348
--- /dev/null
+++ b/examples/junit5-arquillian-simple-websockets/src/test/java/org/superbiz/websockets/WebSocketResourceTest.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.superbiz.websockets;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit5.ArquillianExtension;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+import javax.websocket.*;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.concurrent.TimeUnit;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+@RunAsClient
+@ExtendWith(ArquillianExtension.class)
+public class WebSocketResourceTest {
+
+ @ArquillianResource()
+ private URL base;
+
+ @Deployment(testable = false)
+ public static WebArchive app() {
+ return ShrinkWrap.create(WebArchive.class, "demo.war")
+ .addClasses(WebSocketResource.class)
+ .addAsWebInfResource(new File("src/main/webapp/WEB-INF/web.xml"), "web.xml")
+ .addAsWebInfResource(new File("src/main/resources/META-INF/beans.xml"), "beans.xml");
+ }
+
+ @Test
+ public void testConnectAndReceiveMessage() throws Exception {
+ Session session = connectToServer(MyWebSocketClientObject.class);
+ assertNotNull(session);
+
+ assertTrue(MyWebSocketClientObject.latch.await(2, TimeUnit.SECONDS));
+ assertEquals("Successfully opened session", MyWebSocketClientObject.response);
+
+ session.close();
+ }
+
+ @Test
+ public void testConnectAndSendPayload() throws Exception {
+
+ String payload = "I am the payload sent to this resource.";
+
+ Session session = connectToServer(MyWebSocketClientObject.class);
+ assertNotNull(session);
+
+ assertTrue(MyWebSocketClientObject.latch.await(2, TimeUnit.SECONDS));
+ assertEquals("Successfully opened session", MyWebSocketClientObject.response);
+
+ session.getBasicRemote().sendText(payload);
+
+ assertTrue(MyWebSocketClientObject.payloadLatch.await(2, TimeUnit.SECONDS));
+ assertEquals("Received: " + payload, MyWebSocketClientObject.response);
+
+ session.close();
+ }
+
+ /**
+ * Method used to supply connection to the server by passing the naming of
+ * the websocket endpoint
+ */
+ public Session connectToServer(Class<?> endpoint) throws DeploymentException, IOException, URISyntaxException {
+ WebSocketContainer container = ContainerProvider.getWebSocketContainer();
+ assertNotNull(container);
+ return container.connectToServer(endpoint, new URI("ws", base.getUserInfo(), base.getHost(), base.getPort(),base.getPath() + "api/socket",null, null));
+ }
+
+}
diff --git a/examples/junit5-arquillian-simple-websockets/src/test/java/resources/arquillian.xml b/examples/junit5-arquillian-simple-websockets/src/test/java/resources/arquillian.xml
new file mode 100644
index 0000000..7f0b9d9
--- /dev/null
+++ b/examples/junit5-arquillian-simple-websockets/src/test/java/resources/arquillian.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<arquillian xmlns="http://jboss.org/schema/arquillian"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://jboss.org/schema/arquillian
+ http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+ <container qualifier="tomee" default="true">
+ <configuration>
+ <property name="httpPort">-1</property>
+ <property name="stopPort">-1</property>
+ <property name="ajpPort">-1</property>
+ <property name="classifier">webprofile</property>
+ <property name="dir">target/apache-tomee</property>
+ <property name="appWorkingDir">target/arquillian-test-working-dir</property>
+ </configuration>
+ </container>
+
+</arquillian>
\ No newline at end of file
diff --git a/examples/pom.xml b/examples/pom.xml
index 46b75e0..de8267c 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -97,6 +97,8 @@
<module>jsf-managedBean-and-ejb</module>
<module>jsf-cdi-and-ejb</module>
<module>junit5-application-composer</module>
+ <module>junit5-arquillian-multiple-tomee</module>
+ <module>junit5-arquillian-simple-websockets</module>
<module>lookup-of-ejbs</module>
<module>lookup-of-ejbs-with-descriptor</module>
<!-- Does not work with Java 9+ because of the modules. Needs more work