use of org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance in project webtools.servertools by eclipse.
the class XmlTestCase method testServerInstance1.
/**
* Test behavior of ServerInstance
*/
public void testServerInstance1() {
Server server = getXml40Server("serverxml.test1");
assertNotNull(server);
ServerInstance si = new ServerInstance(server, "nonexistent_service", null);
assertNull(si.getService());
assertEquals("Service \"nonexistent_service\" was not found.", si.getStatus().getMessage());
si = new ServerInstance(server, null, null);
assertNotNull(si.getService());
assertEquals("Service", si.getService().getName());
si = new ServerInstance(server, "Service", null);
assertNotNull(si.getService());
assertNull(si.getEngine());
assertEquals("Engine element not found under Service \"Service\".", si.getStatus().getMessage());
}
use of org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance in project webtools.servertools by eclipse.
the class Tomcat40TestConfiguration method verifyPublishedModule.
protected void verifyPublishedModule(IPath baseDir, IModule module) throws Exception {
Tomcat40TestConfiguration config = new Tomcat40TestConfiguration(null);
config.load(baseDir.append("conf"), null);
ServerInstance serverInstance = config.getServerInstance();
Context context = serverInstance.getContext(module.getName());
String deployDir = getTomcatServer().getDeployDirectory();
if ("webapps".equals(deployDir)) {
assertEquals(module.getName(), context.getDocBase());
} else {
assertEquals(getTomcatServerBehaviour().getModuleDeployDirectory(module).toOSString(), context.getDocBase());
}
verifyPublishedModuleFiles(module);
}
use of org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance in project webtools.servertools by eclipse.
the class Tomcat55TestConfiguration method verifyPublishedModule.
protected void verifyPublishedModule(IPath baseDir, IModule module) throws Exception {
Tomcat55TestConfiguration config = new Tomcat55TestConfiguration(null);
config.load(baseDir.append("conf"), null);
ServerInstance serverInstance = config.getServerInstance();
Context context = serverInstance.getContext(module.getName());
String deployDir = getTomcatServer().getDeployDirectory();
if ("webapps".equals(deployDir)) {
assertEquals(module.getName(), context.getDocBase());
} else {
assertEquals(getTomcatServerBehaviour().getModuleDeployDirectory(module).toOSString(), context.getDocBase());
}
verifyPublishedModuleFiles(module);
}
use of org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance in project webtools.servertools by eclipse.
the class Tomcat60TestConfiguration method verifyPublishedModule.
protected void verifyPublishedModule(IPath baseDir, IModule module) throws Exception {
Tomcat60TestConfiguration config = new Tomcat60TestConfiguration(null);
config.load(baseDir.append("conf"), null);
ServerInstance serverInstance = config.getServerInstance();
Context context = serverInstance.getContext(module.getName());
String deployDir = getTomcatServer().getDeployDirectory();
if ("webapps".equals(deployDir)) {
assertEquals(module.getName(), context.getDocBase());
} else {
assertEquals(getTomcatServerBehaviour().getModuleDeployDirectory(module).toOSString(), context.getDocBase());
}
verifyPublishedModuleFiles(module);
}
use of org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance in project liferay-ide by liferay.
the class LiferayTomcatUtil method ensurePortalIDEPropertiesExists.
private static File ensurePortalIDEPropertiesExists(IPath installPath, IPath configPath, IServer currentServer, ILiferayTomcatServer portalServer) {
// $NON-NLS-1$
IPath idePropertiesPath = installPath.append("../portal-ide.properties");
// $NON-NLS-1$
String hostName = "localhost";
try {
ServerInstance server = // $NON-NLS-1$
TomcatVersionHelper.getCatalinaServerInstance(configPath.append("conf/server.xml"), null, null);
hostName = server.getHost().getName();
} catch (Exception e) {
LiferayTomcatPlugin.logError(e);
}
// read portal-developer.properties
// Properties devProps = new Properties();
// IPath devPropertiesPath =
// installPath.append("webapps/ROOT/WEB-INF/classes/portal-developer.properties");
// if (devPropertiesPath.toFile().exists()) {
// devProps.load(new FileReader(devPropertiesPath.toFile()));
// }
// if (idePropertiesPath.toFile().exists()) {
// String value =
// CoreUtil.readPropertyFileValue(idePropertiesPath.toFile(),
// "auto.deploy.tomcat.conf.dir");
// if (configPath.append("conf/Catalina/"+hostName).toFile().equals(new
// File(value))) {
// return;
// }
// }
Properties props = new Properties();
if (portalServer != null && portalServer.getServerMode() == ILiferayTomcatConstants.DEVELOPMENT_SERVER_MODE) {
props.put("include-and-override", "portal-developer.properties");
}
// $NON-NLS-1$ //$NON-NLS-2$
props.put("com.liferay.portal.servlet.filters.etag.ETagFilter", "false");
// $NON-NLS-1$ //$NON-NLS-2$
props.put("com.liferay.portal.servlet.filters.header.HeaderFilter", "false");
// $NON-NLS-1$ //$NON-NLS-2$
props.put("json.service.auth.token.enabled", "false");
// $NON-NLS-1$ //$NON-NLS-2$
props.put("auto.deploy.tomcat.conf.dir", configPath.append("conf/Catalina/" + hostName).toOSString());
if (currentServer != null && portalServer != null) {
IPath runtimLocation = currentServer.getRuntime().getLocation();
String autoDeployDir = portalServer.getAutoDeployDirectory();
if (!ILiferayTomcatConstants.DEFAULT_AUTO_DEPLOYDIR.equals(autoDeployDir)) {
IPath autoDeployDirPath = new Path(autoDeployDir);
if (autoDeployDirPath.isAbsolute() && autoDeployDirPath.toFile().exists()) {
// $NON-NLS-1$
props.put("auto.deploy.deploy.dir", portalServer.getAutoDeployDirectory());
} else {
File autoDeployDirFile = new File(runtimLocation.toFile(), autoDeployDir);
if (autoDeployDirFile.exists()) {
// $NON-NLS-1$
props.put("auto.deploy.deploy.dir", autoDeployDirFile.getPath());
}
}
}
// $NON-NLS-1$
props.put("auto.deploy.interval", portalServer.getAutoDeployInterval());
}
// props.put( "json.service.public.methods", "*" );
// $NON-NLS-1$ //$NON-NLS-2$
props.put("jsonws.web.service.public.methods", "*");
File file = idePropertiesPath.toFile();
try {
props.store(Files.newOutputStream(file.toPath()), null);
} catch (Exception e) {
LiferayTomcatPlugin.logError(e);
}
return file;
}
Aggregations