Author: heiko.braun(a)jboss.com
Date: 2008-06-03 08:55:39 -0400 (Tue, 03 Jun 2008)
New Revision: 7287
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerPlugin.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerTestCase.java
Log:
Fix WSConsumerTestCase
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerPlugin.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerPlugin.java 2008-06-03
12:32:41 UTC (rev 7286)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerPlugin.java 2008-06-03
12:55:39 UTC (rev 7287)
@@ -24,11 +24,8 @@
import org.jboss.wsf.spi.tools.WSContractConsumer;
import org.jboss.wsf.test.JBossWSTest;
-import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.PrintStream;
+import java.io.*;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
@@ -84,16 +81,21 @@
consumeWSDL();
- Class sei = loadEndpointInterface("testBindingFiles");
+ File sei = loadEndpointInterface("testBindingFiles");
+
+ boolean containsAsyncOperations = false;
+ BufferedReader bin = new BufferedReader( new FileReader(sei) );
- boolean containsAsyncOperations = false;
- for (Method m : sei.getDeclaredMethods())
+ String l = bin.readLine();
+ while(l!=null)
{
- if (m.getName().equals("echoAsync"))
+ if(l.indexOf("echoAsync")!=-1)
{
- containsAsyncOperations = true;
+ containsAsyncOperations=true;
break;
}
+
+ l = bin.readLine();
}
assertTrue("External binding file was ignored",
containsAsyncOperations);
@@ -173,9 +175,9 @@
File seiSource = new File(outputDirectory,
"org/jboss/test/ws/tools/testTargetPackage/EndpointInterface.java");
assertTrue("SEI not generated", seiSource.exists());
-
- Class seiClass = loadEndpointInterface("testTargetPackage");
- assertNotNull("Cannot load SEI class", seiClass);
+
+ File seiClass = loadEndpointInterface("testTargetPackage");
+ assertTrue("Cannot load SEI class", seiClass.exists());
}
/**
@@ -186,19 +188,32 @@
{
consumer.setTargetPackage("org.jboss.test.ws.tools.testWsdlLocation");
consumer.setWsdlLocation("http://foo.bar.com/endpoint?wsdl");
- consumer.setGenerateSource(true);
- consumer.setNoCompile(false); // explicitly enable compilation
+ consumer.setGenerateSource(true);
consumeWSDL();
- //URLClassLoader loader = new URLClassLoader(new URL[] { outputDirectory.toURL()
});
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- String seiClassName =
"org.jboss.test.ws.tools.testWsdlLocation.TestService";
- Class sei = loader.loadClass(seiClassName);
+ File sei = loadEndpointInterface("testWsdlLocation",
"TestService.java");
+ BufferedReader bin = new BufferedReader( new FileReader(sei) );
+
+ boolean match = false;
+ String prevLine = null;
+ String l = bin.readLine();
+ while(l!=null)
+ {
+ if(l.indexOf("public class TestService")!=-1)
+ {
+ if(prevLine!=null &&
prevLine.startsWith("@WebServiceClient"))
+ {
+ match = true;
+ break;
+ }
+ }
- WebServiceClient webServiceClient =
(WebServiceClient)sei.getAnnotation(WebServiceClient.class);
- assertNotNull("@WebServiceClient not generated on service interface",
webServiceClient);
- assertEquals("(a)WebServiceClient.wsdlLocation not set",
"http://foo.bar.com/endpoint?wsdl", webServiceClient.wsdlLocation());
+ prevLine = l;
+ l = bin.readLine();
+ }
+
+ assertTrue("@WebServiceClient not generated on service interface",
match);
}
/**
@@ -309,12 +324,13 @@
consumer.setOutputDirectory(outputDirectory);
consumer.consume(getResourceFile("jaxws/smoke/tools/wsdl/TestService.wsdl").getCanonicalPath());
}
-
- private Class loadEndpointInterface(String testName) throws MalformedURLException,
ClassNotFoundException
+
+ private File loadEndpointInterface(String testName, String... fileName) throws
MalformedURLException, ClassNotFoundException
{
- URLClassLoader loader = new URLClassLoader(new URL[] { outputDirectory.toURL() });
- String seiClassName = "org.jboss.test.ws.tools." + testName +
".EndpointInterface";
- Class sei = loader.loadClass(seiClassName);
+ String name = fileName.length> 0 ? fileName[0] :
"EndpointInterface.java";
+ String interfaceFile = "org/jboss/test/ws/tools/" + testName +
"/"+name;
+ File sei = new File(outputDirectory, interfaceFile);
+ if(!sei.exists()) throw new IllegalStateException(sei.getAbsolutePath() + "
doesn't exist!");
return sei;
}
}
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-06-03
12:32:41 UTC (rev 7286)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerTestCase.java 2008-06-03
12:55:39 UTC (rev 7287)
@@ -211,9 +211,10 @@
}
}
+
+ List<URL> jarFirstClasspath = new ArrayList<URL>();
- // Replace the ThreadContextLoader to prevent loading from target/classes and
target/test-classes
- List<URL> jarFirstClasspath = new ArrayList<URL>();
+ // Replace the ThreadContextLoader to prevent loading from target/classes and
target/test-classes
jarFirstClasspath.addAll(jarURLs);
jarFirstClasspath.addAll(classDirUrls);
URLClassLoader jarFirstClassLoader = new URLClassLoader(jarFirstClasspath.toArray(
new URL[] {}), this.origClassLoader);