Author: heiko.braun(a)jboss.com
Date: 2007-09-26 14:42:59 -0400 (Wed, 26 Sep 2007)
New Revision: 4635
Added:
framework/trunk/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java
Modified:
framework/trunk/src/test/ant-import/build-testsuite.xml
Log:
Added testcase for wsprovide and wsconsume scripts that reside with the AS
Modified: framework/trunk/src/test/ant-import/build-testsuite.xml
===================================================================
--- framework/trunk/src/test/ant-import/build-testsuite.xml 2007-09-26 15:04:52 UTC (rev
4634)
+++ framework/trunk/src/test/ant-import/build-testsuite.xml 2007-09-26 18:42:59 UTC (rev
4635)
@@ -401,6 +401,8 @@
<mkdir dir="${tests.output.dir}/reports"/>
<junit printsummary="yes" showoutput="yes"
dir="${tests.output.dir}" haltonfailure="${haltonfailure}">
<jvmarg value="-Djava.security.manager"/>
+ <sysproperty key="jdk.home" value="${env.JAVA_HOME}"/>
+ <sysproperty key="test.execution.dir"
value="${tests.output.dir}"/>
<sysproperty key="build.testlog"
value="${tests.output.dir}/log"/>
<sysproperty key="client.scenario"
value="${client.scenario}"/>
<sysproperty key="java.endorsed.dirs"
value="${endorsed.dirs}"/>
@@ -436,9 +438,12 @@
-->
<target name="one-test" depends="tests-init" if="test"
description="Run a single unit test">
<mkdir dir="${tests.output.dir}/reports"/>
+
<junit printsummary="yes" showoutput="yes"
dir="${tests.output.dir}">
<jvmarg line="${remote.debug.line}"/>
<jvmarg value="-Djava.security.manager"/>
+ <sysproperty key="jdk.home" value="${env.JAVA_HOME}"/>
+ <sysproperty key="test.execution.dir"
value="${tests.output.dir}"/>
<sysproperty key="build.testlog"
value="${tests.output.dir}/log"/>
<sysproperty key="client.scenario"
value="${client.scenario}"/>
<sysproperty key="java.endorsed.dirs"
value="${endorsed.dirs}"/>
Added:
framework/trunk/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java
===================================================================
--- framework/trunk/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java
(rev 0)
+++
framework/trunk/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java 2007-09-26
18:42:59 UTC (rev 4635)
@@ -0,0 +1,123 @@
+/*
+ * 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.ws.jaxws.smoke.tools;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Test the wsprovide and wsconsume scripts that reside
+ * under JBOSS_HOME/bin. This basically verifies all dependencies are
+ * met to run the shell scripts.
+ *
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+public class ScriptTestCase extends TestCase
+{
+ private String WSDL_LOCATION =
"resources/jaxws/smoke/tools/wsdl/TestServiceCatalog.wsdl";
+ private String ENDPOINT_CLASS =
"org.jboss.test.ws.jaxws.smoke.tools.CalculatorBean";
+
+ private String JBOSS_HOME;
+ private String JDK_HOME;
+ private String TEST_EXEC_DIR;
+ private String OS;
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ JBOSS_HOME = System.getProperty("jboss.home");
+ TEST_EXEC_DIR = System.getProperty("test.execution.dir");
+ JDK_HOME = System.getProperty("jdk.home");
+ OS = System.getProperty("os.name").toLowerCase();
+ }
+
+ public void testWSConsumeFromCommandLine() throws Exception
+ {
+ if(isWindowsOS())
+ {
+ fail("This test has not been verified on windows");
+ }
+
+ String command = JBOSS_HOME + "/bin/wsconsume.sh -k -o wsconsume/java " +
WSDL_LOCATION;
+ Process p = executeCommand(command);
+
+ // check status code
+ assertStatusCode(p);
+
+ File javaSource = new
File("wsconsume/java/org/openuri/_2004/_04/helloworld/EndpointInterface.java");
+
+ assertTrue("Sevice endpoint interface not generated",
javaSource.exists());
+ }
+
+ public void testWSProvideFromCommandLine() throws Exception
+ {
+ if(isWindowsOS())
+ {
+ fail("This test has not been verified on windows");
+ }
+
+ String command = JBOSS_HOME + "/bin/wsprovide.sh -k -w -o wsprovide/java/
--classpath "+TEST_EXEC_DIR+"/classes "+ ENDPOINT_CLASS;
+ Process p = executeCommand(command);
+
+ // check status code
+ assertStatusCode(p);
+
+ File outputDir = new File("wsprovide/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
+ {
+ // 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}
+ );
+ return p;
+ }
+
+ private void assertStatusCode(Process p)
+ throws InterruptedException
+ {
+ // check status code
+ int status = p.waitFor();
+ assertTrue("wsprovide did exit with status " + status, status==0);
+ }
+
+ private boolean isWindowsOS()
+ {
+ return ( (OS.indexOf("nt") > -1) || (OS.indexOf("windows")
> -1 ));
+ }
+}
Property changes on:
framework/trunk/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF