Author: alessio.soldano(a)jboss.com
Date: 2008-05-14 07:11:11 -0400 (Wed, 14 May 2008)
New Revision: 7025
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerTestCase.java
Log:
Fixing WSConsumerTestCase regression
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerTestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerTestCase.java 2008-05-14
10:48:24 UTC (rev 7024)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerTestCase.java 2008-05-14
11:11:11 UTC (rev 7025)
@@ -28,7 +28,9 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
+import java.util.LinkedList;
import java.util.List;
+import java.util.StringTokenizer;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
@@ -54,6 +56,8 @@
// default is off
boolean toogleMessageOut = false;
+
+ private String targetDir;
/**
* Recreates a tools delegate for every test
@@ -68,8 +72,9 @@
if (toogleMessageOut)
consumer.setMessageStream(System.out);
- // shared output directory, relative to test execution
- outputDirectory = new File("wsconsume/java");
+ // shared output directory, we go out of the test-resources directory
+ outputDirectory = createResourceFile("../wsconsume/java");
+ targetDir = createResourceFile("..").getAbsolutePath();
}
/**
@@ -87,7 +92,7 @@
consumeWSDL();
- URLClassLoader loader = new URLClassLoader(new URL[] { new URL("file:" +
System.getProperty("user.dir") + "/wsconsume/java/") });
+ URLClassLoader loader = new URLClassLoader(new URL[] { outputDirectory.toURL() });
String seiClassName =
"org.jboss.test.ws.tools.testBindingFiles.EndpointInterface";
Class sei = loader.loadClass(seiClassName);
@@ -126,11 +131,11 @@
{
consumer.setTargetPackage("org.jboss.test.ws.tools.testOutputDirectory");
consumer.setGenerateSource(true);
- consumer.setSourceDirectory(new File("work/testOutputDirectory/java/"));
+ consumer.setSourceDirectory(new File(targetDir +
"/work/testOutputDirectory/java/"));
consumeWSDL();
- File sei = new
File("work/testOutputDirectory/java/org/jboss/test/ws/tools/testOutputDirectory/EndpointInterface.java");
+ File sei = new File(targetDir +
"/work/testOutputDirectory/java/org/jboss/test/ws/tools/testOutputDirectory/EndpointInterface.java");
assertTrue("Output directory switch ignored", sei.exists());
}
@@ -144,11 +149,11 @@
{
consumer.setTargetPackage("org.jboss.test.ws.tools.testSourceDirectory");
consumer.setGenerateSource(true);
- consumer.setSourceDirectory(new File("work/wsconsumeSource/java/"));
+ consumer.setSourceDirectory(new File(targetDir +
"/work/wsconsumeSource/java/"));
consumeWSDL();
- File sei = new
File("work/wsconsumeSource/java/org/jboss/test/ws/tools/testSourceDirectory/EndpointInterface.java");
+ File sei = new File(targetDir +
"/work/wsconsumeSource/java/org/jboss/test/ws/tools/testSourceDirectory/EndpointInterface.java");
assertTrue("Source directory switch ignored", sei.exists());
}
@@ -173,10 +178,10 @@
consumeWSDL();
- File packageDir = new
File("wsconsume/java/org/jboss/test/ws/tools/testTargetPackage");
+ File packageDir = new File(outputDirectory,
"org/jboss/test/ws/tools/testTargetPackage");
assertTrue("Package not created", packageDir.exists());
- File sei = new
File("wsconsume/java/org/jboss/test/ws/tools/testTargetPackage/EndpointInterface.java");
+ File sei = new File(outputDirectory,
"org/jboss/test/ws/tools/testTargetPackage/EndpointInterface.java");
assertTrue("SEI not generated", sei.exists());
}
@@ -192,7 +197,7 @@
consumeWSDL();
- URLClassLoader loader = new URLClassLoader(new URL[] { new URL("file:" +
System.getProperty("user.dir") + "/wsconsume/java/") });
+ URLClassLoader loader = new URLClassLoader(new URL[] { outputDirectory.toURL() });
String seiClassName =
"org.jboss.test.ws.tools.testWsdlLocation.TestService";
Class sei = loader.loadClass(seiClassName);
@@ -257,12 +262,12 @@
}
catch (Exception e)
{
- File outputDir = new File(System.getProperty("user.dir") +
"/wsconsume/java/org/jboss/test/ws/tools/testTarget");
+ File outputDir = new File(outputDirectory,
"org/jboss/test/ws/tools/testTarget");
outputDir.deleteOnExit();
return;
}
- URLClassLoader loader = new URLClassLoader(new URL[] { new URL("file:" +
System.getProperty("user.dir") + "/wsconsume/java/") });
+ URLClassLoader loader = new URLClassLoader(new URL[] { outputDirectory.toURL() });
String seiClassName = "org.jboss.test.ws.tools.testTarget.TestService";
Class sei = loader.loadClass(seiClassName);
@@ -297,14 +302,28 @@
consumer.setGenerateSource(true);
consumer.setExtension(true);
consumer.consume(getResourceFile("jaxws/smoke/tools/wsdl/TestServiceSoap12.wsdl").getCanonicalPath());
- File sei = new
File("wsconsume/java/org/jboss/test/ws/tools/testSOAP12Extension/EndpointInterface.java");
+ File sei = new File(outputDirectory,
"org/jboss/test/ws/tools/testSOAP12Extension/EndpointInterface.java");
assertTrue("SEI not generated", sei.exists());
- File service = new
File("wsconsume/java/org/jboss/test/ws/tools/testSOAP12Extension/TestService.java");
+ File service = new File(outputDirectory,
"org/jboss/test/ws/tools/testSOAP12Extension/TestService.java");
assertTrue("Service not generated", service.exists());
}
private void consumeWSDL() throws Exception
{
+ String classpath = System.getProperty("surefire.test.class.path");
+ if (classpath != null && !classpath.equals(""))
+ {
+ //setting additional compiler classpath since the consumer gets the classpath
from the
+ //java.class.path system properties which actually does not contain the test
classpath
+ //when running from maven surefire plugin
+ StringTokenizer st = new StringTokenizer(classpath, File.pathSeparator, false);
+ List<String> classpathList = new LinkedList<String>();
+ while (st.hasMoreTokens())
+ {
+ classpathList.add(st.nextToken());
+ }
+ consumer.setAdditionalCompilerClassPath(classpathList);
+ }
consumer.setOutputDirectory(outputDirectory);
consumer.consume(getResourceFile("jaxws/smoke/tools/wsdl/TestService.wsdl").getCanonicalPath());
}
Show replies by date