use of com.liferay.ide.server.remote.ServerManagerConnection in project liferay-ide by liferay.
the class LiferayServerCore method getRemoteConnection.
public static IServerManagerConnection getRemoteConnection(final IRemoteServer server) {
IServerManagerConnection retval = null;
if (connections == null) {
connections = new HashMap<String, IServerManagerConnection>();
}
if (server != null) {
IServerManagerConnection service = connections.get(server.getId());
if (service == null) {
service = new ServerManagerConnection();
updateConnectionSettings(server, service);
connections.put(server.getId(), service);
} else {
updateConnectionSettings(server, service);
}
retval = service;
}
return retval;
}
use of com.liferay.ide.server.remote.ServerManagerConnection 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);
}
Aggregations