Search in sources :

Example 16 with ServerInstance

use of org.eclipse.jst.server.tomcat.core.internal.xml.server32.ServerInstance 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);
}
Also used : Context(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context) Connector(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector) Listener(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener) Server(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server) Service(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service) Host(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host) ServerInstance(org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance) Engine(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine)

Example 17 with ServerInstance

use of org.eclipse.jst.server.tomcat.core.internal.xml.server32.ServerInstance 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);
}
Also used : Context(org.eclipse.jst.server.tomcat.core.internal.xml.server32.Context) ServerInstance(org.eclipse.jst.server.tomcat.core.internal.xml.server32.ServerInstance)

Example 18 with ServerInstance

use of org.eclipse.jst.server.tomcat.core.internal.xml.server32.ServerInstance in project webtools.servertools by eclipse.

the class Tomcat41TestConfiguration method verifyPublishedModule.

protected void verifyPublishedModule(IPath baseDir, IModule module) throws Exception {
    Tomcat41TestConfiguration config = new Tomcat41TestConfiguration(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(module.getName(), context.getDocBase());
    } else {
        assertEquals(getTomcatServerBehaviour().getModuleDeployDirectory(module).toOSString(), context.getDocBase());
    }
    verifyPublishedModuleFiles(module);
}
Also used : Context(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context) ServerInstance(org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)

Example 19 with ServerInstance

use of org.eclipse.jst.server.tomcat.core.internal.xml.server32.ServerInstance in project webtools.servertools by eclipse.

the class Tomcat50TestConfiguration method verifyPublishedModule.

protected void verifyPublishedModule(IPath baseDir, IModule module) throws Exception {
    Tomcat50TestConfiguration config = new Tomcat50TestConfiguration(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(module.getName(), context.getDocBase());
    } else {
        assertEquals(getTomcatServerBehaviour().getModuleDeployDirectory(module).toOSString(), context.getDocBase());
    }
    verifyPublishedModuleFiles(module);
}
Also used : Context(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context) ServerInstance(org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)

Example 20 with ServerInstance

use of org.eclipse.jst.server.tomcat.core.internal.xml.server32.ServerInstance in project webtools.servertools by eclipse.

the class Tomcat70TestConfiguration method verifyPublishedModule.

protected void verifyPublishedModule(IPath baseDir, IModule module) throws Exception {
    Tomcat70TestConfiguration config = new Tomcat70TestConfiguration(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(module.getName(), context.getDocBase());
    } else {
        assertEquals(getTomcatServerBehaviour().getModuleDeployDirectory(module).toOSString(), context.getDocBase());
    }
    verifyPublishedModuleFiles(module);
}
Also used : Context(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context) ServerInstance(org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)

Aggregations

ServerInstance (org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)38 IStatus (org.eclipse.core.runtime.IStatus)25 Status (org.eclipse.core.runtime.Status)24 Factory (org.eclipse.jst.server.tomcat.core.internal.xml.Factory)24 FileInputStream (java.io.FileInputStream)23 CoreException (org.eclipse.core.runtime.CoreException)21 InputStream (java.io.InputStream)19 ByteArrayInputStream (java.io.ByteArrayInputStream)18 InputSource (org.xml.sax.InputSource)18 IFile (org.eclipse.core.resources.IFile)17 Context (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context)17 File (java.io.File)13 Server (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server)10 IPath (org.eclipse.core.runtime.IPath)9 FileNotFoundException (java.io.FileNotFoundException)6 IOException (java.io.IOException)6 MultiStatus (org.eclipse.core.runtime.MultiStatus)6 Path (org.eclipse.core.runtime.Path)5 SAXException (org.xml.sax.SAXException)5 JarFile (java.util.jar.JarFile)4