Search in sources :

Example 6 with TomcatServer

use of org.eclipse.jst.server.tomcat.core.internal.TomcatServer in project webtools.servertools by eclipse.

the class AbstractTomcatServerTestCase method verifyLegacyRemovePublish.

/**
 * @throws Exception
 */
public void verifyLegacyRemovePublish() throws Exception {
    IModule webModule = ModuleTestCase.webModule;
    IServerWorkingCopy wc = getServer().createWorkingCopy();
    // Unset the deployment directory
    ((TomcatServer) wc.loadAdapter(TomcatServer.class, null)).setDeployDirectory(null);
    wc.modifyModules(null, new IModule[] { webModule }, null);
    wc.save(true, null);
    getServer().publish(IServer.PUBLISH_FULL, null);
    TomcatServerBehaviour tsb = getTomcatServerBehaviour();
    IPath baseDir = tsb.getRuntimeBaseDirectory();
    IPath moduleDir = baseDir.append("webapps").append(ModuleTestCase.webModule.getName());
    assertFalse(moduleDir.toFile().exists());
}
Also used : IModule(org.eclipse.wst.server.core.IModule) IPath(org.eclipse.core.runtime.IPath) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) TomcatServerBehaviour(org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour) TomcatServer(org.eclipse.jst.server.tomcat.core.internal.TomcatServer)

Example 7 with TomcatServer

use of org.eclipse.jst.server.tomcat.core.internal.TomcatServer in project webtools.servertools by eclipse.

the class ConfigurationWebModuleEditorPart method init.

/* (non-Javadoc)
	 * Initializes the editor part with a site and input.
	 */
public void init(IEditorSite site, IEditorInput input) {
    super.init(site, input);
    TomcatServer ts = (TomcatServer) server.loadAdapter(TomcatServer.class, null);
    try {
        configuration = ts.getTomcatConfiguration();
    } catch (Exception e) {
    // ignore
    }
    if (configuration != null)
        addChangeListener();
    if (server != null)
        server2 = (ITomcatServerWorkingCopy) server.loadAdapter(ITomcatServerWorkingCopy.class, null);
    initialize();
}
Also used : ITomcatServerWorkingCopy(org.eclipse.jst.server.tomcat.core.internal.ITomcatServerWorkingCopy) TomcatServer(org.eclipse.jst.server.tomcat.core.internal.TomcatServer)

Example 8 with TomcatServer

use of org.eclipse.jst.server.tomcat.core.internal.TomcatServer in project webtools.servertools by eclipse.

the class ConfigurationPropertyTester method test.

/* (non-Javadoc)
	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
	 */
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
    try {
        IServerAttributes server = (IServerAttributes) receiver;
        TomcatServer tomcatServer = (TomcatServer) server.loadAdapter(ITomcatServer.class, null);
        if (tomcatServer != null)
            return tomcatServer.getServerConfiguration() != null;
    } catch (Exception e) {
    // ignore
    }
    return false;
}
Also used : IServerAttributes(org.eclipse.wst.server.core.IServerAttributes) ITomcatServer(org.eclipse.jst.server.tomcat.core.internal.ITomcatServer) TomcatServer(org.eclipse.jst.server.tomcat.core.internal.TomcatServer) ITomcatServer(org.eclipse.jst.server.tomcat.core.internal.ITomcatServer)

Example 9 with TomcatServer

use of org.eclipse.jst.server.tomcat.core.internal.TomcatServer in project webtools.servertools by eclipse.

the class AbstractTomcatServerTestCase method verifyLegacyAddPublish.

/**
 * @throws Exception
 */
