use of com.microsoft.z3.Context in project webtools.servertools by eclipse.
the class XmlTestCase method testTomcatContextComparison.
public void testTomcatContextComparison() {
Context context = getXml40Context("tomcat.context.50");
assertTrue(context.isEquivalentTest(context));
Context context2 = getXml40Context("tomcat.context.50");
assertTrue(context.isEquivalentTest(context2));
assertTrue(context2.isEquivalentTest(context));
String docBase = context2.getDocBase();
context2.setDocBase(docBase + "X");
assertTrue(!context.isEquivalentTest(context2));
assertTrue(!context2.isEquivalentTest(context));
context.setDocBase(docBase + "X");
assertTrue(context.isEquivalentTest(context2));
assertTrue(context2.isEquivalentTest(context));
Element realm = context2.getSubElement("Realm");
assertNotNull(realm);
Node parent = realm.getParentNode();
assertNotNull(parent);
assertTrue(parent == context2.getElementNode());
parent.removeChild(realm);
assertTrue(!context.isEquivalentTest(context2));
assertTrue(!context2.isEquivalentTest(context));
parent.insertBefore(realm, parent.getFirstChild());
assertTrue(!context.isEquivalentTest(context2));
assertTrue(!context2.isEquivalentTest(context));
parent.removeChild(realm);
parent.appendChild(realm);
assertTrue(context.isEquivalentTest(context2));
assertTrue(context2.isEquivalentTest(context));
}
use of com.microsoft.z3.Context in project webtools.servertools by eclipse.
the class XmlTestCase method testServerInstance32.
/**
* Test behavior of ServerInstance with Tomcat 3.2 default server.xml.
*/
public void testServerInstance32() {
org.eclipse.jst.server.tomcat.core.internal.xml.server32.Server server = getXml32Server("default.serverxml.32");
assertNotNull(server);
org.eclipse.jst.server.tomcat.core.internal.xml.server32.ServerInstance si = new org.eclipse.jst.server.tomcat.core.internal.xml.server32.ServerInstance(server);
assertNotNull(si.getContextManager());
org.eclipse.jst.server.tomcat.core.internal.xml.server32.Connector[] connectors = si.getConnectors();
assertNotNull(connectors);
assertEquals(2, connectors.length);
Parameter parameter = connectors[0].getParameter(0);
assertEquals("handler", parameter.getName());
assertEquals("org.apache.tomcat.service.http.HttpConnectionHandler", parameter.getValue());
parameter = connectors[0].getParameter(1);
assertEquals("port", parameter.getName());
assertEquals("8080", parameter.getValue());
parameter = connectors[1].getParameter(0);
assertEquals("handler", parameter.getName());
assertEquals("org.apache.tomcat.service.connector.Ajp12ConnectionHandler", parameter.getValue());
parameter = connectors[1].getParameter(1);
assertEquals("port", parameter.getName());
assertEquals("8007", parameter.getValue());
parameter = si.getConnector(0).getParameter(0);
assertEquals("handler", parameter.getName());
assertEquals("org.apache.tomcat.service.http.HttpConnectionHandler", parameter.getValue());
parameter = si.getConnector(0).getParameter(1);
assertEquals("port", parameter.getName());
assertEquals("8080", parameter.getValue());
parameter = si.getConnector(1).getParameter(0);
assertEquals("handler", parameter.getName());
assertEquals("org.apache.tomcat.service.connector.Ajp12ConnectionHandler", parameter.getValue());
parameter = si.getConnector(1).getParameter(1);
assertEquals("port", parameter.getName());
assertEquals("8007", parameter.getValue());
org.eclipse.jst.server.tomcat.core.internal.xml.server32.Context[] contexts = si.getContexts();
assertNotNull(contexts);
assertEquals(2, contexts.length);
assertEquals("/examples", contexts[0].getPath());
assertEquals("/admin", contexts[1].getPath());
assertEquals("/examples", si.getContext(0).getPath());
assertEquals("/admin", si.getContext(1).getPath());
assertEquals("/examples", si.getContext("examples").getPath());
assertEquals("/admin", si.getContext("/admin").getPath());
org.eclipse.jst.server.tomcat.core.internal.xml.server32.Context context = si.createContext(2);
context.setPath("/WebApp1");
contexts = si.getContexts();
assertNotNull(contexts);
assertEquals(3, contexts.length);
assertEquals("/examples", contexts[0].getPath());
assertEquals("/admin", contexts[1].getPath());
assertEquals("/WebApp1", contexts[2].getPath());
assertEquals(new Path("/Base/work/localhost_8080%2Fexamples"), si.getContextWorkDirectory(new Path("/Base"), si.getContext("examples")));
assertEquals(new Path("/Base/work/localhost_8080%2Fadmin"), si.getContextWorkDirectory(new Path("/Base"), si.getContext("admin")));
assertEquals(new Path("/Base/work/localhost_8080%2FWebApp1"), si.getContextWorkDirectory(new Path("/Base"), si.getContext("WebApp1")));
assertTrue(si.removeContext(2));
contexts = si.getContexts();
assertNotNull(contexts);
assertEquals(2, contexts.length);
assertEquals("/examples", contexts[0].getPath());
assertEquals("/admin", contexts[1].getPath());
context = si.createContext(2);
context.setPath("");
context = si.getContext("");
assertNotNull(context);
assertEquals("", context.getPath());
assertEquals(new Path("/Base/work/localhost_8080"), si.getContextWorkDirectory(new Path("/Base"), si.getContext("")));
assertEquals(si.getServerWorkDirectory(new Path("/Base")), new Path("/Base/work"));
}
use of com.microsoft.z3.Context in project webtools.servertools by eclipse.
the class XmlTestCase method testServerInstance3.
/**
* Test behavior of ServerInstance
*/
public void testServerInstance3() {
Server server = getXml40Server("serverxml.test3");
assertNotNull(server);
ServerInstance si = new ServerInstance(server, "Service", null);
Context context = si.getContext("/WebApp1");
assertNotNull(context);
assertEquals(new Path("/Base/relative/host/WebApp1"), si.getContextWorkDirectory(new Path("/Base"), context));
context = si.getContext("WebApp2");
assertNotNull(context);
assertEquals(new Path("/Base/relative/workdir"), si.getContextWorkDirectory(new Path("/Base"), context));
context = si.getContext("WebApp3");
assertNotNull(context);
assertEquals(new Path("/absolute/workdir"), si.getContextWorkDirectory(new Path("/Base"), context));
}
use of com.microsoft.z3.Context in project webtools.servertools by eclipse.
the class XmlTestCase method testServerInstance50.
/**
* Test reading of the default server.xml provided by the
* current Tomcat 5.0 release using ServerInstance.
*/
public void testServerInstance50() {
Server server = getXml40Server("default.serverxml.50");
assertNotNull(server);
ServerInstance si = new ServerInstance(server, null, null);
assertEquals(2, server.getListenerCount());
Listener[] listeners = si.getListeners();
assertEquals("org.apache.catalina.mbeans.ServerLifecycleListener", listeners[0].getClassName());
assertEquals("org.apache.catalina.mbeans.GlobalResourcesLifecycleListener", listeners[1].getClassName());
Service service = si.getService();
assertNotNull(service);
assertEquals("Catalina", service.getName());
assertEquals("8080", si.getConnector(0).getPort());
assertNull(si.getConnector(0).getProtocol());
assertEquals("8009", si.getConnector(1).getPort());
assertEquals("AJP/1.3", si.getConnector(1).getProtocol());
Connector[] connectors = si.getConnectors();
assertEquals(2, connectors.length);
assertEquals("8080", connectors[0].getPort());
assertNull(connectors[0].getProtocol());
assertEquals("8009", connectors[1].getPort());
assertEquals("AJP/1.3", connectors[1].getProtocol());
Engine engine = si.getEngine();
assertNotNull(engine);
assertEquals("Catalina", engine.getName());
assertEquals("localhost", engine.getDefaultHost());
Host host = si.getHost();
assertNotNull(host);
assertEquals("localhost", host.getName());
assertEquals("webapps", host.getAppBase());
assertEquals("true", host.getAttributeValue("unpackWARs"));
assertEquals("true", host.getAttributeValue("autoDeploy"));
Context[] contexts = si.getContexts();
assertEquals(0, contexts.length);
}
use of com.microsoft.z3.Context in project webtools.servertools by eclipse.
the class Tomcat32TestConfiguration method verifyPublishedModule.
protected void verifyPublishedModule(IPath baseDir, IModule module) throws Exception {
Tomcat32TestConfiguration config = new Tomcat32TestConfiguration(null);
config.load(baseDir.append("conf"), null);
ServerInstance serverInstance = config.getServerInstance();
Context context = serverInstance.getContext(module.getName());
String deployDir = getTomcatServer().getDeployDirectory();
if ("webapps".equals(deployDir)) {
assertEquals("webapps/" + module.getName(), context.getDocBase());
} else {
assertEquals(getTomcatServerBehaviour().getModuleDeployDirectory(module).toOSString(), context.getDocBase());
}
verifyPublishedModuleFiles(module);
}
Aggregations