use of org.eclipse.jst.server.generic.servertype.definition.ServerRuntime in project webtools.servertools by eclipse.
the class GenericServerWizardFragment method getServerTypeDefinitionFor.
/**
* @param server
* @return
*/
private ServerRuntime getServerTypeDefinitionFor(IServerWorkingCopy server) {
GenericServerRuntime runtime = (GenericServerRuntime) server.getRuntime().getAdapter(GenericServerRuntime.class);
if (runtime == null) {
IRuntime wc = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
runtime = (GenericServerRuntime) wc.getAdapter(GenericServerRuntime.class);
if (runtime == null)
runtime = (GenericServerRuntime) wc.loadAdapter(GenericServerRuntime.class, new NullProgressMonitor());
}
String serverTyepId = server.getServerType().getId();
String runtimeTypeId = runtime.getRuntime().getRuntimeType().getId();
if (runtimeTypeId == null) {
return null;
}
Map runtimeProperties = runtime.getServerInstanceProperties();
ServerRuntime definition = getServerTypeDefinition(serverTyepId, runtimeTypeId, runtimeProperties);
return definition;
}
use of org.eclipse.jst.server.generic.servertype.definition.ServerRuntime in project webtools.servertools by eclipse.
the class GenericServerTest method testServerAndRuntimeInfoForServerDefOnly.
public void testServerAndRuntimeInfoForServerDefOnly() throws Exception {
GenericServerRuntime runtime = ServerRuntimeUtils.getGenericServerRuntime(TEST_SERVERDEFONLY_RUNTIMETYPE_ID);
GenericServer server = ServerRuntimeUtils.getGenericServer(TEST_SERVERDEFONLY_SERVERTYPE_ID, runtime.getRuntime());
assertNotNull(server);
ServerRuntime serverRuntime = server.getServerDefinition();
// Verify Server and Runtime info
ServerRuntimeUtils.verifyProperty(serverRuntime.getProperty(), "foo.prop.a", "a runtime property value");
ServerRuntimeUtils.verifyProperty(serverRuntime.getProperty(), "foo.prop.b", "a server property value");
ServerRuntimeUtils.verifyClasspath(serverRuntime.getClasspath(), "foo.classpath");
}
use of org.eclipse.jst.server.generic.servertype.definition.ServerRuntime in project webtools.servertools by eclipse.
the class GenericServerRuntimeTest method testServerAndRuntimeInfo.
/**
* runtimeTypeId used as key to .serverdef
*/
public void testServerAndRuntimeInfo() throws Exception {
GenericServerRuntime runtime = ServerRuntimeUtils.getGenericServerRuntime(TEST_SERVERDEFONLY_RUNTIMETYPE_ID);
assertNotNull(runtime);
ServerRuntime serverRuntime = runtime.getServerTypeDefinition();
assertNotNull(serverRuntime);
// Verify runtime info, and server info
ServerRuntimeUtils.verifyProperty(serverRuntime.getProperty(), "foo.prop.a", "a runtime property value");
ServerRuntimeUtils.verifyProperty(serverRuntime.getProperty(), "foo.prop.b", "a server property value");
}
use of org.eclipse.jst.server.generic.servertype.definition.ServerRuntime in project webtools.servertools by eclipse.
the class ServerDefinitionTypeTest method testResolve.
public void testResolve() {
ServerTypeDefinitionManager serverTypeDefinitionManager = CorePlugin.getDefault().getServerTypeDefinitionManager();
assertNotNull(serverTypeDefinitionManager);
ServerRuntime[] types = serverTypeDefinitionManager.getServerTypeDefinitions();
assertNotNull(types);
assertTrue(types.length > 0);
for (int i = 0; i < types.length; i++) {
ServerRuntime definition = types[i];
String wd = definition.getStart().getWorkingDirectory();
String resolved = definition.getResolver().resolveProperties(wd);
assertFalse(resolved.indexOf("${") >= 0);
}
}
use of org.eclipse.jst.server.generic.servertype.definition.ServerRuntime in project webtools.servertools by eclipse.
the class ServerDefinitionTypeTest method testGetTypes.
public void testGetTypes() {
IExtension[] extensions = ExtensionPointUtil.getGenericServerDefinitionExtensions();
int noOfExtensions = 0;
for (int i = 0; i < extensions.length; i++) {
noOfExtensions += ExtensionPointUtil.getConfigurationElements(extensions[i]).length;
}
ServerTypeDefinitionManager serverTypeDefinitionManager = CorePlugin.getDefault().getServerTypeDefinitionManager();
assertNotNull(serverTypeDefinitionManager);
ServerRuntime[] types = serverTypeDefinitionManager.getServerTypeDefinitions();
assertNotNull(types);
assertEquals(noOfExtensions, types.length);
}
Aggregations