use of org.eclipse.jst.server.generic.servertype.definition.Classpath in project webtools.servertools by eclipse.
the class ServerRuntimeMergeUtil method combine.
/**
* Combines a runtime definition and a server definition
* into a single logical <code>ServerRuntime</code>.
*
* @param serverdef
* @param runtimedef
* @return serverdef
*/
public static ServerRuntime combine(ServerRuntime serverdef, ServerRuntime runtimedef) {
/**
* Add properties from runtimedef to serverdef if not already present,
* this ensures that:
*
* (1) while we are affecting the cached copy of serverdef, it is always
* required to be combined with its runtimedef (if there is one), and
* we check that the property has not already been added
*
* (2) serverdef properties can override runtimedef properties
*/
List properties = runtimedef.getProperty();
if (properties != null) {
Iterator iter = properties.iterator();
while (iter.hasNext()) {
Property prop = (Property) iter.next();
addPropertyIfNotPresent(serverdef.getProperty(), prop);
}
}
/**
* Add classpaths from runtimedef to serverdef if not already present,
* this ensures that:
*
* (1) while we are affecting the cached copy of serverdef, it is always
* required to be combined with its runtimedef (if there is one), and
* we check that the classpath has not already been added (by id)
*
* (2) serverdef classpath can override runtimedef classpath by id
*/
List classpaths = runtimedef.getClasspath();
if (classpaths != null) {
Iterator iter = classpaths.iterator();
while (iter.hasNext()) {
Classpath classpath = (Classpath) iter.next();
addClasspathIfNotPresent(serverdef.getClasspath(), classpath);
}
}
return serverdef;
}
use of org.eclipse.jst.server.generic.servertype.definition.Classpath in project webtools.servertools by eclipse.
the class ServerTypeDefinitionModelTest method testServerRuntime.
public void testServerRuntime() {
assertTrue(subject.getClasspath() != null && subject.getClasspath().size() > 0);
assertTrue(subject.getConfigurationElementNamespace() != null && subject.getConfigurationElementNamespace().length() > 0);
assertTrue(subject.getName() != null && subject.getName().length() > 0);
assertTrue(subject.getVersion() != null && subject.getVersion().length() > 0);
assertTrue(subject.getProperty() != null && subject.getProperty().size() > 0);
assertTrue(subject.getPort() != null && subject.getPort().size() > 0);
assertTrue(subject.getModule() != null && subject.getModule().size() > 0);
assertNotNull(subject.getProject());
assertNotNull(subject.getStop());
assertNotNull(subject.getStart());
assertTrue(subject.getId() != null && subject.getId().length() > 0);
assertTrue(subject.getFilename() != null && subject.getFilename().length() > 0);
Classpath cp = (Classpath) subject.getClasspath().get(0);
assertEquals(cp, subject.getClasspath(cp.getId()));
Module module = (Module) subject.getModule().get(0);
assertEquals(module, subject.getModule(module.getType()));
assertNotNull(subject.getPublisher("org.eclipse.jst.server.generic.antpublisher"));
}
Aggregations