You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by jl...@apache.org on 2012/08/16 18:40:22 UTC

svn commit: r1373974 - in /incubator/easyant/buildtypes/trunk/build-webapp-java: ./ src/main/resources/ src/test/ src/test/antunit/ src/test/antunit/src/ src/test/antunit/src/main/ src/test/antunit/src/main/java/ src/test/antunit/src/main/java/org/ src...

Author: jlboudart
Date: Thu Aug 16 18:40:21 2012
New Revision: 1373974

URL: http://svn.apache.org/viewvc?rev=1373974&view=rev
Log:
Updates build-webapp-java with high level targets and according tests

Added:
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/build-webapp-java-test.xml
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/module.ivy
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/java/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/java/org/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/java/org/apache/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/java/org/apache/easyant/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/java/org/apache/easyant/example/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/java/org/apache/easyant/example/Example.java
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/resources/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/resources/main.properties
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/java/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/java/org/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/java/org/apache/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/java/org/apache/easyant/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/java/org/apache/easyant/example/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/java/org/apache/easyant/example/ExampleTest.java
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/resources/
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/resources/test.properties
Modified:
    incubator/easyant/buildtypes/trunk/build-webapp-java/module.ivy
    incubator/easyant/buildtypes/trunk/build-webapp-java/src/main/resources/build-webapp-java.ant

Modified: incubator/easyant/buildtypes/trunk/build-webapp-java/module.ivy
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-webapp-java/module.ivy?rev=1373974&r1=1373973&r2=1373974&view=diff
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-webapp-java/module.ivy (original)
+++ incubator/easyant/buildtypes/trunk/build-webapp-java/module.ivy Thu Aug 16 18:40:21 2012
@@ -15,7 +15,7 @@
    limitations under the License.
 -->
 <ivy-module version="2.0" xmlns:ea="http://www.easyant.org"> 
-    <info organisation="org.apache.easyant.buildtypes" module="build-webapp-java" revision="0.2">
+    <info organisation="org.apache.easyant.buildtypes" module="build-webapp-java" revision="0.9">
            <description>A standard build for webapp java modules, relying on standard phases, and providing compilation, execution and unit tests</description>
            <ea:build organisation="org.apache.easyant.buildtypes" module="build-std-ant-plugin" revision="0.1"/>
         </info>

Modified: incubator/easyant/buildtypes/trunk/build-webapp-java/src/main/resources/build-webapp-java.ant
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-webapp-java/src/main/resources/build-webapp-java.ant?rev=1373974&r1=1373973&r2=1373974&view=diff
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-webapp-java/src/main/resources/build-webapp-java.ant (original)
+++ incubator/easyant/buildtypes/trunk/build-webapp-java/src/main/resources/build-webapp-java.ant Thu Aug 16 18:40:21 2012
@@ -23,29 +23,36 @@
 
     <property file="${org.apache.easyant.buildtypes#build-webapp-java.properties.file}" />
 
-    <ea:import mrid="org.apache.easyant.plugins#clean-std;0.2" />
-    <ea:import mrid="org.apache.easyant.plugins#ivy-provisioning;0.2" />
-    <ea:import mrid="org.apache.easyant.plugins#default-version-strategy;0.2" />
-    <ea:import mrid="org.apache.easyant.plugins#ivy-publication;0.2" />
-    <ea:import mrid="org.apache.easyant.plugins#ivy-utils;0.2" />
-    <ea:import mrid="org.apache.easyant.plugins#resources-std;0.2" />
-    <ea:import mrid="org.apache.easyant.plugins#compile-java;0.2" />
-    <ea:import mrid="org.apache.easyant.plugins#compile-test-java;0.2" />
-    <ea:import mrid="org.apache.easyant.plugins#test-junit;0.3" />
-    <ea:import mrid="org.apache.easyant.plugins#manifest;0.2" />
-    <ea:import mrid="org.apache.easyant.plugins#package-war;0.2" />
+    <ea:import mrid="org.apache.easyant.plugins#phases-std;0.9" />
+
+    <ea:import mrid="org.apache.easyant.plugins#clean-std;0.9" />
+    <ea:import mrid="org.apache.easyant.plugins#ivy-provisioning;0.9" />
+    <ea:import mrid="org.apache.easyant.plugins#default-version-strategy;0.9" />
+    <ea:import mrid="org.apache.easyant.plugins#ivy-publication;0.9" />
+    <ea:import mrid="org.apache.easyant.plugins#ivy-utils;0.9" />
+    <ea:import mrid="org.apache.easyant.plugins#resources-std;0.9" />
+    <ea:import mrid="org.apache.easyant.plugins#compile-java;0.9" />
+    <ea:import mrid="org.apache.easyant.plugins#compile-test-java;0.9" />
+    <ea:import mrid="org.apache.easyant.plugins#test-junit;0.9" />
+    <ea:import mrid="org.apache.easyant.plugins#manifest;0.9" />
+    <ea:import mrid="org.apache.easyant.plugins#package-war;0.9" />
 
     <!-- plugin binding -->
