Setup and Configuration

## 4 Setup and Configuration

Note | The Jakarta EE Specification process provides for any number of compatible implementations. As additional implementations become available, refer to project or product documentation from those vendors for specific TCK setup and operational guidance.

This chapter describes how to set up the WebSocket TCK and JavaTest harness software. Before proceeding with the instructions in this chapter, be sure to install all required software, as described in Chapter 3, "Installation."

After completing the instructions in this chapter, proceed to Chapter 5, "Executing Tests," for instructions on running the WebSocket TCK.

Note | The WebSocket TCK is not depended on any particular build tool to run the tests. It will be convenient and advisable to create a Apache Maven project to setup and run the TCK. This chapter will henceforth use instructions and steps to provide setup with Apache Maven as a build tool.

### 4.1 Configuring Your Environment to Run the TCK Against the Compatible Implementation

After configuring your environment as described in this section, continue with the instructions in Chapter 5, "Executing Tests."

Note | In these instructions, variables in angle brackets need to be expanded for each platform. For example, `<JAVA_HOME>` becomes `$JAVA_HOME` on Solaris/Linux and `%JAVA_HOME%` on Windows. In addition, the forward slashes (`/`) used in all of the examples need to be replaced with backslashes (`\`) for Windows. Finally, be sure to use the appropriate separator for your operating system when specifying multiple path entries (`;` on Windows, `:` on UNIX/Linux). On Windows, you must escape any backslashes with an extra backslash in path separators used in any of the following properties, or use forward slashes as a path separator instead.

1. Set the following environment variables in your shell environment:

   1. `JAVA_HOME` to the directory in which Java SE 17+ is installed

   2. `M2_HOME` to the directory in which the Apache Maven build tool is installed.

   3. `WEBSOCKET_HOME` to the directory in which the WebSocket 2.2 CI has been installed

   4. `PATH` to include the following directories: `JAVA_HOME/bin`, and `M2_HOME/bin`

2. Set the following System properties:

   1. Set the `webServerHost` property to the name of the host on which Jakarta EE 11.0.0 CI is running.
      The default setting is `localhost`.

   2. Set the `webServerPort` property to the port number of the host on which Jakarta EE 11.0.0 CI is running.
      The default setting is `8080`.

   3. Set the `web.home` property to the installation directory of Jakarta EE 11.0.0 CI.

   4. Set the `porting.ts.url.class.1` property to your porting implementation class that is used for obtaining URLs.
      The default setting for this property is `com.sun.ts.tests.websocket.lib.implementation.sun.common.SunRIURL`.

3. Set the below jars to the classpath

   1. JAR file for the WebSocket 2.2 API.
      eg. `${web.home}/modules/jakarta.websocket-api.jar`.

   2. Arquillian JAR arquillian-junit5-container Maven cordinates :

                <dependency>
                      <groupId>org.jboss.arquillian.junit5</groupId>
                      <artifactId>arquillian-junit5-container</artifactId>
                      <version>1.7.0.Alpha10</version>
                </dependency>

   3. JUnit 5 jars (5.7.2+) Maven cordinates :

                 <dependency>
                    <groupId>org.junit</groupId>
                    <artifactId>junit-bom</artifactId>
                    <version>5.7.2</version>
                    <type>pom</type>
                    <scope>import</scope>
                 </dependency>

   4. sigtest-maven-plugin (1.4) to run the signature tests. Maven cordinates :

                <dependency>
                      <groupId>org.netbeans.tools</groupId>
                      <artifactId>sigtest-maven-plugin</artifactId>
                      <version>1.4</version>
                  </dependency>

   5. Eclipse Tyrus 2.2 CI jars
      For eg, if you are using the Eclipse Tyrus 2.2 CI below jars need to be added to Classpath

       ${web.home}/modules/jakarta.websocket-api.jar
       ${web.home}/modules/jakarta.websocket-client-api.jar
       ${web.home}/modules/jakarta.servlet-api.jar
       ${web.home}/modules/jakarta.enterprise.cdi-api.jar
       ${web.home}/modules/tyrus-websocket-core.jar
       ${web.home}/modules/tyrus-client.jar
       ${web.home}/modules/tyrus-core.jar
       ${web.home}/modules/tyrus-container-grizzly.jar
       ${web.home}/modules/glassfish-grizzly-extra-all.jar
       ${web.home}/modules/nucleus-grizzly-all.jar
       ${web.home}/modules/tyrus-server.jar
       ${web.home}/modules/tyrus-container-servlet.jar
       ${web.home}/modules/tyrus-container-grizzly-client.jar
       ${web.home}/modules/tyrus-spi.jar

4. Provide compatible implementation of the porting package interface provided with the WebSocket TCK.
   The porting package interface, `TSURLInterface.java`, obtains URL strings for web resources in an implementation-specific manner. API documentation for the `TSURLInterface.java` porting package interface is available in the WebSocket TCK documentation bundle.

### 4.2 Configuring Your Environment to Repackage and Run the TCK Against the Vendor Implementation

After configuring your environment as described in this section, continue with the instructions in Chapter 5, "Executing Tests."

Note | In these instructions, variables in angle brackets need to be expanded for each platform. For example, `<JAVA_HOME>` becomes `$JAVA_HOME` on Solaris/Linux and `%JAVA_HOME%` on Windows. In addition, the forward slashes (`/`) used in all of the examples need to be replaced with backslashes (`\`) for Windows. Finally, be sure to use the appropriate separator for your operating system when specifying multiple path entries (`;` on Windows, `:` on UNIX/Linux). On Windows, you must escape any backslashes with an extra backslash in path separators used in any of the following properties, or use forward slashes as a path separator instead.

#### Before You Begin

Decide against which WebSocket implementation the tests will be run and determine to which Servlet–compliant Web server the WebSocket TCK applications will be published.

1. Set the following environment variables in your shell environment:

   1. `JAVA_HOME` to the directory in which Java SE 17+ is installed

   2. `M2_HOME` to the directory in which the Apache Maven build tool is installed.

   3. `WEBSOCKET_HOME` to the directory in which the WebSocket 2.2 CI has been installed

   4. `PATH` to include the following directories: `JAVA_HOME/bin`, and `M2_HOME/bin`

2. Set the following System properties:

   1. Set the `webServerHost` property to the name of the host on which Jakarta EE 11.0.0 CI is running.
      The default setting is `localhost`.

   2. Set the `webServerPort` property to the port number of the host on which Jakarta EE 11.0.0 CI is running.
      The default setting is `8080`.

   3. Set the `web.home` property to the installation directory of Jakarta EE 11.0.0 CI.

   4. Set the `porting.ts.url.class.1` property to your porting implementation class that is used for obtaining URLs.
      The default setting for this property is `com.sun.ts.lib.implementation.sun.common.SunRIURL`.

3. Set the below jars to the classpath

   1. JAR file for the WebSocket 2.2 API.
      eg. `${web.home}/modules/jakarta.websocket-api.jar`.

   2. Arquillian JAR arquillian-junit5-container Maven cordinates :

                <dependency>
                      <groupId>org.jboss.arquillian.junit5</groupId>
                      <artifactId>arquillian-junit5-container</artifactId>
                      <version>1.7.0.Alpha10</version>
                </dependency>

   3. JUnit 5 jars (5.7.2+) Maven cordinates :

                 <dependency>
                    <groupId>org.junit</groupId>
                    <artifactId>junit-bom</artifactId>
                    <version>5.7.2</version>
                    <type>pom</type>
                    <scope>import</scope>
                 </dependency>

   4. Eclipse Tyrus 2.2 CI jars
      For eg, if you are using the Eclipse Tyrus 2.2 CI below jars need to be added to Classpath

       ${web.home}/modules/jakarta.websocket-api.jar
       ${web.home}/modules/jakarta.websocket-client-api.jar
       ${web.home}/modules/jakarta.servlet-api.jar
       ${web.home}/modules/jakarta.enterprise.cdi-api.jar
       ${web.home}/modules/tyrus-websocket-core.jar
       ${web.home}/modules/tyrus-client.jar
       ${web.home}/modules/tyrus-core.jar
       ${web.home}/modules/tyrus-container-grizzly.jar
       ${web.home}/modules/glassfish-grizzly-extra-all.jar
       ${web.home}/modules/nucleus-grizzly-all.jar
       ${web.home}/modules/tyrus-server.jar
       ${web.home}/modules/tyrus-container-servlet.jar
       ${web.home}/modules/tyrus-container-grizzly-client.jar
       ${web.home}/modules/tyrus-spi.jar

4. Provide compatible implementation of the porting package interface provided with the WebSocket TCK.
   The porting package interface, `TSURLInterface.java`, obtains URL strings for web resources in an implementation-specific manner. API documentation for the `TSURLInterface.java` porting package interface is available in the WebSocket TCK documentation bundle.

### 4.3 Deploying the Java API for WebSocket TCK Tests

The WebSocket TCK provides an automatic way of deploying both archives to the configured web container or containers by using arquillian Shrinkwrap API before the tests are run.

Copyright © 2017, 2021 Oracle and/or its affiliates. All rights reserved.