Search in sources :

Example 6 with PortalRuntime

use of com.liferay.ide.server.core.portal.PortalRuntime 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 7 with PortalRuntime

use of com.liferay.ide.server.core.portal.PortalRuntime 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)

Example 8 with PortalRuntime

use of com.liferay.ide.server.core.portal.PortalRuntime in project liferay-ide by liferay.

the class ServerNameChangeTests method setupRuntime.

private String setupRuntime(IPath runtimeZipPath, IPath runitmeDirPath, String runtimeName, IPath runtimUnzipDir, String runtimeId) throws Exception {
    assertEquals("Expected liferayBundlesPath to exist: " + runtimeZipPath.toOSString(), true, runtimeZipPath.toFile().exists());
    extractLiferayRuntime(runtimeZipPath, runtimUnzipDir);
    final NullProgressMonitor npm = new NullProgressMonitor();
    IRuntime findRuntime = ServerCore.findRuntime(runtimeName);
    if (findRuntime == null) {
        final IRuntimeWorkingCopy runtimeWC = ServerCore.findRuntimeType(runtimeId).createRuntime(runtimeName, npm);
        runtimeWC.setName(runtimeName);
        runtimeWC.setLocation(runitmeDirPath);
        findRuntime = runtimeWC.save(true, npm);
    }
    assertNotNull(findRuntime);
    final PortalRuntime liferayRuntime = (PortalRuntime) ServerCore.findRuntime(runtimeName).loadAdapter(PortalRuntime.class, npm);
    assertNotNull(liferayRuntime);
    return findRuntime.getId();
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) PortalRuntime(com.liferay.ide.server.core.portal.PortalRuntime) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy) IRuntime(org.eclipse.wst.server.core.IRuntime)

Example 9 with PortalRuntime

use of com.liferay.ide.server.core.portal.PortalRuntime in project liferay-ide by liferay.

the class PortalRuntimeComposite method updateJREs.

protected void updateJREs() {
    PortalRuntime portalRuntime = getPortalRuntime();
    IVMInstall currentVM = null;
    if (portalRuntime != null && portalRuntime.getVMInstall() != null) {
        currentVM = portalRuntime.getVMInstall();
    } else {
        currentVM = JavaRuntime.getDefaultVMInstall();
    }
    int currentJREIndex = -1;
    // get all installed JVMs
    installedJREs = new ArrayList<IVMInstall>();
    IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes();
    int size = vmInstallTypes.length;
    for (int i = 0; i < size; i++) {
        IVMInstall[] vmInstalls = vmInstallTypes[i].getVMInstalls();
        int size2 = vmInstalls.length;
        for (int j = 0; j < size2; j++) {
            installedJREs.add(vmInstalls[j]);
        }
    }
    // get names
    size = installedJREs.size();
    jreNames = new String[size + 1];
    jreNames[0] = Msgs.defaultWorkbenchJRE;
    for (int i = 0; i < size; i++) {
        IVMInstall vmInstall = installedJREs.get(i);
        jreNames[i + 1] = vmInstall.getName();
        if (vmInstall.equals(currentVM)) {
            currentJREIndex = i + 1;
        }
    }
    if (jreCombo != null) {
        jreCombo.setItems(jreNames);
        jreCombo.select(currentJREIndex);
    }
}
Also used : PortalRuntime(com.liferay.ide.server.core.portal.PortalRuntime) IVMInstall(org.eclipse.jdt.launching.IVMInstall) IVMInstallType(org.eclipse.jdt.launching.IVMInstallType)

Aggregations

PortalRuntime (com.liferay.ide.server.core.portal.PortalRuntime)9 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 IRuntimeWorkingCopy (org.eclipse.wst.server.core.IRuntimeWorkingCopy)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 Test (org.junit.Test)4 IVMInstall (org.eclipse.jdt.launching.IVMInstall)2 PortalBundle (com.liferay.ide.server.core.portal.PortalBundle)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Enumeration (java.util.Enumeration)1 LinkedHashMap (java.util.LinkedHashMap)1 JarEntry (java.util.jar.JarEntry)1 JarFile (java.util.jar.JarFile)1 JarInputStream (java.util.jar.JarInputStream)1 IPath (org.eclipse.core.runtime.IPath)1 IVMInstallType (org.eclipse.jdt.launching.IVMInstallType)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1