-    <bindtargets targets="compile-java:compile,manifest:manifest,manifest:manifest-runnable,resources-std:copy-resources" extensionPoint="package-jar:jar-ready" />
-    <bindtargets targets="compile-test-java:compile,resources-std:copy-test-resources" extensionPoint="abstract-test:test-ready" />
-    <bindtargets targets="package-jar:jar" extensionPoint="package-war:war-ready" />
+    <bindtargets targets="manifest:manifest-runnable,resources-std:copy-resources" extensionPoint="abstract-package:package-ready" />
+    <bindtargets targets="abstract-compile:compile-finished,resources-std:copy-resources,resources-std:copy-test-resources" extensionPoint="abstract-test:test-ready" />
     <bindtargets targets="package-war:war" extensionPoint="ivy-publication:publish-ready" />
 
-    <!-- friendly target names -->
-    <target name="clean" depends="clean-std:clean" description="Clean the project" />
-    <target name="compile" depends="compile-java:compile" description="Compile the project" />
-    <target name="test" depends="test-junit:run" description="Launch the unit tests" />
-    <target name="dist" depends="ivy-publication:publish-ready" description="Produce every artifact to be distributed" />
-    <target name="install" depends="ivy-publication:publish-local" description="Install the artifacts into the repository" />
+    <!-- bind high level targets -->
+    <bindtargets targets="clean-std:clean" extensionPoint="clean"/>
+    <bindtargets targets="abstract-compile:compile-finished" extensionPoint="compile"/>
+    <bindtargets targets="abstract-test:test-run" extensionPoint="test"/>
+    <bindtargets targets="abstract-test:integration-test-run" extensionPoint="integration-test"/>
+    <bindtargets targets="abstract-package:package-finished" extensionPoint="package"/>
+    <bindtargets targets="ivy-publication:publish-local" extensionPoint="publish-local"/>
+    <bindtargets targets="ivy-publication:publish-shared" extensionPoint="publish-shared"/>
+    <bindtargets targets="ivy-publication:release" extensionPoint="release"/>
 
+    <!-- additionnal friendtly target names -->
+    <target name="dist" depends="ivy-publication:publish-ready" description="Produce every artifact to be distributed" />
+    <target name="install" depends="ivy-publication:publish-local" description="Install the artifacts into local repository" />
 </project>

Added: incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/build-webapp-java-test.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/build-webapp-java-test.xml?rev=1373974&view=auto
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/build-webapp-java-test.xml (added)
+++ incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/build-webapp-java-test.xml Thu Aug 16 18:40:21 2012
@@ -0,0 +1,61 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project name="org.apache.easyant.plugins;build-webapp-java-test" 
+    xmlns:au="antlib:org.apache.ant.antunit" 
+    xmlns:ivy="antlib:org.apache.ivy.ant"
+    xmlns:ea="antlib:org.apache.easyant">
+    
+    <!-- Import your plugin --> 
+    <property name="target" value="target/test-antunit"/>
+    <!-- configure easyant in current project -->
+    <ea:configure-easyant-ivy-instance />
+    <!-- import our local plugin -->
+    <property name="easyant.file" value="${basedir}/module.ivy"/>
+    <ea:import-test-module moduleIvy="../../../module.ivy" sourceDirectory="../../main/resources"/>
+
+    <!-- Defines a setUp / tearDown (before each test) that cleans the environnement --> 
+    <target name="clean-test" description="remove stale build artifacts before / after each test">
+        <delete dir="${basedir}" includeemptydirs="true">
+            <include name="**/target/**"/>
+            <include name="**/lib/**"/>
+        </delete>
+    </target>
+    
+    <target name="setUp" depends="clean-test">
+       <ivy:settings id="project.ivy.instance"/>
+    </target>
+    <target name="tearDown" depends="clean-test"/>
+    
+    <target name="test-build-webapp-java:clean" depends="clean">
+         <au:assertLogContains text="Cleaning ${target}..."/>
+         <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-webapp-java:clean' is [clean-test, setUp, clean-std:clean, clean, test-build-webapp-java:clean]" level="debug"/>
+   </target>
+
+   <target name="test-build-webapp-java:compile" depends="compile">
+         <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-webapp-java:compile' is [clean-test, setUp, -ivy-provisioning:init, abstract-provisioning:provisioning-ready, -ivy-provisioning:resolve, -ivy-provisioning:resolve-main-confs, -ivy-provisioning:resolve-test-confs, -ivy-provisioning:resolve-provided-confs, ivy-provisioning:resolve, abstract-provisioning:provisioning-finished, abstract-compile:compile-ready, compile-java:init, compile-java:compile, compile-test-java:compile, compile-test-java:compile-integration, abstract-compile:compile-finished, compile, test-build-webapp-java:compile]" level="debug"/>
+    </target>
+    <target name="test-build-webapp-java:test" depends="test">
+         <au:assertLogContains text="Running org.apache.easyant.example.ExampleTest"/>
+         <au:assertLogContains text="Tests run: 2, Failures: 0, Errors: 0"/>
+         <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-webapp-java:test' is [clean-test, setUp, -ivy-provisioning:init, abstract-provisioning:provisioning-ready, -ivy-provisioning:resolve, -ivy-provisioning:resolve-main-confs, -ivy-provisioning:resolve-test-confs, -ivy-provisioning:resolve-provided-confs, ivy-provisioning:resolve, abstract-provisioning:provisioning-finished, abstract-compile:compile-ready, compile-java:init, compile-java:compile, compile-test-java:compile, compile-test-java:compile-integration, abstract-compile:compile-finished, compile, resources-std:init, -resources-std:check-resources, resources-std:copy-resources, resources-std:copy-test-resources, abstract-test:test-ready, abstract-test:init, test-junit:init, abstract-test:compute-test-sets, -test-junit:test, test-junit:run, abstract-test:test-run, test, test-build-webapp-java:test]" level="debug"/>
+    </target>
+
+   <target name="test-build-webapp-java:package" depends="package">
+       <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-webapp-java:package' is [clean-test, setUp, -ivy-provisioning:init, abstract-provisioning:provisioning-ready, -ivy-provisioning:resolve, -ivy-provisioning:resolve-main-confs, -ivy-provisioning:resolve-test-confs, -ivy-provisioning:resolve-provided-confs, ivy-provisioning:resolve, abstract-provisioning:provisioning-finished, abstract-compile:compile-ready, compile-java:init, compile-java:compile, compile-test-java:compile, compile-test-java:compile-integration, abstract-compile:compile-finished, compile, manifest:init, -manifest:generate-version-number, manifest:manifest, manifest:manifest-runnable, resources-std:init, -resources-std:check-resources, resources-std:copy-resources, abstract-package:package-ready, abstract-package:init, abstract-package:compute-metainf, package-war:init, -package-war:prepare-war, package-war:war, abstract-package:register-main-artifact, abstract-package:package-
 finished, package, test-build-webapp-java:package]" level="debug"/>
