Search in sources :

Example 26 with IRuntimeWorkingCopy

use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project webtools.servertools by eclipse.

the class TomcatRuntimeTestCase method modifyRuntime.

protected void modifyRuntime() throws Exception {
    IRuntimeWorkingCopy wc = runtime.createWorkingCopy();
    ITomcatRuntimeWorkingCopy trwc = (ITomcatRuntimeWorkingCopy) wc.loadAdapter(ITomcatRuntimeWorkingCopy.class, null);
    trwc.setVMInstall(null);
    wc.save(true, null);
    tomcatRuntime = (ITomcatRuntime) runtime.loadAdapter(ITomcatRuntime.class, null);
    assertNotNull(tomcatRuntime.getVMInstall());
}
Also used : ITomcatRuntimeWorkingCopy(org.eclipse.jst.server.tomcat.core.internal.ITomcatRuntimeWorkingCopy) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy)

Example 27 with IRuntimeWorkingCopy

use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project webtools.servertools by eclipse.

the class TomcatRuntimeTestCase method createRuntime.

protected IRuntimeWorkingCopy createRuntime(String runtimeTypeId) throws Exception {
    IRuntimeType rt = ServerCore.findRuntimeType(runtimeTypeId);
    IRuntimeWorkingCopy wc = rt.createRuntime("a", null);
    wc.setLocation(new Path("c://test"));
    return wc;
}
Also used : Path(org.eclipse.core.runtime.Path) IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy)

Example 28 with IRuntimeWorkingCopy

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

the class ProjectCoreBase method createNewRuntime.

protected IRuntime createNewRuntime(final String name) throws Exception {
    final IPath newRuntimeLocation = new Path(getLiferayRuntimeDir().toString() + "-new");
    if (!newRuntimeLocation.toFile().exists()) {
        FileUtils.copyDirectory(getLiferayRuntimeDir().toFile(), newRuntimeLocation.toFile());
    }
    assertEquals(true, newRuntimeLocation.toFile().exists());
    final NullProgressMonitor npm = new NullProgressMonitor();
    IRuntime runtime = ServerCore.findRuntime(name);
    if (runtime == null) {
        final IRuntimeWorkingCopy runtimeWC = ServerCore.findRuntimeType(getRuntimeId()).createRuntime(name, npm);
        runtimeWC.setName(name);
        runtimeWC.setLocation(newRuntimeLocation);
        runtime = runtimeWC.save(true, npm);
    }
    ServerCore.getRuntimes();
    assertNotNull(runtime);
    return runtime;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IPath(org.eclipse.core.runtime.IPath) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy) IRuntime(org.eclipse.wst.server.core.IRuntime)

Example 29 with IRuntimeWorkingCopy

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

the class PortalBundleTests method testPortalBundleTypeDetection.

@Test
public void testPortalBundleTypeDetection() throws Exception {
    if (shouldSkipBundleTests())
        return;
    IProgressMonitor npm = new NullProgressMonitor();
    final String name = "detectionTest";
    final IRuntimeWorkingCopy runtimeWC = ServerCore.findRuntimeType(getRuntimeId()).createRuntime(name, npm);
    assertNotNull(runtimeWC);
    runtimeWC.setName(name);
    runtimeWC.setLocation(getLiferayRuntimeDir());
    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 30 with IRuntimeWorkingCopy

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

the class PortalBundleTests method testPortalBundleChangeLocation.

@Test
public void testPortalBundleChangeLocation() throws Exception {
    if (shouldSkipBundleTests())
        return;
    IProgressMonitor npm = new NullProgressMonitor();
    final String name = "changeLocationTest";
    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());
    runtimeWC.setLocation(getLiferayRuntimeDir().append(".."));
    assertNotNull(portalRuntime.getPortalBundle());
    runtimeWC.setLocation(null);
    assertNull(portalRuntime.getPortalBundle());
    runtimeWC.setLocation(getLiferayRuntimeDir());
    assertNotNull(portalRuntime.getPortalBundle());
// set 7.x server with 6.2 location
// IPath zip = getLiferayBundlesPath().append( "liferay-portal-tomcat-6.2-ce-ga4-20150416163831865.zip" );
// IPath dir = ProjectCore.getDefault().getStateLocation().append( "liferay-portal-6.2-ce-ga4/tomcat-7.0.42" );
// 
// extractRuntime( zip, dir );
// 
// runtimeWC.setLocation( dir );
// 
// 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