Search in sources :

Example 1 with TesterServletContext

use of org.apache.tomcat.unittest.TesterServletContext in project tomcat by apache.

the class TestWsServerContainer method testDuplicatePaths_02.

@Test(expected = javax.websocket.DeploymentException.class)
public void testDuplicatePaths_02() throws Exception {
    WsServerContainer sc = new WsServerContainer(new TesterServletContext());
    ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(Object.class, "/a/b/{var}").build();
    ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(Object.class, "/a/b/{var}").build();
    sc.addEndpoint(configA);
    sc.addEndpoint(configB);
}
Also used : TesterServletContext(org.apache.tomcat.unittest.TesterServletContext) ServerEndpointConfig(javax.websocket.server.ServerEndpointConfig) Test(org.junit.Test) WebSocketBaseTest(org.apache.tomcat.websocket.WebSocketBaseTest)

Example 2 with TesterServletContext

use of org.apache.tomcat.unittest.TesterServletContext in project tomcat by apache.

the class TestWsServerContainer method testDuplicatePaths_03.

@Test(expected = javax.websocket.DeploymentException.class)
public void testDuplicatePaths_03() throws Exception {
    WsServerContainer sc = new WsServerContainer(new TesterServletContext());
    ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(Object.class, "/a/b/{var1}").build();
    ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(Object.class, "/a/b/{var2}").build();
    sc.addEndpoint(configA);
    sc.addEndpoint(configB);
}
Also used : TesterServletContext(org.apache.tomcat.unittest.TesterServletContext) ServerEndpointConfig(javax.websocket.server.ServerEndpointConfig) Test(org.junit.Test) WebSocketBaseTest(org.apache.tomcat.websocket.WebSocketBaseTest)

Example 3 with TesterServletContext

use of org.apache.tomcat.unittest.TesterServletContext in project tomcat70 by apache.

the class TestWsServerContainer method testSpecExample3.

@Test
public void testSpecExample3() throws Exception {
    WsServerContainer sc = new WsServerContainer(new TesterServletContext());
    ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(Object.class, "/a/{var}/c").build();
    ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(Object.class, "/a/b/c").build();
    ServerEndpointConfig configC = ServerEndpointConfig.Builder.create(Object.class, "/a/{var1}/{var2}").build();
    sc.addEndpoint(configA);
    sc.addEndpoint(configB);
    sc.addEndpoint(configC);
    Assert.assertEquals(configB, sc.findMapping("/a/b/c").getConfig());
    Assert.assertEquals(configA, sc.findMapping("/a/d/c").getConfig());
    Assert.assertEquals(configC, sc.findMapping("/a/x/y").getConfig());
}
Also used : TesterServletContext(org.apache.tomcat.unittest.TesterServletContext) ServerEndpointConfig(javax.websocket.server.ServerEndpointConfig) Test(org.junit.Test) WebSocketBaseTest(org.apache.tomcat.websocket.WebSocketBaseTest)

Example 4 with TesterServletContext

use of org.apache.tomcat.unittest.TesterServletContext in project tomcat70 by apache.

the class TestWsServerContainer method testDuplicatePaths_01.

@Test(expected = javax.websocket.DeploymentException.class)
public void testDuplicatePaths_01() throws Exception {
    WsServerContainer sc = new WsServerContainer(new TesterServletContext());
    ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(Object.class, "/a/b/c").build();
    ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(Object.class, "/a/b/c").build();
    sc.addEndpoint(configA);
    sc.addEndpoint(configB);
}
Also used : TesterServletContext(org.apache.tomcat.unittest.TesterServletContext) ServerEndpointConfig(javax.websocket.server.ServerEndpointConfig) Test(org.junit.Test) WebSocketBaseTest(org.apache.tomcat.websocket.WebSocketBaseTest)

Example 5 with TesterServletContext

use of org.apache.tomcat.unittest.TesterServletContext in project tomcat70 by apache.

the class TestWsServerContainer method testDuplicatePaths_02.

@Test(expected = javax.websocket.DeploymentException.class)
public void testDuplicatePaths_02() throws Exception {
    WsServerContainer sc = new WsServerContainer(new TesterServletContext());
    ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(Object.class, "/a/b/{var}").build();
    ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(Object.class, "/a/b/{var}").build();
    sc.addEndpoint(configA);
    sc.addEndpoint(configB);
}
Also used : TesterServletContext(org.apache.tomcat.unittest.TesterServletContext) ServerEndpointConfig(javax.websocket.server.ServerEndpointConfig) Test(org.junit.Test) WebSocketBaseTest(org.apache.tomcat.websocket.WebSocketBaseTest)

Aggregations

TesterServletContext (org.apache.tomcat.unittest.TesterServletContext)28 Test (org.junit.Test)27 WebSocketBaseTest (org.apache.tomcat.websocket.WebSocketBaseTest)24 ServerEndpointConfig (jakarta.websocket.server.ServerEndpointConfig)14 ServerEndpointConfig (javax.websocket.server.ServerEndpointConfig)10 URL (java.net.URL)2 URLClassLoader (java.net.URLClassLoader)2 TesterContext (org.apache.tomcat.unittest.TesterContext)2 MalformedURLException (java.net.MalformedURLException)1 HashSet (java.util.HashSet)1 Request (org.apache.catalina.connector.Request)1 TomcatBaseTest (org.apache.catalina.startup.TomcatBaseTest)1 TesterRequest (org.apache.tomcat.unittest.TesterRequest)1 SecurityConstraint (org.apache.tomcat.util.descriptor.web.SecurityConstraint)1 BeforeClass (org.junit.BeforeClass)1