* with code to start the SimpleAxisServer, deploy all the generated services, undeploy all the
* generated services, stop the SimpleAxisServer, and clean up the test environment.
*/
public void run(TestResult result) {
// Get the SimpleAxisServer running--using the default port.
SimpleAxisServer server = new SimpleAxisServer();
try {
Options opts = new Options(new String[]{});
int port = opts.getPort();
System.out.println("Starting test http server at port " + port);
ServerSocket ss = new ServerSocket(port);
server.setServerSocket(ss);
Thread serverThread = new Thread(server);
serverThread.setDaemon(true);
serverThread.setContextClassLoader(loader);
serverThread.start();
// Find all the "deploy.xml" files and run them through the AdminClient.
Iterator testIterator = Wsdl2javaTestSuite.fileNames.iterator();
while (testIterator.hasNext()) {
String deploy = null;
Iterator files = ((List) testIterator.next()).iterator();
while (files.hasNext()) {
String fileName = (String) files.next();
if (fileName.endsWith(File.separator + "deploy.xml")) {
deploy = fileName;
}
}
if(deploy != null){
// Perform actual deployment
String[] args = new String[] { Wsdl2javaTestSuite.WORK_DIR + deploy };
AdminClient.main(args);
}
}
//AdminClient.main(new String[] {"list"});
// Run the tests
super.run(result);
// Find all the "undeploy.xml" files and run them through the AdminClient.
testIterator = Wsdl2javaTestSuite.fileNames.iterator();
while (testIterator.hasNext()) {
String undeploy = null;
Iterator files = ((List) testIterator.next()).iterator();
while (files.hasNext()) {
String fileName = (String) files.next();
if (fileName.endsWith(File.separator + "undeploy.xml")) {
undeploy = fileName;
}
}
if(undeploy != null) {
// Perform actual undeployment
String[] args = new String[] { Wsdl2javaTestSuite.WORK_DIR + undeploy };
AdminClient.main(args);
}
}
//AdminClient.main(new String[] {"list"});
// Clean up the test environment
//this.cleanTest(); // commented out while debugging.
// Stop the SimpleAxisServer
System.out.println("Stopping test http server.");
server.stop();
} catch (Exception e) {
throw new AssertionFailedError("The test suite failed with the following exception: " + e.getMessage());
}
}