use of org.apache.catalina.core.StandardHost in project tomcat by apache.
the class TestMapper method createHost.
private synchronized Host createHost(String name) {
Host host = hostMap.get(name);
if (host == null) {
host = new StandardHost();
host.setName(name);
hostMap.put(name, host);
}
return host;
}
use of org.apache.catalina.core.StandardHost in project tomcat by apache.
the class TestTomcat method testGetCustomContextPerAddContextWithHost.
@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());
}
use of org.apache.catalina.core.StandardHost in project tomcat by apache.
the class TestTomcat method testGetCustomContextPerAddWebappWithNullHost.
@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());
}
use of org.apache.catalina.core.StandardHost in project tomcat by apache.
the class TestTomcat method testGetCustomContextPerAddWebappWithHost.
@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());
}
use of org.apache.catalina.core.StandardHost in project tomcat by apache.
the class TestTomcat method testGetBrokenContextPerAddWepapp.
@Test
public void testGetBrokenContextPerAddWepapp() {
Tomcat tomcat = getTomcatInstance();
Host host = tomcat.getHost();
if (host instanceof StandardHost) {
((StandardHost) host).setContextClass("InvalidContextClassName");
}
try {
File appFile = new File("test/deployment/context.war");
tomcat.addWebapp(null, "/test", appFile.getAbsolutePath());
fail();
} catch (IllegalArgumentException e) {
// OK
}
}
Aggregations