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());
}
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() );
}
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();
}
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);
}
}
Aggregations