@Test public void testGetCustomContextPerAddWebappWithNullHost() { Tomcat tomcat = getTomcatInstance(); Host host = tomcat.getHost(); if (host instanceof StandardHost) { ((StandardHost) host).setContextClass(ReplicatedContext.class .getName()); } File appFile = new File("test/deployment/context.war"); Context context = tomcat.addWebapp(null, "/test", appFile.getAbsolutePath()); assertEquals(ReplicatedContext.class.getName(), context.getClass() .getName()); }
@Test public void testGetCustomContextPerAddWebappWithHost() { Tomcat tomcat = getTomcatInstance(); Host host = tomcat.getHost(); if (host instanceof StandardHost) { ((StandardHost) host).setContextClass(ReplicatedContext.class .getName()); } File appFile = new File("test/deployment/context.war"); Context context = tomcat.addWebapp(host, "/test", appFile.getAbsolutePath()); assertEquals(ReplicatedContext.class.getName(), context.getClass() .getName()); }
@Test public void testGetCustomContextPerAddContextWithHost() { Tomcat tomcat = getTomcatInstance(); Host host = tomcat.getHost(); if (host instanceof StandardHost) { ((StandardHost) host).setContextClass(ReplicatedContext.class .getName()); } // No file system docBase required Context ctx = tomcat.addContext(host, "", null); assertEquals(ReplicatedContext.class.getName(), ctx.getClass() .getName()); }