diff --git a/glassfish-runner/pom.xml b/glassfish-runner/pom.xml
index 55de0bb38b..a957c37e21 100644
--- a/glassfish-runner/pom.xml
+++ b/glassfish-runner/pom.xml
@@ -31,10 +31,10 @@
3.1.0
jakarta-restful-ws-tck
- 7.0.0-M8
+ 7.0.2
glassfish7
- 5.7.2
+ 5.9.1
diff --git a/glassfish-runner/websocket-platform-tck/j2ee.pass b/glassfish-runner/websocket-platform-tck/j2ee.pass
new file mode 100644
index 0000000000..8859170690
--- /dev/null
+++ b/glassfish-runner/websocket-platform-tck/j2ee.pass
@@ -0,0 +1,17 @@
+
+#
+# Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v. 2.0, which is available at
+# http://www.eclipse.org/legal/epl-2.0.
+#
+# This Source Code may also be made available under the following Secondary
+# Licenses when the conditions for such availability set forth in the
+# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+# version 2 with the GNU Classpath Exception, which is available at
+# https://www.gnu.org/software/classpath/license.html.
+#
+# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+#
+AS_ADMIN_USERPASSWORD=j2ee
\ No newline at end of file
diff --git a/glassfish-runner/websocket-platform-tck/javajoe.pass b/glassfish-runner/websocket-platform-tck/javajoe.pass
new file mode 100644
index 0000000000..d69a7520e5
--- /dev/null
+++ b/glassfish-runner/websocket-platform-tck/javajoe.pass
@@ -0,0 +1,16 @@
+#
+# Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v. 2.0, which is available at
+# http://www.eclipse.org/legal/epl-2.0.
+#
+# This Source Code may also be made available under the following Secondary
+# Licenses when the conditions for such availability set forth in the
+# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+# version 2 with the GNU Classpath Exception, which is available at
+# https://www.gnu.org/software/classpath/license.html.
+#
+# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+#
+AS_ADMIN_USERPASSWORD=javajoe
diff --git a/glassfish-runner/websocket-platform-tck/pom.xml b/glassfish-runner/websocket-platform-tck/pom.xml
new file mode 100644
index 0000000000..13e9429065
--- /dev/null
+++ b/glassfish-runner/websocket-platform-tck/pom.xml
@@ -0,0 +1,358 @@
+
+
+ jakarta
+ glassfish.websocket-platform-tck
+ 10.0.0-SNAPSHOT
+ jar
+ 4.0.0
+
+
+ org.glassfish
+ standalone-tck
+ 10.0.0
+ ../pom.xml
+
+
+
+ jakarta.websocket-platform-tck
+ 2.1.0
+
+
+
+
+
+ org.junit
+ junit-bom
+ ${junit.jupiter.version}
+ pom
+ import
+
+
+
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter
+ ${junit.jupiter.version}
+
+
+ jakartatck
+ common
+ ${project.version}
+
+
+ jakartatck
+ libutil
+ ${project.version}
+
+
+ jakartatck
+ runtime
+ ${project.version}
+
+
+ org.jboss.arquillian.container
+ arquillian-glassfish-managed-6
+ 1.0.0.Alpha1
+
+
+ org.glassfish.hk2
+ hk2-locator
+
+
+
+
+ jakartatck
+ websocket-tck
+ 10.0.0-SNAPSHOT
+
+
+ org.glassfish.main.common
+ simple-glassfish-api
+ ${glassfish.container.version}
+
+
+ org.jboss.arquillian.junit5
+ arquillian-junit5-container
+ 1.7.0.Alpha14
+
+
+ org.jboss.arquillian.junit5
+ arquillian-junit5-core
+ 1.7.0.Alpha14
+
+
+ org.glassfish.hk2
+ hk2-locator
+ 3.0.3
+
+
+
+
+
+ full
+
+ true
+
+
+ glassfish
+
+
+
+ web
+
+ web
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 3.2.0
+
+
+ unpack
+ pre-integration-test
+
+ unpack
+
+
+
+
+ org.glassfish.main.distributions
+ ${glassfish-artifact-id}
+ ${glassfish.container.version}
+ zip
+ true
+ ${project.build.directory}
+
+
+
+
+
+
+
+ exec-maven-plugin
+ org.codehaus.mojo
+
+
+ StopDomain1
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ stop-domain
+
+
+
+
+ StartDomain1
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ start-domain
+
+
+
+
+ Enable Trace requests
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ set
+ server-config.network-config.protocols.protocol.http-listener-1.http.trace-enabled=true
+
+
+
+
+ Delete User j2ee
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ --passwordfile
+ ${project.basedir}/j2ee.pass
+ delete-file-user
+ j2ee
+
+
+ 0
+ 1
+
+
+
+
+ Add User j2ee
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ --passwordfile
+ ${project.basedir}/j2ee.pass
+ create-file-user
+ --groups
+ staff:mgr
+ j2ee
+
+
+
+
+ Delete User javajoe
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ --passwordfile
+ ${project.basedir}/javajoe.pass
+ delete-file-user
+ javajoe
+
+
+ 0
+ 1
+
+
+
+
+ Add User javajoe
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ --passwordfile
+ ${project.basedir}/javajoe.pass
+ create-file-user
+ --groups
+ guest
+ javajoe
+
+
+
+
+ list users
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ list-file-users
+
+
+
+
+ StopDomain
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ stop-domain
+
+
+
+
+
+
+ maven-failsafe-plugin
+ 3.0.0-M5
+
+
+ gf-tests
+
+ integration-test
+ verify
+
+
+
+ **/platform/**
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/jakarta.websocket-api.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/jakarta.websocket-client-api.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/jakarta.servlet-api.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/jakarta.enterprise.cdi-api.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-websocket-core.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-client.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-core.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-container-grizzly.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/glassfish-grizzly-extra-all.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/nucleus-grizzly-all.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-server.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-container-servlet.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-container-grizzly-client.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-spi.jar
+
+ jakartatck:websocket-tck
+
+ ${project.build.directory}/${glassfish.toplevel.dir}
+ localhost
+ 8080
+ 8181
+ 5
+ websockettck
+ true
+ j2ee
+ j2ee
+ javajoe
+ javajoe
+ com.sun.ts.tests.websocket.lib.implementation.sun.common.SunRIURL
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}
+
+
+
+
+
+
+
+
diff --git a/glassfish-runner/websocket-tck/j2ee.pass b/glassfish-runner/websocket-tck/j2ee.pass
new file mode 100644
index 0000000000..8859170690
--- /dev/null
+++ b/glassfish-runner/websocket-tck/j2ee.pass
@@ -0,0 +1,17 @@
+
+#
+# Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v. 2.0, which is available at
+# http://www.eclipse.org/legal/epl-2.0.
+#
+# This Source Code may also be made available under the following Secondary
+# Licenses when the conditions for such availability set forth in the
+# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+# version 2 with the GNU Classpath Exception, which is available at
+# https://www.gnu.org/software/classpath/license.html.
+#
+# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+#
+AS_ADMIN_USERPASSWORD=j2ee
\ No newline at end of file
diff --git a/glassfish-runner/websocket-tck/javajoe.pass b/glassfish-runner/websocket-tck/javajoe.pass
new file mode 100644
index 0000000000..d69a7520e5
--- /dev/null
+++ b/glassfish-runner/websocket-tck/javajoe.pass
@@ -0,0 +1,16 @@
+#
+# Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v. 2.0, which is available at
+# http://www.eclipse.org/legal/epl-2.0.
+#
+# This Source Code may also be made available under the following Secondary
+# Licenses when the conditions for such availability set forth in the
+# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+# version 2 with the GNU Classpath Exception, which is available at
+# https://www.gnu.org/software/classpath/license.html.
+#
+# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+#
+AS_ADMIN_USERPASSWORD=javajoe
diff --git a/glassfish-runner/websocket-tck/pom.xml b/glassfish-runner/websocket-tck/pom.xml
new file mode 100644
index 0000000000..d748752cea
--- /dev/null
+++ b/glassfish-runner/websocket-tck/pom.xml
@@ -0,0 +1,358 @@
+
+
+ jakarta
+ glassfish.websocket-tck
+ 10.0.0-SNAPSHOT
+ jar
+ 4.0.0
+
+
+ org.glassfish
+ standalone-tck
+ 10.0.0
+ ../pom.xml
+
+
+
+ jakarta.websocket-tck
+ 2.1.0
+
+
+
+
+
+ org.junit
+ junit-bom
+ ${junit.jupiter.version}
+ pom
+ import
+
+
+
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter
+ ${junit.jupiter.version}
+
+
+ jakartatck
+ common
+ ${project.version}
+
+
+ jakartatck
+ libutil
+ ${project.version}
+
+
+ jakartatck
+ runtime
+ ${project.version}
+
+
+ org.jboss.arquillian.container
+ arquillian-glassfish-managed-6
+ 1.0.0.Alpha1
+
+
+ org.glassfish.hk2
+ hk2-locator
+
+
+
+
+ jakartatck
+ websocket-tck
+ 10.0.0-SNAPSHOT
+
+
+ org.glassfish.main.common
+ simple-glassfish-api
+ ${glassfish.container.version}
+
+
+ org.jboss.arquillian.junit5
+ arquillian-junit5-container
+ 1.7.0.Alpha14
+
+
+ org.jboss.arquillian.junit5
+ arquillian-junit5-core
+ 1.7.0.Alpha14
+
+
+ org.glassfish.hk2
+ hk2-locator
+ 3.0.3
+
+
+
+
+
+ full
+
+ true
+
+
+ glassfish
+
+
+
+ web
+
+ web
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 3.2.0
+
+
+ unpack
+ pre-integration-test
+
+ unpack
+
+
+
+
+ org.glassfish.main.distributions
+ ${glassfish-artifact-id}
+ ${glassfish.container.version}
+ zip
+ true
+ ${project.build.directory}
+
+
+
+
+
+
+
+ exec-maven-plugin
+ org.codehaus.mojo
+
+
+ StopDomain1
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ stop-domain
+
+
+
+
+ StartDomain1
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ start-domain
+
+
+
+
+ Enable Trace requests
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ set
+ server-config.network-config.protocols.protocol.http-listener-1.http.trace-enabled=true
+
+
+
+
+ Delete User j2ee
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ --passwordfile
+ ${project.basedir}/j2ee.pass
+ delete-file-user
+ j2ee
+
+
+ 0
+ 1
+
+
+
+
+ Add User j2ee
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ --passwordfile
+ ${project.basedir}/j2ee.pass
+ create-file-user
+ --groups
+ staff:mgr
+ j2ee
+
+
+
+
+ Delete User javajoe
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ --passwordfile
+ ${project.basedir}/javajoe.pass
+ delete-file-user
+ javajoe
+
+
+ 0
+ 1
+
+
+
+
+ Add User javajoe
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ --passwordfile
+ ${project.basedir}/javajoe.pass
+ create-file-user
+ --groups
+ guest
+ javajoe
+
+
+
+
+ list users
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ list-file-users
+
+
+
+
+ StopDomain
+ pre-integration-test
+
+ exec
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/bin/asadmin
+
+ stop-domain
+
+
+
+
+
+
+ maven-failsafe-plugin
+ 3.0.0-M5
+
+
+ gf-tests
+
+ integration-test
+ verify
+
+
+
+ **/platform/**
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/jakarta.websocket-api.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/jakarta.websocket-client-api.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/jakarta.servlet-api.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/jakarta.enterprise.cdi-api.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-websocket-core.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-client.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-core.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-container-grizzly.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/glassfish-grizzly-extra-all.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/nucleus-grizzly-all.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-server.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-container-servlet.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-container-grizzly-client.jar
+ ${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/tyrus-spi.jar
+
+ jakartatck:websocket-tck
+
+ ${project.build.directory}/${glassfish.toplevel.dir}
+ localhost
+ 8080
+ 8181
+ 5
+ websockettck
+ true
+ j2ee
+ j2ee
+ javajoe
+ javajoe
+ com.sun.ts.tests.websocket.lib.implementation.sun.common.SunRIURL
+
+
+ ${project.build.directory}/${glassfish.toplevel.dir}
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 21ad1f3f47..aa9dfbbf24 100644
--- a/pom.xml
+++ b/pom.xml
@@ -116,7 +116,6 @@
jacc
javaee
javamail
- jaxrs-platform-tck
jaxws-common
jaxws
jdbc
diff --git a/websocket/pom.xml b/websocket/pom.xml
index fbb5a85857..56a92589ff 100644
--- a/websocket/pom.xml
+++ b/websocket/pom.xml
@@ -1,7 +1,7 @@
- 4.0.0
+ 4.0.0
-
- jakartatck
- project
- 10.0.0-SNAPSHOT
-
+
+ jakartatck
+ project
+ 10.0.0-SNAPSHOT
+
- websocket
- jar
+ websocket-tck
+ jar
- WEBSOCKET
- WEBSOCKET
+ WEBSOCKET
+ WEBSOCKET
-
-
- ${project.groupId}
- common
-
-
- javatest
- javatest
-
-
- commons-httpclient
- commons-httpclient
-
-
- jakarta.websocket
- jakarta.websocket-api
-
-
- jakarta.websocket
- jakarta.websocket-client-api
-
-
- jakarta.servlet
- jakarta.servlet-api
-
-
- jakarta.inject
- jakarta.inject-api
+
+ ${project.version}
+ 5.9.1
+
+
+
+
+
+ commons-httpclient
+ commons-httpclient
+
+
+ jakarta.websocket
+ jakarta.websocket-api
+
+
+ jakarta.websocket
+ jakarta.websocket-client-api
+
+
+ jakarta.enterprise
+ jakarta.enterprise.cdi-api
+
+
+ jakartatck
+ libutil
+ ${project.version}
+
+
+ org.slf4j
+ slf4j-api
+ 2.0.6
+
+
+ org.junit.jupiter
+ junit-jupiter
+ ${junit.jupiter.version}
+
+
+ org.jboss.arquillian.junit5
+ arquillian-junit5-container
+ 1.7.0.Alpha14
- jakarta.enterprise
- jakarta.enterprise.cdi-api
+ org.jboss.arquillian.junit5
+ arquillian-junit5-core
+ 1.7.0.Alpha14
-
-
+
+ jakartatck
+ common
+ ${project.version}
+
+
+ jakartatck
+ runtime
+ ${project.version}
+
+
+
+
+
+ tck-build
+
+ true
+
+
+
+
+ maven-compiler-plugin
+ 2.3.2
+
+
+ maven-surefire-plugin
+ 3.0.0-M5
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.2.0
+
+
+
+ src/main/java
+
+ **/*.xml
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ attach-sources
+
+ jar
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/clientendpointconfig/WSClient.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/clientendpointconfig/WSClient.java
deleted file mode 100644
index c62a632b3b..0000000000
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/clientendpointconfig/WSClient.java
+++ /dev/null
@@ -1,1167 +0,0 @@
-/*
- * Copyright (c) 2013, 2020 Oracle and/or its affiliates and others.
- * All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-/*
- * $Id:$
- */
-package com.sun.ts.tests.websocket.api.jakarta.websocket.clientendpointconfig;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import com.sun.javatest.Status;
-import com.sun.ts.lib.harness.ServiceEETest;
-import com.sun.ts.lib.util.TestUtil;
-import com.sun.ts.tests.websocket.common.TCKExtension;
-
-import jakarta.websocket.ClientEndpointConfig;
-import jakarta.websocket.ClientEndpointConfig.Configurator;
-import jakarta.websocket.Decoder;
-import jakarta.websocket.Encoder;
-import jakarta.websocket.Extension;
-import jakarta.websocket.HandshakeResponse;
-
-public class WSClient extends ServiceEETest {
-
- public static void main(String[] args) {
- WSClient theTests = new WSClient();
- Status s = theTests.run(args, new PrintWriter(System.out),
- new PrintWriter(System.err));
- s.exit();
- }
-
- /*
- * @class.setup_props: webServerHost; webServerPort; ws_wait; ts_home;
- */
- @SuppressWarnings("unused")
- public void setup(String[] args, Properties p) throws Exception {
- }
-
- /* Run test */
- /*
- * @testName: constructortest
- *
- * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
- * WebSocket:JAVADOC:6; WebSocket:JAVADOC:7; WebSocket:JAVADOC:70;
- * WebSocket:JAVADOC:71; WebSocket:SPEC:WSC-3.2.1-1;
- * WebSocket:SPEC:WSC-3.2.2-1;
- *
- * @test_Strategy: Test constructor
- */
- public void constructortest() throws Exception {
- boolean passed = true;
-
- try {
- ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create().build();
-
- List tmp = dcc.getDecoders();
- if (tmp != null) {
- TestUtil.logTrace("getDecoders() return non-null List");
- if (!tmp.isEmpty()) {
- TestUtil.logErr("getDecoders() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- tmp = dcc.getEncoders();
- if (tmp != null) {
- TestUtil.logTrace("getEncoders() return non-null List");
- if (!tmp.isEmpty()) {
- TestUtil.logErr("getEncoders() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- tmp = dcc.getExtensions();
- if (tmp != null) {
- TestUtil.logTrace("getExtensions() return non-null List");
- if (!tmp.isEmpty()) {
- TestUtil.logErr("getExtensions() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- tmp = dcc.getPreferredSubprotocols();
- if (tmp != null) {
- TestUtil.logTrace("getPreferredSubprotocols() return non-null List");
- if (!tmp.isEmpty()) {
- TestUtil.logErr(
- "getPreferredSubprotocols() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- } catch (Exception e) {
- TestUtil.logErr(e.getMessage());
- throw new Exception(e);
- }
-
- if (passed == false) {
- throw new Exception("Test failed");
- }
- }
-
- /*
- * @testName: preferredSubprotocolsTest
- *
- * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
- * WebSocket:JAVADOC:7; WebSocket:JAVADOC:14;
- *
- * @test_Strategy:
- */
- public void preferredSubprotocolsTest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap",
- "WAMP", "v10.stomp", "v11.stomp", "v12.stomp");
- try {
- ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
- .preferredSubprotocols(expected_subprotocols).build();
-
- List tmp = dcc.getPreferredSubprotocols();
- if (tmp != null) {
- log.append("getPreferredSubprotocols() return non-null List|");
- if (!tmp.isEmpty()) {
- log.append(
- "getPreferredSubprotocols() return non-empty List with size "
- + tmp.size() + "|");
- int size_actual = tmp.size();
- if (size_actual == expected_subprotocols.size()) {
- for (String subpro : tmp) {
- if (expected_subprotocols.contains(subpro)) {
- log.append("sub protocol " + subpro + " found is expected|");
- } else {
- passed = false;
- log.append(
- "sub protocol " + subpro + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getPreferredSubprotocols() returned not exactly the same size.");
- log.append("Expecting seven, returned " + size_actual);
- }
- } else {
- log.append("getPreferredSubprotocols() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getPreferredSubprotocols() return null list");
- }
- } catch (Exception e) {
- System.err.print(e.getMessage() + log.toString());
- throw new Exception(e);
- }
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: extensionsTest
- *
- * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
- * WebSocket:JAVADOC:6; WebSocket:JAVADOC:13;
- *
- * @test_Strategy:
- */
- public void extensionsTest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- final List extension1 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
- add(new TCKExtension.TCKParameter("prop", "val"));
- }
- };
-
- final List extension2 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("prop1", "val1"));
- add(new TCKExtension.TCKParameter("prop2", "val2"));
- }
- };
-
- ArrayList extensions = new ArrayList<>();
- extensions.add(new TCKExtension("ext1", extension1));
- extensions.add(new TCKExtension("ext2", extension2));
-
- try {
- ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
- .extensions(extensions).build();
- List tmp = dcc.getExtensions();
- if (tmp != null) {
- log.append("getExtensions() return non-null List|");
- if (!tmp.isEmpty()) {
- log.append("getExtensions() return non-empty List with size "
- + tmp.size() + "|");
- int size_actual = tmp.size();
- if (size_actual == extensions.size()) {
- for (Extension ext : tmp) {
- if (extensions.contains(ext)) {
- log.append("extension " + ext + " found is expected|");
- } else {
- passed = false;
- log.append("extension " + ext + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getExtensions() returned not exactly the same amount of extensions.");
- log.append("Expecting two, returned " + size_actual);
- }
- } else {
- log.append("getExtensions() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getExtensions() return null list|");
- }
- } catch (Exception e) {
- System.err.println(e.getMessage() + log.toString());
- throw new Exception(e);
- }
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: constructorTest1
- *
- * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
- * WebSocket:JAVADOC:6; WebSocket:JAVADOC:7; WebSocket:JAVADOC:13;
- * WebSocket:JAVADOC:14;
- *
- * @test_Strategy:
- */
- public void constructorTest1() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap",
- "WAMP", "v10.stomp", "v11.stomp", "v12.stomp");
-
- final List extension1 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
- add(new TCKExtension.TCKParameter("prop", "val"));
- }
- };
-
- final List extension2 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("prop1", "val1"));
- add(new TCKExtension.TCKParameter("prop2", "val2"));
- }
- };
-
- ArrayList extensions = new ArrayList<>();
- extensions.add(new TCKExtension("ext1", extension1));
- extensions.add(new TCKExtension("ext2", extension2));
-
- try {
- ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
- .preferredSubprotocols(expected_subprotocols).extensions(extensions)
- .build();
-
- List tmpe = dcc.getExtensions();
- List tmpp = dcc.getPreferredSubprotocols();
-
- if (tmpe != null) {
- log.append("getExtensions() return non-null List|");
- if (!tmpe.isEmpty()) {
- log.append("getExtensions() return non-empty List with size "
- + tmpe.size() + "|");
- int size_actual = tmpe.size();
- if (size_actual == extensions.size()) {
- for (Extension ext : tmpe) {
- if (extensions.contains(ext)) {
- log.append("extension " + ext + " found is expected|");
- } else {
- passed = false;
- log.append("extension " + ext + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getExtensions() returned not exactly the same amount of extensions.");
- log.append("Expecting two, returned " + size_actual);
- }
- } else {
- log.append("getExtensions() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getExtensions() return null list|");
- }
-
- if (tmpp != null) {
- log.append("getPreferredSubprotocols() return non-null List|");
- if (!tmpp.isEmpty()) {
- log.append(
- "getPreferredSubprotocols() return non-empty List with size "
- + tmpp.size() + "|");
- int size_actual = tmpp.size();
- if (size_actual == expected_subprotocols.size()) {
- for (String subpro : tmpp) {
- if (expected_subprotocols.contains(subpro)) {
- log.append("sub protocol " + subpro + " found is expected|");
- } else {
- passed = false;
- log.append(
- "sub protocol " + subpro + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getPreferredSubprotocols() returned not exactly the same size.");
- log.append("Expecting seven, returned " + size_actual);
- }
- } else {
- log.append("getPreferredSubprotocols() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getPreferredSubprotocols() return null list");
- }
-
- } catch (Exception e) {
- System.err.println(e.getMessage() + log.toString());
- throw new Exception(e);
- }
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: encodersTest
- *
- * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
- * WebSocket:JAVADOC:12; WebSocket:JAVADOC:71;
- *
- * @test_Strategy:
- */
- public void encodersTest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List> expected_encoders = new ArrayList<>();
- expected_encoders
- .add(com.sun.ts.tests.websocket.common.util.ErrorEncoder.class);
- expected_encoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanEncoder.class);
-
- try {
- ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
- .encoders(expected_encoders).build();
-
- List> tmp = dcc.getEncoders();
- if (tmp != null) {
- log.append("getEncoders() return non-null List");
- if (!tmp.isEmpty()) {
- int size = tmp.size();
- log.append(
- "getEncoders() return non-empty List with size " + size + "|");
- if (size == 2) {
- for (Class extends Encoder> encoder : tmp) {
- log.append("Encoder " + encoder + " found ");
- if (expected_encoders.contains(encoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getEncoders() returned not exactly the same size.");
- log.append("Expecting two, returned " + size);
- }
- } else {
- log.append("getEncoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getEncoders() return null list");
- }
- } catch (Exception e) {
- System.err.print(log.toString());
- throw new Exception(e);
- }
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: decodersTest
- *
- * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
- * WebSocket:JAVADOC:11; WebSocket:JAVADOC:70;
- *
- * @test_Strategy:
- */
- public void decodersTest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List> expected_decoders = new ArrayList<>();
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
-
- try {
- ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
- .decoders(expected_decoders).build();
-
- List> tmp = dcc.getDecoders();
- if (tmp != null) {
- log.append("getDecoders() return non-null List|");
- if (!tmp.isEmpty()) {
- int size = tmp.size();
- log.append("getDecoders() return non-empty List with size "
- + tmp.size() + "|");
- if (size == 2) {
- for (Class extends Decoder> decoder : tmp) {
- log.append("Decoder " + decoder + " found ");
- if (expected_decoders.contains(decoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getDecoders() returned not exactly the same size.");
- log.append("Expecting two, returned " + size);
- }
- } else {
- log.append("getDecoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getDecoders() return null list|");
- }
-
- } catch (Exception e) {
- System.err.println(e.getMessage() + log.toString());
- throw new Exception(e);
- }
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: constructorTest2
- *
- * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
- * WebSocket:JAVADOC:6; WebSocket:JAVADOC:7; WebSocket:JAVADOC:13;
- * WebSocket:JAVADOC:14; WebSocket:JAVADOC:11; WebSocket:JAVADOC:70;
- *
- * @test_Strategy:
- */
- public void constructorTest2() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap",
- "WAMP", "v10.stomp", "v11.stomp", "v12.stomp");
-
- List> expected_decoders = new ArrayList<>();
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
-
- final List extension1 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
- add(new TCKExtension.TCKParameter("prop", "val"));
- }
- };
-
- final List extension2 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("prop1", "val1"));
- add(new TCKExtension.TCKParameter("prop2", "val2"));
- }
- };
-
- ArrayList extensions = new ArrayList<>();
- extensions.add(new TCKExtension("ext1", extension1));
- extensions.add(new TCKExtension("ext2", extension2));
-
- try {
- ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
- .preferredSubprotocols(expected_subprotocols).extensions(extensions)
- .decoders(expected_decoders).build();
-
- List tmpe = dcc.getExtensions();
- List tmpp = dcc.getPreferredSubprotocols();
- List> tmpd = dcc.getDecoders();
-
- if (tmpe != null) {
- log.append("getExtensions() return non-null List|");
- if (!tmpe.isEmpty()) {
- log.append("getExtensions() return non-empty List with size "
- + tmpe.size() + "|");
- int size_actual = tmpe.size();
- if (size_actual == extensions.size()) {
- for (Extension ext : tmpe) {
- if (extensions.contains(ext)) {
- log.append("extension " + ext + " found is expected|");
- } else {
- passed = false;
- log.append("extension " + ext + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getExtensions() returned not exactly the same amount of extensions.");
- log.append("Expecting two, returned " + size_actual);
- }
- } else {
- log.append("getExtensions() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getExtensions() return null list|");
- }
-
- if (tmpp != null) {
- log.append("getPreferredSubprotocols() return non-null List|");
- if (!tmpp.isEmpty()) {
- log.append(
- "getPreferredSubprotocols() return non-empty List with size "
- + tmpp.size() + "|");
- int size_actual = tmpp.size();
- if (size_actual == expected_subprotocols.size()) {
- for (String subpro : tmpp) {
- if (expected_subprotocols.contains(subpro)) {
- log.append("sub protocol " + subpro + " found is expected|");
- } else {
- passed = false;
- log.append(
- "sub protocol " + subpro + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getPreferredSubprotocols() returned not exactly the same size.");
- log.append("Expecting seven, returned " + size_actual);
- }
- } else {
- log.append("getPreferredSubprotocols() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getPreferredSubprotocols() return null list");
- }
-
- if (tmpd != null) {
- log.append("getDecoders() return non-null List|");
- if (!tmpd.isEmpty()) {
- int size = tmpd.size();
- log.append("getDecoders() return non-empty List with size "
- + tmpd.size() + "|");
- if (size == 2) {
- for (Class extends Decoder> decoder : tmpd) {
- log.append("Decoder " + decoder + " found ");
- if (expected_decoders.contains(decoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getDecoders() returned not exactly the same size.");
- log.append("Expecting seven, returned " + size);
- }
- } else {
- log.append("getDecoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getDecoders() return null list|");
- }
- } catch (Exception e) {
- System.err.println(e.getMessage() + log.toString());
- throw new Exception(e);
- }
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: constructorTest3
- *
- * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
- * WebSocket:JAVADOC:6; WebSocket:JAVADOC:7; WebSocket:JAVADOC:13;
- * WebSocket:JAVADOC:14; WebSocket:JAVADOC:11; WebSocket:JAVADOC:12;
- * WebSocket:JAVADOC:70; WebSocket:JAVADOC:71;
- *
- * @test_Strategy:
- */
- public void constructorTest3() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap",
- "WAMP", "v10.stomp", "v11.stomp", "v12.stomp");
-
- List> expected_encoders = new ArrayList<>();
- expected_encoders
- .add(com.sun.ts.tests.websocket.common.util.ErrorEncoder.class);
- expected_encoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanEncoder.class);
-
- List> expected_decoders = new ArrayList<>();
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
-
- final List extension1 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
- add(new TCKExtension.TCKParameter("prop", "val"));
- }
- };
-
- final List extension2 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("prop1", "val1"));
- add(new TCKExtension.TCKParameter("prop2", "val2"));
- }
- };
-
- ArrayList extensions = new ArrayList<>();
- extensions.add(new TCKExtension("ext1", extension1));
- extensions.add(new TCKExtension("ext2", extension2));
-
- try {
- ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
- .preferredSubprotocols(expected_subprotocols).extensions(extensions)
- .decoders(expected_decoders).encoders(expected_encoders).build();
-
- List tmpe = dcc.getExtensions();
- List tmpp = dcc.getPreferredSubprotocols();
- List> tmpd = dcc.getDecoders();
-
- if (tmpe != null) {
- log.append("getExtensions() return non-null List|");
- if (!tmpe.isEmpty()) {
- log.append("getExtensions() return non-empty List with size "
- + tmpe.size() + "|");
- int size_actual = tmpe.size();
- if (size_actual == extensions.size()) {
- for (Extension ext : tmpe) {
- if (extensions.contains(ext)) {
- log.append("extension " + ext + " found is expected|");
- } else {
- passed = false;
- log.append("extension " + ext + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getExtensions() returned not exactly the same amount of extensions.");
- log.append("Expecting two, returned " + size_actual);
- }
- } else {
- log.append("getExtensions() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getExtensions() return null list|");
- }
-
- if (tmpp != null) {
- log.append("getPreferredSubprotocols() return non-null List|");
- if (!tmpp.isEmpty()) {
- log.append(
- "getPreferredSubprotocols() return non-empty List with size "
- + tmpp.size() + "|");
- int size_actual = tmpp.size();
- if (size_actual == expected_subprotocols.size()) {
- for (String subpro : tmpp) {
- if (expected_subprotocols.contains(subpro)) {
- log.append("sub protocol " + subpro + " found is expected|");
- } else {
- passed = false;
- log.append(
- "sub protocol " + subpro + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getPreferredSubprotocols() returned not exactly the same size.");
- log.append("Expecting seven, returned " + size_actual);
- }
- } else {
- log.append("getPreferredSubprotocols() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getPreferredSubprotocols() return null list");
- }
-
- if (tmpd != null) {
- log.append("getDecoders() return non-null List|");
- if (!tmpd.isEmpty()) {
- int size = tmpd.size();
- log.append("getDecoders() return non-empty List with size "
- + tmpd.size() + "|");
- if (size == 2) {
- for (Class extends Decoder> decoder : tmpd) {
- log.append("Decoder " + decoder + " found ");
- if (expected_decoders.contains(decoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getDecoders() returned not exactly the same size.");
- log.append("Expecting two, returned " + size);
- }
- } else {
- log.append("getDecoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getDecoders() return null list|");
- }
-
- List> tmpen = dcc.getEncoders();
- if (tmpen != null) {
- log.append("getEncoders() return non-null List");
- if (!tmpen.isEmpty()) {
- int size = tmpen.size();
- log.append(
- "getEncoders() return non-empty List with size " + size + "|");
- if (size == 2) {
- for (Class extends Encoder> encoder : tmpen) {
- log.append("Encoder " + encoder + " found ");
- if (expected_encoders.contains(encoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getEncoders() returned not exactly the same size.");
- log.append("Expecting two, returned " + size);
- }
- } else {
- log.append("getEncoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getEncoders() return null list");
- }
- } catch (Exception e) {
- System.err.println(e.getMessage() + log.toString());
- throw new Exception(e);
- }
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: configuratorTest
- *
- * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
- * WebSocket:JAVADOC:5; WebSocket:JAVADOC:9;
- *
- * @test_Strategy:
- */
- public void configuratorTest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- Configurator config = new TCKConfigurator();
-
- try {
- ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
- .configurator(config).build();
-
- Configurator tmpc = dcc.getConfigurator();
-
- if (!tmpc.getClass().equals(
- com.sun.ts.tests.websocket.api.jakarta.websocket.clientendpointconfig.TCKConfigurator.class)) {
- TestUtil.logErr("getConfigurator() returned a different Configurator: "
- + tmpc.getClass().getName());
- passed = false;
- }
-
- } catch (Exception e) {
- System.err.print(log.toString());
- throw new Exception(e);
- }
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: constructorTest4
- *
- * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
- * WebSocket:JAVADOC:5; WebSocket:JAVADOC:9; WebSocket:JAVADOC:6;
- * WebSocket:JAVADOC:7; WebSocket:JAVADOC:70; WebSocket:JAVADOC:71;
- *
- * @test_Strategy:
- */
- public void constructorTest4() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- Configurator config = new TCKConfigurator();
-
- try {
- ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
- .configurator(config).build();
- List tmp = dcc.getDecoders();
- if (tmp != null) {
- TestUtil.logTrace("getDecoders() return non-null List");
- if (!tmp.isEmpty()) {
- TestUtil.logErr("getDecoders() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- tmp = dcc.getEncoders();
- if (tmp != null) {
- TestUtil.logTrace("getEncoders() return non-null List");
- if (!tmp.isEmpty()) {
- TestUtil.logErr("getEncoders() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- tmp = dcc.getExtensions();
- if (tmp != null) {
- TestUtil.logTrace("getExtensions() return non-null List");
- if (!tmp.isEmpty()) {
- TestUtil.logErr("getExtensions() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- tmp = dcc.getPreferredSubprotocols();
- if (tmp != null) {
- TestUtil.logTrace("getPreferredSubprotocols() return non-null List");
- if (!tmp.isEmpty()) {
- TestUtil.logErr(
- "getPreferredSubprotocols() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- } catch (Exception e) {
- System.err.print(log.toString());
- throw new Exception(e);
- }
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: constructorTest5
- *
- * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
- * WebSocket:JAVADOC:6; WebSocket:JAVADOC:7; WebSocket:JAVADOC:5;
- * WebSocket:JAVADOC:9; WebSocket:JAVADOC:13; WebSocket:JAVADOC:14;
- * WebSocket:JAVADOC:11; WebSocket:JAVADOC:12; WebSocket:JAVADOC:70;
- * WebSocket:JAVADOC:71;
- *
- * @test_Strategy:
- */
- public void constructorTest5() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List expected_subprotocols = Arrays.asList("JSON", "XML", "XMPP",
- "Hessian", "Quake", "PUB/SUB", "Query");
-
- List> expected_encoders = new ArrayList<>();
- expected_encoders
- .add(com.sun.ts.tests.websocket.common.util.ErrorEncoder.class);
- expected_encoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanEncoder.class);
-
- List> expected_decoders = new ArrayList<>();
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
-
- Configurator config = new TCKConfigurator();
-
- final List extension1 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
- add(new TCKExtension.TCKParameter("prop", "val"));
- }
- };
-
- final List extension2 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("prop1", "val1"));
- add(new TCKExtension.TCKParameter("prop2", "val2"));
- }
- };
-
- ArrayList extensions = new ArrayList<>();
- extensions.add(new TCKExtension("ext1", extension1));
- extensions.add(new TCKExtension("ext2", extension2));
-
- try {
- ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
- .preferredSubprotocols(expected_subprotocols).extensions(extensions)
- .decoders(expected_decoders).encoders(expected_encoders)
- .configurator(config).build();
-
- List tmpe = dcc.getExtensions();
- List tmpp = dcc.getPreferredSubprotocols();
- List> tmpd = dcc.getDecoders();
-
- if (tmpe != null) {
- log.append("getExtensions() return non-null List|");
- if (!tmpe.isEmpty()) {
- log.append("getExtensions() return non-empty List with size "
- + tmpe.size() + "|");
- int size_actual = tmpe.size();
- if (size_actual == extensions.size()) {
- for (Extension ext : tmpe) {
- if (extensions.contains(ext)) {
- log.append("extension " + ext + " found is expected|");
- } else {
- passed = false;
- log.append("extension " + ext + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getExtensions() returned not exactly the same amount of extensions.");
- log.append("Expecting two, returned " + size_actual);
- }
- } else {
- log.append("getExtensions() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getExtensions() return null list|");
- }
-
- if (tmpp != null) {
- log.append("getPreferredSubprotocols() return non-null List|");
- if (!tmpp.isEmpty()) {
- log.append(
- "getPreferredSubprotocols() return non-empty List with size "
- + tmpp.size() + "|");
- int size_actual = tmpp.size();
- if (size_actual == expected_subprotocols.size()) {
- for (String subpro : tmpp) {
- if (expected_subprotocols.contains(subpro)) {
- log.append("sub protocol " + subpro + " found is expected|");
- } else {
- passed = false;
- log.append(
- "sub protocol " + subpro + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getPreferredSubprotocols() returned not exactly the same size.");
- log.append("Expecting seven, returned " + size_actual);
- }
- } else {
- log.append("getPreferredSubprotocols() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getPreferredSubprotocols() return null list");
- }
-
- if (tmpd != null) {
- log.append("getDecoders() return non-null List|");
- if (!tmpd.isEmpty()) {
- int size = tmpd.size();
- log.append("getDecoders() return non-empty List with size "
- + tmpd.size() + "|");
- if (size == 2) {
- for (Class extends Decoder> decoder : tmpd) {
- log.append("Decoder " + decoder + " found ");
- if (expected_decoders.contains(decoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getDecoders() returned not exactly the same size.");
- log.append("Expecting two, returned " + size);
- }
- } else {
- log.append("getDecoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getDecoders() return null list|");
- }
-
- List> tmpen = dcc.getEncoders();
- if (tmpen != null) {
- log.append("getEncoders() return non-null List");
- if (!tmpen.isEmpty()) {
- int size = tmpen.size();
- log.append(
- "getEncoders() return non-empty List with size " + size + "|");
- if (size == 2) {
- for (Class extends Encoder> encoder : tmpen) {
- log.append("Encoder " + encoder + " found ");
- if (expected_encoders.contains(encoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getEncoders() returned not exactly the same size.");
- log.append("Expecting two, returned " + size);
- }
- } else {
- log.append("getEncoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getEncoders() return null list");
- }
- } catch (Exception e) {
- System.err.println(e.getMessage() + log.toString());
- throw new Exception(e);
- }
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- public void cleanup() {
- }
-}
-
-class TCKConfigurator extends Configurator {
-
- @Override
- public void beforeRequest(Map> headers) {
- }
-
- @Override
- public void afterResponse(HandshakeResponse hr) {
- }
-}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/clientendpointconfig/WSClientIT.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/clientendpointconfig/WSClientIT.java
new file mode 100644
index 0000000000..049b55ad36
--- /dev/null
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/clientendpointconfig/WSClientIT.java
@@ -0,0 +1,1092 @@
+/*
+ * Copyright (c) 2013, 2023 Oracle and/or its affiliates and others.
+ * All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+/*
+ * $Id:$
+ */
+package com.sun.ts.tests.websocket.api.jakarta.websocket.clientendpointconfig;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.jupiter.api.Test;
+
+import com.sun.ts.lib.util.TestUtil;
+import com.sun.ts.tests.websocket.common.TCKExtension;
+
+import jakarta.websocket.ClientEndpointConfig;
+import jakarta.websocket.ClientEndpointConfig.Configurator;
+import jakarta.websocket.Decoder;
+import jakarta.websocket.Encoder;
+import jakarta.websocket.Extension;
+import jakarta.websocket.HandshakeResponse;
+
+public class WSClientIT {
+
+ /* Run test */
+ /*
+ * @testName: constructortest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
+ * WebSocket:JAVADOC:6; WebSocket:JAVADOC:7; WebSocket:JAVADOC:70;
+ * WebSocket:JAVADOC:71; WebSocket:SPEC:WSC-3.2.1-1; WebSocket:SPEC:WSC-3.2.2-1;
+ *
+ * @test_Strategy: Test constructor
+ */
+ @Test
+ public void constructortest() throws Exception {
+ boolean passed = true;
+
+ try {
+ ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create().build();
+
+ List tmp = dcc.getDecoders();
+ if (tmp != null) {
+ TestUtil.logTrace("getDecoders() return non-null List");
+ if (!tmp.isEmpty()) {
+ TestUtil.logErr("getDecoders() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ tmp = dcc.getEncoders();
+ if (tmp != null) {
+ TestUtil.logTrace("getEncoders() return non-null List");
+ if (!tmp.isEmpty()) {
+ TestUtil.logErr("getEncoders() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ tmp = dcc.getExtensions();
+ if (tmp != null) {
+ TestUtil.logTrace("getExtensions() return non-null List");
+ if (!tmp.isEmpty()) {
+ TestUtil.logErr("getExtensions() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ tmp = dcc.getPreferredSubprotocols();
+ if (tmp != null) {
+ TestUtil.logTrace("getPreferredSubprotocols() return non-null List");
+ if (!tmp.isEmpty()) {
+ TestUtil.logErr("getPreferredSubprotocols() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ } catch (Exception e) {
+ TestUtil.logErr(e.getMessage());
+ throw new Exception(e);
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ /*
+ * @testName: preferredSubprotocolsTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
+ * WebSocket:JAVADOC:7; WebSocket:JAVADOC:14;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void preferredSubprotocolsTest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap", "WAMP", "v10.stomp", "v11.stomp",
+ "v12.stomp");
+ try {
+ ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
+ .preferredSubprotocols(expected_subprotocols).build();
+
+ List tmp = dcc.getPreferredSubprotocols();
+ if (tmp != null) {
+ log.append("getPreferredSubprotocols() return non-null List|");
+ if (!tmp.isEmpty()) {
+ log.append("getPreferredSubprotocols() return non-empty List with size " + tmp.size() + "|");
+ int size_actual = tmp.size();
+ if (size_actual == expected_subprotocols.size()) {
+ for (String subpro : tmp) {
+ if (expected_subprotocols.contains(subpro)) {
+ log.append("sub protocol " + subpro + " found is expected|");
+ } else {
+ passed = false;
+ log.append("sub protocol " + subpro + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getPreferredSubprotocols() returned not exactly the same size.");
+ log.append("Expecting seven, returned " + size_actual);
+ }
+ } else {
+ log.append("getPreferredSubprotocols() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getPreferredSubprotocols() return null list");
+ }
+ } catch (Exception e) {
+ System.err.print(e.getMessage() + log.toString());
+ throw new Exception(e);
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: extensionsTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
+ * WebSocket:JAVADOC:6; WebSocket:JAVADOC:13;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void extensionsTest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ final List extension1 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
+ add(new TCKExtension.TCKParameter("prop", "val"));
+ }
+ };
+
+ final List extension2 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("prop1", "val1"));
+ add(new TCKExtension.TCKParameter("prop2", "val2"));
+ }
+ };
+
+ ArrayList extensions = new ArrayList<>();
+ extensions.add(new TCKExtension("ext1", extension1));
+ extensions.add(new TCKExtension("ext2", extension2));
+
+ try {
+ ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create().extensions(extensions).build();
+ List tmp = dcc.getExtensions();
+ if (tmp != null) {
+ log.append("getExtensions() return non-null List|");
+ if (!tmp.isEmpty()) {
+ log.append("getExtensions() return non-empty List with size " + tmp.size() + "|");
+ int size_actual = tmp.size();
+ if (size_actual == extensions.size()) {
+ for (Extension ext : tmp) {
+ if (extensions.contains(ext)) {
+ log.append("extension " + ext + " found is expected|");
+ } else {
+ passed = false;
+ log.append("extension " + ext + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() returned not exactly the same amount of extensions.");
+ log.append("Expecting two, returned " + size_actual);
+ }
+ } else {
+ log.append("getExtensions() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() return null list|");
+ }
+ } catch (Exception e) {
+ System.err.println(e.getMessage() + log.toString());
+ throw new Exception(e);
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: constructorTest1
+ *
+ * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
+ * WebSocket:JAVADOC:6; WebSocket:JAVADOC:7; WebSocket:JAVADOC:13;
+ * WebSocket:JAVADOC:14;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void constructorTest1() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap", "WAMP", "v10.stomp", "v11.stomp",
+ "v12.stomp");
+
+ final List extension1 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
+ add(new TCKExtension.TCKParameter("prop", "val"));
+ }
+ };
+
+ final List extension2 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("prop1", "val1"));
+ add(new TCKExtension.TCKParameter("prop2", "val2"));
+ }
+ };
+
+ ArrayList extensions = new ArrayList<>();
+ extensions.add(new TCKExtension("ext1", extension1));
+ extensions.add(new TCKExtension("ext2", extension2));
+
+ try {
+ ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
+ .preferredSubprotocols(expected_subprotocols).extensions(extensions).build();
+
+ List tmpe = dcc.getExtensions();
+ List tmpp = dcc.getPreferredSubprotocols();
+
+ if (tmpe != null) {
+ log.append("getExtensions() return non-null List|");
+ if (!tmpe.isEmpty()) {
+ log.append("getExtensions() return non-empty List with size " + tmpe.size() + "|");
+ int size_actual = tmpe.size();
+ if (size_actual == extensions.size()) {
+ for (Extension ext : tmpe) {
+ if (extensions.contains(ext)) {
+ log.append("extension " + ext + " found is expected|");
+ } else {
+ passed = false;
+ log.append("extension " + ext + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() returned not exactly the same amount of extensions.");
+ log.append("Expecting two, returned " + size_actual);
+ }
+ } else {
+ log.append("getExtensions() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() return null list|");
+ }
+
+ if (tmpp != null) {
+ log.append("getPreferredSubprotocols() return non-null List|");
+ if (!tmpp.isEmpty()) {
+ log.append("getPreferredSubprotocols() return non-empty List with size " + tmpp.size() + "|");
+ int size_actual = tmpp.size();
+ if (size_actual == expected_subprotocols.size()) {
+ for (String subpro : tmpp) {
+ if (expected_subprotocols.contains(subpro)) {
+ log.append("sub protocol " + subpro + " found is expected|");
+ } else {
+ passed = false;
+ log.append("sub protocol " + subpro + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getPreferredSubprotocols() returned not exactly the same size.");
+ log.append("Expecting seven, returned " + size_actual);
+ }
+ } else {
+ log.append("getPreferredSubprotocols() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getPreferredSubprotocols() return null list");
+ }
+
+ } catch (Exception e) {
+ System.err.println(e.getMessage() + log.toString());
+ throw new Exception(e);
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: encodersTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
+ * WebSocket:JAVADOC:12; WebSocket:JAVADOC:71;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void encodersTest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List> expected_encoders = new ArrayList<>();
+ expected_encoders.add(com.sun.ts.tests.websocket.common.util.ErrorEncoder.class);
+ expected_encoders.add(com.sun.ts.tests.websocket.common.util.BooleanEncoder.class);
+
+ try {
+ ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create().encoders(expected_encoders).build();
+
+ List> tmp = dcc.getEncoders();
+ if (tmp != null) {
+ log.append("getEncoders() return non-null List");
+ if (!tmp.isEmpty()) {
+ int size = tmp.size();
+ log.append("getEncoders() return non-empty List with size " + size + "|");
+ if (size == 2) {
+ for (Class extends Encoder> encoder : tmp) {
+ log.append("Encoder " + encoder + " found ");
+ if (expected_encoders.contains(encoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getEncoders() returned not exactly the same size.");
+ log.append("Expecting two, returned " + size);
+ }
+ } else {
+ log.append("getEncoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getEncoders() return null list");
+ }
+ } catch (Exception e) {
+ System.err.print(log.toString());
+ throw new Exception(e);
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: decodersTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
+ * WebSocket:JAVADOC:11; WebSocket:JAVADOC:70;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void decodersTest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List> expected_decoders = new ArrayList<>();
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
+
+ try {
+ ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create().decoders(expected_decoders).build();
+
+ List> tmp = dcc.getDecoders();
+ if (tmp != null) {
+ log.append("getDecoders() return non-null List|");
+ if (!tmp.isEmpty()) {
+ int size = tmp.size();
+ log.append("getDecoders() return non-empty List with size " + tmp.size() + "|");
+ if (size == 2) {
+ for (Class extends Decoder> decoder : tmp) {
+ log.append("Decoder " + decoder + " found ");
+ if (expected_decoders.contains(decoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() returned not exactly the same size.");
+ log.append("Expecting two, returned " + size);
+ }
+ } else {
+ log.append("getDecoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() return null list|");
+ }
+
+ } catch (Exception e) {
+ System.err.println(e.getMessage() + log.toString());
+ throw new Exception(e);
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: constructorTest2
+ *
+ * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
+ * WebSocket:JAVADOC:6; WebSocket:JAVADOC:7; WebSocket:JAVADOC:13;
+ * WebSocket:JAVADOC:14; WebSocket:JAVADOC:11; WebSocket:JAVADOC:70;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void constructorTest2() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap", "WAMP", "v10.stomp", "v11.stomp",
+ "v12.stomp");
+
+ List> expected_decoders = new ArrayList<>();
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
+
+ final List extension1 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
+ add(new TCKExtension.TCKParameter("prop", "val"));
+ }
+ };
+
+ final List extension2 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("prop1", "val1"));
+ add(new TCKExtension.TCKParameter("prop2", "val2"));
+ }
+ };
+
+ ArrayList extensions = new ArrayList<>();
+ extensions.add(new TCKExtension("ext1", extension1));
+ extensions.add(new TCKExtension("ext2", extension2));
+
+ try {
+ ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
+ .preferredSubprotocols(expected_subprotocols).extensions(extensions).decoders(expected_decoders)
+ .build();
+
+ List tmpe = dcc.getExtensions();
+ List tmpp = dcc.getPreferredSubprotocols();
+ List> tmpd = dcc.getDecoders();
+
+ if (tmpe != null) {
+ log.append("getExtensions() return non-null List|");
+ if (!tmpe.isEmpty()) {
+ log.append("getExtensions() return non-empty List with size " + tmpe.size() + "|");
+ int size_actual = tmpe.size();
+ if (size_actual == extensions.size()) {
+ for (Extension ext : tmpe) {
+ if (extensions.contains(ext)) {
+ log.append("extension " + ext + " found is expected|");
+ } else {
+ passed = false;
+ log.append("extension " + ext + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() returned not exactly the same amount of extensions.");
+ log.append("Expecting two, returned " + size_actual);
+ }
+ } else {
+ log.append("getExtensions() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() return null list|");
+ }
+
+ if (tmpp != null) {
+ log.append("getPreferredSubprotocols() return non-null List|");
+ if (!tmpp.isEmpty()) {
+ log.append("getPreferredSubprotocols() return non-empty List with size " + tmpp.size() + "|");
+ int size_actual = tmpp.size();
+ if (size_actual == expected_subprotocols.size()) {
+ for (String subpro : tmpp) {
+ if (expected_subprotocols.contains(subpro)) {
+ log.append("sub protocol " + subpro + " found is expected|");
+ } else {
+ passed = false;
+ log.append("sub protocol " + subpro + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getPreferredSubprotocols() returned not exactly the same size.");
+ log.append("Expecting seven, returned " + size_actual);
+ }
+ } else {
+ log.append("getPreferredSubprotocols() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getPreferredSubprotocols() return null list");
+ }
+
+ if (tmpd != null) {
+ log.append("getDecoders() return non-null List|");
+ if (!tmpd.isEmpty()) {
+ int size = tmpd.size();
+ log.append("getDecoders() return non-empty List with size " + tmpd.size() + "|");
+ if (size == 2) {
+ for (Class extends Decoder> decoder : tmpd) {
+ log.append("Decoder " + decoder + " found ");
+ if (expected_decoders.contains(decoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() returned not exactly the same size.");
+ log.append("Expecting seven, returned " + size);
+ }
+ } else {
+ log.append("getDecoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() return null list|");
+ }
+ } catch (Exception e) {
+ System.err.println(e.getMessage() + log.toString());
+ throw new Exception(e);
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: constructorTest3
+ *
+ * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
+ * WebSocket:JAVADOC:6; WebSocket:JAVADOC:7; WebSocket:JAVADOC:13;
+ * WebSocket:JAVADOC:14; WebSocket:JAVADOC:11; WebSocket:JAVADOC:12;
+ * WebSocket:JAVADOC:70; WebSocket:JAVADOC:71;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void constructorTest3() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap", "WAMP", "v10.stomp", "v11.stomp",
+ "v12.stomp");
+
+ List> expected_encoders = new ArrayList<>();
+ expected_encoders.add(com.sun.ts.tests.websocket.common.util.ErrorEncoder.class);
+ expected_encoders.add(com.sun.ts.tests.websocket.common.util.BooleanEncoder.class);
+
+ List> expected_decoders = new ArrayList<>();
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
+
+ final List extension1 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
+ add(new TCKExtension.TCKParameter("prop", "val"));
+ }
+ };
+
+ final List extension2 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("prop1", "val1"));
+ add(new TCKExtension.TCKParameter("prop2", "val2"));
+ }
+ };
+
+ ArrayList extensions = new ArrayList<>();
+ extensions.add(new TCKExtension("ext1", extension1));
+ extensions.add(new TCKExtension("ext2", extension2));
+
+ try {
+ ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
+ .preferredSubprotocols(expected_subprotocols).extensions(extensions).decoders(expected_decoders)
+ .encoders(expected_encoders).build();
+
+ List tmpe = dcc.getExtensions();
+ List tmpp = dcc.getPreferredSubprotocols();
+ List> tmpd = dcc.getDecoders();
+
+ if (tmpe != null) {
+ log.append("getExtensions() return non-null List|");
+ if (!tmpe.isEmpty()) {
+ log.append("getExtensions() return non-empty List with size " + tmpe.size() + "|");
+ int size_actual = tmpe.size();
+ if (size_actual == extensions.size()) {
+ for (Extension ext : tmpe) {
+ if (extensions.contains(ext)) {
+ log.append("extension " + ext + " found is expected|");
+ } else {
+ passed = false;
+ log.append("extension " + ext + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() returned not exactly the same amount of extensions.");
+ log.append("Expecting two, returned " + size_actual);
+ }
+ } else {
+ log.append("getExtensions() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() return null list|");
+ }
+
+ if (tmpp != null) {
+ log.append("getPreferredSubprotocols() return non-null List|");
+ if (!tmpp.isEmpty()) {
+ log.append("getPreferredSubprotocols() return non-empty List with size " + tmpp.size() + "|");
+ int size_actual = tmpp.size();
+ if (size_actual == expected_subprotocols.size()) {
+ for (String subpro : tmpp) {
+ if (expected_subprotocols.contains(subpro)) {
+ log.append("sub protocol " + subpro + " found is expected|");
+ } else {
+ passed = false;
+ log.append("sub protocol " + subpro + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getPreferredSubprotocols() returned not exactly the same size.");
+ log.append("Expecting seven, returned " + size_actual);
+ }
+ } else {
+ log.append("getPreferredSubprotocols() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getPreferredSubprotocols() return null list");
+ }
+
+ if (tmpd != null) {
+ log.append("getDecoders() return non-null List|");
+ if (!tmpd.isEmpty()) {
+ int size = tmpd.size();
+ log.append("getDecoders() return non-empty List with size " + tmpd.size() + "|");
+ if (size == 2) {
+ for (Class extends Decoder> decoder : tmpd) {
+ log.append("Decoder " + decoder + " found ");
+ if (expected_decoders.contains(decoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() returned not exactly the same size.");
+ log.append("Expecting two, returned " + size);
+ }
+ } else {
+ log.append("getDecoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() return null list|");
+ }
+
+ List> tmpen = dcc.getEncoders();
+ if (tmpen != null) {
+ log.append("getEncoders() return non-null List");
+ if (!tmpen.isEmpty()) {
+ int size = tmpen.size();
+ log.append("getEncoders() return non-empty List with size " + size + "|");
+ if (size == 2) {
+ for (Class extends Encoder> encoder : tmpen) {
+ log.append("Encoder " + encoder + " found ");
+ if (expected_encoders.contains(encoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getEncoders() returned not exactly the same size.");
+ log.append("Expecting two, returned " + size);
+ }
+ } else {
+ log.append("getEncoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getEncoders() return null list");
+ }
+ } catch (Exception e) {
+ System.err.println(e.getMessage() + log.toString());
+ throw new Exception(e);
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: configuratorTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
+ * WebSocket:JAVADOC:5; WebSocket:JAVADOC:9;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void configuratorTest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ Configurator config = new TCKConfigurator();
+
+ try {
+ ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create().configurator(config).build();
+
+ Configurator tmpc = dcc.getConfigurator();
+
+ if (!tmpc.getClass().equals(
+ com.sun.ts.tests.websocket.api.jakarta.websocket.clientendpointconfig.TCKConfigurator.class)) {
+ TestUtil.logErr("getConfigurator() returned a different Configurator: " + tmpc.getClass().getName());
+ passed = false;
+ }
+
+ } catch (Exception e) {
+ System.err.print(log.toString());
+ throw new Exception(e);
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: constructorTest4
+ *
+ * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
+ * WebSocket:JAVADOC:5; WebSocket:JAVADOC:9; WebSocket:JAVADOC:6;
+ * WebSocket:JAVADOC:7; WebSocket:JAVADOC:70; WebSocket:JAVADOC:71;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void constructorTest4() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ Configurator config = new TCKConfigurator();
+
+ try {
+ ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create().configurator(config).build();
+ List tmp = dcc.getDecoders();
+ if (tmp != null) {
+ TestUtil.logTrace("getDecoders() return non-null List");
+ if (!tmp.isEmpty()) {
+ TestUtil.logErr("getDecoders() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ tmp = dcc.getEncoders();
+ if (tmp != null) {
+ TestUtil.logTrace("getEncoders() return non-null List");
+ if (!tmp.isEmpty()) {
+ TestUtil.logErr("getEncoders() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ tmp = dcc.getExtensions();
+ if (tmp != null) {
+ TestUtil.logTrace("getExtensions() return non-null List");
+ if (!tmp.isEmpty()) {
+ TestUtil.logErr("getExtensions() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ tmp = dcc.getPreferredSubprotocols();
+ if (tmp != null) {
+ TestUtil.logTrace("getPreferredSubprotocols() return non-null List");
+ if (!tmp.isEmpty()) {
+ TestUtil.logErr("getPreferredSubprotocols() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ } catch (Exception e) {
+ System.err.print(log.toString());
+ throw new Exception(e);
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: constructorTest5
+ *
+ * @assertion_ids: WebSocket:JAVADOC:8; WebSocket:JAVADOC:10;
+ * WebSocket:JAVADOC:6; WebSocket:JAVADOC:7; WebSocket:JAVADOC:5;
+ * WebSocket:JAVADOC:9; WebSocket:JAVADOC:13; WebSocket:JAVADOC:14;
+ * WebSocket:JAVADOC:11; WebSocket:JAVADOC:12; WebSocket:JAVADOC:70;
+ * WebSocket:JAVADOC:71;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void constructorTest5() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List expected_subprotocols = Arrays.asList("JSON", "XML", "XMPP", "Hessian", "Quake", "PUB/SUB",
+ "Query");
+
+ List> expected_encoders = new ArrayList<>();
+ expected_encoders.add(com.sun.ts.tests.websocket.common.util.ErrorEncoder.class);
+ expected_encoders.add(com.sun.ts.tests.websocket.common.util.BooleanEncoder.class);
+
+ List> expected_decoders = new ArrayList<>();
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
+
+ Configurator config = new TCKConfigurator();
+
+ final List extension1 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
+ add(new TCKExtension.TCKParameter("prop", "val"));
+ }
+ };
+
+ final List extension2 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("prop1", "val1"));
+ add(new TCKExtension.TCKParameter("prop2", "val2"));
+ }
+ };
+
+ ArrayList extensions = new ArrayList<>();
+ extensions.add(new TCKExtension("ext1", extension1));
+ extensions.add(new TCKExtension("ext2", extension2));
+
+ try {
+ ClientEndpointConfig dcc = ClientEndpointConfig.Builder.create()
+ .preferredSubprotocols(expected_subprotocols).extensions(extensions).decoders(expected_decoders)
+ .encoders(expected_encoders).configurator(config).build();
+
+ List tmpe = dcc.getExtensions();
+ List tmpp = dcc.getPreferredSubprotocols();
+ List> tmpd = dcc.getDecoders();
+
+ if (tmpe != null) {
+ log.append("getExtensions() return non-null List|");
+ if (!tmpe.isEmpty()) {
+ log.append("getExtensions() return non-empty List with size " + tmpe.size() + "|");
+ int size_actual = tmpe.size();
+ if (size_actual == extensions.size()) {
+ for (Extension ext : tmpe) {
+ if (extensions.contains(ext)) {
+ log.append("extension " + ext + " found is expected|");
+ } else {
+ passed = false;
+ log.append("extension " + ext + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() returned not exactly the same amount of extensions.");
+ log.append("Expecting two, returned " + size_actual);
+ }
+ } else {
+ log.append("getExtensions() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() return null list|");
+ }
+
+ if (tmpp != null) {
+ log.append("getPreferredSubprotocols() return non-null List|");
+ if (!tmpp.isEmpty()) {
+ log.append("getPreferredSubprotocols() return non-empty List with size " + tmpp.size() + "|");
+ int size_actual = tmpp.size();
+ if (size_actual == expected_subprotocols.size()) {
+ for (String subpro : tmpp) {
+ if (expected_subprotocols.contains(subpro)) {
+ log.append("sub protocol " + subpro + " found is expected|");
+ } else {
+ passed = false;
+ log.append("sub protocol " + subpro + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getPreferredSubprotocols() returned not exactly the same size.");
+ log.append("Expecting seven, returned " + size_actual);
+ }
+ } else {
+ log.append("getPreferredSubprotocols() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getPreferredSubprotocols() return null list");
+ }
+
+ if (tmpd != null) {
+ log.append("getDecoders() return non-null List|");
+ if (!tmpd.isEmpty()) {
+ int size = tmpd.size();
+ log.append("getDecoders() return non-empty List with size " + tmpd.size() + "|");
+ if (size == 2) {
+ for (Class extends Decoder> decoder : tmpd) {
+ log.append("Decoder " + decoder + " found ");
+ if (expected_decoders.contains(decoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() returned not exactly the same size.");
+ log.append("Expecting two, returned " + size);
+ }
+ } else {
+ log.append("getDecoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() return null list|");
+ }
+
+ List> tmpen = dcc.getEncoders();
+ if (tmpen != null) {
+ log.append("getEncoders() return non-null List");
+ if (!tmpen.isEmpty()) {
+ int size = tmpen.size();
+ log.append("getEncoders() return non-empty List with size " + size + "|");
+ if (size == 2) {
+ for (Class extends Encoder> encoder : tmpen) {
+ log.append("Encoder " + encoder + " found ");
+ if (expected_encoders.contains(encoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getEncoders() returned not exactly the same size.");
+ log.append("Expecting two, returned " + size);
+ }
+ } else {
+ log.append("getEncoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getEncoders() return null list");
+ }
+ } catch (Exception e) {
+ System.err.println(e.getMessage() + log.toString());
+ throw new Exception(e);
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ public void cleanup() {
+ }
+}
+
+class TCKConfigurator extends Configurator {
+
+ @Override
+ public void beforeRequest(Map> headers) {
+ }
+
+ @Override
+ public void afterResponse(HandshakeResponse hr) {
+ }
+}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/closereason/WSClient.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/closereason/WSClient.java
deleted file mode 100644
index 613c545642..0000000000
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/closereason/WSClient.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (c) 2013, 2020 Oracle and/or its affiliates and others.
- * All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-/*
- * $Id:$
- */
-package com.sun.ts.tests.websocket.api.jakarta.websocket.closereason;
-
-import java.io.PrintWriter;
-import java.util.Properties;
-
-import com.sun.javatest.Status;
-import com.sun.ts.lib.harness.ServiceEETest;
-
-import jakarta.websocket.CloseReason;
-import jakarta.websocket.CloseReason.CloseCode;
-import jakarta.websocket.CloseReason.CloseCodes;
-
-public class WSClient extends ServiceEETest {
-
- final CloseCodes[] codes = { CloseReason.CloseCodes.CANNOT_ACCEPT,
- CloseReason.CloseCodes.CLOSED_ABNORMALLY,
- CloseReason.CloseCodes.GOING_AWAY, CloseReason.CloseCodes.NORMAL_CLOSURE,
- CloseReason.CloseCodes.NOT_CONSISTENT,
- CloseReason.CloseCodes.NO_EXTENSION,
- CloseReason.CloseCodes.NO_STATUS_CODE,
- CloseReason.CloseCodes.PROTOCOL_ERROR, CloseReason.CloseCodes.RESERVED,
- CloseReason.CloseCodes.SERVICE_RESTART,
- CloseReason.CloseCodes.TLS_HANDSHAKE_FAILURE,
- CloseReason.CloseCodes.TOO_BIG, CloseReason.CloseCodes.TRY_AGAIN_LATER,
- CloseReason.CloseCodes.UNEXPECTED_CONDITION,
- CloseReason.CloseCodes.VIOLATED_POLICY };
-
- final String[] codes_string = { "CANNOT_ACCEPT", "CLOSED_ABNORMALLY",
- "GOING_AWAY", "NORMAL_CLOSURE", "NOT_CONSISTENT", "NO_EXTENSION",
- "NO_STATUS_CODE", "PROTOCOL_ERROR", "RESERVED", "SERVICE_RESTART",
- "TLS_HANDSHAKE_FAILURE", "TOO_BIG", "TRY_AGAIN_LATER",
- "UNEXPECTED_CONDITION", "VIOLATED_POLICY" };
-
- final int[] codes_number = { 1003, 1006, 1001, 1000, 1007, 1010, 1005, 1002,
- 1004, 1012, 1015, 1009, 1013, 1011, 1008 };
-
- final String[] tck_codes_reason = { "TCK_CANNOT_ACCEPT",
- "TCK_CLOSED_ABNORMALLY", "TCK_GOING_AWAY", "TCK_NORMAL_CLOSURE",
- "TCK_NOT_CONSISTENT", "TCK_NO_EXTENSION", "TCK_NO_STATUS_CODE",
- "TCK_PROTOCOL_ERROR", "TCK_RESERVED", "TCK_SERVICE_RESTART",
- "TCK_TLS_HANDSHAKE_FAILURE", "TCK_TOO_BIG", "TCK_TRY_AGAIN_LATER",
- "TCK_UNEXPECTED_CONDITION", "TCK_VIOLATED_POLICY" };
-
- public static void main(String[] args) {
- WSClient theTests = new WSClient();
- Status s = theTests.run(args, new PrintWriter(System.out),
- new PrintWriter(System.err));
- s.exit();
- }
-
- /*
- * @class.setup_props: webServerHost; webServerPort; ts_home;
- */
- @SuppressWarnings("unused")
- public void setup(String[] args, Properties p) throws Exception {
- }
-
- /* Run test */
- /*
- * @testName: getCodeTest
- *
- * @assertion_ids: WebSocket:JAVADOC:24;
- *
- * @test_Strategy: Test method CloseCodes.getCode()
- */
- public void getCodeTest() throws Exception {
- boolean passed = true;
-
- int size = codes_number.length;
- for (int i = 0; i < size; i++) {
- if (codes[i].getCode() != codes_number[i]) {
- passed = false;
- System.err.println("Expecting CloseCodes' number " + codes_number[i]
- + "; got " + codes[i].getCode());
- }
- }
-
- if (passed == false) {
- throw new Exception("Test failed");
- }
- }
-
- /*
- * @testName: getCodeTest1
- *
- * @assertion_ids: WebSocket:JAVADOC:22;
- *
- * @test_Strategy: Test method CloseCode.getCode()
- */
- public void getCodeTest1() throws Exception {
- boolean passed = true;
-
- int size = codes_number.length;
- for (int i = 0; i < size; i++) {
- if (((CloseCode) codes[i]).getCode() != codes_number[i]) {
- passed = false;
- System.err.println("Expecting CloseCode' number " + codes_number[i]
- + "; got " + codes[i].getCode());
- }
- }
-
- if (passed == false) {
- throw new Exception("Test failed");
- }
- }
-
- /*
- * @testName: valueOfTest
- *
- * @assertion_ids: WebSocket:JAVADOC:25;
- *
- * @test_Strategy: Test method CloseCodes.valueOf(String)
- */
- public void valueOfTest() throws Exception {
- boolean passed = true;
-
- int size = codes_number.length;
-
- for (int i = 0; i < size; i++) {
- if (!CloseReason.CloseCodes.valueOf(codes_string[i]).equals(codes[i])) {
- passed = false;
- System.err.println("Expecting CloseCodes " + codes[i] + "; got "
- + CloseReason.CloseCodes.valueOf(codes_string[i]));
- }
- }
-
- if (passed == false) {
- throw new Exception("Test failed");
- }
- }
-
- /*
- * @testName: valuesTest
- *
- * @assertion_ids: WebSocket:JAVADOC:26;
- *
- * @test_Strategy: Test method CloseCodes.values()
- */
- public void valuesTest() throws Exception {
- boolean passed = true;
-
- CloseCodes[] close_codes = CloseReason.CloseCodes.values();
-
- int size = close_codes.length;
- boolean[] passed_array = new boolean[size];
- for (int i = 0; i < size; i++) {
- passed_array[i] = false;
- for (int j = 0; j < size; j++) {
- if (close_codes[i].equals(codes[j])) {
- break;
- }
- }
- passed_array[i] = true;
- System.out.println("Expected CloseCodes " + codes[i] + " returned");
- System.out.println("Expected CloseCodes " + codes[i] + " returned");
-
- }
-
- for (int i = 0; i < size; i++) {
- if (passed_array[i] == false) {
- passed = false;
- }
- }
-
- if (!passed) {
- throw new Exception("Test failed");
- }
- }
-
- /*
- * @testName: constructorTest
- *
- * @assertion_ids: WebSocket:JAVADOC:18; WebSocket:JAVADOC:19;
- * WebSocket:JAVADOC:20;
- *
- * @test_Strategy: Test constructor CloseReason( CloseCode, String )
- */
- public void constructorTest() throws Exception {
- boolean passed = true;
-
- int size = codes_number.length;
- CloseReason closereason;
-
- for (int i = 0; i < size; i++) {
- closereason = new CloseReason(codes[i], tck_codes_reason[i]);
- if (!closereason.getCloseCode().equals(codes[i])) {
- passed = false;
- System.err.println("Expected CloseCodes " + codes[i] + ", returned"
- + closereason.getCloseCode());
- }
-
- if (!closereason.getReasonPhrase().equals(tck_codes_reason[i])) {
- passed = false;
- System.err.println("Expected reason phrase " + tck_codes_reason[i]
- + ", returned" + closereason.getReasonPhrase());
- }
- }
-
- if (!passed) {
- throw new Exception("Test failed");
- }
- }
-
- /*
- * @testName: getCloseCodeTest
- *
- * @assertion_ids: WebSocket:JAVADOC:23;
- *
- * @test_Strategy: Test constructor CloseCodes.getCloseCode( int )
- */
- public void getCloseCodeTest() throws Exception {
- boolean passed = true;
-
- int size = codes_number.length;
- CloseCode tmp;
-
- for (int i = 0; i < size; i++) {
- tmp = CloseReason.CloseCodes.getCloseCode(codes_number[i]);
- if (!tmp.equals(codes[i])) {
- passed = false;
- System.err
- .println("Expected CloseCode " + codes[i] + ", returned" + tmp);
- }
- }
-
- if (!passed) {
- throw new Exception("Test failed");
- }
- }
-
- public void cleanup() {
- }
-}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/closereason/WSClientIT.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/closereason/WSClientIT.java
new file mode 100644
index 0000000000..a2a210857f
--- /dev/null
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/closereason/WSClientIT.java
@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) 2013, 2023 Oracle and/or its affiliates and others.
+ * All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+/*
+ * $Id:$
+ */
+package com.sun.ts.tests.websocket.api.jakarta.websocket.closereason;
+
+import org.junit.jupiter.api.Test;
+
+import jakarta.websocket.CloseReason;
+import jakarta.websocket.CloseReason.CloseCode;
+import jakarta.websocket.CloseReason.CloseCodes;
+
+public class WSClientIT {
+
+ final CloseCodes[] codes = { CloseReason.CloseCodes.CANNOT_ACCEPT, CloseReason.CloseCodes.CLOSED_ABNORMALLY,
+ CloseReason.CloseCodes.GOING_AWAY, CloseReason.CloseCodes.NORMAL_CLOSURE,
+ CloseReason.CloseCodes.NOT_CONSISTENT, CloseReason.CloseCodes.NO_EXTENSION,
+ CloseReason.CloseCodes.NO_STATUS_CODE, CloseReason.CloseCodes.PROTOCOL_ERROR,
+ CloseReason.CloseCodes.RESERVED, CloseReason.CloseCodes.SERVICE_RESTART,
+ CloseReason.CloseCodes.TLS_HANDSHAKE_FAILURE, CloseReason.CloseCodes.TOO_BIG,
+ CloseReason.CloseCodes.TRY_AGAIN_LATER, CloseReason.CloseCodes.UNEXPECTED_CONDITION,
+ CloseReason.CloseCodes.VIOLATED_POLICY };
+
+ final String[] codes_string = { "CANNOT_ACCEPT", "CLOSED_ABNORMALLY", "GOING_AWAY", "NORMAL_CLOSURE",
+ "NOT_CONSISTENT", "NO_EXTENSION", "NO_STATUS_CODE", "PROTOCOL_ERROR", "RESERVED", "SERVICE_RESTART",
+ "TLS_HANDSHAKE_FAILURE", "TOO_BIG", "TRY_AGAIN_LATER", "UNEXPECTED_CONDITION", "VIOLATED_POLICY" };
+
+ final int[] codes_number = { 1003, 1006, 1001, 1000, 1007, 1010, 1005, 1002, 1004, 1012, 1015, 1009, 1013, 1011,
+ 1008 };
+
+ final String[] tck_codes_reason = { "TCK_CANNOT_ACCEPT", "TCK_CLOSED_ABNORMALLY", "TCK_GOING_AWAY",
+ "TCK_NORMAL_CLOSURE", "TCK_NOT_CONSISTENT", "TCK_NO_EXTENSION", "TCK_NO_STATUS_CODE", "TCK_PROTOCOL_ERROR",
+ "TCK_RESERVED", "TCK_SERVICE_RESTART", "TCK_TLS_HANDSHAKE_FAILURE", "TCK_TOO_BIG", "TCK_TRY_AGAIN_LATER",
+ "TCK_UNEXPECTED_CONDITION", "TCK_VIOLATED_POLICY" };
+
+ /* Run test */
+ /*
+ * @testName: getCodeTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:24;
+ *
+ * @test_Strategy: Test method CloseCodes.getCode()
+ */
+ @Test
+ public void getCodeTest() throws Exception {
+ boolean passed = true;
+
+ int size = codes_number.length;
+ for (int i = 0; i < size; i++) {
+ if (codes[i].getCode() != codes_number[i]) {
+ passed = false;
+ System.err.println("Expecting CloseCodes' number " + codes_number[i] + "; got " + codes[i].getCode());
+ }
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ /*
+ * @testName: getCodeTest1
+ *
+ * @assertion_ids: WebSocket:JAVADOC:22;
+ *
+ * @test_Strategy: Test method CloseCode.getCode()
+ */
+ @Test
+ public void getCodeTest1() throws Exception {
+ boolean passed = true;
+
+ int size = codes_number.length;
+ for (int i = 0; i < size; i++) {
+ if (((CloseCode) codes[i]).getCode() != codes_number[i]) {
+ passed = false;
+ System.err.println("Expecting CloseCode' number " + codes_number[i] + "; got " + codes[i].getCode());
+ }
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ /*
+ * @testName: valueOfTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:25;
+ *
+ * @test_Strategy: Test method CloseCodes.valueOf(String)
+ */
+ @Test
+ public void valueOfTest() throws Exception {
+ boolean passed = true;
+
+ int size = codes_number.length;
+
+ for (int i = 0; i < size; i++) {
+ if (!CloseReason.CloseCodes.valueOf(codes_string[i]).equals(codes[i])) {
+ passed = false;
+ System.err.println("Expecting CloseCodes " + codes[i] + "; got "
+ + CloseReason.CloseCodes.valueOf(codes_string[i]));
+ }
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ /*
+ * @testName: valuesTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:26;
+ *
+ * @test_Strategy: Test method CloseCodes.values()
+ */
+ @Test
+ public void valuesTest() throws Exception {
+ boolean passed = true;
+
+ CloseCodes[] close_codes = CloseReason.CloseCodes.values();
+
+ int size = close_codes.length;
+ boolean[] passed_array = new boolean[size];
+ for (int i = 0; i < size; i++) {
+ passed_array[i] = false;
+ for (int j = 0; j < size; j++) {
+ if (close_codes[i].equals(codes[j])) {
+ break;
+ }
+ }
+ passed_array[i] = true;
+ System.out.println("Expected CloseCodes " + codes[i] + " returned");
+ System.out.println("Expected CloseCodes " + codes[i] + " returned");
+
+ }
+
+ for (int i = 0; i < size; i++) {
+ if (passed_array[i] == false) {
+ passed = false;
+ }
+ }
+
+ if (!passed) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ /*
+ * @testName: constructorTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:18; WebSocket:JAVADOC:19;
+ * WebSocket:JAVADOC:20;
+ *
+ * @test_Strategy: Test constructor CloseReason( CloseCode, String )
+ */
+ @Test
+ public void constructorTest() throws Exception {
+ boolean passed = true;
+
+ int size = codes_number.length;
+ CloseReason closereason;
+
+ for (int i = 0; i < size; i++) {
+ closereason = new CloseReason(codes[i], tck_codes_reason[i]);
+ if (!closereason.getCloseCode().equals(codes[i])) {
+ passed = false;
+ System.err.println("Expected CloseCodes " + codes[i] + ", returned" + closereason.getCloseCode());
+ }
+
+ if (!closereason.getReasonPhrase().equals(tck_codes_reason[i])) {
+ passed = false;
+ System.err.println(
+ "Expected reason phrase " + tck_codes_reason[i] + ", returned" + closereason.getReasonPhrase());
+ }
+ }
+
+ if (!passed) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ /*
+ * @testName: getCloseCodeTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:23;
+ *
+ * @test_Strategy: Test constructor CloseCodes.getCloseCode( int )
+ */
+ @Test
+ public void getCloseCodeTest() throws Exception {
+ boolean passed = true;
+
+ int size = codes_number.length;
+ CloseCode tmp;
+
+ for (int i = 0; i < size; i++) {
+ tmp = CloseReason.CloseCodes.getCloseCode(codes_number[i]);
+ if (!tmp.equals(codes[i])) {
+ passed = false;
+ System.err.println("Expected CloseCode " + codes[i] + ", returned" + tmp);
+ }
+ }
+
+ if (!passed) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ public void cleanup() {
+ }
+}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/decodeexception/WSClient.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/decodeexception/WSClient.java
deleted file mode 100644
index e1785ecf3e..0000000000
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/decodeexception/WSClient.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (c) 2013, 2020 Oracle and/or its affiliates and others.
- * All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-/*
- * $Id:$
- */
-package com.sun.ts.tests.websocket.api.jakarta.websocket.decodeexception;
-
-import java.io.PrintWriter;
-import java.nio.ByteBuffer;
-import java.util.Properties;
-
-import com.sun.javatest.Status;
-import com.sun.ts.lib.harness.ServiceEETest;
-import com.sun.ts.lib.util.RemoteLoggingInitException;
-import com.sun.ts.lib.util.TestUtil;
-
-import jakarta.websocket.DecodeException;
-
-public class WSClient extends ServiceEETest {
- // properties read from ts.jte file
-
- int ws_wait;
-
- String webServerHost;
-
- String webServerPort;
-
- public static void main(String[] args) {
- WSClient theTests = new WSClient();
- Status s = theTests.run(args, new PrintWriter(System.out),
- new PrintWriter(System.err));
- s.exit();
- }
-
- /*
- * @class.setup_props: webServerHost; webServerPort; ws_wait; ts_home;
- */
- @SuppressWarnings("unused")
- public void setup(String[] args, Properties p) throws Exception {
- try {
- TestUtil.init(p);
- } catch (RemoteLoggingInitException rlex) {
- System.err.println("Failed to initialize logging.");
- }
-
- webServerHost = p.getProperty("webServerHost").trim();
- webServerPort = p.getProperty("webServerPort").trim();
- ws_wait = Integer.parseInt(p.getProperty("ws_wait"));
-
- // check props for errors
- if (ws_wait < 1) {
- throw new Exception("'ws_wait' (milliseconds) in ts.jte must be > 0");
- }
- if (webServerHost == null) {
- throw new Exception("'webServerHost' in ts.jte must not be null ");
- }
- if (webServerPort == null) {
- throw new Exception("'webServerPort' in ts.jte must not be null ");
- }
- }
-
- /* Run test */
- /*
- * @testName: constructorTest
- *
- * @assertion_ids: WebSocket:JAVADOC:32; WebSocket:JAVADOC:33;
- * WebSocket:JAVADOC:34;
- *
- * @test_Strategy: Test constructor DecodeException(String, String)
- */
- public void constructorTest() throws Exception {
- boolean passed = true;
- String reason = "TCK: Cannot decode the message";
- String encoded_message = "xyz for now";
- StringBuilder tmp = new StringBuilder();
-
- DecodeException dex = new DecodeException(encoded_message, reason);
-
- if (!encoded_message.equals(dex.getText())) {
- passed = false;
- tmp.append("Expected message ").append(encoded_message)
- .append(", returned").append(dex.getText());
- }
-
- if (dex.getBytes() != null) {
- passed = false;
- tmp.append("Expected ByteBuffer to be null, returned")
- .append(dex.getBytes());
- }
-
- if (passed == false) {
- throw new Exception("Test failed: " + tmp.toString());
- }
- }
-
- /*
- * @testName: constructorTest1
- *
- * @assertion_ids: WebSocket:JAVADOC:31; WebSocket:JAVADOC:33;
- * WebSocket:JAVADOC:34;
- *
- * @test_Strategy: Test constructor DecodeException(ByteBuffer, String)
- */
- public void constructorTest1() throws Exception {
- boolean passed = true;
- String reason = "TCK: Cannot decode the message";
- ByteBuffer encoded_message = ByteBuffer.allocate(20);
- encoded_message.put("xyz for now".getBytes());
-
- DecodeException dex = new DecodeException(encoded_message, reason);
-
- if (dex.getText() != null) {
- passed = false;
- TestUtil
- .logErr("Expected encoded_message null, returned" + dex.getText());
- }
-
- if (!encoded_message.equals(dex.getBytes())) {
- passed = false;
- TestUtil.logErr("Expected ByteBuffer " + encoded_message + ", returned"
- + dex.getBytes());
- }
-
- if (passed == false) {
- throw new Exception("Test failed");
- }
- }
-
- /*
- * @testName: constructorTest2
- *
- * @assertion_ids: WebSocket:JAVADOC:30; WebSocket:JAVADOC:33;
- * WebSocket:JAVADOC:34;
- *
- * @test_Strategy: Test constructor DecodeException(String, String, Throwable)
- */
- public void constructorTest2() throws Exception {
- boolean passed = true;
- String reason = "TCK: Cannot decode the message";
- String encoded_message = "xyz for now";
-
- DecodeException dex = new DecodeException(encoded_message, reason,
- new Throwable("CocntructorTest2"));
-
- if (!encoded_message.equals(dex.getText())) {
- passed = false;
- TestUtil.logErr("Expected encoded_message " + encoded_message
- + ", returned" + dex.getText());
- }
-
- if (dex.getBytes() != null) {
- passed = false;
- TestUtil.logErr("Expected ByteBuffer null, returned" + dex.getBytes());
- }
-
- if (passed == false) {
- throw new Exception("Test failed");
- }
- }
-
- /*
- * @testName: constructorTest3
- *
- * @assertion_ids: WebSocket:JAVADOC:29; WebSocket:JAVADOC:33;
- * WebSocket:JAVADOC:34;
- *
- * @test_Strategy: Test constructor DecodeException(ByteBuffer, String,
- * Throwable)
- */
- public void constructorTest3() throws Exception {
- boolean passed = true;
- String reason = "TCK: Cannot decode the message";
- ByteBuffer encoded_message = ByteBuffer.allocate(20);
- encoded_message.put("xyz for now".getBytes());
-
- DecodeException dex = new DecodeException(encoded_message, reason,
- new Throwable("constructorTest3"));
-
- if (dex.getText() != null) {
- passed = false;
- TestUtil
- .logErr("Expected encoded_message null, returned" + dex.getText());
- }
-
- if (!encoded_message.equals(dex.getBytes())) {
- passed = false;
- TestUtil.logErr("Expected ByteBuffer " + encoded_message + ", returned"
- + dex.getBytes());
- }
-
- if (passed == false) {
- throw new Exception("Test failed");
- }
- }
-
- public void cleanup() {
- }
-}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/decodeexception/WSClientIT.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/decodeexception/WSClientIT.java
new file mode 100644
index 0000000000..8116dc4349
--- /dev/null
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/decodeexception/WSClientIT.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2013, 2023 Oracle and/or its affiliates and others.
+ * All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+/*
+ * $Id:$
+ */
+package com.sun.ts.tests.websocket.api.jakarta.websocket.decodeexception;
+
+import java.nio.ByteBuffer;
+
+import org.junit.jupiter.api.Test;
+
+import com.sun.ts.lib.util.TestUtil;
+
+import jakarta.websocket.DecodeException;
+
+public class WSClientIT {
+
+ /* Run test */
+ /*
+ * @testName: constructorTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:32; WebSocket:JAVADOC:33;
+ * WebSocket:JAVADOC:34;
+ *
+ * @test_Strategy: Test constructor DecodeException(String, String)
+ */
+ @Test
+ public void constructorTest() throws Exception {
+ boolean passed = true;
+ String reason = "TCK: Cannot decode the message";
+ String encoded_message = "xyz for now";
+ StringBuilder tmp = new StringBuilder();
+
+ DecodeException dex = new DecodeException(encoded_message, reason);
+
+ if (!encoded_message.equals(dex.getText())) {
+ passed = false;
+ tmp.append("Expected message ").append(encoded_message).append(", returned").append(dex.getText());
+ }
+
+ if (dex.getBytes() != null) {
+ passed = false;
+ tmp.append("Expected ByteBuffer to be null, returned").append(dex.getBytes());
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + tmp.toString());
+ }
+ }
+
+ /*
+ * @testName: constructorTest1
+ *
+ * @assertion_ids: WebSocket:JAVADOC:31; WebSocket:JAVADOC:33;
+ * WebSocket:JAVADOC:34;
+ *
+ * @test_Strategy: Test constructor DecodeException(ByteBuffer, String)
+ */
+ @Test
+ public void constructorTest1() throws Exception {
+ boolean passed = true;
+ String reason = "TCK: Cannot decode the message";
+ ByteBuffer encoded_message = ByteBuffer.allocate(20);
+ encoded_message.put("xyz for now".getBytes());
+
+ DecodeException dex = new DecodeException(encoded_message, reason);
+
+ if (dex.getText() != null) {
+ passed = false;
+ TestUtil.logErr("Expected encoded_message null, returned" + dex.getText());
+ }
+
+ if (!encoded_message.equals(dex.getBytes())) {
+ passed = false;
+ TestUtil.logErr("Expected ByteBuffer " + encoded_message + ", returned" + dex.getBytes());
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ /*
+ * @testName: constructorTest2
+ *
+ * @assertion_ids: WebSocket:JAVADOC:30; WebSocket:JAVADOC:33;
+ * WebSocket:JAVADOC:34;
+ *
+ * @test_Strategy: Test constructor DecodeException(String, String, Throwable)
+ */
+ @Test
+ public void constructorTest2() throws Exception {
+ boolean passed = true;
+ String reason = "TCK: Cannot decode the message";
+ String encoded_message = "xyz for now";
+
+ DecodeException dex = new DecodeException(encoded_message, reason, new Throwable("CocntructorTest2"));
+
+ if (!encoded_message.equals(dex.getText())) {
+ passed = false;
+ TestUtil.logErr("Expected encoded_message " + encoded_message + ", returned" + dex.getText());
+ }
+
+ if (dex.getBytes() != null) {
+ passed = false;
+ TestUtil.logErr("Expected ByteBuffer null, returned" + dex.getBytes());
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ /*
+ * @testName: constructorTest3
+ *
+ * @assertion_ids: WebSocket:JAVADOC:29; WebSocket:JAVADOC:33;
+ * WebSocket:JAVADOC:34;
+ *
+ * @test_Strategy: Test constructor DecodeException(ByteBuffer, String,
+ * Throwable)
+ */
+ @Test
+ public void constructorTest3() throws Exception {
+ boolean passed = true;
+ String reason = "TCK: Cannot decode the message";
+ ByteBuffer encoded_message = ByteBuffer.allocate(20);
+ encoded_message.put("xyz for now".getBytes());
+
+ DecodeException dex = new DecodeException(encoded_message, reason, new Throwable("constructorTest3"));
+
+ if (dex.getText() != null) {
+ passed = false;
+ TestUtil.logErr("Expected encoded_message null, returned" + dex.getText());
+ }
+
+ if (!encoded_message.equals(dex.getBytes())) {
+ passed = false;
+ TestUtil.logErr("Expected ByteBuffer " + encoded_message + ", returned" + dex.getBytes());
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ public void cleanup() {
+ }
+}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/deploymentException/WSClient.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/deploymentException/WSClient.java
deleted file mode 100644
index 3a58581f77..0000000000
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/deploymentException/WSClient.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2013, 2020 Oracle and/or its affiliates and others.
- * All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-/*
- * $Id:$
- */
-package com.sun.ts.tests.websocket.api.jakarta.websocket.deploymentException;
-
-import java.io.PrintWriter;
-import java.util.Properties;
-
-import com.sun.javatest.Status;
-import com.sun.ts.lib.harness.ServiceEETest;
-
-import jakarta.websocket.DeploymentException;
-
-public class WSClient extends ServiceEETest {
-
- public static void main(String[] args) {
- WSClient theTests = new WSClient();
- Status s = theTests.run(args, new PrintWriter(System.out),
- new PrintWriter(System.err));
- s.exit();
- }
-
- /*
- * @class.setup_props: webServerHost; webServerPort; ws_wait; ts_home;
- */
- @SuppressWarnings("unused")
- public void setup(String[] args, Properties p) throws Exception {
- }
-
- /* Run test */
- /*
- * @testName: constructorTest
- *
- * @assertion_ids: WebSocket:JAVADOC:49;
- *
- * @test_Strategy: Test constructor DeploymentException(String)
- */
- public void constructorTest() throws Exception {
- String reason = "TCK: testing the DeploymentException(String)";
-
- @SuppressWarnings("unused")
- DeploymentException dex = new DeploymentException(reason);
-
- }
-
- /*
- * @testName: constructorTest1
- *
- * @assertion_ids: WebSocket:JAVADOC:50;
- *
- * @test_Strategy: Test constructor DeploymentException(String, Throwable)
- */
- public void constructorTest1() throws Exception {
- String reason = "TCK: testing the DeploymentException(String)";
-
- @SuppressWarnings("unused")
- DeploymentException dex = new DeploymentException(reason,
- new Throwable("TCK_Test"));
- }
-
- public void cleanup() {
- }
-}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/deploymentException/WSClientIT.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/deploymentException/WSClientIT.java
new file mode 100644
index 0000000000..4beec5336d
--- /dev/null
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/deploymentException/WSClientIT.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2013, 2023 Oracle and/or its affiliates and others.
+ * All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+/*
+ * $Id:$
+ */
+package com.sun.ts.tests.websocket.api.jakarta.websocket.deploymentException;
+
+import org.junit.jupiter.api.Test;
+
+import jakarta.websocket.DeploymentException;
+
+public class WSClientIT {
+
+ /* Run test */
+ /*
+ * @testName: constructorTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:49;
+ *
+ * @test_Strategy: Test constructor DeploymentException(String)
+ */
+ @Test
+ public void constructorTest() throws Exception {
+ String reason = "TCK: testing the DeploymentException(String)";
+
+ @SuppressWarnings("unused")
+ DeploymentException dex = new DeploymentException(reason);
+
+ }
+
+ /*
+ * @testName: constructorTest1
+ *
+ * @assertion_ids: WebSocket:JAVADOC:50;
+ *
+ * @test_Strategy: Test constructor DeploymentException(String, Throwable)
+ */
+ @Test
+ public void constructorTest1() throws Exception {
+ String reason = "TCK: testing the DeploymentException(String)";
+
+ @SuppressWarnings("unused")
+ DeploymentException dex = new DeploymentException(reason, new Throwable("TCK_Test"));
+ }
+
+ public void cleanup() {
+ }
+}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/encodeexception/WSClient.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/encodeexception/WSClient.java
deleted file mode 100644
index 18c96153e7..0000000000
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/encodeexception/WSClient.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2013, 2020 Oracle and/or its affiliates and others.
- * All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-/*
- * $Id:$
- */
-package com.sun.ts.tests.websocket.api.jakarta.websocket.encodeexception;
-
-import java.io.PrintWriter;
-import java.nio.ByteBuffer;
-import java.util.Properties;
-
-import com.sun.javatest.Status;
-import com.sun.ts.lib.harness.ServiceEETest;
-import com.sun.ts.lib.util.TestUtil;
-
-import jakarta.websocket.EncodeException;
-
-public class WSClient extends ServiceEETest {
- public static void main(String[] args) {
- WSClient theTests = new WSClient();
- Status s = theTests.run(args, new PrintWriter(System.out),
- new PrintWriter(System.err));
- s.exit();
- }
-
- /*
- * @class.setup_props: webServerHost; webServerPort; ws_wait; ts_home;
- */
- @SuppressWarnings("unused")
- public void setup(String[] args, Properties p) throws Exception {
- }
-
- /* Run test */
- /*
- * @testName: constructorTest
- *
- * @assertion_ids: WebSocket:JAVADOC:51; WebSocket:JAVADOC:53;
- *
- * @test_Strategy: Test constructor EncodeException(Object, String)
- */
- public void constructorTest() throws Exception {
- boolean passed = true;
- String reason = "TCK: Cannot encode the message";
- String encoded_message = "xyz for now";
-
- EncodeException eex = new EncodeException(encoded_message, reason);
-
- if (!encoded_message.equals(eex.getObject())) {
- passed = false;
- TestUtil.logErr("Expected message " + encoded_message + ", returned"
- + eex.getObject());
- }
-
- if (passed == false) {
- throw new Exception("Test failed");
- }
- }
-
- /*
- * @testName: constructorTest1
- *
- * @assertion_ids: WebSocket:JAVADOC:52; WebSocket:JAVADOC:53;
- *
- * @test_Strategy: Test constructor EncodeException(Object, String, Throwable)
- */
- public void constructorTest1() throws Exception {
- boolean passed = true;
- String reason = "TCK: Cannot decode the message";
- ByteBuffer encoded_message = ByteBuffer.allocate(20);
- encoded_message.put("xyz for now".getBytes());
-
- EncodeException eex = new EncodeException(encoded_message, reason,
- new Throwable("TCK Cannot encode"));
-
- if (!encoded_message.equals(eex.getObject())) {
- passed = false;
- TestUtil.logErr("Expected message " + encoded_message + ", returned"
- + eex.getObject());
- }
-
- if (passed == false) {
- throw new Exception("Test failed");
- }
- }
-
- public void cleanup() {
- }
-}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/encodeexception/WSClientIT.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/encodeexception/WSClientIT.java
new file mode 100644
index 0000000000..d1d8f9f7ff
--- /dev/null
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/encodeexception/WSClientIT.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2013, 2023 Oracle and/or its affiliates and others.
+ * All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+/*
+ * $Id:$
+ */
+package com.sun.ts.tests.websocket.api.jakarta.websocket.encodeexception;
+
+import java.nio.ByteBuffer;
+
+import org.junit.jupiter.api.Test;
+
+import com.sun.ts.lib.util.TestUtil;
+
+import jakarta.websocket.EncodeException;
+
+public class WSClientIT {
+
+ /* Run test */
+ /*
+ * @testName: constructorTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:51; WebSocket:JAVADOC:53;
+ *
+ * @test_Strategy: Test constructor EncodeException(Object, String)
+ */
+ @Test
+ public void constructorTest() throws Exception {
+ boolean passed = true;
+ String reason = "TCK: Cannot encode the message";
+ String encoded_message = "xyz for now";
+
+ EncodeException eex = new EncodeException(encoded_message, reason);
+
+ if (!encoded_message.equals(eex.getObject())) {
+ passed = false;
+ TestUtil.logErr("Expected message " + encoded_message + ", returned" + eex.getObject());
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ /*
+ * @testName: constructorTest1
+ *
+ * @assertion_ids: WebSocket:JAVADOC:52; WebSocket:JAVADOC:53;
+ *
+ * @test_Strategy: Test constructor EncodeException(Object, String, Throwable)
+ */
+ @Test
+ public void constructorTest1() throws Exception {
+ boolean passed = true;
+ String reason = "TCK: Cannot decode the message";
+ ByteBuffer encoded_message = ByteBuffer.allocate(20);
+ encoded_message.put("xyz for now".getBytes());
+
+ EncodeException eex = new EncodeException(encoded_message, reason, new Throwable("TCK Cannot encode"));
+
+ if (!encoded_message.equals(eex.getObject())) {
+ passed = false;
+ TestUtil.logErr("Expected message " + encoded_message + ", returned" + eex.getObject());
+ }
+
+ if (passed == false) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ public void cleanup() {
+ }
+}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/server/serverendpointconfig/TCKEndpoint.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/server/serverendpointconfig/TCKEndpoint.java
index 79121495c2..b4977f042a 100644
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/server/serverendpointconfig/TCKEndpoint.java
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/server/serverendpointconfig/TCKEndpoint.java
@@ -26,8 +26,8 @@
public class TCKEndpoint extends Endpoint {
- @Override
- public void onOpen(Session session, EndpointConfig config) {
- System.out.println("========TCKEndpoint");
- }
+ @Override
+ public void onOpen(Session session, EndpointConfig config) {
+ System.out.println("========TCKEndpoint");
+ }
}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/server/serverendpointconfig/WSClient.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/server/serverendpointconfig/WSClient.java
deleted file mode 100644
index f5b2b25833..0000000000
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/server/serverendpointconfig/WSClient.java
+++ /dev/null
@@ -1,1263 +0,0 @@
-/*
- * Copyright (c) 2013, 2020 Oracle and/or its affiliates and others.
- * All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-/*
- * $Id:$
- */
-package com.sun.ts.tests.websocket.api.jakarta.websocket.server.serverendpointconfig;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import com.sun.javatest.Status;
-import com.sun.ts.lib.harness.ServiceEETest;
-import com.sun.ts.lib.util.TestUtil;
-import com.sun.ts.tests.websocket.common.TCKExtension;
-
-import jakarta.websocket.Decoder;
-import jakarta.websocket.Encoder;
-import jakarta.websocket.Extension;
-import jakarta.websocket.server.ServerEndpointConfig;
-
-public class WSClient extends ServiceEETest {
-
- public static void main(String[] args) {
- WSClient theTests = new WSClient();
- Status s = theTests.run(args, new PrintWriter(System.out),
- new PrintWriter(System.err));
- s.exit();
- }
-
- /*
- * @class.setup_props: webServerHost; webServerPort; ws_wait; ts_home;
- */
- @SuppressWarnings("unused")
- public void setup(String[] args, Properties p) throws Exception {
- }
-
- /* Run test */
- /*
- * @testName: constructortest
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:70; WebSocket:JAVADOC:71; WebSocket:JAVADOC:195;
- * WebSocket:JAVADOC:197;
- *
- *
- * @test_Strategy: Test constructor
- */
- public void constructortest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, "/TCKTestServer").build();
-
- List tmp = sec.getDecoders();
- if (tmp != null) {
- TestUtil.logTrace("getDecoders() return non-null List");
- if (!tmp.isEmpty()) {
- log.append("getDecoders() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- tmp = sec.getEncoders();
- if (tmp != null) {
- TestUtil.logTrace("getEncoders() return non-null List");
- if (!tmp.isEmpty()) {
- log.append("getEncoders() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- tmp = sec.getExtensions();
- if (tmp != null) {
- TestUtil.logTrace("getExtensions() return non-null List");
- if (!tmp.isEmpty()) {
- log.append("getExtensions() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- tmp = sec.getSubprotocols();
- if (tmp != null) {
- TestUtil.logTrace("getSubprotocols() return non-null List");
- if (!tmp.isEmpty()) {
- log.append("getSubprotocols() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
-
- if (passed == false) {
- throw new Exception("Test failed");
- }
- }
-
- /*
- * @testName: subprotocolsTest
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:197; WebSocket:JAVADOC:204;
- *
- * @test_Strategy:
- */
- public void subprotocolsTest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap",
- "WAMP", "v10.stomp", "v11.stomp", "v12.stomp");
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, "/TCKTestServer")
- .subprotocols(expected_subprotocols).build();
-
- List tmp = sec.getSubprotocols();
- if (tmp != null) {
- log.append("getSubprotocols() return non-null List|");
- if (!tmp.isEmpty()) {
- log.append("getSubprotocols() return non-empty List with size "
- + tmp.size() + "|");
- int size_actual = tmp.size();
- if (size_actual == expected_subprotocols.size()) {
- for (String subpro : tmp) {
- if (expected_subprotocols.contains(subpro)) {
- log.append("sub protocol " + subpro + " found is expected|");
- } else {
- passed = false;
- log.append(
- "sub protocol " + subpro + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append("getSubprotocols() returned not exactly the same size.");
- log.append("Expecting seven, returned " + size_actual);
- }
- } else {
- log.append("getSubprotocols() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getSubprotocols() return null list");
- }
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: extensionsTest
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:195; WebSocket:JAVADOC:203;
- *
- * @test_Strategy:
- */
- public void extensionsTest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- final List extension1 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
- add(new TCKExtension.TCKParameter("prop", "val"));
- }
- };
-
- final List extension2 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("prop1", "val1"));
- add(new TCKExtension.TCKParameter("prop2", "val2"));
- }
- };
-
- ArrayList extensions = new ArrayList<>();
- extensions.add(new TCKExtension("ext1", extension1));
- extensions.add(new TCKExtension("ext2", extension2));
-
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, "/TCKTestServer").extensions(extensions)
- .build();
- List tmp = sec.getExtensions();
- if (tmp != null) {
- log.append("getExtensions() return non-null List|");
- if (!tmp.isEmpty()) {
- log.append("getExtensions() return non-empty List with size "
- + tmp.size() + "|");
- int size_actual = tmp.size();
- if (size_actual == extensions.size()) {
- for (Extension ext : tmp) {
- if (extensions.contains(ext)) {
- log.append("extension " + ext + " found is expected|");
- } else {
- passed = false;
- log.append("extension " + ext + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getExtensions() returned not exactly the same amount of extensions.");
- log.append("Expecting two, returned " + size_actual);
- }
- } else {
- log.append("getExtensions() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getExtensions() return null list|");
- }
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: constructorTest1
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:195; WebSocket:JAVADOC:197; WebSocket:JAVADOC:203;
- * WebSocket:JAVADOC:204;
- *
- *
- * @test_Strategy:
- */
- public void constructorTest1() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap",
- "WAMP", "v10.stomp", "v11.stomp", "v12.stomp");
-
- final List extension1 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
- add(new TCKExtension.TCKParameter("prop", "val"));
- }
- };
-
- final List extension2 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("prop1", "val1"));
- add(new TCKExtension.TCKParameter("prop2", "val2"));
- }
- };
-
- ArrayList extensions = new ArrayList<>();
- extensions.add(new TCKExtension("ext1", extension1));
- extensions.add(new TCKExtension("ext2", extension2));
-
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, "/TCKTestServer")
- .subprotocols(expected_subprotocols).extensions(extensions).build();
-
- List tmpe = sec.getExtensions();
- List tmpp = sec.getSubprotocols();
-
- if (tmpe != null) {
- log.append("getExtensions() return non-null List|");
- if (!tmpe.isEmpty()) {
- log.append("getExtensions() return non-empty List with size "
- + tmpe.size() + "|");
- int size_actual = tmpe.size();
- if (size_actual == extensions.size()) {
- for (Extension ext : tmpe) {
- if (extensions.contains(ext)) {
- log.append("extension " + ext + " found is expected|");
- } else {
- passed = false;
- log.append("extension " + ext + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getExtensions() returned not exactly the same amount of extensions.");
- log.append("Expecting two, returned " + size_actual);
- }
- } else {
- log.append("getExtensions() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getExtensions() return null list|");
- }
-
- if (tmpp != null) {
- log.append("getSubprotocols() return non-null List|");
- if (!tmpp.isEmpty()) {
- log.append("getSubprotocols() return non-empty List with size "
- + tmpp.size() + "|");
- int size_actual = tmpp.size();
- if (size_actual == expected_subprotocols.size()) {
- for (String subpro : tmpp) {
- if (expected_subprotocols.contains(subpro)) {
- log.append("sub protocol " + subpro + " found is expected|");
- } else {
- passed = false;
- log.append(
- "sub protocol " + subpro + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append("getSubprotocols() returned not exactly the same size.");
- log.append("Expecting seven, returned " + size_actual);
- }
- } else {
- log.append("getSubprotocols() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getSubprotocols() return null list");
- }
-
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: encodersTest
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:71; WebSocket:JAVADOC:202;
- *
- * @test_Strategy:
- */
- public void encodersTest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List> expected_encoders = new ArrayList<>();
- expected_encoders
- .add(com.sun.ts.tests.websocket.common.util.ErrorEncoder.class);
- expected_encoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanEncoder.class);
-
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, "/TCKTestServer")
- .encoders(expected_encoders).build();
-
- List> tmp = sec.getEncoders();
- if (tmp != null) {
- log.append("getEncoders() return non-null List");
- if (!tmp.isEmpty()) {
- int size = tmp.size();
- log.append(
- "getEncoders() return non-empty List with size " + size + "|");
- if (size == 2) {
- for (Class extends Encoder> encoder : tmp) {
- log.append("Encoder " + encoder + " found ");
- if (expected_encoders.contains(encoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getEncoders() returned not exactly the same size.");
- log.append("Expecting two, returned " + size);
- }
- } else {
- log.append("getEncoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getEncoders() return null list");
- }
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: decodersTest
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:70; WebSocket:JAVADOC:201;
- *
- * @test_Strategy:
- */
- public void decodersTest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List> expected_decoders = new ArrayList<>();
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
-
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, "/TCKTestServer")
- .decoders(expected_decoders).build();
-
- List> tmp = sec.getDecoders();
- if (tmp != null) {
- log.append("getDecoders() return non-null List|");
- if (!tmp.isEmpty()) {
- int size = tmp.size();
- log.append("getDecoders() return non-empty List with size "
- + tmp.size() + "|");
- if (size == 2) {
- for (Class extends Decoder> decoder : tmp) {
- log.append("Decoder " + decoder + " found ");
- if (expected_decoders.contains(decoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getDecoders() returned not exactly the same size.");
- log.append("Expecting two, returned " + size);
- }
- } else {
- log.append("getDecoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getDecoders() return null list|");
- }
-
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: constructorTest2
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:195; WebSocket:JAVADOC:197; WebSocket:JAVADOC:203;
- * WebSocket:JAVADOC:204; WebSocket:JAVADOC:70; WebSocket:JAVADOC:201;
- *
- * @test_Strategy:
- */
- public void constructorTest2() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap",
- "WAMP", "v10.stomp", "v11.stomp", "v12.stomp");
-
- List> expected_decoders = new ArrayList<>();
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
-
- final List extension1 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
- add(new TCKExtension.TCKParameter("prop", "val"));
- }
- };
-
- final List extension2 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("prop1", "val1"));
- add(new TCKExtension.TCKParameter("prop2", "val2"));
- }
- };
-
- ArrayList extensions = new ArrayList<>();
- extensions.add(new TCKExtension("ext1", extension1));
- extensions.add(new TCKExtension("ext2", extension2));
-
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, "/TCKTestServer")
- .subprotocols(expected_subprotocols).extensions(extensions)
- .decoders(expected_decoders).build();
-
- List tmpe = sec.getExtensions();
- List tmpp = sec.getSubprotocols();
- List> tmpd = sec.getDecoders();
-
- if (tmpe != null) {
- log.append("getExtensions() return non-null List|");
- if (!tmpe.isEmpty()) {
- log.append("getExtensions() return non-empty List with size "
- + tmpe.size() + "|");
- int size_actual = tmpe.size();
- if (size_actual == extensions.size()) {
- for (Extension ext : tmpe) {
- if (extensions.contains(ext)) {
- log.append("extension " + ext + " found is expected|");
- } else {
- passed = false;
- log.append("extension " + ext + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getExtensions() returned not exactly the same amount of extensions.");
- log.append("Expecting two, returned " + size_actual);
- }
- } else {
- log.append("getExtensions() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getExtensions() return null list|");
- }
-
- if (tmpp != null) {
- log.append("getSubprotocols() return non-null List|");
- if (!tmpp.isEmpty()) {
- log.append("getSubprotocols() return non-empty List with size "
- + tmpp.size() + "|");
- int size_actual = tmpp.size();
- if (size_actual == expected_subprotocols.size()) {
- for (String subpro : tmpp) {
- if (expected_subprotocols.contains(subpro)) {
- log.append("sub protocol " + subpro + " found is expected|");
- } else {
- passed = false;
- log.append(
- "sub protocol " + subpro + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append("getSubprotocols() returned not exactly the same size.");
- log.append("Expecting seven, returned " + size_actual);
- }
- } else {
- log.append("getSubprotocols() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getSubprotocols() return null list");
- }
-
- if (tmpd != null) {
- log.append("getDecoders() return non-null List|");
- if (!tmpd.isEmpty()) {
- int size = tmpd.size();
- log.append("getDecoders() return non-empty List with size "
- + tmpd.size() + "|");
- if (size == 2) {
- for (Class extends Decoder> decoder : tmpd) {
- log.append("Decoder " + decoder + " found ");
- if (expected_decoders.contains(decoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getDecoders() returned not exactly the same size.");
- log.append("Expecting seven, returned " + size);
- }
- } else {
- log.append("getDecoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getDecoders() return null list|");
- }
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: constructorTest3
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:195; WebSocket:JAVADOC:197; WebSocket:JAVADOC:203;
- * WebSocket:JAVADOC:204; WebSocket:JAVADOC:70; WebSocket:JAVADOC:71;
- * WebSocket:JAVADOC:201; WebSocket:JAVADOC:202;
- *
- * @test_Strategy:
- */
- public void constructorTest3() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap",
- "WAMP", "v10.stomp", "v11.stomp", "v12.stomp");
-
- List> expected_encoders = new ArrayList<>();
- expected_encoders
- .add(com.sun.ts.tests.websocket.common.util.ErrorEncoder.class);
- expected_encoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanEncoder.class);
-
- List> expected_decoders = new ArrayList<>();
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
-
- final List extension1 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
- add(new TCKExtension.TCKParameter("prop", "val"));
- }
- };
-
- final List extension2 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("prop1", "val1"));
- add(new TCKExtension.TCKParameter("prop2", "val2"));
- }
- };
-
- ArrayList extensions = new ArrayList<>();
- extensions.add(new TCKExtension("ext1", extension1));
- extensions.add(new TCKExtension("ext2", extension2));
-
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, "/TCKTestServer")
- .subprotocols(expected_subprotocols).extensions(extensions)
- .decoders(expected_decoders).encoders(expected_encoders).build();
-
- List tmpe = sec.getExtensions();
- List tmpp = sec.getSubprotocols();
- List> tmpd = sec.getDecoders();
-
- if (tmpe != null) {
- log.append("getExtensions() return non-null List|");
- if (!tmpe.isEmpty()) {
- log.append("getExtensions() return non-empty List with size "
- + tmpe.size() + "|");
- int size_actual = tmpe.size();
- if (size_actual == extensions.size()) {
- for (Extension ext : tmpe) {
- if (extensions.contains(ext)) {
- log.append("extension " + ext + " found is expected|");
- } else {
- passed = false;
- log.append("extension " + ext + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getExtensions() returned not exactly the same amount of extensions.");
- log.append("Expecting two, returned " + size_actual);
- }
- } else {
- log.append("getExtensions() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getExtensions() return null list|");
- }
-
- if (tmpp != null) {
- log.append("getSubprotocols() return non-null List|");
- if (!tmpp.isEmpty()) {
- log.append("getSubprotocols() return non-empty List with size "
- + tmpp.size() + "|");
- int size_actual = tmpp.size();
- if (size_actual == expected_subprotocols.size()) {
- for (String subpro : tmpp) {
- if (expected_subprotocols.contains(subpro)) {
- log.append("sub protocol " + subpro + " found is expected|");
- } else {
- passed = false;
- log.append(
- "sub protocol " + subpro + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append("getSubprotocols() returned not exactly the same size.");
- log.append("Expecting seven, returned " + size_actual);
- }
- } else {
- log.append("getSubprotocols() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getSubprotocols() return null list");
- }
-
- if (tmpd != null) {
- log.append("getDecoders() return non-null List|");
- if (!tmpd.isEmpty()) {
- int size = tmpd.size();
- log.append("getDecoders() return non-empty List with size "
- + tmpd.size() + "|");
- if (size == 2) {
- for (Class extends Decoder> decoder : tmpd) {
- log.append("Decoder " + decoder + " found ");
- if (expected_decoders.contains(decoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getDecoders() returned not exactly the same size.");
- log.append("Expecting two, returned " + size);
- }
- } else {
- log.append("getDecoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getDecoders() return null list|");
- }
-
- List> tmpen = sec.getEncoders();
- if (tmpen != null) {
- log.append("getEncoders() return non-null List");
- if (!tmpen.isEmpty()) {
- int size = tmpen.size();
- log.append(
- "getEncoders() return non-empty List with size " + size + "|");
- if (size == 2) {
- for (Class extends Encoder> encoder : tmpen) {
- log.append("Encoder " + encoder + " found ");
- if (expected_encoders.contains(encoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getEncoders() returned not exactly the same size.");
- log.append("Expecting two, returned " + size);
- }
- } else {
- log.append("getEncoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getEncoders() return null list");
- }
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: configuratorTest
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:199; WebSocket:JAVADOC:193; WebSocket:JAVADOC:206;
- * WebSocket:JAVADOC:207; WebSocket:JAVADOC:69;
- *
- * @test_Strategy:
- */
- public void configuratorTest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- ServerEndpointConfig.Configurator config = new TCKConfigurator();
-
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, "/TCKTestServer").configurator(config)
- .build();
-
- ServerEndpointConfig.Configurator tmpc = sec.getConfigurator();
-
- if (!tmpc.getClass().equals(
- com.sun.ts.tests.websocket.api.jakarta.websocket.server.serverendpointconfig.TCKConfigurator.class)) {
- log.append("getConfigurator() returned a different Configurator: "
- + tmpc.getClass().getName());
- passed = false;
- }
-
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: constructorTest4
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:199; WebSocket:JAVADOC:193; WebSocket:JAVADOC:206;
- * WebSocket:JAVADOC:207; WebSocket:JAVADOC:69; WebSocket:JAVADOC:70;
- * WebSocket:JAVADOC:71; WebSocket:JAVADOC:195; WebSocket:JAVADOC:197;
- *
- * @test_Strategy:
- */
- public void constructorTest4() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- ServerEndpointConfig.Configurator config = new TCKConfigurator();
-
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, "/TCKTestServer").configurator(config)
- .build();
- List tmp = sec.getDecoders();
- if (tmp != null) {
- TestUtil.logTrace("getDecoders() return non-null List");
- if (!tmp.isEmpty()) {
- log.append("getDecoders() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- tmp = sec.getEncoders();
- if (tmp != null) {
- TestUtil.logTrace("getEncoders() return non-null List");
- if (!tmp.isEmpty()) {
- log.append("getEncoders() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- tmp = sec.getExtensions();
- if (tmp != null) {
- TestUtil.logTrace("getExtensions() return non-null List");
- if (!tmp.isEmpty()) {
- log.append("getExtensions() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- tmp = sec.getSubprotocols();
- if (tmp != null) {
- TestUtil.logTrace("getSubprotocols() return non-null List");
- if (!tmp.isEmpty()) {
- log.append("getSubprotocols() return non-empty List with size "
- + tmp.size() + "|");
- passed = false;
- }
- }
-
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: getEndpointClassTest
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:194;
- *
- * @test_Strategy:
- */
- public void getEndpointClassTest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, "/TCKTestServer").build();
-
- Class tmp = sec.getEndpointClass();
-
- if (!tmp.equals(
- com.sun.ts.tests.websocket.api.jakarta.websocket.server.serverendpointconfig.TCKEndpoint.class)) {
- log.append(
- "getEndpointClass() returned a different Class: " + tmp.getName());
- passed = false;
- }
-
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: getPathTest
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:196;
- *
- * @test_Strategy:
- */
- public void getPathTest() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
- String path = "/TCKTestServer";
-
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, path).build();
-
- String tmp = sec.getPath();
-
- if (!path.equals(tmp)) {
- log.append("getPath() returned a different path: " + tmp);
- passed = false;
- }
-
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- /*
- * @testName: constructorTest5
- *
- * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
- * WebSocket:JAVADOC:199; WebSocket:JAVADOC:193; WebSocket:JAVADOC:206;
- * WebSocket:JAVADOC:207; WebSocket:JAVADOC:69; WebSocket:JAVADOC:195;
- * WebSocket:JAVADOC:197; WebSocket:JAVADOC:203; WebSocket:JAVADOC:204;
- * WebSocket:JAVADOC:70; WebSocket:JAVADOC:71; WebSocket:JAVADOC:201;
- * WebSocket:JAVADOC:202;
- *
- * @test_Strategy:
- */
- public void constructorTest5() throws Exception {
- boolean passed = true;
- StringBuffer log = new StringBuffer();
-
- List expected_subprotocols = Arrays.asList("JSON", "XML", "XMPP",
- "Hessian", "Quake", "PUB/SUB", "Query");
-
- List> expected_encoders = new ArrayList<>();
- expected_encoders
- .add(com.sun.ts.tests.websocket.common.util.ErrorEncoder.class);
- expected_encoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanEncoder.class);
-
- List> expected_decoders = new ArrayList<>();
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
- expected_decoders
- .add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
-
- ServerEndpointConfig.Configurator config = new TCKConfigurator();
-
- final List extension1 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
- add(new TCKExtension.TCKParameter("prop", "val"));
- }
- };
-
- final List extension2 = new ArrayList() {
-
- {
- add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
- add(new TCKExtension.TCKParameter("prop1", "val1"));
- add(new TCKExtension.TCKParameter("prop2", "val2"));
- }
- };
-
- ArrayList extensions = new ArrayList<>();
- extensions.add(new TCKExtension("ext1", extension1));
- extensions.add(new TCKExtension("ext2", extension2));
-
- try {
- ServerEndpointConfig sec = ServerEndpointConfig.Builder
- .create(TCKEndpoint.class, "/TCKTestServer")
- .subprotocols(expected_subprotocols).extensions(extensions)
- .decoders(expected_decoders).encoders(expected_encoders)
- .configurator(config).build();
-
- List tmpe = sec.getExtensions();
- List tmpp = sec.getSubprotocols();
- List> tmpd = sec.getDecoders();
-
- if (tmpe != null) {
- log.append("getExtensions() return non-null List|");
- if (!tmpe.isEmpty()) {
- log.append("getExtensions() return non-empty List with size "
- + tmpe.size() + "|");
- int size_actual = tmpe.size();
- if (size_actual == extensions.size()) {
- for (Extension ext : tmpe) {
- if (extensions.contains(ext)) {
- log.append("extension " + ext + " found is expected|");
- } else {
- passed = false;
- log.append("extension " + ext + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append(
- "getExtensions() returned not exactly the same amount of extensions.");
- log.append("Expecting two, returned " + size_actual);
- }
- } else {
- log.append("getExtensions() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getExtensions() return null list|");
- }
-
- if (tmpp != null) {
- log.append("getSubprotocols() return non-null List|");
- if (!tmpp.isEmpty()) {
- log.append("getSubprotocols() return non-empty List with size "
- + tmpp.size() + "|");
- int size_actual = tmpp.size();
- if (size_actual == expected_subprotocols.size()) {
- for (String subpro : tmpp) {
- if (expected_subprotocols.contains(subpro)) {
- log.append("sub protocol " + subpro + " found is expected|");
- } else {
- passed = false;
- log.append(
- "sub protocol " + subpro + " found is not expected|");
- }
- }
- } else {
- passed = false;
- log.append("getSubprotocols() returned not exactly the same size.");
- log.append("Expecting seven, returned " + size_actual);
- }
- } else {
- log.append("getSubprotocols() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getSubprotocols() return null list");
- }
-
- if (tmpd != null) {
- log.append("getDecoders() return non-null List|");
- if (!tmpd.isEmpty()) {
- int size = tmpd.size();
- log.append("getDecoders() return non-empty List with size "
- + tmpd.size() + "|");
- if (size == 2) {
- for (Class extends Decoder> decoder : tmpd) {
- log.append("Decoder " + decoder + " found ");
- if (expected_decoders.contains(decoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getDecoders() returned not exactly the same size.");
- log.append("Expecting two, returned " + size);
- }
- } else {
- log.append("getDecoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getDecoders() return null list|");
- }
-
- List> tmpen = sec.getEncoders();
- if (tmpen != null) {
- log.append("getEncoders() return non-null List");
- if (!tmpen.isEmpty()) {
- int size = tmpen.size();
- log.append(
- "getEncoders() return non-empty List with size " + size + "|");
- if (size == 2) {
- for (Class extends Encoder> encoder : tmpen) {
- log.append("Encoder " + encoder + " found ");
- if (expected_encoders.contains(encoder)) {
- log.append("is expected.|");
- } else {
- passed = false;
- log.append("is not expected.|");
- }
- }
- } else {
- passed = false;
- log.append("getEncoders() returned not exactly the same size.");
- log.append("Expecting two, returned " + size);
- }
- } else {
- log.append("getEncoders() return empty List|");
- passed = false;
- }
- } else {
- passed = false;
- log.append("getEncoders() return null list");
- }
- } catch (Exception e) {
- log.append(e.getMessage());
- passed = false;
- }
-
- System.out.println(log.toString());
-
- if (passed == false) {
- throw new Exception("Test failed: " + log.toString());
- }
- }
-
- public void cleanup() {
- }
-}
-
-class TCKConfigurator extends ServerEndpointConfig.Configurator {
-
- public static final TCKEndpoint testEndpoint = new TCKEndpoint();
-
- @Override
- public T getEndpointInstance(Class endpointClass)
- throws InstantiationException {
- if (endpointClass.equals(TCKEndpoint.class)) {
- return (T) testEndpoint;
- }
- throw new InstantiationException();
- }
-}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/server/serverendpointconfig/WSClientIT.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/server/serverendpointconfig/WSClientIT.java
new file mode 100644
index 0000000000..ef4b4685e3
--- /dev/null
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/server/serverendpointconfig/WSClientIT.java
@@ -0,0 +1,1208 @@
+/*
+ * Copyright (c) 2013, 2023 Oracle and/or its affiliates and others.
+ * All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+/*
+ * $Id:$
+ */
+package com.sun.ts.tests.websocket.api.jakarta.websocket.server.serverendpointconfig;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit5.ArquillianExtension;
+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 com.sun.ts.lib.util.TestUtil;
+import com.sun.ts.tests.websocket.common.TCKExtension;
+
+import jakarta.websocket.Decoder;
+import jakarta.websocket.Encoder;
+import jakarta.websocket.Extension;
+import jakarta.websocket.server.ServerEndpointConfig;
+
+@ExtendWith(ArquillianExtension.class)
+public class WSClientIT {
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() throws IOException {
+
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, "websocket_serverendpointconfig.war");
+ archive.addClasses(TCKEndpoint.class);
+ return archive;
+ }
+
+ /* Run test */
+ /*
+ * @testName: constructortest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:70; WebSocket:JAVADOC:71; WebSocket:JAVADOC:195;
+ * WebSocket:JAVADOC:197;
+ *
+ *
+ * @test_Strategy: Test constructor
+ */
+ @Test
+ public void constructortest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, "/TCKTestServer").build();
+
+ List tmp = sec.getDecoders();
+ if (tmp != null) {
+ TestUtil.logTrace("getDecoders() return non-null List");
+ if (!tmp.isEmpty()) {
+ log.append("getDecoders() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ tmp = sec.getEncoders();
+ if (tmp != null) {
+ TestUtil.logTrace("getEncoders() return non-null List");
+ if (!tmp.isEmpty()) {
+ log.append("getEncoders() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ tmp = sec.getExtensions();
+ if (tmp != null) {
+ TestUtil.logTrace("getExtensions() return non-null List");
+ if (!tmp.isEmpty()) {
+ log.append("getExtensions() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ tmp = sec.getSubprotocols();
+ if (tmp != null) {
+ TestUtil.logTrace("getSubprotocols() return non-null List");
+ if (!tmp.isEmpty()) {
+ log.append("getSubprotocols() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+
+ if (passed == false) {
+ throw new Exception("Test failed");
+ }
+ }
+
+ /*
+ * @testName: subprotocolsTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:197; WebSocket:JAVADOC:204;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void subprotocolsTest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap", "WAMP", "v10.stomp", "v11.stomp",
+ "v12.stomp");
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, "/TCKTestServer")
+ .subprotocols(expected_subprotocols).build();
+
+ List tmp = sec.getSubprotocols();
+ if (tmp != null) {
+ log.append("getSubprotocols() return non-null List|");
+ if (!tmp.isEmpty()) {
+ log.append("getSubprotocols() return non-empty List with size " + tmp.size() + "|");
+ int size_actual = tmp.size();
+ if (size_actual == expected_subprotocols.size()) {
+ for (String subpro : tmp) {
+ if (expected_subprotocols.contains(subpro)) {
+ log.append("sub protocol " + subpro + " found is expected|");
+ } else {
+ passed = false;
+ log.append("sub protocol " + subpro + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getSubprotocols() returned not exactly the same size.");
+ log.append("Expecting seven, returned " + size_actual);
+ }
+ } else {
+ log.append("getSubprotocols() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getSubprotocols() return null list");
+ }
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: extensionsTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:195; WebSocket:JAVADOC:203;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void extensionsTest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ final List extension1 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
+ add(new TCKExtension.TCKParameter("prop", "val"));
+ }
+ };
+
+ final List extension2 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("prop1", "val1"));
+ add(new TCKExtension.TCKParameter("prop2", "val2"));
+ }
+ };
+
+ ArrayList extensions = new ArrayList<>();
+ extensions.add(new TCKExtension("ext1", extension1));
+ extensions.add(new TCKExtension("ext2", extension2));
+
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, "/TCKTestServer")
+ .extensions(extensions).build();
+ List tmp = sec.getExtensions();
+ if (tmp != null) {
+ log.append("getExtensions() return non-null List|");
+ if (!tmp.isEmpty()) {
+ log.append("getExtensions() return non-empty List with size " + tmp.size() + "|");
+ int size_actual = tmp.size();
+ if (size_actual == extensions.size()) {
+ for (Extension ext : tmp) {
+ if (extensions.contains(ext)) {
+ log.append("extension " + ext + " found is expected|");
+ } else {
+ passed = false;
+ log.append("extension " + ext + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() returned not exactly the same amount of extensions.");
+ log.append("Expecting two, returned " + size_actual);
+ }
+ } else {
+ log.append("getExtensions() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() return null list|");
+ }
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: constructorTest1
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:195; WebSocket:JAVADOC:197; WebSocket:JAVADOC:203;
+ * WebSocket:JAVADOC:204;
+ *
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void constructorTest1() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap", "WAMP", "v10.stomp", "v11.stomp",
+ "v12.stomp");
+
+ final List extension1 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
+ add(new TCKExtension.TCKParameter("prop", "val"));
+ }
+ };
+
+ final List extension2 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("prop1", "val1"));
+ add(new TCKExtension.TCKParameter("prop2", "val2"));
+ }
+ };
+
+ ArrayList extensions = new ArrayList<>();
+ extensions.add(new TCKExtension("ext1", extension1));
+ extensions.add(new TCKExtension("ext2", extension2));
+
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, "/TCKTestServer")
+ .subprotocols(expected_subprotocols).extensions(extensions).build();
+
+ List tmpe = sec.getExtensions();
+ List tmpp = sec.getSubprotocols();
+
+ if (tmpe != null) {
+ log.append("getExtensions() return non-null List|");
+ if (!tmpe.isEmpty()) {
+ log.append("getExtensions() return non-empty List with size " + tmpe.size() + "|");
+ int size_actual = tmpe.size();
+ if (size_actual == extensions.size()) {
+ for (Extension ext : tmpe) {
+ if (extensions.contains(ext)) {
+ log.append("extension " + ext + " found is expected|");
+ } else {
+ passed = false;
+ log.append("extension " + ext + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() returned not exactly the same amount of extensions.");
+ log.append("Expecting two, returned " + size_actual);
+ }
+ } else {
+ log.append("getExtensions() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() return null list|");
+ }
+
+ if (tmpp != null) {
+ log.append("getSubprotocols() return non-null List|");
+ if (!tmpp.isEmpty()) {
+ log.append("getSubprotocols() return non-empty List with size " + tmpp.size() + "|");
+ int size_actual = tmpp.size();
+ if (size_actual == expected_subprotocols.size()) {
+ for (String subpro : tmpp) {
+ if (expected_subprotocols.contains(subpro)) {
+ log.append("sub protocol " + subpro + " found is expected|");
+ } else {
+ passed = false;
+ log.append("sub protocol " + subpro + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getSubprotocols() returned not exactly the same size.");
+ log.append("Expecting seven, returned " + size_actual);
+ }
+ } else {
+ log.append("getSubprotocols() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getSubprotocols() return null list");
+ }
+
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: encodersTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:71; WebSocket:JAVADOC:202;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void encodersTest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List> expected_encoders = new ArrayList<>();
+ expected_encoders.add(com.sun.ts.tests.websocket.common.util.ErrorEncoder.class);
+ expected_encoders.add(com.sun.ts.tests.websocket.common.util.BooleanEncoder.class);
+
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, "/TCKTestServer")
+ .encoders(expected_encoders).build();
+
+ List> tmp = sec.getEncoders();
+ if (tmp != null) {
+ log.append("getEncoders() return non-null List");
+ if (!tmp.isEmpty()) {
+ int size = tmp.size();
+ log.append("getEncoders() return non-empty List with size " + size + "|");
+ if (size == 2) {
+ for (Class extends Encoder> encoder : tmp) {
+ log.append("Encoder " + encoder + " found ");
+ if (expected_encoders.contains(encoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getEncoders() returned not exactly the same size.");
+ log.append("Expecting two, returned " + size);
+ }
+ } else {
+ log.append("getEncoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getEncoders() return null list");
+ }
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: decodersTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:70; WebSocket:JAVADOC:201;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void decodersTest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List> expected_decoders = new ArrayList<>();
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
+
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, "/TCKTestServer")
+ .decoders(expected_decoders).build();
+
+ List> tmp = sec.getDecoders();
+ if (tmp != null) {
+ log.append("getDecoders() return non-null List|");
+ if (!tmp.isEmpty()) {
+ int size = tmp.size();
+ log.append("getDecoders() return non-empty List with size " + tmp.size() + "|");
+ if (size == 2) {
+ for (Class extends Decoder> decoder : tmp) {
+ log.append("Decoder " + decoder + " found ");
+ if (expected_decoders.contains(decoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() returned not exactly the same size.");
+ log.append("Expecting two, returned " + size);
+ }
+ } else {
+ log.append("getDecoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() return null list|");
+ }
+
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: constructorTest2
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:195; WebSocket:JAVADOC:197; WebSocket:JAVADOC:203;
+ * WebSocket:JAVADOC:204; WebSocket:JAVADOC:70; WebSocket:JAVADOC:201;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void constructorTest2() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap", "WAMP", "v10.stomp", "v11.stomp",
+ "v12.stomp");
+
+ List> expected_decoders = new ArrayList<>();
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
+
+ final List extension1 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
+ add(new TCKExtension.TCKParameter("prop", "val"));
+ }
+ };
+
+ final List extension2 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("prop1", "val1"));
+ add(new TCKExtension.TCKParameter("prop2", "val2"));
+ }
+ };
+
+ ArrayList extensions = new ArrayList<>();
+ extensions.add(new TCKExtension("ext1", extension1));
+ extensions.add(new TCKExtension("ext2", extension2));
+
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, "/TCKTestServer")
+ .subprotocols(expected_subprotocols).extensions(extensions).decoders(expected_decoders).build();
+
+ List tmpe = sec.getExtensions();
+ List tmpp = sec.getSubprotocols();
+ List> tmpd = sec.getDecoders();
+
+ if (tmpe != null) {
+ log.append("getExtensions() return non-null List|");
+ if (!tmpe.isEmpty()) {
+ log.append("getExtensions() return non-empty List with size " + tmpe.size() + "|");
+ int size_actual = tmpe.size();
+ if (size_actual == extensions.size()) {
+ for (Extension ext : tmpe) {
+ if (extensions.contains(ext)) {
+ log.append("extension " + ext + " found is expected|");
+ } else {
+ passed = false;
+ log.append("extension " + ext + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() returned not exactly the same amount of extensions.");
+ log.append("Expecting two, returned " + size_actual);
+ }
+ } else {
+ log.append("getExtensions() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() return null list|");
+ }
+
+ if (tmpp != null) {
+ log.append("getSubprotocols() return non-null List|");
+ if (!tmpp.isEmpty()) {
+ log.append("getSubprotocols() return non-empty List with size " + tmpp.size() + "|");
+ int size_actual = tmpp.size();
+ if (size_actual == expected_subprotocols.size()) {
+ for (String subpro : tmpp) {
+ if (expected_subprotocols.contains(subpro)) {
+ log.append("sub protocol " + subpro + " found is expected|");
+ } else {
+ passed = false;
+ log.append("sub protocol " + subpro + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getSubprotocols() returned not exactly the same size.");
+ log.append("Expecting seven, returned " + size_actual);
+ }
+ } else {
+ log.append("getSubprotocols() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getSubprotocols() return null list");
+ }
+
+ if (tmpd != null) {
+ log.append("getDecoders() return non-null List|");
+ if (!tmpd.isEmpty()) {
+ int size = tmpd.size();
+ log.append("getDecoders() return non-empty List with size " + tmpd.size() + "|");
+ if (size == 2) {
+ for (Class extends Decoder> decoder : tmpd) {
+ log.append("Decoder " + decoder + " found ");
+ if (expected_decoders.contains(decoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() returned not exactly the same size.");
+ log.append("Expecting seven, returned " + size);
+ }
+ } else {
+ log.append("getDecoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() return null list|");
+ }
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: constructorTest3
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:195; WebSocket:JAVADOC:197; WebSocket:JAVADOC:203;
+ * WebSocket:JAVADOC:204; WebSocket:JAVADOC:70; WebSocket:JAVADOC:71;
+ * WebSocket:JAVADOC:201; WebSocket:JAVADOC:202;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void constructorTest3() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List expected_subprotocols = Arrays.asList("MBWS", "MBLWS", "soap", "WAMP", "v10.stomp", "v11.stomp",
+ "v12.stomp");
+
+ List> expected_encoders = new ArrayList<>();
+ expected_encoders.add(com.sun.ts.tests.websocket.common.util.ErrorEncoder.class);
+ expected_encoders.add(com.sun.ts.tests.websocket.common.util.BooleanEncoder.class);
+
+ List> expected_decoders = new ArrayList<>();
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
+
+ final List extension1 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
+ add(new TCKExtension.TCKParameter("prop", "val"));
+ }
+ };
+
+ final List extension2 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("prop1", "val1"));
+ add(new TCKExtension.TCKParameter("prop2", "val2"));
+ }
+ };
+
+ ArrayList extensions = new ArrayList<>();
+ extensions.add(new TCKExtension("ext1", extension1));
+ extensions.add(new TCKExtension("ext2", extension2));
+
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, "/TCKTestServer")
+ .subprotocols(expected_subprotocols).extensions(extensions).decoders(expected_decoders)
+ .encoders(expected_encoders).build();
+
+ List tmpe = sec.getExtensions();
+ List tmpp = sec.getSubprotocols();
+ List> tmpd = sec.getDecoders();
+
+ if (tmpe != null) {
+ log.append("getExtensions() return non-null List|");
+ if (!tmpe.isEmpty()) {
+ log.append("getExtensions() return non-empty List with size " + tmpe.size() + "|");
+ int size_actual = tmpe.size();
+ if (size_actual == extensions.size()) {
+ for (Extension ext : tmpe) {
+ if (extensions.contains(ext)) {
+ log.append("extension " + ext + " found is expected|");
+ } else {
+ passed = false;
+ log.append("extension " + ext + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() returned not exactly the same amount of extensions.");
+ log.append("Expecting two, returned " + size_actual);
+ }
+ } else {
+ log.append("getExtensions() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() return null list|");
+ }
+
+ if (tmpp != null) {
+ log.append("getSubprotocols() return non-null List|");
+ if (!tmpp.isEmpty()) {
+ log.append("getSubprotocols() return non-empty List with size " + tmpp.size() + "|");
+ int size_actual = tmpp.size();
+ if (size_actual == expected_subprotocols.size()) {
+ for (String subpro : tmpp) {
+ if (expected_subprotocols.contains(subpro)) {
+ log.append("sub protocol " + subpro + " found is expected|");
+ } else {
+ passed = false;
+ log.append("sub protocol " + subpro + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getSubprotocols() returned not exactly the same size.");
+ log.append("Expecting seven, returned " + size_actual);
+ }
+ } else {
+ log.append("getSubprotocols() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getSubprotocols() return null list");
+ }
+
+ if (tmpd != null) {
+ log.append("getDecoders() return non-null List|");
+ if (!tmpd.isEmpty()) {
+ int size = tmpd.size();
+ log.append("getDecoders() return non-empty List with size " + tmpd.size() + "|");
+ if (size == 2) {
+ for (Class extends Decoder> decoder : tmpd) {
+ log.append("Decoder " + decoder + " found ");
+ if (expected_decoders.contains(decoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() returned not exactly the same size.");
+ log.append("Expecting two, returned " + size);
+ }
+ } else {
+ log.append("getDecoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() return null list|");
+ }
+
+ List> tmpen = sec.getEncoders();
+ if (tmpen != null) {
+ log.append("getEncoders() return non-null List");
+ if (!tmpen.isEmpty()) {
+ int size = tmpen.size();
+ log.append("getEncoders() return non-empty List with size " + size + "|");
+ if (size == 2) {
+ for (Class extends Encoder> encoder : tmpen) {
+ log.append("Encoder " + encoder + " found ");
+ if (expected_encoders.contains(encoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getEncoders() returned not exactly the same size.");
+ log.append("Expecting two, returned " + size);
+ }
+ } else {
+ log.append("getEncoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getEncoders() return null list");
+ }
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: configuratorTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:199; WebSocket:JAVADOC:193; WebSocket:JAVADOC:206;
+ * WebSocket:JAVADOC:207; WebSocket:JAVADOC:69;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void configuratorTest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ ServerEndpointConfig.Configurator config = new TCKConfigurator();
+
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, "/TCKTestServer")
+ .configurator(config).build();
+
+ ServerEndpointConfig.Configurator tmpc = sec.getConfigurator();
+
+ if (!tmpc.getClass().equals(
+ com.sun.ts.tests.websocket.api.jakarta.websocket.server.serverendpointconfig.TCKConfigurator.class)) {
+ log.append("getConfigurator() returned a different Configurator: " + tmpc.getClass().getName());
+ passed = false;
+ }
+
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: constructorTest4
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:199; WebSocket:JAVADOC:193; WebSocket:JAVADOC:206;
+ * WebSocket:JAVADOC:207; WebSocket:JAVADOC:69; WebSocket:JAVADOC:70;
+ * WebSocket:JAVADOC:71; WebSocket:JAVADOC:195; WebSocket:JAVADOC:197;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void constructorTest4() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ ServerEndpointConfig.Configurator config = new TCKConfigurator();
+
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, "/TCKTestServer")
+ .configurator(config).build();
+ List tmp = sec.getDecoders();
+ if (tmp != null) {
+ TestUtil.logTrace("getDecoders() return non-null List");
+ if (!tmp.isEmpty()) {
+ log.append("getDecoders() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ tmp = sec.getEncoders();
+ if (tmp != null) {
+ TestUtil.logTrace("getEncoders() return non-null List");
+ if (!tmp.isEmpty()) {
+ log.append("getEncoders() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ tmp = sec.getExtensions();
+ if (tmp != null) {
+ TestUtil.logTrace("getExtensions() return non-null List");
+ if (!tmp.isEmpty()) {
+ log.append("getExtensions() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ tmp = sec.getSubprotocols();
+ if (tmp != null) {
+ TestUtil.logTrace("getSubprotocols() return non-null List");
+ if (!tmp.isEmpty()) {
+ log.append("getSubprotocols() return non-empty List with size " + tmp.size() + "|");
+ passed = false;
+ }
+ }
+
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: getEndpointClassTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:194;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void getEndpointClassTest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, "/TCKTestServer").build();
+
+ Class tmp = sec.getEndpointClass();
+
+ if (!tmp.equals(
+ com.sun.ts.tests.websocket.api.jakarta.websocket.server.serverendpointconfig.TCKEndpoint.class)) {
+ log.append("getEndpointClass() returned a different Class: " + tmp.getName());
+ passed = false;
+ }
+
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: getPathTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:196;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void getPathTest() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+ String path = "/TCKTestServer";
+
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, path).build();
+
+ String tmp = sec.getPath();
+
+ if (!path.equals(tmp)) {
+ log.append("getPath() returned a different path: " + tmp);
+ passed = false;
+ }
+
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ /*
+ * @testName: constructorTest5
+ *
+ * @assertion_ids: WebSocket:JAVADOC:200; WebSocket:JAVADOC:198;
+ * WebSocket:JAVADOC:199; WebSocket:JAVADOC:193; WebSocket:JAVADOC:206;
+ * WebSocket:JAVADOC:207; WebSocket:JAVADOC:69; WebSocket:JAVADOC:195;
+ * WebSocket:JAVADOC:197; WebSocket:JAVADOC:203; WebSocket:JAVADOC:204;
+ * WebSocket:JAVADOC:70; WebSocket:JAVADOC:71; WebSocket:JAVADOC:201;
+ * WebSocket:JAVADOC:202;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void constructorTest5() throws Exception {
+ boolean passed = true;
+ StringBuffer log = new StringBuffer();
+
+ List expected_subprotocols = Arrays.asList("JSON", "XML", "XMPP", "Hessian", "Quake", "PUB/SUB",
+ "Query");
+
+ List> expected_encoders = new ArrayList<>();
+ expected_encoders.add(com.sun.ts.tests.websocket.common.util.ErrorEncoder.class);
+ expected_encoders.add(com.sun.ts.tests.websocket.common.util.BooleanEncoder.class);
+
+ List> expected_decoders = new ArrayList<>();
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.ByteDecoder.class);
+ expected_decoders.add(com.sun.ts.tests.websocket.common.util.BooleanDecoder.class);
+
+ ServerEndpointConfig.Configurator config = new TCKConfigurator();
+
+ final List extension1 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("permessage-compress", "foo"));
+ add(new TCKExtension.TCKParameter("prop", "val"));
+ }
+ };
+
+ final List extension2 = new ArrayList() {
+
+ {
+ add(new TCKExtension.TCKParameter("permessage-compress", "deflate"));
+ add(new TCKExtension.TCKParameter("prop1", "val1"));
+ add(new TCKExtension.TCKParameter("prop2", "val2"));
+ }
+ };
+
+ ArrayList extensions = new ArrayList<>();
+ extensions.add(new TCKExtension("ext1", extension1));
+ extensions.add(new TCKExtension("ext2", extension2));
+
+ try {
+ ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(TCKEndpoint.class, "/TCKTestServer")
+ .subprotocols(expected_subprotocols).extensions(extensions).decoders(expected_decoders)
+ .encoders(expected_encoders).configurator(config).build();
+
+ List tmpe = sec.getExtensions();
+ List tmpp = sec.getSubprotocols();
+ List> tmpd = sec.getDecoders();
+
+ if (tmpe != null) {
+ log.append("getExtensions() return non-null List|");
+ if (!tmpe.isEmpty()) {
+ log.append("getExtensions() return non-empty List with size " + tmpe.size() + "|");
+ int size_actual = tmpe.size();
+ if (size_actual == extensions.size()) {
+ for (Extension ext : tmpe) {
+ if (extensions.contains(ext)) {
+ log.append("extension " + ext + " found is expected|");
+ } else {
+ passed = false;
+ log.append("extension " + ext + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() returned not exactly the same amount of extensions.");
+ log.append("Expecting two, returned " + size_actual);
+ }
+ } else {
+ log.append("getExtensions() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getExtensions() return null list|");
+ }
+
+ if (tmpp != null) {
+ log.append("getSubprotocols() return non-null List|");
+ if (!tmpp.isEmpty()) {
+ log.append("getSubprotocols() return non-empty List with size " + tmpp.size() + "|");
+ int size_actual = tmpp.size();
+ if (size_actual == expected_subprotocols.size()) {
+ for (String subpro : tmpp) {
+ if (expected_subprotocols.contains(subpro)) {
+ log.append("sub protocol " + subpro + " found is expected|");
+ } else {
+ passed = false;
+ log.append("sub protocol " + subpro + " found is not expected|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getSubprotocols() returned not exactly the same size.");
+ log.append("Expecting seven, returned " + size_actual);
+ }
+ } else {
+ log.append("getSubprotocols() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getSubprotocols() return null list");
+ }
+
+ if (tmpd != null) {
+ log.append("getDecoders() return non-null List|");
+ if (!tmpd.isEmpty()) {
+ int size = tmpd.size();
+ log.append("getDecoders() return non-empty List with size " + tmpd.size() + "|");
+ if (size == 2) {
+ for (Class extends Decoder> decoder : tmpd) {
+ log.append("Decoder " + decoder + " found ");
+ if (expected_decoders.contains(decoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() returned not exactly the same size.");
+ log.append("Expecting two, returned " + size);
+ }
+ } else {
+ log.append("getDecoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getDecoders() return null list|");
+ }
+
+ List> tmpen = sec.getEncoders();
+ if (tmpen != null) {
+ log.append("getEncoders() return non-null List");
+ if (!tmpen.isEmpty()) {
+ int size = tmpen.size();
+ log.append("getEncoders() return non-empty List with size " + size + "|");
+ if (size == 2) {
+ for (Class extends Encoder> encoder : tmpen) {
+ log.append("Encoder " + encoder + " found ");
+ if (expected_encoders.contains(encoder)) {
+ log.append("is expected.|");
+ } else {
+ passed = false;
+ log.append("is not expected.|");
+ }
+ }
+ } else {
+ passed = false;
+ log.append("getEncoders() returned not exactly the same size.");
+ log.append("Expecting two, returned " + size);
+ }
+ } else {
+ log.append("getEncoders() return empty List|");
+ passed = false;
+ }
+ } else {
+ passed = false;
+ log.append("getEncoders() return null list");
+ }
+ } catch (Exception e) {
+ log.append(e.getMessage());
+ passed = false;
+ }
+
+ System.out.println(log.toString());
+
+ if (passed == false) {
+ throw new Exception("Test failed: " + log.toString());
+ }
+ }
+
+ public void cleanup() {
+ }
+}
+
+class TCKConfigurator extends ServerEndpointConfig.Configurator {
+
+ public static final TCKEndpoint testEndpoint = new TCKEndpoint();
+
+ @Override
+ public T getEndpointInstance(Class endpointClass) throws InstantiationException {
+ if (endpointClass.equals(TCKEndpoint.class)) {
+ return (T) testEndpoint;
+ }
+ throw new InstantiationException();
+ }
+}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/websocketcontainer/WSClient.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/websocketcontainer/WSClient.java
deleted file mode 100644
index 4f7639fdc2..0000000000
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/websocketcontainer/WSClient.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (c) 2013, 2020 Oracle and/or its affiliates and others.
- * All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-/*
- * $Id:$
- */
-package com.sun.ts.tests.websocket.api.jakarta.websocket.websocketcontainer;
-
-import java.io.PrintWriter;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import com.sun.javatest.Status;
-import com.sun.ts.lib.harness.ServiceEETest;
-import com.sun.ts.lib.util.TestUtil;
-
-import jakarta.websocket.ContainerProvider;
-import jakarta.websocket.Extension;
-import jakarta.websocket.Extension.Parameter;
-import jakarta.websocket.WebSocketContainer;
-
-public class WSClient extends ServiceEETest {
-
- public static void main(String[] args) {
- WSClient theTests = new WSClient();
- Status s = theTests.run(args, new PrintWriter(System.out),
- new PrintWriter(System.err));
- s.exit();
- }
-
- /*
- * @class.setup_props: webServerHost; webServerPort; ts_home;
- */
- @SuppressWarnings("unused")
- public void setup(String[] args, Properties p) throws Exception {
- }
-
- /* Run test */
- /*
- * @testName: getMaxSessionIdleTimeoutTest
- *
- * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:167;
- *
- * @test_Strategy: Test method getMaxSessionIdleTimeout
- */
- public void getMaxSessionIdleTimeoutTest() throws Exception {
- WebSocketContainer client = ContainerProvider.getWebSocketContainer();
-
- if (client.getDefaultMaxSessionIdleTimeout() != 0L) {
- TestUtil.logTrace(
- "Default timeout is: " + client.getDefaultMaxSessionIdleTimeout());
- }
- }
-
- /*
- * @testName: setMaxSessionIdleTimeoutTest
- *
- * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:167;
- * WebSocket:JAVADOC:172;
- *
- * @test_Strategy: Test method setMaxSessionIdleTimeout
- */
- public void setMaxSessionIdleTimeoutTest() throws Exception {
- long timeout = 987654321L;
- WebSocketContainer client = ContainerProvider.getWebSocketContainer();
- client.setDefaultMaxSessionIdleTimeout(timeout);
-
- if (client.getDefaultMaxSessionIdleTimeout() != timeout) {
- throw new Exception(
- "Test failed. getMaxSessionIdleTimeout didn't return set value."
- + "Expecting " + timeout + "; got "
- + client.getDefaultMaxSessionIdleTimeout());
- }
- }
-
- /*
- * @testName: getMaxTextMessageBufferSizeTest
- *
- * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:168;
- *
- * @test_Strategy: Test method getMaxTextMessageBufferSize
- */
- public void getMaxTextMessageBufferSizeTest() throws Exception {
- WebSocketContainer client = ContainerProvider.getWebSocketContainer();
- long default_msgsize = client.getDefaultMaxTextMessageBufferSize();
- System.out
- .println("Default MaxTextMessageBufferSize is " + default_msgsize);
- }
-
- /*
- * @testName: setMaxTextMessageBufferSizeTest
- *
- * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:168;
- * WebSocket:JAVADOC:173;
- *
- * @test_Strategy:
- */
- public void setMaxTextMessageBufferSizeTest() throws Exception {
- int expected_msgsize = 987654321;
-
- WebSocketContainer client = ContainerProvider.getWebSocketContainer();
- long default_msgsize = client.getDefaultMaxTextMessageBufferSize();
- System.out
- .println("Default MaxTextMessageBufferSize is " + default_msgsize);
-
- client.setDefaultMaxTextMessageBufferSize(expected_msgsize);
- long actual_msgsize = client.getDefaultMaxTextMessageBufferSize();
- if (expected_msgsize != actual_msgsize) {
- throw new Exception("DefaultMaxTextMessageBufferSize does not match. "
- + "Expecting " + expected_msgsize + ", got " + actual_msgsize);
- }
- }
-
- /*
- * @testName: getMaxBinaryMessageBufferSizeTest
- *
- * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:166;
- *
- * @test_Strategy:
- */
- public void getMaxBinaryMessageBufferSizeTest() throws Exception {
- WebSocketContainer client = ContainerProvider.getWebSocketContainer();
- long default_msgsize = client.getDefaultMaxBinaryMessageBufferSize();
- System.out
- .println("Default MaxTextMessageBufferSize is " + default_msgsize);
- }
-
- /*
- * @testName: setMaxBinaryMessageBufferSizeTest
- *
- * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:166;
- * WebSocket:JAVADOC:171;
- *
- * @test_Strategy:
- */
- public void setMaxBinaryMessageBufferSizeTest() throws Exception {
- int expected_msgsize = 987654321;
-
- WebSocketContainer client = ContainerProvider.getWebSocketContainer();
- long default_msgsize = client.getDefaultMaxBinaryMessageBufferSize();
- System.out
- .println("Default MaxBinaryMessageBufferSize is " + default_msgsize);
-
- client.setDefaultMaxBinaryMessageBufferSize(expected_msgsize);
- long actual_msgsize = client.getDefaultMaxBinaryMessageBufferSize();
- if (expected_msgsize != actual_msgsize) {
- throw new Exception("DefaultMaxBinaryMessageBufferSize does not match. "
- + "Expecting " + expected_msgsize + ", got " + actual_msgsize);
- }
- }
-
- /*
- * @testName: getDefaultAsyncSendTimeoutTest
- *
- * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:165;
- *
- * @test_Strategy: Test method getMaxSessionIdleTimeout
- */
- public void getDefaultAsyncSendTimeoutTest() throws Exception {
- WebSocketContainer client = ContainerProvider.getWebSocketContainer();
-
- if (client.getDefaultAsyncSendTimeout() != 0L) {
- TestUtil.logTrace(
- "Default timeout is: " + client.getDefaultMaxSessionIdleTimeout());
- }
- }
-
- /*
- * @testName: setAsyncSendTimeoutTest
- *
- * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:165;
- * WebSocket:JAVADOC:170;
- *
- * @test_Strategy:
- */
- public void setAsyncSendTimeoutTest() throws Exception {
- long expected_timeout = 987654321L;
- WebSocketContainer client = ContainerProvider.getWebSocketContainer();
- client.setAsyncSendTimeout(expected_timeout);
-
- long actual_timeout = client.getDefaultAsyncSendTimeout();
- if (actual_timeout != expected_timeout) {
- throw new Exception(
- "Test failed. getDefaultAsyncSendTimeout didn't return set value."
- + "Expecting " + expected_timeout + "; got " + actual_timeout);
- }
- }
-
- /*
- * @testName: getInstalledExtensionsTest
- *
- * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:169;
- *
- * @test_Strategy:
- */
- public void getInstalledExtensionsTest() throws Exception {
- WebSocketContainer client = ContainerProvider.getWebSocketContainer();
-
- Set extensions = client.getInstalledExtensions();
- if (extensions != null) {
- if (!extensions.isEmpty()) {
- for (Extension tmp : extensions) {
- System.out.println("Installed Extension: " + tmp.getName());
- List params = tmp.getParameters();
- for (Parameter tmp1 : params) {
- System.out.println("Parameter's name= " + tmp1.getName()
- + "Parameter's value= " + tmp1.getValue());
- }
- }
- } else {
- System.out.println("Installed Extension returned empty set");
- }
- } else {
- System.out.println("getInstalledExtensions() returned null");
- }
- }
-
- public void cleanup() {
- }
-}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/websocketcontainer/WSClientIT.java b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/websocketcontainer/WSClientIT.java
new file mode 100644
index 0000000000..9d71b562a4
--- /dev/null
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/api/jakarta/websocket/websocketcontainer/WSClientIT.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2013, 2020 Oracle and/or its affiliates and others.
+ * All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+/*
+ * $Id:$
+ */
+package com.sun.ts.tests.websocket.api.jakarta.websocket.websocketcontainer;
+
+import java.util.List;
+import java.util.Set;
+
+import org.junit.jupiter.api.Test;
+
+import com.sun.ts.lib.util.TestUtil;
+
+import jakarta.websocket.ContainerProvider;
+import jakarta.websocket.Extension;
+import jakarta.websocket.Extension.Parameter;
+import jakarta.websocket.WebSocketContainer;
+
+public class WSClientIT {
+
+ /* Run test */
+ /*
+ * @testName: getMaxSessionIdleTimeoutTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:167;
+ *
+ * @test_Strategy: Test method getMaxSessionIdleTimeout
+ */
+ @Test
+ public void getMaxSessionIdleTimeoutTest() throws Exception {
+ WebSocketContainer client = ContainerProvider.getWebSocketContainer();
+
+ if (client.getDefaultMaxSessionIdleTimeout() != 0L) {
+ TestUtil.logTrace("Default timeout is: " + client.getDefaultMaxSessionIdleTimeout());
+ }
+ }
+
+ /*
+ * @testName: setMaxSessionIdleTimeoutTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:167;
+ * WebSocket:JAVADOC:172;
+ *
+ * @test_Strategy: Test method setMaxSessionIdleTimeout
+ */
+ @Test
+ public void setMaxSessionIdleTimeoutTest() throws Exception {
+ long timeout = 987654321L;
+ WebSocketContainer client = ContainerProvider.getWebSocketContainer();
+ client.setDefaultMaxSessionIdleTimeout(timeout);
+
+ if (client.getDefaultMaxSessionIdleTimeout() != timeout) {
+ throw new Exception("Test failed. getMaxSessionIdleTimeout didn't return set value." + "Expecting "
+ + timeout + "; got " + client.getDefaultMaxSessionIdleTimeout());
+ }
+ }
+
+ /*
+ * @testName: getMaxTextMessageBufferSizeTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:168;
+ *
+ * @test_Strategy: Test method getMaxTextMessageBufferSize
+ */
+ @Test
+ public void getMaxTextMessageBufferSizeTest() throws Exception {
+ WebSocketContainer client = ContainerProvider.getWebSocketContainer();
+ long default_msgsize = client.getDefaultMaxTextMessageBufferSize();
+ System.out.println("Default MaxTextMessageBufferSize is " + default_msgsize);
+ }
+
+ /*
+ * @testName: setMaxTextMessageBufferSizeTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:168;
+ * WebSocket:JAVADOC:173;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void setMaxTextMessageBufferSizeTest() throws Exception {
+ int expected_msgsize = 987654321;
+
+ WebSocketContainer client = ContainerProvider.getWebSocketContainer();
+ long default_msgsize = client.getDefaultMaxTextMessageBufferSize();
+ System.out.println("Default MaxTextMessageBufferSize is " + default_msgsize);
+
+ client.setDefaultMaxTextMessageBufferSize(expected_msgsize);
+ long actual_msgsize = client.getDefaultMaxTextMessageBufferSize();
+ if (expected_msgsize != actual_msgsize) {
+ throw new Exception("DefaultMaxTextMessageBufferSize does not match. " + "Expecting " + expected_msgsize
+ + ", got " + actual_msgsize);
+ }
+ }
+
+ /*
+ * @testName: getMaxBinaryMessageBufferSizeTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:166;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void getMaxBinaryMessageBufferSizeTest() throws Exception {
+ WebSocketContainer client = ContainerProvider.getWebSocketContainer();
+ long default_msgsize = client.getDefaultMaxBinaryMessageBufferSize();
+ System.out.println("Default MaxTextMessageBufferSize is " + default_msgsize);
+ }
+
+ /*
+ * @testName: setMaxBinaryMessageBufferSizeTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:166;
+ * WebSocket:JAVADOC:171;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void setMaxBinaryMessageBufferSizeTest() throws Exception {
+ int expected_msgsize = 987654321;
+
+ WebSocketContainer client = ContainerProvider.getWebSocketContainer();
+ long default_msgsize = client.getDefaultMaxBinaryMessageBufferSize();
+ System.out.println("Default MaxBinaryMessageBufferSize is " + default_msgsize);
+
+ client.setDefaultMaxBinaryMessageBufferSize(expected_msgsize);
+ long actual_msgsize = client.getDefaultMaxBinaryMessageBufferSize();
+ if (expected_msgsize != actual_msgsize) {
+ throw new Exception("DefaultMaxBinaryMessageBufferSize does not match. " + "Expecting " + expected_msgsize
+ + ", got " + actual_msgsize);
+ }
+ }
+
+ /*
+ * @testName: getDefaultAsyncSendTimeoutTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:165;
+ *
+ * @test_Strategy: Test method getMaxSessionIdleTimeout
+ */
+ @Test
+ public void getDefaultAsyncSendTimeoutTest() throws Exception {
+ WebSocketContainer client = ContainerProvider.getWebSocketContainer();
+
+ if (client.getDefaultAsyncSendTimeout() != 0L) {
+ TestUtil.logTrace("Default timeout is: " + client.getDefaultMaxSessionIdleTimeout());
+ }
+ }
+
+ /*
+ * @testName: setAsyncSendTimeoutTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:165;
+ * WebSocket:JAVADOC:170;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void setAsyncSendTimeoutTest() throws Exception {
+ long expected_timeout = 987654321L;
+ WebSocketContainer client = ContainerProvider.getWebSocketContainer();
+ client.setAsyncSendTimeout(expected_timeout);
+
+ long actual_timeout = client.getDefaultAsyncSendTimeout();
+ if (actual_timeout != expected_timeout) {
+ throw new Exception("Test failed. getDefaultAsyncSendTimeout didn't return set value." + "Expecting "
+ + expected_timeout + "; got " + actual_timeout);
+ }
+ }
+
+ /*
+ * @testName: getInstalledExtensionsTest
+ *
+ * @assertion_ids: WebSocket:JAVADOC:28; WebSocket:JAVADOC:169;
+ *
+ * @test_Strategy:
+ */
+ @Test
+ public void getInstalledExtensionsTest() throws Exception {
+ WebSocketContainer client = ContainerProvider.getWebSocketContainer();
+
+ Set extensions = client.getInstalledExtensions();
+ if (extensions != null) {
+ if (!extensions.isEmpty()) {
+ for (Extension tmp : extensions) {
+ System.out.println("Installed Extension: " + tmp.getName());
+ List params = tmp.getParameters();
+ for (Parameter tmp1 : params) {
+ System.out.println(
+ "Parameter's name= " + tmp1.getName() + "Parameter's value= " + tmp1.getValue());
+ }
+ }
+ } else {
+ System.out.println("Installed Extension returned empty set");
+ }
+ } else {
+ System.out.println("getInstalledExtensions() returned null");
+ }
+ }
+
+ public void cleanup() {
+ }
+}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/common/TCKExtension.java b/websocket/src/main/java/com/sun/ts/tests/websocket/common/TCKExtension.java
index 5c666557c2..6e6e353c6c 100644
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/common/TCKExtension.java
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/common/TCKExtension.java
@@ -25,66 +25,62 @@
public class TCKExtension implements Extension {
- private final String name;
-
- private final List parameters;
-
- public TCKExtension(String name) {
- this(name, null);
- }
-
- public TCKExtension(String name, List parameters) {
- if (name == null || name.length() == 0) {
- throw new IllegalArgumentException();
- }
-
- this.name = name;
- if (parameters != null) {
- this.parameters = Collections
- .unmodifiableList(new ArrayList<>(parameters));
- } else {
- this.parameters = Collections
- .unmodifiableList(Collections. emptyList());
- }
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public List getParameters() {
- return parameters;
- }
-
- public static class TCKParameter implements Parameter {
-
- private final String name;
-
- private final String value;
-
- /**
- * Create {@link Parameter} with name and value.
- *
- * @param name
- * parameter name.
- * @param value
- * parameter value.
- */
- public TCKParameter(String name, String value) {
- this.name = name;
- this.value = value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getValue() {
- return value;
- }
- }
+ private final String name;
+
+ private final List parameters;
+
+ public TCKExtension(String name) {
+ this(name, null);
+ }
+
+ public TCKExtension(String name, List parameters) {
+ if (name == null || name.length() == 0) {
+ throw new IllegalArgumentException();
+ }
+
+ this.name = name;
+ if (parameters != null) {
+ this.parameters = Collections.unmodifiableList(new ArrayList<>(parameters));
+ } else {
+ this.parameters = Collections.unmodifiableList(Collections.emptyList());
+ }
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public List getParameters() {
+ return parameters;
+ }
+
+ public static class TCKParameter implements Parameter {
+
+ private final String name;
+
+ private final String value;
+
+ /**
+ * Create {@link Parameter} with name and value.
+ *
+ * @param name parameter name.
+ * @param value parameter value.
+ */
+ public TCKParameter(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+ }
}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/AnnotatedByteBufferClientEndpoint.java b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/AnnotatedByteBufferClientEndpoint.java
index 6a7e0de0a0..24935e67d1 100644
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/AnnotatedByteBufferClientEndpoint.java
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/AnnotatedByteBufferClientEndpoint.java
@@ -21,11 +21,10 @@
/**
* @since 1.11
*/
-public class AnnotatedByteBufferClientEndpoint
- extends AnnotatedClientEndpoint {
+public class AnnotatedByteBufferClientEndpoint extends AnnotatedClientEndpoint {
- public AnnotatedByteBufferClientEndpoint() {
- super(new ByteBufferClientEndpoint());
- }
+ public AnnotatedByteBufferClientEndpoint() {
+ super(new ByteBufferClientEndpoint());
+ }
}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/AnnotatedClientEndpoint.java b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/AnnotatedClientEndpoint.java
index a9c16420ba..1f0cf9a534 100644
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/AnnotatedClientEndpoint.java
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/AnnotatedClientEndpoint.java
@@ -43,41 +43,41 @@
*/
public abstract class AnnotatedClientEndpoint {
- protected ClientEndpoint clientEndpoint;
+ protected ClientEndpoint clientEndpoint;
- public AnnotatedClientEndpoint(ClientEndpoint endpoint) {
- this.clientEndpoint = endpoint;
- }
+ public AnnotatedClientEndpoint(ClientEndpoint endpoint) {
+ this.clientEndpoint = endpoint;
+ }
- // @OnOpen
- public void onOpen(Session session, EndpointConfig config) {
- clientEndpoint.onOpen(session, config, false);
- }
+ // @OnOpen
+ public void onOpen(Session session, EndpointConfig config) {
+ clientEndpoint.onOpen(session, config, false);
+ }
- // @OnMessage
- public void onMessage(DATATYPE msg) {
- clientEndpoint.onMessage(msg);
- }
+ // @OnMessage
+ public void onMessage(DATATYPE msg) {
+ clientEndpoint.onMessage(msg);
+ }
- // @OnClose
- public void onClose(Session session, CloseReason closeReason) {
- clientEndpoint.onClose(session, closeReason);
- }
+ // @OnClose
+ public void onClose(Session session, CloseReason closeReason) {
+ clientEndpoint.onClose(session, closeReason);
+ }
- // @OnError
- public void onError(Session session, Throwable t) {
- clientEndpoint.onError(session, t);
- }
+ // @OnError
+ public void onError(Session session, Throwable t) {
+ clientEndpoint.onError(session, t);
+ }
- public CountDownLatch getCountDownLatch() {
- return ClientEndpoint.getCountDownLatch();
- }
+ public CountDownLatch getCountDownLatch() {
+ return ClientEndpoint.getCountDownLatch();
+ }
- public StringBuffer getMessageBuilder() {
- return ClientEndpoint.getMessageBuilder();
- }
+ public StringBuffer getMessageBuilder() {
+ return ClientEndpoint.getMessageBuilder();
+ }
- public Throwable getLastError() {
- return ClientEndpoint.getLastError();
- }
+ public Throwable getLastError() {
+ return ClientEndpoint.getLastError();
+ }
}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/AnnotatedStringClientEndpoint.java b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/AnnotatedStringClientEndpoint.java
index 9c21fd8a66..6fe37c1682 100644
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/AnnotatedStringClientEndpoint.java
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/AnnotatedStringClientEndpoint.java
@@ -16,11 +16,10 @@
package com.sun.ts.tests.websocket.common.client;
-public abstract class AnnotatedStringClientEndpoint
- extends AnnotatedClientEndpoint {
+public abstract class AnnotatedStringClientEndpoint extends AnnotatedClientEndpoint {
- public AnnotatedStringClientEndpoint() {
- super(new StringClientEndpoint());
- }
+ public AnnotatedStringClientEndpoint() {
+ super(new StringClientEndpoint());
+ }
}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ApacheRequestAdapter.java b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ApacheRequestAdapter.java
index 6f31bd289a..a0c9881a89 100644
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ApacheRequestAdapter.java
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ApacheRequestAdapter.java
@@ -21,22 +21,19 @@
public class ApacheRequestAdapter extends HttpRequest {
- public ApacheRequestAdapter(String protocol, String requestLine, String host,
- int port) {
- super(
- "GET " + requestLine.replace(protocol + "://", "http://") + " HTTP/1.1",
- host, port);
- }
+ public ApacheRequestAdapter(String protocol, String requestLine, String host, int port) {
+ super("GET " + requestLine.replace(protocol + "://", "http://") + " HTTP/1.1", host, port);
+ }
- /**
- * getRequestPath
returns the request path for this particular
- * request.
- *
- * @return String request path
- */
- @Override
- public String getRequestPath() {
- return super.getRequestPath();
- }
+ /**
+ * getRequestPath
returns the request path for this particular
+ * request.
+ *
+ * @return String request path
+ */
+ @Override
+ public String getRequestPath() {
+ return super.getRequestPath();
+ }
}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ApacheResponseAdapter.java b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ApacheResponseAdapter.java
index 465df0cac2..54f0a4604d 100644
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ApacheResponseAdapter.java
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ApacheResponseAdapter.java
@@ -26,56 +26,56 @@
public class ApacheResponseAdapter extends HttpResponse {
- public ApacheResponseAdapter(String host, int port) {
- super(host, port, port == 443, null, null);
- this.caser = TextCaser.NONE;
- }
+ public ApacheResponseAdapter(String host, int port) {
+ super(host, port, port == 443, null, null);
+ this.caser = TextCaser.NONE;
+ }
- public ApacheResponseAdapter(String host, int port, TextCaser caser) {
- this(host, port);
- this.caser = caser;
- }
+ public ApacheResponseAdapter(String host, int port, TextCaser caser) {
+ this(host, port);
+ this.caser = caser;
+ }
- private TextCaser caser = null;
+ private TextCaser caser = null;
- /**
- * Simulates HTTP status code, 500 on error, 200 on ok
- */
- @Override
- public String getStatusCode() {
- if (ClientEndpointData.getError() != null)
- WebSocketTestCase.logMsg("Unexpected error on client endpoint:",
- IOUtil.printStackTrace(ClientEndpointData.getError()));
- return ClientEndpointData.getError() == null ? "200" : "500";
- }
+ /**
+ * Simulates HTTP status code, 500 on error, 200 on ok
+ */
+ @Override
+ public String getStatusCode() {
+ if (ClientEndpointData.getError() != null)
+ WebSocketTestCase.logMsg("Unexpected error on client endpoint:",
+ IOUtil.printStackTrace(ClientEndpointData.getError()));
+ return ClientEndpointData.getError() == null ? "200" : "500";
+ }
- @Override
- public String getResponseBodyAsString() throws IOException {
- return caser.getCasedText(ClientEndpointData.getResponseAsString());
- }
+ @Override
+ public String getResponseBodyAsString() throws IOException {
+ return caser.getCasedText(ClientEndpointData.getResponseAsString());
+ }
- @Override
- public String getResponseBodyAsRawString() throws IOException {
- return getResponseBodyAsString();
- }
+ @Override
+ public String getResponseBodyAsRawString() throws IOException {
+ return getResponseBodyAsString();
+ }
- @Override
- public String getReasonPhrase() {
- return null;
- }
+ @Override
+ public String getReasonPhrase() {
+ return null;
+ }
- @Override
- public Header[] getResponseHeaders() {
- return new Header[0];
- }
+ @Override
+ public Header[] getResponseHeaders() {
+ return new Header[0];
+ }
- @Override
- public Header getResponseHeader(String headerName) {
- return null;
- }
+ @Override
+ public Header getResponseHeader(String headerName) {
+ return null;
+ }
- @Override
- public String getResponseEncoding() {
- return null;
- }
+ @Override
+ public String getResponseEncoding() {
+ return null;
+ }
}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/BinaryAndTextClientEndpoint.java b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/BinaryAndTextClientEndpoint.java
index a14d630286..bf4ef35bac 100644
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/BinaryAndTextClientEndpoint.java
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/BinaryAndTextClientEndpoint.java
@@ -30,15 +30,15 @@
* behaves without making any difference on type of message received.
*/
public class BinaryAndTextClientEndpoint extends ClientEndpoint {
- @Override
- public void onOpen(Session session, EndpointConfig config) {
- super.onOpen(session, config);
- session.addMessageHandler(new MessageHandler.Whole() {
- @Override
- public void onMessage(ByteBuffer message) {
- String msg = IOUtil.byteBufferToString(message);
- BinaryAndTextClientEndpoint.this.onMessage(msg);
- }
- });
- }
+ @Override
+ public void onOpen(Session session, EndpointConfig config) {
+ super.onOpen(session, config);
+ session.addMessageHandler(new MessageHandler.Whole() {
+ @Override
+ public void onMessage(ByteBuffer message) {
+ String msg = IOUtil.byteBufferToString(message);
+ BinaryAndTextClientEndpoint.this.onMessage(msg);
+ }
+ });
+ }
}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ByteBufferClientEndpoint.java b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ByteBufferClientEndpoint.java
index 66067b027b..da1b853a25 100644
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ByteBufferClientEndpoint.java
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ByteBufferClientEndpoint.java
@@ -22,8 +22,8 @@
public class ByteBufferClientEndpoint extends ClientEndpoint {
- @Override
- protected void appendMessage(ByteBuffer message) {
- getMessageBuilder().append(IOUtil.byteBufferToString(message));
- }
+ @Override
+ protected void appendMessage(ByteBuffer message) {
+ getMessageBuilder().append(IOUtil.byteBufferToString(message));
+ }
}
diff --git a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ClientEndpoint.java b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ClientEndpoint.java
index c8c9eca7a7..8bcab4a0fd 100644
--- a/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ClientEndpoint.java
+++ b/websocket/src/main/java/com/sun/ts/tests/websocket/common/client/ClientEndpoint.java
@@ -28,188 +28,182 @@
import jakarta.websocket.Session;
import jakarta.websocket.WebSocketContainer;
-public abstract class ClientEndpoint extends Endpoint
- implements MessageHandler.Whole {
-
- /**
- * This structure is static, because the original API was unable to set an
- * instance of endpoint when connecting to server, the only available option
- * as an argument of
- * {@link WebSocketContainer#connectToServer(Class, ClientEndpointConfig, java.net.URI)}
- * was Class. The instance of endpoint was created by websocket API, and no
- * information could be injected into the instance.
- */
- public static class ClientEndpointData {
- protected static volatile StringBuffer sb = new StringBuffer();
-
- protected static volatile Throwable websocketError = null;
-
- protected static EndpointCallback callback;
-
- protected static volatile CountDownLatch messageLatch;
-
- protected static volatile Object lastMessage = null;
-
- protected static final Object LOCK = new Object();
-
- protected static volatile CountDownLatch onCloseLatch = null;
-
- public static Throwable getError() {
- return websocketError;
- }
-
- private static void setError(Throwable error) {
- websocketError = error;
- }
-
- public static String getResponseAsString() {
- WebSocketTestCase.logMsg("Response:", sb.toString());
- return sb.toString();
- }
-
- public static void resetData() {
- synchronized (LOCK) {
- WebSocketCommonClient.logTrace("Reseting callback and message", "");
- sb = new StringBuffer();
- websocketError = null;
- callback = null;
- lastMessage = null;
- messageLatch = null;
- onCloseLatch = null;
- }
- }
-
- public static void newCountDown(int count) {
- messageLatch = new CountDownLatch(count);
- };
-
- public static void awaitCountDown(int seconds) {
- try {
- messageLatch.await(seconds, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static void newOnCloseCountDown() {
- if (onCloseLatch == null)
- onCloseLatch = new CountDownLatch(1);
- }
-
- public static long getCount() {
- return messageLatch.getCount();
- }
-
- public static void awaitOnClose() {
- try {
- onCloseLatch.await(2000L, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- e.printStackTrace(); // If it does not wait,
- // the test should still pass
- }
- }
-
- public static Object getOriginalMessage() {
- return lastMessage;
- }
-
- private static void setOriginalMessage(Object message) {
- lastMessage = message;
- }
-
- }
-
- /**
- * Hopefully this approach might be changed when api allows for passing the
- * instance instead of class.
- */
-
- @Override
- public void onOpen(Session session, EndpointConfig config) {
- onOpen(session, config, true);
- }
-
- public void onOpen(Session session, EndpointConfig config,
- boolean addMessageHandler) {
- WebSocketCommonClient.logTrace("On open on session id", session.getId());
- String uri = session.getRequestURI() == null ? "NULL"
- : session.getRequestURI().toASCIIString();
- WebSocketCommonClient.logTrace("RequestUri:", uri);
- if (session.isOpen()) {
- if (addMessageHandler)
- session.addMessageHandler(this);
- } else
- WebSocketCommonClient.logTrace("Session is closed!!!!", "");
- synchronized (ClientEndpointData.LOCK) {
- if (ClientEndpointData.callback != null && session.isOpen())
- ClientEndpointData.callback.onOpen(session, config);
- }
- }
-
- @Override
- public void onError(Session session, Throwable t) {
- ClientEndpointData.setError(t);
- t.printStackTrace();
- synchronized (ClientEndpointData.LOCK) {
- if (ClientEndpointData.callback != null)
- ClientEndpointData.callback.onError(session, t);
- }
- }
-
- protected void appendMessage(T message) {
- ClientEndpointData.sb.append(message.toString());
- }
-
- @Override
- public void onMessage(T message) {
- ClientEndpointData.setOriginalMessage(message);
- appendMessage(message);
- WebSocketCommonClient.logTrace("Received message so far",
- ClientEndpointData.sb.toString());
- synchronized (ClientEndpointData.LOCK) {
- if (ClientEndpointData.callback != null)
- ClientEndpointData.callback.onMessage(message);
- }
- WebSocketTestCase.logTrace("CountDownLatch hit");
- if (ClientEndpointData.messageLatch.getCount() == 0)
- throw new IllegalStateException("CountDownLatch.getCount == 0 already");
- ClientEndpointData.messageLatch.countDown();
- }
-
- @Override
- public void onClose(Session session, CloseReason closeReason) {
- synchronized (ClientEndpointData.LOCK) {
- WebSocketTestCase.logTrace("On close on session id", session.getId(),
- "reason", closeReason);
- if (ClientEndpointData.lastMessage == null)
- WebSocketTestCase
- .logTrace("onClose has been called before a message was received");
- else
- WebSocketTestCase.logTrace("onClose has been called");
- if (ClientEndpointData.callback != null)
- ClientEndpointData.callback.onClose(session, closeReason);
- // onCloseLatch == null when close has not been called by client
- if (ClientEndpointData.onCloseLatch == null)
- ClientEndpointData.newOnCloseCountDown();
- ClientEndpointData.onCloseLatch.countDown();
- }
- }
-
- public static CountDownLatch getCountDownLatch() {
- return ClientEndpointData.messageLatch;
- }
-
- public static StringBuffer getMessageBuilder() {
- return ClientEndpointData.sb;
- }
-
- @SuppressWarnings({ "unchecked", "unused" })
- public T getLastMessage(Class messageType) {
- return (T) ClientEndpointData.lastMessage;
- }
-
- public static Throwable getLastError() {
- return ClientEndpointData.websocketError;
- }
+public abstract class ClientEndpoint extends Endpoint implements MessageHandler.Whole {
+
+ /**
+ * This structure is static, because the original API was unable to set an
+ * instance of endpoint when connecting to server, the only available option as
+ * an argument of
+ * {@link WebSocketContainer#connectToServer(Class, ClientEndpointConfig, java.net.URI)}
+ * was Class. The instance of endpoint was created by websocket API, and no
+ * information could be injected into the instance.
+ */
+ public static class ClientEndpointData {
+ protected static volatile StringBuffer sb = new StringBuffer();
+
+ protected static volatile Throwable websocketError = null;
+
+ protected static EndpointCallback callback;
+
+ protected static volatile CountDownLatch messageLatch;
+
+ protected static volatile Object lastMessage = null;
+
+ protected static final Object LOCK = new Object();
+
+ protected static volatile CountDownLatch onCloseLatch = null;
+
+ public static Throwable getError() {
+ return websocketError;
+ }
+
+ private static void setError(Throwable error) {
+ websocketError = error;
+ }
+
+ public static String getResponseAsString() {
+ WebSocketTestCase.logMsg("Response:", sb.toString());
+ return sb.toString();
+ }
+
+ public static void resetData() {
+ synchronized (LOCK) {
+ WebSocketCommonClient.logTrace("Reseting callback and message", "");
+ sb = new StringBuffer();
+ websocketError = null;
+ callback = null;
+ lastMessage = null;
+ messageLatch = null;
+ onCloseLatch = null;
+ }
+ }
+
+ public static void newCountDown(int count) {
+ messageLatch = new CountDownLatch(count);
+ };
+
+ public static void awaitCountDown(int seconds) {
+ try {
+ messageLatch.await(seconds, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void newOnCloseCountDown() {
+ if (onCloseLatch == null)
+ onCloseLatch = new CountDownLatch(1);
+ }
+
+ public static long getCount() {
+ return messageLatch.getCount();
+ }
+
+ public static void awaitOnClose() {
+ try {
+ onCloseLatch.await(2000L, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ e.printStackTrace(); // If it does not wait,
+ // the test should still pass
+ }
+ }
+
+ public static Object getOriginalMessage() {
+ return lastMessage;
+ }
+
+ private static void setOriginalMessage(Object message) {
+ lastMessage = message;
+ }
+
+ }
+
+ /**
+ * Hopefully this approach might be changed when api allows for passing the
+ * instance instead of class.
+ */
+
+ @Override
+ public void onOpen(Session session, EndpointConfig config) {
+ onOpen(session, config, true);
+ }
+
+ public void onOpen(Session session, EndpointConfig config, boolean addMessageHandler) {
+ WebSocketCommonClient.logTrace("On open on session id", session.getId());
+ String uri = session.getRequestURI() == null ? "NULL" : session.getRequestURI().toASCIIString();
+ WebSocketCommonClient.logTrace("RequestUri:", uri);
+ if (session.isOpen()) {
+ if (addMessageHandler)
+ session.addMessageHandler(this);
+ } else
+ WebSocketCommonClient.logTrace("Session is closed!!!!", "");
+ synchronized (ClientEndpointData.LOCK) {
+ if (ClientEndpointData.callback != null && session.isOpen())
+ ClientEndpointData.callback.onOpen(session, config);
+ }
+ }
+
+ @Override
+ public void onError(Session session, Throwable t) {
+ ClientEndpointData.setError(t);
+ t.printStackTrace();
+ synchronized (ClientEndpointData.LOCK) {
+ if (ClientEndpointData.callback != null)
+ ClientEndpointData.callback.onError(session, t);
+ }
+ }
+
+ protected void appendMessage(T message) {
+ ClientEndpointData.sb.append(message.toString());
+ }
+
+ @Override
+ public void onMessage(T message) {
+ ClientEndpointData.setOriginalMessage(message);
+ appendMessage(message);
+ WebSocketCommonClient.logTrace("Received message so far", ClientEndpointData.sb.toString());
+ synchronized (ClientEndpointData.LOCK) {
+ if (ClientEndpointData.callback != null)
+ ClientEndpointData.callback.onMessage(message);
+ }
+ WebSocketTestCase.logTrace("CountDownLatch hit");
+ if (ClientEndpointData.messageLatch.getCount() == 0)
+ throw new IllegalStateException("CountDownLatch.getCount == 0 already");
+ ClientEndpointData.messageLatch.countDown();
+ }
+
+ @Override
+ public void onClose(Session session, CloseReason closeReason) {
+ synchronized (ClientEndpointData.LOCK) {
+ WebSocketTestCase.logTrace("On close on session id", session.getId(), "reason", closeReason);
+ if (ClientEndpointData.lastMessage == null)
+ WebSocketTestCase.logTrace("onClose has been called before a message was received");
+ else
+ WebSocketTestCase.logTrace("onClose has been called");
+ if (ClientEndpointData.callback != null)
+ ClientEndpointData.callback.onClose(session, closeReason);
+ // onCloseLatch == null when close has not been called by client
+ if (ClientEndpointData.onCloseLatch == null)
+ ClientEndpointData.newOnCloseCountDown();
+ ClientEndpointData.onCloseLatch.countDown();
+ }
+ }
+
+ public static CountDownLatch getCountDownLatch() {
+ return ClientEndpointData.messageLatch;
+ }
+
+ public static StringBuffer getMessageBuilder() {
+ return ClientEndpointData.sb;
+ }
+
+ @SuppressWarnings({ "unchecked", "unused" })
+ public T getLastMessage(Class