use of org.eclipse.jst.server.tomcat.core.internal.ITomcatConfigurationWorkingCopy in project webtools.servertools by eclipse.
the class AbstractTomcatServerTestCase method createServer.
public IServer createServer() throws Exception {
IServerType st = ServerCore.findServerType(getServerTypeId());
IRuntime runtime = createRuntime();
IServerWorkingCopy wc = st.createServer(null, null, runtime, null);
ServerPort[] ports = wc.getServerPorts(null);
TomcatServer tomcatServer = (TomcatServer) wc.getAdapter(TomcatServer.class);
ITomcatConfigurationWorkingCopy configuration = (ITomcatConfigurationWorkingCopy) tomcatServer.getServerConfiguration();
// if no ports from the server, use the configuration
if (ports == null || ports.length == 0) {
List portsList = configuration.getServerPorts();
if (portsList != null && portsList.size() > 0) {
ports = (ServerPort[]) portsList.toArray(new ServerPort[portsList.size()]);
}
}
if (ports != null) {
int size = ports.length;
for (int i = 0; i < size; i++) {
configuration.modifyServerPort(ports[i].getId(), 22100 + i);
}
}
return wc.save(true, null);
}
use of org.eclipse.jst.server.tomcat.core.internal.ITomcatConfigurationWorkingCopy in project webtools.servertools by eclipse.
the class AbstractTomcatServerTestCase method createServer.
public IServer createServer() throws Exception {
IServerType st = ServerCore.findServerType(getServerTypeId());
IRuntime runtime = createRuntime();
IServerWorkingCopy wc = st.createServer(null, null, runtime, null);
ServerPort[] ports = wc.getServerPorts(null);
TomcatServer tomcatServer = (TomcatServer) wc.getAdapter(TomcatServer.class);
ITomcatConfigurationWorkingCopy configuration = (ITomcatConfigurationWorkingCopy) tomcatServer.getServerConfiguration();
// if no ports from the server, use the configuration
if (ports == null || ports.length == 0) {
List portsList = configuration.getServerPorts();
if (portsList != null && portsList.size() > 0) {
ports = (ServerPort[]) portsList.toArray(new ServerPort[portsList.size()]);
}
}
if (ports != null) {
int size = ports.length;
for (int i = 0; i < size; i++) {
configuration.modifyServerPort(ports[i].getId(), 22100 + i);
}
}
return wc.save(true, null);
}
Aggregations