[jboss-cvs] JBossAS SVN: r111192 - branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/scripts/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 18 09:35:07 EDT 2011


Author: rsvoboda at redhat.com
Date: 2011-04-18 09:35:07 -0400 (Mon, 18 Apr 2011)
New Revision: 111192

Modified:
   branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/scripts/test/WsconsumeTestCase.java
Log:
tests-scripts-noserver: wsconsume test: fix regarding JBWS-3193 - without "-k", the generated artifacts should be placed in output directory

Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/scripts/test/WsconsumeTestCase.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/scripts/test/WsconsumeTestCase.java	2011-04-18 12:09:09 UTC (rev 111191)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/scripts/test/WsconsumeTestCase.java	2011-04-18 13:35:07 UTC (rev 111192)
@@ -124,21 +124,27 @@
     }
 
     
-    //NATIVE  issue (needs to have -k specified (no -n), when -o + -n java files in output directory )
 
     /**
      * Tests generate only sources command
      *
+     * If there are "-n" and "-s" flag, without "-k", the generated artifacts should be placed in output directory
+     * For details see JBWS-3193 and http://fisheye.jboss.org/changelog/JBossWS/?cs=13533
+     *
      * @throws Exception
      */
     public void testGenerateSources() throws Exception {
         File outDir = new File(scriptsDirUrl.getFile() + FS + "wsconsume-sources-out");
+        File srcDir = new File(scriptsDirUrl.getFile() + FS + "wsconsume-sources-src");
         if (!outDir.exists()) {
             outDir.mkdir();
         }
+        if (!srcDir.exists()) {
+            srcDir.mkdir();
+        }
 
         String command = "wsconsume";
-        String options = "-n -p org.jboss.test.script -s " + outDir.getAbsolutePath();
+        String options = "-n -p org.jboss.test.script -s " + srcDir.getAbsolutePath() + " -o " + outDir.getAbsolutePath();
         String args = wsdlFileUrl.getFile();
         String[] shellCommand = getShellCommand(command, options, args);
 
@@ -156,22 +162,71 @@
                     (getShellScriptExecutor().getOutput().indexOf("compiling code...") == -1));
         }
         //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");
+        final String commonOutPart = outDir.getAbsolutePath() + FS + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS;
+        final String commonSrcPart = srcDir.getAbsolutePath() + FS + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS;
+        File customerClassFile = new File(commonOutPart + "Customer.class");
+        File getOrderClassFile = new File(commonOutPart + "GetOrder.class");
+        File outDirCustomerJavaFile = new File(commonOutPart + "Customer.java");
+        File outDirGetOrderJavaFile = new File(commonOutPart + "GetOrder.java");
+        File srcDirCustomerJavaFile = new File(commonSrcPart + "Customer.java");
+        File srcDirGetOrderJavaFile = new File(commonSrcPart + "GetOrder.java");
 
         assertFalse(customerClassFile.getAbsolutePath() + " exists", customerClassFile.exists());
         assertFalse(getOrderClassFile.getAbsolutePath() + " exists", getOrderClassFile.exists());
-        assertTrue(customerJavaFile.getAbsolutePath() + " doesn't exist", customerJavaFile.exists());
-        assertTrue(getOrderJavaFile.getAbsolutePath() + " doesn't exist", getOrderJavaFile.exists());
+        assertFalse(srcDirCustomerJavaFile.getAbsolutePath() + " exists", srcDirCustomerJavaFile.exists());
+        assertFalse(srcDirGetOrderJavaFile.getAbsolutePath() + " exists", srcDirGetOrderJavaFile.exists());
+        assertTrue(outDirCustomerJavaFile.getAbsolutePath() + " doesn't exist", outDirCustomerJavaFile.exists());
+        assertTrue(outDirGetOrderJavaFile.getAbsolutePath() + " doesn't exist", outDirGetOrderJavaFile.exists());
     }
 
     /**
+     * Tests generate only sources command with keep parameter
+     *
+     * @throws Exception
+     */
+    public void testGenerateSourcesKeep() throws Exception {
+        File outDir = new File(scriptsDirUrl.getFile() + FS + "wsconsume-sources-keep-out");
+        File srcDir = new File(scriptsDirUrl.getFile() + FS + "wsconsume-sources-keep-src");
+        if (!outDir.exists()) {
+            outDir.mkdir();
+        }
+        if (!srcDir.exists()) {
+            srcDir.mkdir();
+        }
+
+        String command = "wsconsume";
+        String options = "-n -k -p org.jboss.test.script -s " + srcDir.getAbsolutePath() + " -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
+        if (isCXFInstalled()) {
+            getShellScriptExecutor().assertOnOutputStream("wsdl2java", "'wsdl2java' string not found in command output:\n" + getShellScriptExecutor().getOutput());
+        } else {
+            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());
+            assertTrue("'compiling code...' string found in command output",
+                    (getShellScriptExecutor().getOutput().indexOf("compiling code...") == -1));
+        }
+        //check files
+        final String commonOutPart = outDir.getAbsolutePath() + FS + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS;
+        final String commonSrcPart = srcDir.getAbsolutePath() + FS + "org" + FS + "jboss" + FS + "test" + FS + "script" + FS;
+        File customerClassFile = new File(commonOutPart + "Customer.class");
+        File getOrderClassFile = new File(commonOutPart + "GetOrder.class");
+        File srcDirCustomerJavaFile = new File(commonSrcPart + "Customer.java");
+        File srcDirGetOrderJavaFile = new File(commonSrcPart + "GetOrder.java");
+
+        assertFalse(customerClassFile.getAbsolutePath() + " exists", customerClassFile.exists());
+        assertFalse(getOrderClassFile.getAbsolutePath() + " exists", getOrderClassFile.exists());
+        assertTrue(srcDirCustomerJavaFile.getAbsolutePath() + " doesn't exist", srcDirCustomerJavaFile.exists());
+        assertTrue(srcDirGetOrderJavaFile.getAbsolutePath() + " doesn't exist", srcDirGetOrderJavaFile.exists());
+    }
+
+    /**
      * Tests generate only sources command
      *
      * @throws Exception



More information about the jboss-cvs-commits mailing list