tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r619226 - in /incubator/tuscany/java/sca: itest/ itest/component-type/ itest/services/ tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/
Date Thu, 07 Feb 2008 00:01:47 GMT
Author: rfeng
Date: Wed Feb  6 16:01:45 2008
New Revision: 619226

URL: http://svn.apache.org/viewvc?rev=619226&view=rev
Log:
Bring up some of the itests to be runnable as a web app

Modified:
    incubator/tuscany/java/sca/itest/component-type/pom.xml
    incubator/tuscany/java/sca/itest/pom.xml
    incubator/tuscany/java/sca/itest/services/pom.xml
    incubator/tuscany/java/sca/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitGeneratorMojo.java
    incubator/tuscany/java/sca/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitMojo.java

Modified: incubator/tuscany/java/sca/itest/component-type/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/component-type/pom.xml?rev=619226&r1=619225&r2=619226&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/component-type/pom.xml (original)
+++ incubator/tuscany/java/sca/itest/component-type/pom.xml Wed Feb  6 16:01:45 2008
@@ -43,27 +43,5 @@
         </dependency>
     </dependencies>
 
-
-    <profiles>
-        <profile>
-            <id>webapp</id>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-war-plugin</artifactId>
-                        <executions>
-                            <execution>
-                                <phase>package</phase>
-                                <goals>
-                                    <goal>war</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
 </project>
 

Modified: incubator/tuscany/java/sca/itest/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/pom.xml?rev=619226&r1=619225&r2=619226&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/pom.xml (original)
+++ incubator/tuscany/java/sca/itest/pom.xml Wed Feb  6 16:01:45 2008
@@ -34,7 +34,7 @@
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <version>4.2</version>
-            <scope>runtime</scope>
+            <scope>compile</scope>
         </dependency>
 
         <dependency>
@@ -114,38 +114,79 @@
             <id>webapp</id>
             <activation>
                 <activeByDefault>false</activeByDefault>
+                <!--
                 <file>
                     <exists>src</exists>
                 </file>
+                -->
             </activation>
+            
             <dependencies>
                 <dependency>
 	    	    <groupId>org.apache.tuscany.sca</groupId>
 	    	    <artifactId>tuscany-host-webapp</artifactId>
 	    	    <version>1.2-incubating-SNAPSHOT</version>
+                    <scope>runtime</scope>
 	    	</dependency>
-                <!-- marking dependency as provided to exclude from war file -->
                 <dependency>
-                    <groupId>javax.servlet</groupId>
-                    <artifactId>servlet-api</artifactId>
-                    <version>2.3</version>
+	    	    <groupId>javax.servlet</groupId>
+	    	    <artifactId>servlet-api</artifactId>
+	    	    <version>2.3</version>
                     <scope>provided</scope>
-                </dependency>
-                <dependency>
-                    <groupId>junit</groupId>
-                    <artifactId>junit</artifactId>
-                    <version>4.2</version>
-                    <scope>compile</scope>
-                </dependency>	    	    
+	    	</dependency>
 	    </dependencies>    
 
             <modules>
-                <module>component-type</module>
+                <module>callback-api</module>
+                <module>callback-basic</module>
+                <!--
+                <module>callback-complex-type</module>
+                -->
+                <module>callback-id</module>
+                <module>callback-multiple-wires</module>
+                <module>callback-set-callback</module>
+                <module>callback-set-conversation</module>
+                <!--
+                <module>contribution</module>
+                <module>contribution-multiple</module>
+                <module>contribution-import-export</module>
+                <module>contribution-classloader</module>
+                -->
+                <module>conversations</module>
+                <module>exceptions</module>
+                <module>exceptions-cross-binding</module>
+                <module>extended-api</module>
+                <module>oneway</module>
+                <module>operation-overloading</module>
+                <!--
+                <module>properties</module>
+                <module>recursive</module>
+                -->
+                <module>references</module>
                 <module>services</module>
+                <module>component-type</module>
+                <module>interfaces</module>
+                <module>wires</module>
+                <module>scopes</module>
             </modules>
 
             <build>
+                <pluginManagement>
+                    <plugins>
+                        <!-- Skip local junit test cases -->
+                        <plugin>
+                            <groupId>org.apache.maven.plugins</groupId>
+                            <artifactId>maven-surefire-plugin</artifactId>
+                            <version>2.3.1</version>
+                            <configuration>
+                                <skip>true</skip>
+                            </configuration>
+                        </plugin>
+                    </plugins>
+                </pluginManagement>
+
                 <plugins>
+
                     <!-- Create jar containing the jUnit tests -->
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
@@ -170,15 +211,27 @@
                         <artifactId>maven-war-plugin</artifactId>
                         <version>2.0.2</version>
                         <configuration>
