use of com.liferay.ide.core.util.LaunchHelper in project liferay-ide by liferay.
the class ServerManagerTests method startServer.
@Before
public void startServer() throws Exception {
if (shouldSkipServerTests())
return;
final IServer server = getServer();
assertEquals("Expected the port " + liferayServerStartPort + " is available", true, SocketUtil.isPortAvailable(liferayServerStartPort));
assertEquals("Expected the port " + liferayServerAjpPort + " is available", true, SocketUtil.isPortAvailable(liferayServerAjpPort));
changeServerXmlPort(BUNDLE_START_PORT, liferayServerStartPort);
changeServerXmlPort(BUNDLE_AJP_PORT, liferayServerAjpPort);
changeServerXmlPort(BUNDLE_SHUTDOWN_PORT, liferayServerShutdownPort);
copyFileToServer(server, "deploy", "files", remoteIDEConnectorLPKGFileName);
copyFileToServer(server, "", "files", portalSetupWizardFileName);
final String exceFileName = Platform.getOS().contains("win") ? "catalina.bat" : "catalina.sh";
final LaunchHelper launchHelper = new LaunchHelper();
launchHelper.setLaunchSync(false);
final IPath serverLocation = server.getRuntime().getLocation().append("bin");
launchHelper.launch(getLaunchConfig(serverLocation, exceFileName, "run"), ILaunchManager.RUN_MODE, null);
boolean stop = false;
int i = 0;
int statusCode = 0;
while (!stop) {
try {
if (i > 1500) {
stop = true;
}
URL pingUrl = new URL("http://localhost:" + liferayServerStartPort);
URLConnection conn = pingUrl.openConnection();
((HttpURLConnection) conn).setInstanceFollowRedirects(false);
statusCode = ((HttpURLConnection) conn).getResponseCode();
if (!stop) {
Thread.sleep(200);
}
stop = true;
} catch (Exception e) {
i++;
Thread.sleep(200);
}
}
service = new ServerManagerConnection();
service.setHost("localhost");
service.setHttpPort(liferayServerStartPort);
service.setManagerContextPath("/server-manager-web");
service.setUsername("test@liferay.com");
service.setPassword("test");
// Given the server 10 seconds to deploy remote IDE Connector plugin
try {
Thread.sleep(10000);
} catch (Exception e) {
}
assertEquals(200, statusCode);
}
use of com.liferay.ide.core.util.LaunchHelper in project liferay-ide by liferay.
the class ServerManagerTests method stopServer.
@After
public void stopServer() throws Exception {
if (shouldSkipServerTests())
return;
IServer server = getServer();
final String exceFileName = Platform.getOS().contains("win") ? "shutdown.bat" : "shutdown.sh";
final LaunchHelper launchHelper = new LaunchHelper();
launchHelper.setLaunchSync(false);
final IPath serverLocation = server.getRuntime().getLocation().append("bin");
launchHelper.launch(getLaunchConfig(serverLocation, exceFileName, "run"), ILaunchManager.RUN_MODE, null);
boolean stop = false;
int i = 0;
while (!stop) {
try {
if (i > 15) {
stop = true;
}
URL pingUrl = new URL("http://localhost:" + liferayServerStartPort);
URLConnection conn = pingUrl.openConnection();
((HttpURLConnection) conn).setInstanceFollowRedirects(false);
((HttpURLConnection) conn).getResponseCode();
if (!stop) {
Thread.sleep(200);
}
i++;
} catch (Exception e) {
stop = true;
}
}
changeServerXmlPort(liferayServerShutdownPort, BUNDLE_SHUTDOWN_PORT);
changeServerXmlPort(liferayServerStartPort, BUNDLE_START_PORT);
changeServerXmlPort(liferayServerAjpPort, BUNDLE_AJP_PORT);
}
use of com.liferay.ide.core.util.LaunchHelper in project liferay-ide by liferay.
the class MavenProjectRemoteServerPublisher method _execMavenLaunch.
private boolean _execMavenLaunch(IProject project, String goal, IMavenProjectFacade facade, IProgressMonitor monitor) throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(_launchConfigurationTypeId);
IPath basedirLocation = project.getLocation();
String newName = launchManager.generateLaunchConfigurationName(basedirLocation.lastSegment());
ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(null, newName);
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-Dmaven.multiModuleProjectDirectory");
workingCopy.setAttribute(_attrPomDir, basedirLocation.toString());
workingCopy.setAttribute(_attrGoals, goal);
workingCopy.setAttribute(_attrUpdateSnapshots, Boolean.TRUE);
workingCopy.setAttribute(_attrWorkspaceResolution, Boolean.TRUE);
workingCopy.setAttribute(_attrSkipTests, Boolean.TRUE);
if (facade != null) {
ResolverConfiguration configuration = facade.getResolverConfiguration();
String selectedProfiles = configuration.getSelectedProfiles();
if ((selectedProfiles != null) && (selectedProfiles.length() > 0)) {
workingCopy.setAttribute(_attrProfiles, selectedProfiles);
}
new LaunchHelper().launch(workingCopy, "run", monitor);
return true;
} else {
return false;
}
}
use of com.liferay.ide.core.util.LaunchHelper in project liferay-ide by liferay.
the class MavenProjectBuilder method _execMavenLaunch.
private boolean _execMavenLaunch(IProject project, String goal, IMavenProjectFacade facade, IProgressMonitor monitor) throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(_launchConfigurationTypeId);
IPath basedirLocation = project.getLocation();
String newName = launchManager.generateLaunchConfigurationName(basedirLocation.lastSegment());
ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(null, newName);
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-Dmaven.multiModuleProjectDirectory");
workingCopy.setAttribute(_attrPomDir, basedirLocation.toString());
workingCopy.setAttribute(_attrGoals, goal);
// workingCopy.setAttribute( ATTR_UPDATE_SNAPSHOTS, Boolean.TRUE );
workingCopy.setAttribute(_attrWorkspaceResolution, Boolean.TRUE);
workingCopy.setAttribute(_attrSkipTests, Boolean.TRUE);
if (facade != null) {
ResolverConfiguration configuration = facade.getResolverConfiguration();
String selectedProfiles = configuration.getSelectedProfiles();
if ((selectedProfiles != null) && (selectedProfiles.length() > 0)) {
workingCopy.setAttribute(_attrProfiles, selectedProfiles);
}
new LaunchHelper().launch(workingCopy, "run", monitor);
return true;
} else {
return false;
}
}
Aggregations