public void verifyLegacyAddPublish() throws Exception {
    IModule webModule = ModuleTestCase.webModule;
    IServerWorkingCopy wc = getServer().createWorkingCopy();
    // Unset the deployment directory
    ((TomcatServer) wc.loadAdapter(TomcatServer.class, null)).setDeployDirectory(null);
    wc.modifyModules(new IModule[] { webModule }, null, null);
    wc.save(true, null);
    getServer().publish(IServer.PUBLISH_FULL, null);
    TomcatServerBehaviour tsb = getTomcatServerBehaviour();
    IPath baseDir = tsb.getRuntimeBaseDirectory();
    IPath moduleDir = baseDir.append("webapps").append(ModuleTestCase.webModule.getName());
    assertTrue(moduleDir.toFile().exists());
    verifyPublishedModule(baseDir, ModuleTestCase.webModule);
}
Also used : IModule(org.eclipse.wst.server.core.IModule) IPath(org.eclipse.core.runtime.IPath) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) TomcatServerBehaviour(org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour) TomcatServer(org.eclipse.jst.server.tomcat.core.internal.TomcatServer)

Example 10 with TomcatServer

use of org.eclipse.jst.server.tomcat.core.internal.TomcatServer in project webtools.servertools by eclipse.

the class AbstractTomcatServerTestCase method verifyLegacyDeployConfig.

/**
 * Verify configuration when deployment directory is unset.
 * Deployment directory should default to "webapps".
 * @throws Exception
 */
public void verifyLegacyDeployConfig() throws Exception {
    TomcatServer ts = getTomcatServer();
    assertNotNull(ts);
    ts.setDeployDirectory("webapps");
    TomcatServerBehaviour tsb = getTomcatServerBehaviour();
    assertNotNull(tsb);
    assertEquals("webapps", ts.getDeployDirectory());
    // Verify that legacy setting results in attribute removal
    Server svr = (Server) getServer().loadAdapter(Server.class, null);
    assertNotNull(svr);
    String attr = svr.getAttribute("webapps", (String) null);
    assertNull(attr);
    IPath tempDir = tsb.getTempDirectory();
    IPath baseDir = tsb.getRuntimeBaseDirectory();
    assertEquals(tempDir, baseDir);
    IPath deployDir = tsb.getServerDeployDirectory();
    assertEquals(baseDir.append("webapps"), deployDir);
}
Also used : TomcatServer(org.eclipse.jst.server.tomcat.core.internal.TomcatServer) IServer(org.eclipse.wst.server.core.IServer) Server(org.eclipse.wst.server.core.internal.Server) IPath(org.eclipse.core.runtime.IPath) TomcatServerBehaviour(org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour) TomcatServer(org.eclipse.jst.server.tomcat.core.internal.TomcatServer)

Aggregations

TomcatServer (org.eclipse.jst.server.tomcat.core.internal.TomcatServer)11 IPath (org.eclipse.core.runtime.IPath)4 TomcatServerBehaviour (org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour)4 List (java.util.List)3 IModule (org.eclipse.wst.server.core.IModule)3 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)3 ITomcatConfigurationWorkingCopy (org.eclipse.jst.server.tomcat.core.internal.ITomcatConfigurationWorkingCopy)2 IServer (org.eclipse.wst.server.core.IServer)2 IWebModule (org.eclipse.jst.server.core.IWebModule)1 ITomcatServer (org.eclipse.jst.server.tomcat.core.internal.ITomcatServer)1 ITomcatServerWorkingCopy (org.eclipse.jst.server.tomcat.core.internal.ITomcatServerWorkingCopy)1 TomcatConfiguration (org.eclipse.jst.server.tomcat.core.internal.TomcatConfiguration)1 WebModule (org.eclipse.jst.server.tomcat.core.internal.WebModule)1 Shell (org.eclipse.swt.widgets.Shell)1 IRuntime (org.eclipse.wst.server.core.IRuntime)1 IServerAttributes (org.eclipse.wst.server.core.IServerAttributes)1 IServerType (org.eclipse.wst.server.core.IServerType)1 ServerPort (org.eclipse.wst.server.core.ServerPort)1 Server (org.eclipse.wst.server.core.internal.Server)1