-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new test for getContainerDefaultConfigurator
- Loading branch information
Showing
6 changed files
with
172 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...rta/websocket/server/serverendpointconfig/configurator/ContainerDefaultConfiguratorA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2021 Contributors to the Eclipse Foundation. | ||
* | ||
* 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 | ||
*/ | ||
package com.sun.ts.tests.websocket.ee.jakarta.websocket.server.serverendpointconfig.configurator; | ||
|
||
import jakarta.websocket.server.ServerEndpointConfig.Configurator; | ||
|
||
public class ContainerDefaultConfiguratorA extends Configurator { | ||
|
||
private static String containerDefaultConfiguratorID; | ||
|
||
public ContainerDefaultConfiguratorA() { | ||
Configurator c = getContainerDefaultConfigurator(); | ||
containerDefaultConfiguratorID = Integer.toString(System.identityHashCode(c)); | ||
} | ||
|
||
public static String getPlatformDefaultConfiguratorID() { | ||
return containerDefaultConfiguratorID; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...rta/websocket/server/serverendpointconfig/configurator/ContainerDefaultConfiguratorB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2021 Contributors to the Eclipse Foundation. | ||
* | ||
* 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 | ||
*/ | ||
package com.sun.ts.tests.websocket.ee.jakarta.websocket.server.serverendpointconfig.configurator; | ||
|
||
import jakarta.websocket.server.ServerEndpointConfig.Configurator; | ||
|
||
public class ContainerDefaultConfiguratorB extends Configurator { | ||
|
||
private static String containerDefaultConfiguratorID; | ||
|
||
public ContainerDefaultConfiguratorB() { | ||
Configurator c = getContainerDefaultConfigurator(); | ||
containerDefaultConfiguratorID = Integer.toString(System.identityHashCode(c)); | ||
} | ||
|
||
public static String getPlatformDefaultConfiguratorID() { | ||
return containerDefaultConfiguratorID; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...t/server/serverendpointconfig/configurator/WSCGetContainerDefaultConfiguratorServerA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2021 Contributors to the Eclipse Foundation. | ||
* | ||
* 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 | ||
*/ | ||
package com.sun.ts.tests.websocket.ee.jakarta.websocket.server.serverendpointconfig.configurator; | ||
|
||
import java.io.IOException; | ||
|
||
import jakarta.websocket.OnError; | ||
import jakarta.websocket.OnMessage; | ||
import jakarta.websocket.Session; | ||
import jakarta.websocket.server.ServerEndpoint; | ||
|
||
import com.sun.ts.tests.websocket.common.util.IOUtil; | ||
|
||
@ServerEndpoint(value = "/containerdefaultconfiguratorA", configurator = ContainerDefaultConfiguratorA.class) | ||
public class WSCGetContainerDefaultConfiguratorServerA { | ||
|
||
@SuppressWarnings("unused") | ||
@OnMessage | ||
public String onMessage(String msg) { | ||
String response = ContainerDefaultConfiguratorA.getPlatformDefaultConfiguratorID(); | ||
return response; | ||
} | ||
|
||
@OnError | ||
public void onError(Session session, Throwable thr) throws IOException { | ||
thr.printStackTrace(); // Write to error log, too | ||
String message = IOUtil.printStackTrace(thr); | ||
session.getBasicRemote().sendText(message); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...t/server/serverendpointconfig/configurator/WSCGetContainerDefaultConfiguratorServerB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2021 Contributors to the Eclipse Foundation. | ||
* | ||
* 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 | ||
*/ | ||
package com.sun.ts.tests.websocket.ee.jakarta.websocket.server.serverendpointconfig.configurator; | ||
|
||
import java.io.IOException; | ||
|
||
import jakarta.websocket.OnError; | ||
import jakarta.websocket.OnMessage; | ||
import jakarta.websocket.Session; | ||
import jakarta.websocket.server.ServerEndpoint; | ||
|
||
import com.sun.ts.tests.websocket.common.util.IOUtil; | ||
|
||
@ServerEndpoint(value = "/containerdefaultconfiguratorB", configurator = ContainerDefaultConfiguratorB.class) | ||
public class WSCGetContainerDefaultConfiguratorServerB { | ||
|
||
@SuppressWarnings("unused") | ||
@OnMessage | ||
public String onMessage(String msg) { | ||
String response = ContainerDefaultConfiguratorB.getPlatformDefaultConfiguratorID(); | ||
return response; | ||
} | ||
|
||
@OnError | ||
public void onError(Session session, Throwable thr) throws IOException { | ||
thr.printStackTrace(); // Write to error log, too | ||
String message = IOUtil.printStackTrace(thr); | ||
session.getBasicRemote().sendText(message); | ||
} | ||
} |