use of org.eclipse.jst.server.tomcat.core.internal.xml.server32.Parameter 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 org.eclipse.jst.server.tomcat.core.internal.xml.server32.Parameter in project webtools.servertools by eclipse.
the class XmlTestCase method testDefaultServerXml32.
/**
* Test reading of the default server.xml provided by the
* current Tomcat 3.2.
*/
public void testDefaultServerXml32() {
org.eclipse.jst.server.tomcat.core.internal.xml.server32.Server server = getXml32Server("default.serverxml.32");
assertNotNull(server);
ContextManager contextManager = server.getContextManager();
assertNotNull(contextManager);
assertEquals(2, contextManager.getConnectorCount());
assertNotNull(contextManager.getConnector(0));
Parameter parameter = contextManager.getConnector(0).getParameter(0);
assertEquals("handler", parameter.getName());
assertEquals("org.apache.tomcat.service.http.HttpConnectionHandler", parameter.getValue());
parameter = contextManager.getConnector(0).getParameter(1);
assertEquals("port", parameter.getName());
assertEquals("8080", parameter.getValue());
assertNotNull(contextManager.getConnector(1));
parameter = contextManager.getConnector(1).getParameter(0);
assertEquals("handler", parameter.getName());
assertEquals("org.apache.tomcat.service.connector.Ajp12ConnectionHandler", parameter.getValue());
parameter = contextManager.getConnector(1).getParameter(1);
assertEquals("port", parameter.getName());
assertEquals("8007", parameter.getValue());
assertEquals(2, contextManager.getContextCount());
assertNotNull(contextManager.getContext(0));
assertEquals("/examples", contextManager.getContext(0).getPath());
assertNotNull(contextManager.getContext(1));
assertEquals("/admin", contextManager.getContext(1).getPath());
}
Aggregations