[jbossws-commits] JBossWS SVN: r6554 - framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Sat Apr 19 17:16:38 EDT 2008
Author: thomas.diesler at jboss.com
Date: 2008-04-19 17:16:38 -0400 (Sat, 19 Apr 2008)
New Revision: 6554
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/WSConsumerTestCase.java
Log:
Fix imports
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-04-19 20:49:41 UTC (rev 6553)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java 2008-04-19 21:16:38 UTC (rev 6554)
@@ -23,12 +23,11 @@
// $Id$
-
-import junit.framework.TestCase;
-
import java.io.File;
import java.io.IOException;
+import org.jboss.wsf.test.JBossWSTest;
+
/**
* [JBWS-1793] Provide a test case for the tools scripts that reside under JBOSS_HOME/bin
*
@@ -40,8 +39,8 @@
*
* @author Heiko.Braun at jboss.com
*/
-public class ScriptTestCase extends JBossWSTestCase
-{
+public class ScriptTestCase extends JBossWSTest
+{
private String WSDL_LOCATION = "jaxws/smoke/tools/wsdl/TestServiceCatalog.wsdl";
private String ENDPOINT_CLASS = "org.jboss.test.ws.jaxws.smoke.tools.CalculatorBean";
@@ -62,74 +61,66 @@
public void testWSConsumeFromCommandLine() throws Exception
{
- if(isWindowsOS())
+ if (isWindowsOS())
{
fail("This test has not been verified on windows");
}
// use absolute path for the output to be re-usable
- String absWsdlLoc= getResourceFile(WSDL_LOCATION).getAbsolutePath();
+ String absWsdlLoc = getResourceFile(WSDL_LOCATION).getAbsolutePath();
String absOutput = new File("wsconsume/java").getAbsolutePath();
- String command = JBOSS_HOME + "/bin/wsconsume.sh -k -o "+absOutput+" "+ absWsdlLoc;
+ String command = JBOSS_HOME + "/bin/wsconsume.sh -k -o " + absOutput + " " + absWsdlLoc;
Process p = executeCommand(command);
// check status code
assertStatusCode(p, "wsconsume");
File javaSource = new File("wsconsume/java/org/openuri/_2004/_04/helloworld/EndpointInterface.java");
-
+
assertTrue("Service endpoint interface not generated", javaSource.exists());
}
public void testWSProvideFromCommandLine() throws Exception
{
- if(isWindowsOS())
+ if (isWindowsOS())
{
fail("This test has not been verified on windows");
}
String absOutput = new File("wsprovide/java/").getAbsolutePath();
- String command = JBOSS_HOME + "/bin/wsprovide.sh -k -w -o "+absOutput+" --classpath "+TEST_EXEC_DIR+"/classes "+ ENDPOINT_CLASS;
+ String command = JBOSS_HOME + "/bin/wsprovide.sh -k -w -o " + absOutput + " --classpath " + TEST_EXEC_DIR + "/classes " + ENDPOINT_CLASS;
Process p = executeCommand(command);
// check status code
assertStatusCode(p, "wsprovide");
File outputDir = new File("wsprovide/java");
- File javaSource = new File(
- outputDir.getAbsolutePath()+
- "/org/jboss/test/ws/jaxws/smoke/tools/jaxws/AddResponse.java"
- );
-
+ File javaSource = new File(outputDir.getAbsolutePath() + "/org/jboss/test/ws/jaxws/smoke/tools/jaxws/AddResponse.java");
+
assertTrue("Response wrapper not generated", javaSource.exists());
}
- private Process executeCommand(String command)
- throws IOException
+ private Process executeCommand(String command) throws IOException
{
// be verbose
System.out.println("cmd: " + command);
System.out.println("test execution dir: " + TEST_EXEC_DIR);
- Process p = Runtime.getRuntime().exec(
- command,
- new String[] {"JBOSS_HOME="+ JBOSS_HOME, "JAVA_HOME="+ JDK_HOME}
- );
+ Process p = Runtime.getRuntime().exec(command, new String[] { "JBOSS_HOME=" + JBOSS_HOME, "JAVA_HOME=" + JDK_HOME });
return p;
}
-
- private void assertStatusCode(Process p, String s)
- throws InterruptedException
+
+ private void assertStatusCode(Process p, String s) throws InterruptedException
{
// check status code
int status = p.waitFor();
- assertTrue(s +" did exit with status " + status, status==0);
+ assertTrue(s + " did exit with status " + status, status == 0);
}
private boolean isWindowsOS()
{
- return ( (OS.indexOf("nt") > -1) || (OS.indexOf("windows") > -1 ));
+ return ((OS.indexOf("nt") > -1) || (OS.indexOf("windows") > -1));
}
}
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-04-19 20:49:41 UTC (rev 6553)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerTestCase.java 2008-04-19 21:16:38 UTC (rev 6554)
@@ -33,12 +33,9 @@
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
-import junit.framework.TestCase;
-
import org.jboss.wsf.spi.tools.WSContractConsumer;
+import org.jboss.wsf.test.JBossWSTest;
-import sun.reflect.ReflectionFactory.GetReflectionFactoryAction;
-
/**
* Test the WSContractConsumer API across different implementations.
* NOTE: All tests expect to be executed below 'output/tests'.
@@ -46,7 +43,7 @@
* @author Heiko.Braun at jboss.com
* @version $Revision$
*/
-public class WSConsumerTestCase extends JBossWSTestCase
+public class WSConsumerTestCase extends JBossWSTest
{
// Tools delegate. Recreated for every test. See setup(...)
@@ -68,7 +65,8 @@
// create a new consumer for every test case
consumer = WSContractConsumer.newInstance();
- if(toogleMessageOut) consumer.setMessageStream(System.out);
+ if (toogleMessageOut)
+ consumer.setMessageStream(System.out);
// shared output directory, relative to test execution
outputDirectory = new File("wsconsume/java");
@@ -81,22 +79,22 @@
public void testBindingFiles() throws Exception
{
List<File> files = new ArrayList<File>();
- files.add( getResourceFile("jaxws/smoke/tools/wsdl/async-binding.xml") );
-
+ files.add(getResourceFile("jaxws/smoke/tools/wsdl/async-binding.xml"));
+
consumer.setBindingFiles(files);
consumer.setTargetPackage("org.jboss.test.ws.tools.testBindingFiles");
- consumer.setGenerateSource(true);
+ consumer.setGenerateSource(true);
consumeWSDL();
- URLClassLoader loader = new URLClassLoader(new URL[] { new URL("file:"+System.getProperty("user.dir")+"/wsconsume/java/") });
+ URLClassLoader loader = new URLClassLoader(new URL[] { new URL("file:" + System.getProperty("user.dir") + "/wsconsume/java/") });
String seiClassName = "org.jboss.test.ws.tools.testBindingFiles.EndpointInterface";
Class sei = loader.loadClass(seiClassName);
boolean containsAsyncOperations = false;
- for(Method m : sei.getDeclaredMethods())
+ for (Method m : sei.getDeclaredMethods())
{
- if(m.getName().equals("echoAsync"))
+ if (m.getName().equals("echoAsync"))
{
containsAsyncOperations = true;
break;
@@ -114,7 +112,7 @@
public void testCatalog() throws Exception
{
consumer.setTargetPackage("org.jboss.test.ws.tools.testCatalog");
- consumer.setCatalog( getResourceFile("jaxws/spi/tools/wsdl/jax-ws-catalog.xml") );
+ consumer.setCatalog(getResourceFile("jaxws/spi/tools/wsdl/jax-ws-catalog.xml"));
consumer.setGenerateSource(true);
consumer.setOutputDirectory(outputDirectory);
consumer.consume(getResourceFile("jaxws/smoke/tools/wsdl/TestServiceCatalog.wsdl").getCanonicalPath());
@@ -128,8 +126,8 @@
{
consumer.setTargetPackage("org.jboss.test.ws.tools.testOutputDirectory");
consumer.setGenerateSource(true);
- consumer.setSourceDirectory( new File("work/testOutputDirectory/java/") );
-
+ consumer.setSourceDirectory(new File("work/testOutputDirectory/java/"));
+
consumeWSDL();
File sei = new File("work/testOutputDirectory/java/org/jboss/test/ws/tools/testOutputDirectory/EndpointInterface.java");
@@ -144,9 +142,9 @@
*/
public void testSourceDirectory() throws Exception
{
- consumer.setTargetPackage("org.jboss.test.ws.tools.testSourceDirectory");
+ consumer.setTargetPackage("org.jboss.test.ws.tools.testSourceDirectory");
consumer.setGenerateSource(true);
- consumer.setSourceDirectory( new File("work/wsconsumeSource/java/") );
+ consumer.setSourceDirectory(new File("work/wsconsumeSource/java/"));
consumeWSDL();
@@ -170,7 +168,7 @@
*/
public void testTargetPackage() throws Exception
{
- consumer.setTargetPackage("org.jboss.test.ws.tools.testTargetPackage");
+ consumer.setTargetPackage("org.jboss.test.ws.tools.testTargetPackage");
consumer.setGenerateSource(true);
consumeWSDL();
@@ -191,14 +189,14 @@
consumer.setTargetPackage("org.jboss.test.ws.tools.testWsdlLocation");
consumer.setWsdlLocation("http://foo.bar.com/endpoint?wsdl");
consumer.setGenerateSource(true);
-
+
consumeWSDL();
-
- URLClassLoader loader = new URLClassLoader(new URL[] { new URL("file:"+System.getProperty("user.dir")+"/wsconsume/java/") });
+
+ URLClassLoader loader = new URLClassLoader(new URL[] { new URL("file:" + System.getProperty("user.dir") + "/wsconsume/java/") });
String seiClassName = "org.jboss.test.ws.tools.testWsdlLocation.TestService";
Class sei = loader.loadClass(seiClassName);
- WebServiceClient webServiceClient = (WebServiceClient) sei.getAnnotation(WebServiceClient.class);
+ WebServiceClient webServiceClient = (WebServiceClient)sei.getAnnotation(WebServiceClient.class);
assertNotNull("@WebServiceClient not generated on service interface", webServiceClient);
assertEquals("@WebServiceClient.wsdlLocation not set", "http://foo.bar.com/endpoint?wsdl", webServiceClient.wsdlLocation());
}
@@ -214,16 +212,16 @@
consumer.setTargetPackage("org.jboss.test.ws.tools.testMessageStream");
consumer.setMessageStream(pout);
-
+
consumeWSDL();
- String messageOut = new String (bout.toByteArray());
+ String messageOut = new String(bout.toByteArray());
System.out.println("-- Begin captured output -- ");
System.out.println(messageOut);
System.out.println("--- End captured output --");
System.out.println("FIXME [JBWS-1772] WSConsume output is not correctly redirected");
-
+
/*assertTrue("Tools output not correctly redirected",
messageOut.indexOf("org/jboss/test/ws/tools/testMessageStream/EndpointInterface.java")!=-1
);*/
@@ -248,7 +246,7 @@
*/
public void testTarget() throws Exception
{
- consumer.setTargetPackage("org.jboss.test.ws.tools.testTarget");
+ consumer.setTargetPackage("org.jboss.test.ws.tools.testTarget");
consumer.setGenerateSource(true);
consumer.setTarget("2.1");
@@ -259,25 +257,23 @@
}
catch (Exception e)
{
- File outputDir = new File(System.getProperty("user.dir")+"/wsconsume/java/org/jboss/test/ws/tools/testTarget");
+ File outputDir = new File(System.getProperty("user.dir") + "/wsconsume/java/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[] { new URL("file:" + System.getProperty("user.dir") + "/wsconsume/java/") });
String seiClassName = "org.jboss.test.ws.tools.testTarget.TestService";
Class sei = loader.loadClass(seiClassName);
-
boolean featureSig = false;
- for(Method m : sei.getDeclaredMethods())
+ for (Method m : sei.getDeclaredMethods())
{
- if(m.getName().equals("getEndpointInterfacePort"))
+ if (m.getName().equals("getEndpointInterfacePort"))
{
- for(Class c : m.getParameterTypes())
+ for (Class c : m.getParameterTypes())
{
- if(c.isArray() &&
- c.getComponentType().equals(WebServiceFeature.class))
+ if (c.isArray() && c.getComponentType().equals(WebServiceFeature.class))
{
featureSig = true;
break;
@@ -287,7 +283,7 @@
}
assertTrue("JAX-WS 2.1 extensions not generated with 'target=2.1'", featureSig);
-
+
}
/**
@@ -307,8 +303,8 @@
assertTrue("Service not generated", service.exists());
}
- private void consumeWSDL() throws Exception
- {
+ private void consumeWSDL() throws Exception
+ {
consumer.setOutputDirectory(outputDirectory);
consumer.consume(getResourceFile("jaxws/smoke/tools/wsdl/TestService.wsdl").getCanonicalPath());
}
More information about the jbossws-commits
mailing list