+                            <!-- Exclude a few jars to avoid conflicts -->
+                            <warSourceExcludes>WEB-INF/lib/tuscany-host-tomcat-*.jar,WEB-INF/lib/tuscany-host-jetty-*.jar,servlet-api-*.jar</warSourceExcludes>
                             <webResources>
+                                <!-- Add the tests jar into the WAR -->
                                 <resource>
-                                    <!-- this is relative to the pom.xml directory -->
                                     <directory>${project.build.directory}</directory>
                                     <includes>
                                         <include>*-tests.jar</include>
                                     </includes>
-                                    <targetPath>WEB-INF/test-lib</targetPath>
+                                    <targetPath>WEB-INF/lib</targetPath>
+                                </resource>
+
+                                <!-- Add the junit -->
+                                <resource>
+                                    <directory>${settings.localRepository}/junit/junit/4.2</directory>
+                                    <includes>
+                                        <include>junit-4.2.jar</include>
+                                    </includes>
+                                    <targetPath>WEB-INF/lib</targetPath>
                                 </resource>
+
                             </webResources>
                         </configuration>
                         <executions>

Modified: incubator/tuscany/java/sca/itest/services/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/services/pom.xml?rev=619226&r1=619225&r2=619226&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/services/pom.xml (original)
+++ incubator/tuscany/java/sca/itest/services/pom.xml Wed Feb  6 16:01:45 2008
@@ -41,28 +41,6 @@
             <version>1.2-incubating-SNAPSHOT</version>
             <scope>runtime</scope>
         </dependency>
-
     </dependencies>
 
-    <profiles>
-        <profile>
-            <id>webapp</id>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-war-plugin</artifactId>
-                        <executions>
-                            <execution>
-                                <phase>package</phase>
-                                <goals>
-                                    <goal>war</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
 </project>

Modified: incubator/tuscany/java/sca/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitGeneratorMojo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitGeneratorMojo.java?rev=619226&r1=619225&r2=619226&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitGeneratorMojo.java
(original)
+++ incubator/tuscany/java/sca/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitGeneratorMojo.java
Wed Feb  6 16:01:45 2008
@@ -76,6 +76,10 @@
             + "\n       <filter>"
             + "\n           <filter-name>tuscany</filter-name>"
             + "\n           <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>"
+            + "\n           <init-param>"
+            + "\n               <param-name>junit.tests.jar</param-name>"
+            + "\n               <param-value>${junit.tests.jar}</param-value>"
+            + "\n           </init-param>"
             + "\n       </filter>"
             + "\n       <filter-mapping>"
             + "\n           <filter-name>tuscany</filter-name>"
@@ -86,6 +90,11 @@
     /**
      * @parameter
      */
+    private String testsJar;
+
+    /**
+     * @parameter
+     */
     private boolean geronimo;
 
     /**
@@ -107,6 +116,12 @@
         File webxml = new File(base, "web.xml");
         getLog().info("Generating " + webxml.toString());
         String content = setParameter(WEB_XML, "display.name", project.getName());
+
+        if (testsJar == null) {
+            testsJar = "/WEB-INF/lib/junit-tests.jar";
+        }
+        content = setParameter(content, "junit.tests.jar", testsJar);
+
         try {
             FileWriter writer = new FileWriter(webxml);
             writer.append(content);

Modified: incubator/tuscany/java/sca/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitMojo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitMojo.java?rev=619226&r1=619225&r2=619226&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitMojo.java
(original)
+++ incubator/tuscany/java/sca/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitMojo.java
Wed Feb  6 16:01:45 2008
@@ -27,6 +27,7 @@
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
+import org.apache.http.StatusLine;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.DefaultHttpClient;
@@ -107,8 +108,11 @@
             // Execute HTTP request
             HttpResponse response = client.execute(httpget);
 
-            if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
-                throw new MojoExecutionException(response.getStatusLine().getReasonPhrase());
+            StatusLine status = response.getStatusLine();
+            if (status.getStatusCode() != HttpStatus.SC_OK) {
+                // throw new MojoExecutionException(response.getStatusLine().getReasonPhrase());
+                getLog().error(status.getStatusCode() + ": " + status.getReasonPhrase());
+                return;
             }
             Header header = response.getFirstHeader("junit.errors");
             errors = header == null ? 0 : Integer.parseInt(header.getValue());
@@ -135,7 +139,7 @@
                         sb.append(line);
                     }
                     xml = sb.toString();
-                    getLog().info(xml);
+                    getLog().debug(xml);
 
                 } catch (IOException ex) {
 
@@ -160,10 +164,12 @@
 
             }
         } catch (Exception e) {
-            throw new MojoExecutionException(e.getMessage(), e);
+            // throw new MojoExecutionException(e.getMessage(), e);
+            getLog().error(e);
         }
         if (errors != 0 || failures != 0) {
-            throw new MojoExecutionException(xml);
+            // throw new MojoExecutionException(xml);
+            getLog().error(xml);
         }
 
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message