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