use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime in project webtools.servertools by eclipse.
the class GenericServerTest method testServerAndRuntimeInfoForServerDefAndRuntimeDef.
/**
* serverTypeId used as a key to the .serverdef file, then
* the runtimeTypeId used as key to .runtimedef
*
* @throws Exception
*/
public void testServerAndRuntimeInfoForServerDefAndRuntimeDef() throws Exception {
GenericServerRuntime runtime = ServerRuntimeUtils.getGenericServerRuntime(TEST_RUNTIMETYPE_ID);
GenericServer server = ServerRuntimeUtils.getGenericServer(TEST_SERVERTYPE_ID, runtime.getRuntime());
assertNotNull(server);
ServerRuntime serverRuntime = server.getServerDefinition();
// Verify Server and Runtime info: properties from runtimedef and serverdef are available
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.runtime.classpath");
ServerRuntimeUtils.verifyClasspath(serverRuntime.getClasspath(), "foo.server.classpath");
}
use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime in project webtools.servertools by eclipse.
the class ServerCreationTest method testCreateServer.
public void testCreateServer() throws Exception {
// Finds the generic server type
IServerType[] sTypes = ServerCore.getServerTypes();
IServerType serverType = null;
for (int i = 0; i < sTypes.length; i++) {
IServerType sType = sTypes[i];
if (ID.equals(sType.getId()))
serverType = sType;
}
assertNotNull("Could not find org.eclipse.jst.server.generic.jonas4 server type", serverType);
// Finds the generic server runtime type
IRuntimeType runtimeType = serverType.getRuntimeType();
assertNotNull("Could not find runtime type for the generic server type", runtimeType);
// Create a new runtime instance from the type
IRuntime runtime = runtimeType.createRuntime(ID + ".Jonas.Runtime", null);
assertNotNull("Could not create runtime", runtime);
// Create a new server instance from the type
IServerWorkingCopy server = serverType.createServer(ID + ".Jonas.Server", null, runtime, null);
assertNotNull("Could not create server", server);
// Save the server
server.save(false, null);
// Set properties for the runtime
IRuntimeWorkingCopy runtimeWorkingCopy = runtime.createWorkingCopy();
assertNotNull("Could not create runtime working copy", runtimeWorkingCopy);
// Set the JONAS runtime as the default runtime
ServerUtil.setRuntimeDefaultName(runtimeWorkingCopy);
assertNotNull("Runtime working copy has no name", runtimeWorkingCopy.getName());
// Set properties for the JONAS runtime
GenericServerRuntime runtimeDelegate = (GenericServerRuntime) runtimeWorkingCopy.loadAdapter(GenericServerRuntime.class, new NullProgressMonitor());
assertNotNull("Could not obtain runtime delegate", runtimeDelegate);
HashMap props = new HashMap();
props.put("mappernames", "");
props.put("classPathVariableName", "JONAS");
props.put("serverAddress", "127.0.0.1");
props.put("jonasBase", "C:\\nmd\\dev\\java\\appservers\\JOnAS-4.1.4");
props.put("jonasRoot", "C:\\nmd\\dev\\java\\appservers\\JOnAS-4.1.4");
props.put("classPath", "C:\\nmd\\dev\\java\\appservers\\JOnAS-4.1.4");
props.put("protocols", "C:\\nmd\\dev\\java\\appservers\\JOnAS-4.1.4");
props.put("port", "9000");
runtimeDelegate.setServerInstanceProperties(props);
// Save the runtime working copy
runtimeWorkingCopy.save(false, null);
}
use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime in project webtools.servertools by eclipse.
the class GenericServerRuntimeTest method testRuntimeInfoOnly.
/**
* runtimeTypeId used as key to .runtimedef
*/
public void testRuntimeInfoOnly() throws Exception {
GenericServerRuntime runtime = ServerRuntimeUtils.getGenericServerRuntime(TEST_RUNTIMETYPE_ID);
assertNotNull(runtime);
ServerRuntime runtimeDef = runtime.getServerTypeDefinition();
assertNotNull(runtimeDef);
// Verify runtime info, and *no* server info
ServerRuntimeUtils.verifyProperty(runtimeDef.getProperty(), "foo.prop.a", "a runtime property value");
ServerRuntimeUtils.verifyNoProperty(runtimeDef.getProperty(), "foo.prop.b");
}
Aggregations