Author: richard.opalka(a)jboss.com
Date: 2008-07-30 06:24:23 -0400 (Wed, 30 Jul 2008)
New Revision: 7947
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPBase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPlugin.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/projectGenerator/ProjectGeneratorTestCase.java
Log:
[JBWS-1987] make tests portable accross platforms
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPBase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPBase.java 2008-07-30
09:52:11 UTC (rev 7946)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPBase.java 2008-07-30
10:24:23 UTC (rev 7947)
@@ -41,7 +41,8 @@
*/
public abstract class XOPBase extends JBossWSTest
{
- private File imgFile =
getResourceFile("jaxws/samples/xop/shared/attach.jpeg");
+ private static final String FS = System.getProperty("file.separator"); //
'/' on unix, '\' on windows
+ private File imgFile = getResourceFile("jaxws" + FS + "samples" +
FS + "xop" + FS + "shared" + FS + "attach.jpeg");
protected MTOMEndpoint port;
protected SOAPBinding binding;
@@ -146,7 +147,7 @@
assertNotNull(response);
assertNotNull(response.getDataHandler().getContent());
- File tmpDir = new File(System.getProperty("jboss.home") +
"/server/default/tmp/jbossws");
+ File tmpDir = new File(System.getProperty("jboss.home") + FS +
"server" + FS + "default" + FS + "tmp" + FS +
"jbossws");
assertTrue("Temp dir doesn't exist", tmpDir.exists());
for (String fileName : tmpDir.list())
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java 2008-07-30
09:52:11 UTC (rev 7946)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java 2008-07-30
10:24:23 UTC (rev 7947)
@@ -40,7 +40,9 @@
*/
public class ScriptTestCase extends JBossWSTest
{
- private String WSDL_LOCATION =
"jaxws/smoke/tools/wsdl/TestServiceCatalog.wsdl";
+ private static final String FS = System.getProperty("file.separator"); //
'/' on unix, '\' on windows
+
+ private String WSDL_LOCATION = "jaxws" + FS + "smoke" + FS +
"tools" + FS + "wsdl" + FS + "TestServiceCatalog.wsdl";
private String ENDPOINT_CLASS =
"org.jboss.test.ws.jaxws.smoke.tools.CalculatorBean";
private String JBOSS_HOME;
@@ -63,9 +65,9 @@
// the script requires the system JAVA_HOME, which points to the JDK not the JRE
- if(origJavaHome.indexOf("/jre")!=-1)
+ if(origJavaHome.indexOf(FS + "jre")!=-1)
{
- String JDK_HOME = origJavaHome.substring(0,
origJavaHome.indexOf("/jre"));
+ String JDK_HOME = origJavaHome.substring(0, origJavaHome.indexOf(FS +
"jre"));
System.setProperty("java.home", JDK_HOME);
JAVA_HOME= JDK_HOME;
}
@@ -87,15 +89,15 @@
// use absolute path for the output to be re-usable
String absWsdlLoc = getResourceFile(WSDL_LOCATION).getAbsolutePath();
- String absOutput = new File(TEST_DIR,
"wsconsume/java").getAbsolutePath();
+ String absOutput = new File(TEST_DIR, "wsconsume" + FS +
"java").getAbsolutePath();
- String command = JBOSS_HOME + "/bin/wsconsume.sh -v -k -o " + absOutput +
" " + absWsdlLoc;
+ String command = JBOSS_HOME + FS + "bin" + FS + "wsconsume.sh -v -k
-o " + absOutput + " " + absWsdlLoc;
Process p = executeCommand(command);
// check status code
assertStatusCode(p, "wsconsume");
- File javaSource = new File(TEST_DIR,
"wsconsume/java/org/openuri/_2004/_04/helloworld/EndpointInterface.java");
+ File javaSource = new File(TEST_DIR, "wsconsume" + FS + "java"
+ FS + "org" + FS + "openuri" + FS + "_2004" + FS +
"_04" + FS + "helloworld" + FS + "EndpointInterface.java");
assertTrue("Service endpoint interface not generated",
javaSource.exists());
}
@@ -107,15 +109,15 @@
fail("This test has not been verified on windows");
}
- String absOutput = new File(TEST_DIR,
"wsprovide/java/").getAbsolutePath();
+ String absOutput = new File(TEST_DIR, "wsprovide" + FS +
"java").getAbsolutePath();
- String command = JBOSS_HOME + "/bin/wsprovide.sh -k -w -o " + absOutput +
" --classpath " + CLASSES_DIR + " " + ENDPOINT_CLASS;
+ String command = JBOSS_HOME + FS + "bin" + FS + "wsprovide.sh -k -w
-o " + absOutput + " --classpath " + CLASSES_DIR + " " +
ENDPOINT_CLASS;
Process p = executeCommand(command);
// check status code
assertStatusCode(p, "wsprovide");
- File javaSource = new File(TEST_DIR,
"wsprovide/java/org/jboss/test/ws/jaxws/smoke/tools/jaxws/AddResponse.java");
+ File javaSource = new File(TEST_DIR, "wsprovide" + FS + "java"
+ FS + "org" + FS + "jboss" + FS + "test" + FS +
"ws" + FS + "jaxws" + FS + "smoke" + FS + "tools"
+ FS + "jaxws" + FS + "AddResponse.java");
assertTrue("Response wrapper not generated", javaSource.exists());
}
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPlugin.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPlugin.java 2008-07-30
09:52:11 UTC (rev 7946)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPlugin.java 2008-07-30
10:24:23 UTC (rev 7947)
@@ -39,6 +39,7 @@
*/
public class WSProviderPlugin extends JBossWSTest implements WSProviderPluginDelegate
{
+ private static final String FS = System.getProperty("file.separator"); //
'/' on unix, '\' on windows
// tools delegate
WSContractProvider provider;
@@ -55,7 +56,7 @@
if(toogleMessageOut) provider.setMessageStream(System.out);
// shared output directory, relative to test execution
- outputDirectory = createResourceFile("../wsprovide/java");
+ outputDirectory = createResourceFile(".." + FS + "wsprovide" +
FS + "java");
}
private ClassLoader getArtefactClassLoader() throws Exception {
@@ -96,7 +97,7 @@
{
File javaSource = new File(
directory.getAbsolutePath()+
- "/org/jboss/test/ws/jaxws/smoke/tools/jaxws/AddResponse.java"
+ FS + "org" + FS + "jboss" + FS + "test" + FS +
"ws" + FS + "jaxws" + FS + "smoke" + FS + "tools"
+ FS + "jaxws" + FS + "AddResponse.java"
);
assertTrue("Source not generated", javaSource.exists());
@@ -124,7 +125,7 @@
*/
public void testResourceDirectory() throws Exception
{
- File directory = createResourceFile("wsprovide/resources");
+ File directory = createResourceFile("wsprovide" + FS +
"resources");
provider.setResourceDirectory(directory);
provide();
@@ -135,7 +136,7 @@
{
File wsdl = new File(
outputDirectory.getAbsolutePath()+
- "/CalculatorBeanService.wsdl"
+ FS + "CalculatorBeanService.wsdl"
);
assertTrue("WSDL not generated", wsdl.exists());
@@ -152,7 +153,7 @@
*/
public void testSourceDirectory() throws Exception
{
- File sourceDir = createResourceFile("wsprovide/sources");
+ File sourceDir = createResourceFile("wsprovide" + FS +
"sources");
provider.setSourceDirectory(sourceDir);
provider.setGenerateSource(true);
provide();
@@ -169,15 +170,15 @@
{
// Work around the sure jre settings
String javaHome = System.getProperty("java.home");
- String jdkHome = javaHome.substring(0, javaHome.indexOf("/jre"));
+ String jdkHome = javaHome.substring(0, javaHome.indexOf(FS + "jre"));
String targetDir = createResourceFile("").getParent();
URLClassLoader loader = new URLClassLoader(
new URL[]
{
- new
URL("file:"+targetDir+"/test-libs/jaxws-classloading-service.jar"),
- new
URL("file:"+targetDir+"/test-libs/jaxws-classloading-types.jar"),
- new URL("file:"+jdkHome+"/lib/tools.jar")
+ new URL("file:"+targetDir+FS+"test-libs" + FS +
"jaxws-classloading-service.jar"),
+ new URL("file:"+targetDir+FS+"test-libs" + FS +
"jaxws-classloading-types.jar"),
+ new URL("file:"+jdkHome+FS+"lib" + FS +
"tools.jar")
},
getArtefactClassLoader()
);
@@ -187,7 +188,7 @@
provider.setOutputDirectory(outputDirectory);
provider.provide("org.jboss.test.ws.jaxws.smoke.tools.service.HelloWorld");
- File wsdl = new File(outputDirectory.getAbsolutePath() +
"/HelloWorldService.wsdl");
+ File wsdl = new File(outputDirectory.getAbsolutePath() + FS +
"HelloWorldService.wsdl");
assertTrue("WSDL not generated", wsdl.exists());
Element root = DOMUtils.parse( new FileInputStream(wsdl));
@@ -222,7 +223,7 @@
System.out.println("-- End captured output --");
assertTrue("Provider messages not correctly redirected",
-
messageOut.indexOf("org/jboss/test/ws/jaxws/smoke/tools/jaxws/Add.class") != -1
);
+
messageOut.indexOf("org"+FS+"jboss"+FS+"test"+FS+"ws"+FS+"jaxws"+FS+"smoke"+FS+"tools"+FS+"jaxws"+FS+"Add.class")
!= -1 );
}
private void provide() throws Exception
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/projectGenerator/ProjectGeneratorTestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/projectGenerator/ProjectGeneratorTestCase.java 2008-07-30
09:52:11 UTC (rev 7946)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/projectGenerator/ProjectGeneratorTestCase.java 2008-07-30
10:24:23 UTC (rev 7947)
@@ -51,6 +51,7 @@
*/
public class ProjectGeneratorTestCase extends JBossWSTest
{
+ private static final String FS = System.getProperty("file.separator"); //
'/' on unix, '\' on windows
private String jbossHome;
private File workspaceHome;
private File binDistroDir;
@@ -81,7 +82,7 @@
assertStatusCode(executeCommand("ant -f " + distroBuild.getAbsolutePath()
+ " -D" + integrationTarget + ".home=" + jbossHome + "
-Djbossws.integration.target="
+ integrationTarget + " create-project"), "Error while
creating the user project!");
File projectHomeDir = new File(workspaceHome, projectName);
- File packageDir = new File(projectHomeDir.getCanonicalPath() +
"/src/main/java/org/jboss/test/ws/projectGenerator");
+ File packageDir = new File(projectHomeDir.getCanonicalPath() + FS + "src"
+ FS + "main" + FS + "java" + FS + "org" + FS +
"jboss" + FS + "test" + FS + "ws" + FS +
"projectGenerator");
packageDir.mkdirs();
File endpointImpl = new File(packageDir, "EndpointImpl.java");
writeEndpointImpl(endpointImpl);
@@ -196,7 +197,7 @@
private boolean isDistroTest() throws Exception
{
- File build = new File("../build.xml");
+ File build = new File(".." + FS + "build.xml");
if (!build.exists())
{
String testResDir = JBossWSTestHelper.getTestResourcesDir();