Search in sources :

Example 1 with IRuntimeWorkingCopy

use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project sling by apache.

the class SlingWstServer method before.

@Override
protected void before() throws Throwable {
    IRuntimeType launchpadRuntime = null;
    for (IRuntimeType type : ServerCore.getRuntimeTypes()) {
        if ("org.apache.sling.ide.launchpadRuntimeType".equals(type.getId())) {
            launchpadRuntime = type;
            break;
        }
    }
    if (launchpadRuntime == null) {
        throw new IllegalArgumentException("No runtime of type 'org.apache.sling.ide.launchpadRuntimeType' found");
    }
    IRuntimeWorkingCopy rtwc = launchpadRuntime.createRuntime("temp.sling.launchpad.rt.id", new NullProgressMonitor());
    rtwc.save(true, new NullProgressMonitor());
    IServerType serverType = null;
    for (IServerType type : ServerCore.getServerTypes()) {
        if ("org.apache.sling.ide.launchpadServer".equals(type.getId())) {
            serverType = type;
            break;
        }
    }
    if (serverType == null) {
        throw new IllegalArgumentException("No server type of type 'org.apache.sling.ide.launchpadServer' found");
    }
    IServerWorkingCopy wc = serverType.createServer("temp.sling.launchpad.server.id", null, new NullProgressMonitor());
    wc.setHost(config.getHostname());
    wc.setAttribute(ISlingLaunchpadServer.PROP_PORT, config.getPort());
    wc.setAttribute(ISlingLaunchpadServer.PROP_CONTEXT_PATH, config.getContextPath());
    wc.setAttribute(ISlingLaunchpadServer.PROP_USERNAME, config.getUsername());
    wc.setAttribute(ISlingLaunchpadServer.PROP_PASSWORD, config.getPassword());
    wc.setAttribute("auto-publish-time", 0);
    server = wc.save(true, new NullProgressMonitor());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServerType(org.eclipse.wst.server.core.IServerType) IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy)

Example 2 with IRuntimeWorkingCopy

use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project liferay-ide by liferay.

the class ServerUtil method addPortalRuntimeAndServer.

public static void addPortalRuntimeAndServer(String serverRuntimeName, IPath location, IProgressMonitor monitor) throws CoreException {
    final IRuntimeWorkingCopy runtimeWC = ServerCore.findRuntimeType(PortalRuntime.ID).createRuntime(serverRuntimeName, monitor);
    runtimeWC.setName(serverRuntimeName);
    runtimeWC.setLocation(location);
    runtimeWC.save(true, monitor);
    final IServerWorkingCopy serverWC = ServerCore.findServerType(PortalServer.ID).createServer(serverRuntimeName, null, runtimeWC, monitor);
    serverWC.setName(serverRuntimeName);
    serverWC.save(true, monitor);
}
Also used : IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy)

Example 3 with IRuntimeWorkingCopy

use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project liferay-ide by liferay.

the class LiferayRuntimeStubWizardFragment method getLiferayRuntime.

protected ILiferayRuntime getLiferayRuntime() {
    IRuntimeWorkingCopy runtimeWC = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
    ILiferayRuntime liferayRuntime = (ILiferayRuntime) runtimeWC.loadAdapter(ILiferayRuntime.class, null);
    return liferayRuntime;
}
Also used : ILiferayRuntime(com.liferay.ide.server.core.ILiferayRuntime) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy)

Example 4 with IRuntimeWorkingCopy

use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project liferay-ide by liferay.

the class PortalBundleTests method testPortalBundleTypeCorrection.

@Test
public void testPortalBundleTypeCorrection() throws Exception {
    if (shouldSkipBundleTests())
        return;
    IProgressMonitor npm = new NullProgressMonitor();
    final String name = "correctionTest";
    final IRuntimeWorkingCopy runtimeWC = ServerCore.findRuntimeType(getRuntimeId()).createRuntime(name, npm);
    assertNotNull(runtimeWC);
    runtimeWC.setName(name);
    runtimeWC.setLocation(getLiferayRuntimeDir().append(".."));
    PortalRuntime portalRuntime = (PortalRuntime) runtimeWC.loadAdapter(PortalRuntime.class, npm);
    assertNotNull(portalRuntime);
    assertNotNull(portalRuntime.getPortalBundle());
    assertEquals("tomcat", portalRuntime.getPortalBundle().getType());
    assertEquals(getLiferayRuntimeDir().append(".."), portalRuntime.getPortalBundle().getLiferayHome());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) PortalRuntime(com.liferay.ide.server.core.portal.PortalRuntime) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy) Test(org.junit.Test)

Example 5 with IRuntimeWorkingCopy

use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project liferay-ide by liferay.

the class PortalBundleTests method testPortalBundleTypeNotFound.

@Test
public void testPortalBundleTypeNotFound() throws Exception {
    if (shouldSkipBundleTests())
        return;
    IProgressMonitor npm = new NullProgressMonitor();
    final String name = "notfoundTest";
    final IRuntimeWorkingCopy runtimeWC = ServerCore.findRuntimeType(getRuntimeId()).createRuntime(name, npm);
    assertNotNull(runtimeWC);
    runtimeWC.setName(name);
    runtimeWC.setLocation(getLiferayRuntimeDir().append("../.."));
    PortalRuntime portalRuntime = (PortalRuntime) runtimeWC.loadAdapter(PortalRuntime.class, npm);
    assertNotNull(portalRuntime);
    assertNull(portalRuntime.getPortalBundle());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) PortalRuntime(com.liferay.ide.server.core.portal.PortalRuntime) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy) Test(org.junit.Test)

Aggregations

IRuntimeWorkingCopy (org.eclipse.wst.server.core.IRuntimeWorkingCopy)41 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)16 IRuntime (org.eclipse.wst.server.core.IRuntime)13 IRuntimeType (org.eclipse.wst.server.core.IRuntimeType)12 CoreException (org.eclipse.core.runtime.CoreException)9 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)9 IServerType (org.eclipse.wst.server.core.IServerType)8 IPath (org.eclipse.core.runtime.IPath)6 IStatus (org.eclipse.core.runtime.IStatus)6 Path (org.eclipse.core.runtime.Path)6 Test (org.junit.Test)6 PortalRuntime (com.liferay.ide.server.core.portal.PortalRuntime)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 NewModuleFragmentOp (com.liferay.ide.project.core.modules.fragment.NewModuleFragmentOp)2 OverrideFilePath (com.liferay.ide.project.core.modules.fragment.OverrideFilePath)2 HashMap (java.util.HashMap)2 IFile (org.eclipse.core.resources.IFile)2 IProject (org.eclipse.core.resources.IProject)2 GenericServerRuntime (org.eclipse.jst.server.generic.core.internal.GenericServerRuntime)2 ITomcatRuntimeWorkingCopy (org.eclipse.jst.server.tomcat.core.internal.ITomcatRuntimeWorkingCopy)2