+   </target>
+
+</project>

Added: incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/module.ivy
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/module.ivy?rev=1373974&view=auto
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/module.ivy (added)
+++ incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/module.ivy Thu Aug 16 18:40:21 2012
@@ -0,0 +1,30 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<ivy-module version="2.0" xmlns:ea="http://www.easyant.org"> 
+    <info organisation="org.apache.easyant" module="standard-java-app" revision="0.1" status="integration" >
+       <ea:build organisation="org.apache.easyant.buildtypes" module="build-webapp-java" revision="0.9"/>
+    </info>
+    <configurations>
+        <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf"/>
+        <conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases."/>
+    </configurations>
+    <dependencies>
+        <dependency org="hsqldb" name="hsqldb" rev="1.8.0.7" conf="default->default"/>
+        <dependency org="junit" name="junit" rev="4.4" conf="test->default" />
+
+    </dependencies>
+</ivy-module>

Added: incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/java/org/apache/easyant/example/Example.java
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/java/org/apache/easyant/example/Example.java?rev=1373974&view=auto
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/java/org/apache/easyant/example/Example.java (added)
+++ incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/java/org/apache/easyant/example/Example.java Thu Aug 16 18:40:21 2012
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.easyant.example;
+
+import java.io.IOException;
+import java.util.Properties;
+
+public class Example {
+    public static void main(String[] args) throws IOException {
+        System.out.println(new Example().sayHello("EasyAnt"));
+    }
+
+    /* 
+     * @param who Who says hello
+     */
+    public String sayHello(String who) throws IOException {
+        Properties props = new Properties();
+        props.load(Example.class.getResourceAsStream("/main.properties"));
+        return props.getProperty("example") + " " + who + "!";
+    }
+}

Added: incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/resources/main.properties
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/resources/main.properties?rev=1373974&view=auto
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/resources/main.properties (added)
+++ incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/main/resources/main.properties Thu Aug 16 18:40:21 2012
@@ -0,0 +1,15 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+example=Hello

Added: incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/java/org/apache/easyant/example/ExampleTest.java
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/java/org/apache/easyant/example/ExampleTest.java?rev=1373974&view=auto
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/java/org/apache/easyant/example/ExampleTest.java (added)
+++ incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/java/org/apache/easyant/example/ExampleTest.java Thu Aug 16 18:40:21 2012
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.easyant.example;
+
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+public class ExampleTest extends TestCase {
+    public void testExample() throws Exception {
+        assertEquals("Hello EasyAnt!", new Example().sayHello("EasyAnt"));
+    }
+    public void testTestResources() throws Exception {
+        Properties props = new Properties();
+        props.load(Example.class.getResourceAsStream("/test.properties"));
+        assertEquals("Hello Test", props.getProperty("test.example"));
+    }
+}

Added: incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/resources/test.properties
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/resources/test.properties?rev=1373974&view=auto
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/resources/test.properties (added)
+++ incubator/easyant/buildtypes/trunk/build-webapp-java/src/test/antunit/src/test/resources/test.properties Thu Aug 16 18:40:21 2012
@@ -0,0 +1,15 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+test.example=Hello Test