[jboss-cvs] JBossAS SVN: r108485 - in branches/JBPAPP_4_2_0_GA_CP/testsuite: imports and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 8 07:24:48 EDT 2010
Author: rsvoboda at redhat.com
Date: 2010-10-08 07:24:47 -0400 (Fri, 08 Oct 2010)
New Revision: 108485
Added:
branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/scripts.xml
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/Echo.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/EchoClient.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/EchoJavaBean.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/Hello.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/HelloJavaBean.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsclientTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsconsumeTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsprovideTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WstoolsTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/BenchmarkWebService.wsdl
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/web.xml
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/wstools-config.xml
Modified:
branches/JBPAPP_4_2_0_GA_CP/testsuite/build.xml
branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/test-jars.xml
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/README.txt
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ScriptsTestBase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/TwiddleTestCase.java
Log:
JBQA-3753 - tests for Web Services command line scripts (both WS Native and WS CXF stack)
- TwiddleTestCase fix for Windows
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/build.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/build.xml 2010-10-08 07:38:48 UTC (rev 108484)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/build.xml 2010-10-08 11:24:47 UTC (rev 108485)
@@ -3241,6 +3241,7 @@
<fileset dir="${build.classes}">
<include name="**/test/scripts/test/TwiddleTestCase.class"/>
<include name="**/test/scripts/test/ProbeTestCase.class"/>
+ <include name="**/test/scripts/test/WsclientTestCase.class"/>
</fileset>
</batchtest>
</junit>
@@ -3294,6 +3295,9 @@
<fileset dir="${build.classes}">
<include name="**/test/scripts/test/RunTestCase.class"/>
<include name="**/test/scripts/test/ShutdownTestCase.class"/>
+ <include name="**/test/scripts/test/WsconsumeTestCase.class"/>
+ <include name="**/test/scripts/test/WsprovideTestCase.class"/>
+ <include name="**/test/scripts/test/WstoolsTestCase.class"/>
</fileset>
</batchtest>
</junit>
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/scripts.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/scripts.xml (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/scripts.xml 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,15 @@
+<project name="tests-scripts-jars">
+ <!-- webservice tests -->
+ <target name="_jars-scripts">
+ <mkdir dir="${build.lib}"/>
+
+ <echo message="Using target node: ${node0}"/>
+
+ <!-- jaxws-endpoint-servlet -->
+ <war warfile="${build.lib}/wsrunclient-test.war" webxml="${build.resources}/scripts/web.xml">
+ <classes dir="${build.classes}">
+ <include name="org/jboss/test/scripts/support/EchoJavaBean.class"/>
+ </classes>
+ </war>
+ </target>
+</project>
\ No newline at end of file
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/test-jars.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/test-jars.xml 2010-10-08 07:38:48 UTC (rev 108484)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/test-jars.xml 2010-10-08 11:24:47 UTC (rev 108485)
@@ -21,9 +21,9 @@
<import file="sections/dbtest.xml"/>
<import file="sections/deadlock.xml"/>
<import file="sections/deployers.xml"/>
- <import file="sections/ejb3.xml"/>
+ <import file="sections/ejb3.xml"/>
<import file="sections/ejbconf.xml"/>
- <import file="sections/ejb.xml"/>
+ <import file="sections/ejb.xml"/>
<import file="sections/entity.xml"/>
<import file="sections/exception.xml"/>
<import file="sections/foedeployer.xml"/>
@@ -58,8 +58,9 @@
<import file="sections/readahead.xml"/>
<import file="sections/retry.xml"/>
<import file="sections/scoped.xml"/>
- <import file="sections/security.xml"/>
- <import file="sections/securitymgr.xml"/>
+ <import file="sections/scripts.xml"/>
+ <import file="sections/security.xml"/>
+ <import file="sections/securitymgr.xml"/>
<import file="sections/session.xml"/>
<import file="sections/testbean.xml"/>
<import file="sections/threading.xml"/>
@@ -143,6 +144,7 @@
_jars-resendmdb,
_jars-retry,
_jars-scoped,
+ _jars-scripts,
_jars-security,
_jars-securitymgr,
_jars-session,
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/README.txt
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/README.txt 2010-10-08 07:38:48 UTC (rev 108484)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/README.txt 2010-10-08 11:24:47 UTC (rev 108485)
@@ -10,13 +10,14 @@
tests-scripts:
- starts a JBoss instance called 'scripts' which is based on 'all'
-- executes TwiddleTestCase and ProbeTestCase against the instance
+- executes TwiddleTestCase, ProbeTestCase and WsclientTestCase against the instance
- stops the JBoss instance
- the server is started and stopped using JBoss Test
tests-scripts-noserver:
- makes use of a JBoss instance 'scripts-noserver'
-- executes RunTestCase and ShutdownTestCase
+- executes RunTestCase, ShutdownTestCase, WsconsumeTestCase, WsprovideTestCase
+and WstoolsTestCase
- run.sh is used to start the servers
- JMX shutdown or shutdown.sh is used to stop the servers, depending on
the test case in question
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/Echo.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/Echo.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/Echo.java 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.scripts.support;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import javax.jws.WebService;
+import javax.jws.WebParam;
+
+ at WebService(targetNamespace = "http://org.jboss.ws/testsuite")
+public interface Echo extends Remote {
+ String echoString(@WebParam(name = "inputString") String inputString) throws RemoteException;
+}
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/EchoClient.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/EchoClient.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/EchoClient.java 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.scripts.support;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.rmi.RemoteException;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+
+public class EchoClient
+{
+
+ private Echo getPort(String endpointURI) throws MalformedURLException
+ {
+ QName serviceName = new QName("http://org.jboss.ws/testsuite", "EchoService");
+ URL wsdlURL = new URL("http://localhost:8080/" + endpointURI + "?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ return service.getPort(Echo.class);
+ }
+
+ private void sayHello(String endpointURI) throws RemoteException, MalformedURLException
+ {
+ String helloWorld = "Hello world!";
+ Object retObj = getPort(endpointURI).echoString(helloWorld);
+ System.out.println(retObj);
+ }
+
+ public static void main(String[] args) throws Exception {
+
+ new EchoClient().sayHello("wsrunclient-test");
+
+ }
+
+}
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/EchoJavaBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/EchoJavaBean.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/EchoJavaBean.java 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.scripts.support;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+ at WebService(name = "Echo", serviceName = "EchoService", targetNamespace = "http://org.jboss.ws/testsuite")
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+public class EchoJavaBean {
+
+ @WebMethod
+ public String echoString(@WebParam(name = "inputString") String in0) {
+ return in0;
+ }
+}
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/Hello.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/Hello.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/Hello.java 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.scripts.support;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface Hello extends Remote
+{
+ public String echo(String in0) throws RemoteException;
+}
\ No newline at end of file
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/HelloJavaBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/HelloJavaBean.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/support/HelloJavaBean.java 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.scripts.support;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+ at WebService(name = "Hello", serviceName = "HelloService", targetNamespace = "http://org.jboss.ws/testsuite")
+ at SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
+public class HelloJavaBean {
+
+ @WebMethod
+ public String echoString(@WebParam(name = "inputString") String in0) {
+ return in0;
+ }
+}
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ScriptsTestBase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ScriptsTestBase.java 2010-10-08 07:38:48 UTC (rev 108484)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ScriptsTestBase.java 2010-10-08 11:24:47 UTC (rev 108485)
@@ -21,19 +21,6 @@
*/
package org.jboss.test.scripts.test;
-import java.lang.InterruptedException ;
-import java.io.OutputStream ;
-import java.io.ByteArrayOutputStream ;
-import java.io.BufferedReader ;
-import java.io.InputStreamReader ;
-import java.io.PrintWriter ;
-import java.io.StringWriter ;
-import java.io.FileReader ;
-import java.io.FileWriter ;
-import java.io.File ;
-import java.io.FileInputStream ;
-import java.io.FileOutputStream ;
-import java.io.FileNotFoundException ;
import java.io.IOException ;
import java.net.URL ;
@@ -62,13 +49,15 @@
public static final String SERVER_EXIT_MESSAGE = "Server exit" ;
public static final String SERVER_HALTED_MESSAGE = "halting the JVM now" ;
- ShellScriptExecutor se = null ;
+ protected static final String FS = System.getProperty("file.separator"); // '/' on unix, '\' on windows
+
+ ShellScriptExecutor se = null ;
AsyncShellScriptExecutor ase = null ;
LogFileAssertionChecker errorLogChecker = null ;
LogFileAssertionChecker outputLogChecker = null ;
LogFileAssertionChecker bootLogChecker = null ;
LogFileAssertionChecker systemLogChecker = null ;
-
+
public ScriptsTestBase(String name)
{
super(name);
@@ -356,6 +345,7 @@
String currentOutput = ase.getOutput() ;
if (currentOutput.indexOf(SERVER_STOPPED_MESSAGE) > -1 || currentOutput.indexOf(SERVER_HALTED_MESSAGE) > -1) {
serverStopped = true ;
+ break;
}
// wait for a sec
@@ -401,5 +391,5 @@
}
catch(InterruptedException e) {
}
- }
+ }
}
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/TwiddleTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/TwiddleTestCase.java 2010-10-08 07:38:48 UTC (rev 108484)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/TwiddleTestCase.java 2010-10-08 11:24:47 UTC (rev 108485)
@@ -23,10 +23,6 @@
package org.jboss.test.scripts.test;
import java.io.File ;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.jboss.test.JBossTestSetup ;
/**
* Unit tests of twiddle.sh and twiddle.bat.
@@ -261,7 +257,7 @@
// supply the command name prefix, any options as a string, and any args
String command = "twiddle" ;
String options = "-s " + getJndiURL() ;
- String args = "query 'jboss.system:*'" ;
+ String args = "query \"jboss.system:*\"" ; // fix for Windows
String[] shellCommand = getShellCommand(command, options, args) ;
// set the environment if necessary
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsclientTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsclientTestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsclientTestCase.java 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009 Red Hat Middleware, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.scripts.test;
+
+import java.io.File;
+import java.net.URL;
+import junit.framework.Test;
+
+/**
+ * Unit tests of wsrunclient.sh and wsrunclient.bat.
+ *
+ * @author Rostislav Svoboda
+ * @version $Revision: $
+ */
+public class WsclientTestCase extends ScriptsTestBase {
+ private static final URL classesDirUrl = Thread.currentThread().getContextClassLoader().getResource("");
+
+ /**
+ * Create a new WsclientTestCase.
+ *
+ * @param name
+ */
+ public WsclientTestCase(String name) {
+ super(name);
+ }
+
+ // WAR file from org.jboss.test.webservice.endpoint
+ public static Test suite() throws Exception {
+ return getDeploySetup(WsclientTestCase.class, "wsrunclient-test.war");
+ }
+
+ /**
+ * Prints out some basic info about the environment
+ */
+ public void testExecutionEnvironment() {
+ String os = isWindows() ? "Windows" : "non-Windows";
+ // dump out some basic config information
+ System.out.println("Testing run on " + os + " host");
+ System.out.println("Working directory: " + getBinDir());
+ System.out.println("Dist directory: " + getDistDir());
+ System.out.println("Log directory: " + getLogDir());
+ System.out.println("Server config: " + getServerConfig());
+ }
+
+ /**
+ * Tests run "help" command (no args)
+ *
+ * @throws Exception
+ */
+ public void testNoArgs() throws Exception {
+ String command = "wsrunclient";
+ String options = null;
+ String args = null;
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // check assertions
+ getShellScriptExecutor().assertOnOutputStream("usage: wsrunclient", "usage string not found in command output");
+ }
+
+ /**
+ * Tests to run client
+ *
+ * @throws Exception
+ */
+ public void testRunClient() throws Exception {
+ String command = "wsrunclient";
+ // original package was org.jboss.test.ws.benchmark.jaxws.doclit
+ String options = "-classpath " + classesDirUrl.getFile();
+ String args = "org.jboss.test.scripts.support.EchoClient";
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // check assertions
+ getShellScriptExecutor().assertOnOutputStream("Hello world!", "'Hello world!' string not found in command output");
+ }
+ /**
+ * Tests to run non exixting client
+ *
+ * @throws Exception
+ */
+ public void testRunNonExistingClient() throws Exception {
+ String command = "wsrunclient";
+ // original package was org.jboss.test.ws.benchmark.jaxws.doclit
+ String options = "-classpath " + classesDirUrl.getFile();
+ String args = "org.jboss.test.scripts.support.NonExistingClient";
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ getShellScriptExecutor().assertOnErrorStream("NoClassDefFoundError",
+ "'NoClassDefFoundError' string not found in error output");
+ }
+}
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsconsumeTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsconsumeTestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsconsumeTestCase.java 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,260 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009 Red Hat Middleware, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.scripts.test;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * Unit tests of wsconsume.sh and wsconsume.bat.
+ *
+ * @author Rostislav Svoboda
+ * @version $Revision: $
+ */
+public class WsconsumeTestCase extends ScriptsTestBase {
+
+ private static final URL wsdlFileUrl = Thread.currentThread().getContextClassLoader().getResource("scripts/BenchmarkWebService.wsdl");
+ private static final URL scriptsDirUrl = Thread.currentThread().getContextClassLoader().getResource("scripts");
+
+ /**
+ * Create a new WsconsumeTestCase.
+ *
+ * @param name
+ */
+ public WsconsumeTestCase(String name) {
+ super(name);
+ }
+
+ /**
+ * Prints out some basic info about the environment
+ */
+ public void testExecutionEnvironment() {
+ String os = isWindows() ? "Windows" : "non-Windows";
+ // dump out some basic config information
+ System.out.println("Testing run on " + os + " host");
+ System.out.println("Working directory: " + getBinDir());
+ System.out.println("Dist directory: " + getDistDir());
+ System.out.println("Log directory: " + getLogDir());
+ System.out.println("Server config: " + getServerConfig());
+ }
+
+ /**
+ * Tests run "help" command (no args)
+ *
+ * @throws Exception
+ */
+ public void testNoArgs() throws Exception {
+ String command = "wsconsume";
+ String options = null;
+ String args = "-h";
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // check assertions
+ getShellScriptExecutor().assertOnOutputStream("usage: org.jboss.wsf.spi.tools.cmd.WSConsume",
+ "usage string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ }
+
+ /**
+ * Tests generate classes command
+ *
+ * @throws Exception
+ */
+ public void testGenerateClasses() throws Exception {
+ File outDir = new File(scriptsDirUrl.getFile() + FS + "wsconsume-classes-out");
+ if (!outDir.exists()) {
+ outDir.mkdir();
+ }
+
+ String command = "wsconsume";
+ // original package was org.jboss.test.ws.benchmark.jaxws.doclit
+ String options = "-p org.jboss.test.script -o " + outDir.getAbsolutePath();
+ String args = wsdlFileUrl.getFile();
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // check assertions
+ getShellScriptExecutor().assertOnOutputStream("parsing WSDL...", "'parsing WSDL...' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ getShellScriptExecutor().assertOnOutputStream("generating code...", "'generating code...' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+
+ //check files
+ File customerClassFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "Customer.class");
+ File getOrderClassFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "GetOrder.class");
+ File customerJavaFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "Customer.java");
+ File getOrderJavaFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "GetOrder.java");
+
+ assertTrue(customerClassFile.getAbsolutePath() + " doesn't exist", customerClassFile.exists());
+ assertTrue(getOrderClassFile.getAbsolutePath() + " doesn't exist", getOrderClassFile.exists());
+ assertFalse(customerJavaFile.getAbsolutePath() + " exists", customerJavaFile.exists());
+ assertFalse(getOrderJavaFile.getAbsolutePath() + " exists", getOrderJavaFile.exists());
+ }
+
+ /**
+ * Tests generate only sources command
+ *
+ * @throws Exception
+ */
+ public void testKeepSources() throws Exception {
+ File outDir = new File(scriptsDirUrl.getFile() + FS + "wsconsume-sources-keep-out");
+ if (!outDir.exists()) {
+ outDir.mkdir();
+ }
+
+ String command = "wsconsume";
+ String options = "-k -p org.jboss.test.script -s " + outDir.getAbsolutePath();
+ String args = wsdlFileUrl.getFile();
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // check assertions
+ getShellScriptExecutor().assertOnOutputStream("parsing WSDL...", "'parsing WSDL...' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ getShellScriptExecutor().assertOnOutputStream("generating code...", "'generating code...' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+
+ //check files
+ File customerJavaFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "Customer.java");
+ File getOrderJavaFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "GetOrder.java");
+ assertTrue(customerJavaFile.getAbsolutePath() + " doesn't exist", customerJavaFile.exists());
+ assertTrue(getOrderJavaFile.getAbsolutePath() + " doesn't exist", getOrderJavaFile.exists());
+ }
+
+ /**
+ * Tests generate classes and sources command
+ *
+ * @throws Exception
+ */
+ public void testGenerateBoth() throws Exception {
+ File outDir = new File(scriptsDirUrl.getFile() + FS + "wsconsume-both-out");
+ if (!outDir.exists()) {
+ outDir.mkdir();
+ }
+
+ String command = "wsconsume";
+ String options = "-k -p org.jboss.test.script -o " + outDir.getAbsolutePath();
+ String args = wsdlFileUrl.getFile();
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // check assertions
+ getShellScriptExecutor().assertOnOutputStream("parsing WSDL...", "'parsing WSDL...' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ getShellScriptExecutor().assertOnOutputStream("generating code...", "'generating code...' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+
+ //check files
+ File customerClassFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "Customer.class");
+ File getOrderClassFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "GetOrder.class");
+ File customerJavaFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "Customer.java");
+ File getOrderJavaFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "GetOrder.java");
+
+ assertTrue(customerClassFile.getAbsolutePath() + " doesn't exist", customerClassFile.exists());
+ assertTrue(getOrderClassFile.getAbsolutePath() + " doesn't exist", getOrderClassFile.exists());
+ assertTrue(customerJavaFile.getAbsolutePath() + " doesn't exist", customerJavaFile.exists());
+ assertTrue(getOrderJavaFile.getAbsolutePath() + " doesn't exist", getOrderJavaFile.exists());
+ }
+
+ /**
+ * Tests generate classes and sources command, each in separate directory
+ *
+ * @throws Exception
+ */
+ public void testGenerateBothSeparated() throws Exception {
+ File outClassesDir = new File(scriptsDirUrl.getFile() + FS + "wsconsume-separate-classes-out");
+ File outSourcesDir = new File(scriptsDirUrl.getFile() + FS + "wsconsume-separate-sources-out");
+ if (!outClassesDir.exists()) {
+ outClassesDir.mkdir();
+ }
+ if (!outSourcesDir.exists()) {
+ outSourcesDir.mkdir();
+ }
+
+ String command = "wsconsume";
+ String options = "-k -p org.jboss.test.script -o " + outClassesDir.getAbsolutePath()
+ + " -s " + outSourcesDir.getAbsolutePath();
+ String args = wsdlFileUrl.getFile();
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // check assertions
+ getShellScriptExecutor().assertOnOutputStream("parsing WSDL...", "'parsing WSDL...' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ getShellScriptExecutor().assertOnOutputStream("generating code...", "'generating code...' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+
+ //check files
+ File customerClassFile = new File(outClassesDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "Customer.class");
+ File getOrderClassFile = new File(outClassesDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "GetOrder.class");
+ File customerJavaFile = new File(outSourcesDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "Customer.java");
+ File getOrderJavaFile = new File(outSourcesDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS + "GetOrder.java");
+
+ assertTrue(customerClassFile.getAbsolutePath() + " doesn't exist", customerClassFile.exists());
+ assertTrue(getOrderClassFile.getAbsolutePath() + " doesn't exist", getOrderClassFile.exists());
+ assertTrue(customerJavaFile.getAbsolutePath() + " doesn't exist", customerJavaFile.exists());
+ assertTrue(getOrderJavaFile.getAbsolutePath() + " doesn't exist", getOrderJavaFile.exists());
+ }
+
+ /**
+ * Tests generate classes command when wsdl doesn't exist
+ *
+ * @throws Exception
+ */
+ public void testNonExistingWsdl() throws Exception {
+ String command = "wsconsume";
+ String options = "-v -p org.jboss.test.script ";
+ String args = "NonExistingWsdl.wsdl";
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ assertTrue("'Failed to parse the WSDL' string not found in command output:\n" + getShellScriptExecutor().getOutput(),
+ (getShellScriptExecutor().getOutput().indexOf("Failed to parse the WSDL") != -1));
+ assertTrue("'WsImport invocation failed' string not found in command output:\n" + getShellScriptExecutor().getOutput(),
+ (getShellScriptExecutor().getOutput().indexOf("WsImport invocation failed") != -1));
+ }
+
+}
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsprovideTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsprovideTestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsprovideTestCase.java 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,235 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009 Red Hat Middleware, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.scripts.test;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * Unit tests of wsprovide.sh and wsprovide.bat.
+ *
+ * @author Rostislav Svoboda
+ * @version $Revision: $
+ */
+public class WsprovideTestCase extends ScriptsTestBase {
+
+ private static final URL classesDirUrl = Thread.currentThread().getContextClassLoader().getResource("");
+ private static final URL scriptsDirUrl = Thread.currentThread().getContextClassLoader().getResource("scripts");
+
+ /**
+ * Create a new WsprovideTestCase.
+ *
+ * @param name
+ */
+ public WsprovideTestCase(String name) {
+ super(name);
+ }
+
+ /**
+ * Prints out some basic info about the environment
+ */
+ public void testExecutionEnvironment() {
+ String os = isWindows() ? "Windows" : "non-Windows";
+ // dump out some basic config information
+ System.out.println("Testing run on " + os + " host");
+ System.out.println("Working directory: " + getBinDir());
+ System.out.println("Dist directory: " + getDistDir());
+ System.out.println("Log directory: " + getLogDir());
+ System.out.println("Server config: " + getServerConfig());
+ }
+
+ /**
+ * Tests run "help" command (no args)
+ *
+ * @throws Exception
+ */
+ public void testNoArgs() throws Exception {
+ String command = "wsprovide";
+ String options = null;
+ String args = "-h";
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ getShellScriptExecutor().assertOnOutputStream("usage: WSProvide", "usage string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ }
+
+ /**
+ * Tests basic command to generate request and response classes
+ *
+ * @throws Exception
+ */
+ public void testGenerateRequestResponseClasses() throws Exception {
+ File outDir = new File(scriptsDirUrl.getFile() + FS + "wsprovide-basic-out");
+ if (!outDir.exists()) {
+ outDir.mkdir();
+ }
+ String command = "wsprovide";
+ String options = "-c " + classesDirUrl.getFile() + " -o " + outDir.getAbsolutePath();
+ String args = "org.jboss.test.scripts.support.HelloJavaBean";
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // check assertions
+ getShellScriptExecutor().assertOnOutputStream("Output directory:", "'Output directory:' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ getShellScriptExecutor().assertOnOutputStream("Writing Classes:", "'Writing Classes:' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+
+ //check files
+ File echoClassFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "scripts" + FS + "support" + FS + "jaxws" + FS + "EchoString.class");
+ assertTrue(echoClassFile.getAbsolutePath() + " doesn't exist", echoClassFile.exists());
+ }
+
+ /**
+ * Tests basic command to generate WSDL file
+ *
+ * @throws Exception
+ */
+ public void testGenerateWSDL() throws Exception {
+ File outDir = new File(scriptsDirUrl.getFile() + FS + "wsprovide-wsdl-out");
+ if (!outDir.exists()) {
+ outDir.mkdir();
+ }
+ String command = "wsprovide";
+ String options = "-w -c " + classesDirUrl.getFile() + " -o " + outDir.getAbsolutePath();
+ String args = "org.jboss.test.scripts.support.HelloJavaBean";
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // check assertions
+ getShellScriptExecutor().assertOnOutputStream("Output directory:", "'Output directory:' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ getShellScriptExecutor().assertOnOutputStream("Generating WSDL:", "'Generating WSDL:' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+
+ //check files
+ File wsdlFile = new File(outDir.getAbsolutePath() + FS + "HelloService.wsdl");
+ assertTrue(wsdlFile.getAbsolutePath() + " doesn't exist", wsdlFile.exists());
+ }
+
+ /**
+ * Tests basic command to generate and keep source files
+ *
+ * @throws Exception
+ */
+ public void testKeepSources() throws Exception {
+ File outDir = new File(scriptsDirUrl.getFile() + FS + "wsprovide-keep-sources-out");
+ if (!outDir.exists()) {
+ outDir.mkdir();
+ }
+ String command = "wsprovide";
+ String options = "-k -c " + classesDirUrl.getFile() + " -o " + outDir.getAbsolutePath();
+ String args = "org.jboss.test.scripts.support.HelloJavaBean";
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // check assertions
+ getShellScriptExecutor().assertOnOutputStream("Output directory:", "'Output directory:' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ getShellScriptExecutor().assertOnOutputStream("Writing Source:", "'Writing Source:' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ getShellScriptExecutor().assertOnOutputStream("Writing Classes:", "'Writing Classes:' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+
+ //check files
+ File echoClassFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "scripts" + FS + "support" + FS + "jaxws" + FS + "EchoString.class");
+ File echoJavaFile = new File(outDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "scripts" + FS + "support" + FS + "jaxws" + FS + "EchoString.java");
+ assertTrue(echoClassFile.getAbsolutePath() + " doesn't exist", echoClassFile.exists());
+ assertTrue(echoJavaFile.getAbsolutePath() + " doesn't exist", echoJavaFile.exists());
+ }
+
+ /**
+ * Tests command to generate WSDL, support classes and keep source files.
+ * Each in separated directory.
+ *
+ * @throws Exception
+ */
+ public void testGenerateAllSeparated() throws Exception {
+ File outClassesDir = new File(scriptsDirUrl.getFile() + FS + "wsprovide-separate-classes-out");
+ File outSourcesDir = new File(scriptsDirUrl.getFile() + FS + "wsprovide-separate-sources-out");
+ File outResourcesDir = new File(scriptsDirUrl.getFile() + FS + "wsprovide-separate-resources-out");
+ if (!outClassesDir.exists()) {
+ outClassesDir.mkdir();
+ }
+ if (!outSourcesDir.exists()) {
+ outSourcesDir.mkdir();
+ }
+ if (!outResourcesDir.exists()) {
+ outResourcesDir.mkdir();
+ }
+
+ String command = "wsprovide";
+ String options = "-k -w -c " + classesDirUrl.getFile()
+ + " -o " + outClassesDir.getAbsolutePath()
+ + " -r " + outResourcesDir.getAbsolutePath()
+ + " -s " + outSourcesDir.getAbsolutePath();
+ String args = "org.jboss.test.scripts.support.HelloJavaBean";
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // check assertions
+ getShellScriptExecutor().assertOnOutputStream("Output directory:", "'Output directory:' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ getShellScriptExecutor().assertOnOutputStream("Writing Source:", "'Writing Source:' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ getShellScriptExecutor().assertOnOutputStream("Writing Classes:", "'Writing Classes:' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+ getShellScriptExecutor().assertOnOutputStream("Generating WSDL:", "'Generating WSDL:' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+
+ //check files
+ File echoClassFile = new File(outClassesDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "scripts" + FS + "support" + FS + "jaxws" + FS + "EchoString.class");
+ File echoJavaFile = new File(outSourcesDir.getAbsolutePath() + FS
+ + "org" + FS + "jboss" + FS + "test" + FS + "scripts" + FS + "support" + FS + "jaxws" + FS + "EchoString.java");
+ File wsdlFile = new File(outResourcesDir.getAbsolutePath() + FS + "HelloService.wsdl");
+
+ assertTrue(echoClassFile.getAbsolutePath() + " doesn't exist", echoClassFile.exists());
+ assertTrue(echoJavaFile.getAbsolutePath() + " doesn't exist", echoJavaFile.exists());
+ assertTrue(wsdlFile.getAbsolutePath() + " doesn't exist", wsdlFile.exists());
+ }
+
+ /**
+ * Tests basic command to generate support classes from non-existing class
+ *
+ * @throws Exception
+ */
+ public void testNonExistingClass() throws Exception {
+ String command = "wsprovide";
+ String options = "-k -c " + classesDirUrl.getFile();
+ String args = "org.jboss.test.scripts.support.NonExistingBean";
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+ assertTrue("'Could not load class' string not found in error output",
+ (getShellScriptExecutor().getError().indexOf("Could not load class") != -1));
+ }
+}
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WstoolsTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WstoolsTestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WstoolsTestCase.java 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009 Red Hat Middleware, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.scripts.test;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * Unit tests of wstools.sh and wstools.bat.
+ *
+ * @author Rostislav Svoboda
+ * @version $Revision: $
+ */
+public class WstoolsTestCase extends ScriptsTestBase {
+
+ private static final URL configFileUrl = Thread.currentThread().getContextClassLoader().getResource("scripts/wstools-config.xml");
+ private static final URL scriptsDirUrl = Thread.currentThread().getContextClassLoader().getResource("scripts");
+ private static final URL classesDirUrl = Thread.currentThread().getContextClassLoader().getResource("");
+
+ /**
+ * Create a new WstoolsTestCase.
+ *
+ * @param name
+ */
+ public WstoolsTestCase(String name) {
+ super(name);
+ }
+
+ /**
+ * Prints out some basic info about the environment
+ */
+ public void testExecutionEnvironment() {
+ String os = isWindows() ? "Windows" : "non-Windows";
+ // dump out some basic config information
+ System.out.println("Testing run on " + os + " host");
+ System.out.println("Working directory: " + getBinDir());
+ System.out.println("Dist directory: " + getDistDir());
+ System.out.println("Log directory: " + getLogDir());
+ System.out.println("Server config: " + getServerConfig());
+ }
+
+ /**
+ * Tests run "help" command (no args)
+ *
+ * @throws Exception
+ */
+ public void testNoArgs() throws Exception {
+ String command = "wstools";
+ String options = null;
+ String args = "-h";
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // check assertions
+ getShellScriptExecutor().assertOnOutputStream("Usage: wstools", "usage string not found in command output");
+ }
+
+ /**
+ * Tests generate classes command
+ *
+ * @throws Exception
+ */
+ public void testGenerateClasses() throws Exception {
+ File outDir = new File(scriptsDirUrl.getFile() + FS + "wstools-classes-out");
+ if (!outDir.exists()) {
+ outDir.mkdir();
+ }
+
+ String command = "wstools";
+ // original package was org.jboss.test.ws.benchmark.jaxws.doclit
+ String options = "-classpath " + classesDirUrl.getFile() + " -config " + configFileUrl.getFile()
+ + " -dest " + outDir.getAbsolutePath();
+ String args = null;
+ String[] shellCommand = getShellCommand(command, options, args);
+
+ String[] envp = null; // set the environment if necessary
+ File workingDir = new File(getBinDir()); // set the working directory
+ getShellScriptExecutor().runShellCommand(shellCommand, envp, workingDir);
+
+ // NO console output
+
+ //check files
+ File wsdlFile = new File(outDir.getAbsolutePath() + FS + "wsdl" + FS + "HelloService.wsdl");
+ File webservicesFile = new File(outDir.getAbsolutePath() + FS + "webservices.xml");
+ File mappingFile = new File(outDir.getAbsolutePath() + FS + "jaxrpc-mapping.xml");
+
+ assertTrue(wsdlFile.getAbsolutePath() + " doesn't exist", wsdlFile.exists());
+ assertTrue(webservicesFile.getAbsolutePath() + " doesn't exist", webservicesFile.exists());
+ assertTrue(mappingFile.getAbsolutePath() + " doesn't exist", mappingFile.exists());
+ }
+}
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/BenchmarkWebService.wsdl
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/BenchmarkWebService.wsdl (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/BenchmarkWebService.wsdl 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<definitions name="BenchmarkWebService" targetNamespace="http://org.jboss.ws/benchmark" xmlns:tns="http://org.jboss.ws/benchmark" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns2="http://org.jboss.ws/benchmark/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+ <types>
+ <schema targetNamespace="http://org.jboss.ws/benchmark/types" xmlns:tns="http://org.jboss.ws/benchmark/types" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://www.w3.org/2001/XMLSchema">
+ <complexType name="echoArrayOfSimpleUserType">
+ <sequence>
+ <element name="arrayOfSimpleUserType_1" type="tns:SimpleUserType" nillable="true" minOccurs="0" maxOccurs="unbounded"/></sequence></complexType>
+ <complexType name="SimpleUserType">
+ <sequence>
+ <element name="f" type="float"/>
+ <element name="i" type="int"/>
+ <element name="s" type="string" nillable="true"/></sequence></complexType>
+ <complexType name="echoArrayOfSimpleUserTypeResponse">
+ <sequence>
+ <element name="result" type="tns:SimpleUserType" nillable="true" minOccurs="0" maxOccurs="unbounded"/></sequence></complexType>
+ <complexType name="echoSimpleType">
+ <sequence>
+ <element name="SimpleUserType_1" type="tns:SimpleUserType" nillable="true"/></sequence></complexType>
+ <complexType name="echoSimpleTypeResponse">
+ <sequence>
+ <element name="result" type="tns:SimpleUserType" nillable="true"/></sequence></complexType>
+ <complexType name="echoSynthetic">
+ <sequence>
+ <element name="Synthetic_1" type="tns:Synthetic" nillable="true"/></sequence></complexType>
+ <complexType name="Synthetic">
+ <sequence>
+ <element name="b" type="base64Binary" nillable="true"/>
+ <element name="s" type="string" nillable="true"/>
+ <element name="sut" type="tns:SimpleUserType" nillable="true"/></sequence></complexType>
+ <complexType name="echoSyntheticResponse">
+ <sequence>
+ <element name="result" type="tns:Synthetic" nillable="true"/></sequence></complexType>
+ <complexType name="getOrder">
+ <sequence>
+ <element name="int_1" type="int"/>
+ <element name="int_2" type="int"/>
+ </sequence>
+ </complexType>
+ <complexType name="getOrderResponse">
+ <sequence>
+ <element name="result" type="tns:Order" nillable="true"/>
+ </sequence>
+ </complexType>
+ <complexType name="Order">
+ <sequence>
+ <element name="customer" type="tns:Customer" nillable="true"/>
+ <element name="lineItems" type="tns:LineItem" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="orderDate" type="dateTime" nillable="true"/>
+ <element name="orderId" type="int"/>
+ <element name="orderStatus" type="int"/>
+ <element name="orderTotalAmount" type="float"/>
+ </sequence>
+ </complexType>
+ <complexType name="Customer">
+ <sequence>
+ <element name="billingAddress" type="tns:Address" nillable="true"/>
+ <element name="contactFirstName" type="string" nillable="true"/>
+ <element name="contactLastName" type="string" nillable="true"/>
+ <element name="contactPhone" type="string" nillable="true"/>
+ <element name="creditCardExpirationDate" type="string" nillable="true"/>
+ <element name="creditCardNumber" type="string" nillable="true"/>
+ <element name="customerId" type="int"/>
+ <element name="lastActivityDate" type="dateTime" nillable="true"/>
+ <element name="shippingAddress" type="tns:Address" nillable="true"/>
+ </sequence>
+ </complexType>
+ <complexType name="Address">
+ <sequence>
+ <element name="address1" type="string" nillable="true"/>
+ <element name="address2" type="string" nillable="true"/>
+ <element name="city" type="string" nillable="true"/>
+ <element name="firstName" type="string" nillable="true"/>
+ <element name="lastName" type="string" nillable="true"/>
+ <element name="state" type="string" nillable="true"/>
+ <element name="zip" type="string" nillable="true"/>
+ </sequence>
+ </complexType>
+ <complexType name="LineItem">
+ <sequence>
+ <element name="itemId" type="int"/>
+ <element name="orderId" type="int"/>
+ <element name="orderQuantity" type="int"/>
+ <element name="productDescription" type="string" nillable="true"/>
+ <element name="productId" type="int"/>
+ <element name="unitPrice" type="float"/>
+ </sequence>
+ </complexType>
+ <element name="echoArrayOfSimpleUserType" type="tns:echoArrayOfSimpleUserType"/>
+ <element name="echoArrayOfSimpleUserTypeResponse" type="tns:echoArrayOfSimpleUserTypeResponse"/>
+ <element name="echoSimpleType" type="tns:echoSimpleType"/>
+ <element name="echoSimpleTypeResponse" type="tns:echoSimpleTypeResponse"/>
+ <element name="echoSynthetic" type="tns:echoSynthetic"/>
+ <element name="echoSyntheticResponse" type="tns:echoSyntheticResponse"/>
+ <element name="getOrder" type="tns:getOrder"/>
+ <element name="getOrderResponse" type="tns:getOrderResponse"/>
+ </schema>
+ </types>
+
+ <message name="BenchmarkService_echoArrayOfSimpleUserType">
+ <part name="parameters" element="ns2:echoArrayOfSimpleUserType"/>
+ </message>
+ <message name="BenchmarkService_echoArrayOfSimpleUserTypeResponse">
+ <part name="result" element="ns2:echoArrayOfSimpleUserTypeResponse"/>
+ </message>
+ <message name="BenchmarkService_echoSimpleType">
+ <part name="parameters" element="ns2:echoSimpleType"/>
+ </message>
+ <message name="BenchmarkService_echoSimpleTypeResponse">
+ <part name="result" element="ns2:echoSimpleTypeResponse"/>
+ </message>
+ <message name="BenchmarkService_echoSynthetic">
+ <part name="parameters" element="ns2:echoSynthetic"/>
+ </message>
+ <message name="BenchmarkService_echoSyntheticResponse">
+ <part name="result" element="ns2:echoSyntheticResponse"/>
+ </message>
+ <message name="BenchmarkService_getOrder">
+ <part name="parameters" element="ns2:getOrder"/>
+ </message>
+ <message name="BenchmarkService_getOrderResponse">
+ <part name="result" element="ns2:getOrderResponse"/>
+ </message>
+
+ <portType name="BenchmarkService">
+ <operation name="echoArrayOfSimpleUserType">
+ <input message="tns:BenchmarkService_echoArrayOfSimpleUserType"/>
+ <output message="tns:BenchmarkService_echoArrayOfSimpleUserTypeResponse"/>
+ </operation>
+ <operation name="echoSimpleType">
+ <input message="tns:BenchmarkService_echoSimpleType"/>
+ <output message="tns:BenchmarkService_echoSimpleTypeResponse"/>
+ </operation>
+ <operation name="echoSynthetic">
+ <input message="tns:BenchmarkService_echoSynthetic"/>
+ <output message="tns:BenchmarkService_echoSyntheticResponse"/>
+ </operation>
+ <operation name="getOrder">
+ <input message="tns:BenchmarkService_getOrder"/>
+ <output message="tns:BenchmarkService_getOrderResponse"/>
+ </operation>
+ </portType>
+
+ <binding name="BenchmarkServiceBinding" type="tns:BenchmarkService">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <operation name="echoArrayOfSimpleUserType">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/></input>
+ <output>
+ <soap:body use="literal"/></output>
+
+ </operation>
+ <operation name="echoSimpleType">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/></input>
+ <output>
+ <soap:body use="literal"/></output>
+
+ </operation>
+ <operation name="echoSynthetic">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/></input>
+ <output>
+ <soap:body use="literal"/></output>
+
+ </operation>
+ <operation name="getOrder">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/></input>
+ <output>
+ <soap:body use="literal"/></output>
+ </operation>
+
+ </binding>
+ <service name="BenchmarkWebService">
+ <port name="BenchmarkServicePort" binding="tns:BenchmarkServiceBinding">
+ <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
+ </port>
+ </service>
+</definitions>
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/web.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/web.xml (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/web.xml 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <servlet>
+ <servlet-name>TestService</servlet-name>
+ <servlet-class>org.jboss.test.scripts.support.EchoJavaBean</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestService</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/wstools-config.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/wstools-config.xml (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/scripts/wstools-config.xml 2010-10-08 11:24:47 UTC (rev 108485)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<configuration xmlns="http://www.jboss.org/jbossws-tools"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
+ <java-wsdl>
+ <service name="HelloService" style="rpc" endpoint="org.jboss.test.scripts.support.Hello"/>
+ <namespaces target-namespace="http://org.jboss.ws/testsuite" type-namespace="http://org.jboss.ws/testsuite/types"/>
+ <mapping file="jaxrpc-mapping.xml"/>
+ <webservices servlet-link="HelloService"/>
+ </java-wsdl>
+</configuration>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list