Search in sources :

Example 1 with ILiferayTomcatRuntime

use of com.liferay.ide.server.tomcat.core.ILiferayTomcatRuntime in project liferay-ide by liferay.

the class ServerCoreBase method setupRuntime.

@Before
public void setupRuntime() throws Exception {
    if (shouldSkipBundleTests())
        return;
    assertNotNull("Expected System.getProperty(\"liferay.bundles.dir\") to not be null", System.getProperty("liferay.bundles.dir"));
    assertNotNull("Expected liferayBundlesDir to not be null", liferayBundlesDir);
    assertEquals("Expected liferayBundlesPath to exist: " + getLiferayBundlesPath().toOSString(), true, getLiferayBundlesPath().toFile().exists());
    extractRuntime(getLiferayRuntimeZip(), getLiferayRuntimeDir());
    final NullProgressMonitor npm = new NullProgressMonitor();
    final String runtimeName = getRuntimeVersion();
    runtime = ServerCore.findRuntime(runtimeName);
    if (runtime == null) {
        final IRuntimeWorkingCopy runtimeWC = ServerCore.findRuntimeType(getRuntimeId()).createRuntime(runtimeName, npm);
        runtimeWC.setName(runtimeName);
        runtimeWC.setLocation(getLiferayRuntimeDir());
        runtime = runtimeWC.save(true, npm);
    }
    assertNotNull(runtime);
    final ILiferayTomcatRuntime liferayRuntime = (ILiferayTomcatRuntime) ServerCore.findRuntime(runtimeName).loadAdapter(ILiferayTomcatRuntime.class, npm);
    assertNotNull(liferayRuntime);
    final IPath portalBundleFolder = runtime.getLocation().removeLastSegments(1);
    final IPath deployPath = portalBundleFolder.append("deploy");
    final File deployFolder = deployPath.toFile();
    if (!deployFolder.exists()) {
        deployFolder.mkdir();
    }
    assertEquals("Expected the deploy folder to exist:" + deployPath.toOSString(), true, deployFolder.exists());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IPath(org.eclipse.core.runtime.IPath) ILiferayTomcatRuntime(com.liferay.ide.server.tomcat.core.ILiferayTomcatRuntime) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy) File(java.io.File) Before(org.junit.Before)

Aggregations

ILiferayTomcatRuntime (com.liferay.ide.server.tomcat.core.ILiferayTomcatRuntime)1 File (java.io.File)1 IPath (org.eclipse.core.runtime.IPath)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IRuntimeWorkingCopy (org.eclipse.wst.server.core.IRuntimeWorkingCopy)1 Before (org.junit.Before)1