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 17:54:25 UTC

svn commit: r1373954 - in /incubator/easyant/buildtypes/trunk/build-std-java/src/test: ./ antunit/ antunit/src/ antunit/src/main/ antunit/src/main/java/ antunit/src/main/java/org/ antunit/src/main/java/org/apache/ antunit/src/main/java/org/apache/easya...

Author: jlboudart
Date: Thu Aug 16 17:54:24 2012
New Revision: 1373954

URL: http://svn.apache.org/viewvc?rev=1373954&view=rev
Log:
Add build-std-java test
Since plugins are already unit tested we will only make assertion on build sequence

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

Added: incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/build-std-java-test.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/build-std-java-test.xml?rev=1373954&view=auto
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/build-std-java-test.xml (added)
+++ incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/build-std-java-test.xml Thu Aug 16 17:54:24 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-std-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-std-java:clean" depends="clean">
+         <au:assertLogContains text="Cleaning ${target}..."/>
+         <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-std-java:clean' is [clean-test, setUp, clean-std:clean, clean, test-build-std-java:clean]" level="debug"/>
+   </target>
+
+   <target name="test-build-std-java:compile" depends="compile">
+         <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-std-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-std-java:compile]" level="debug"/>
+    </target>
+    <target name="test-build-std-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-std-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-std-java:test]" level="debug"/>
+    </target>
+
+   <target name="test-build-std-java:package" depends="package">
+       <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-std-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-jar:init, package-jar:jar, abstract-package:register-main-artifact, abstract-package:package-finished, package, test-build
 -std-java:package]" level="debug"/>
+   </target>
+
+</project>

Added: incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/module.ivy
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/module.ivy?rev=1373954&view=auto
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/module.ivy (added)
+++ incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/module.ivy Thu Aug 16 17:54:24 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-std-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-std-java/src/test/antunit/src/main/java/org/apache/easyant/example/Example.java
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/src/main/java/org/apache/easyant/example/Example.java?rev=1373954&view=auto
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/src/main/java/org/apache/easyant/example/Example.java (added)
+++ incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/src/main/java/org/apache/easyant/example/Example.java Thu Aug 16 17:54:24 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-std-java/src/test/antunit/src/main/resources/main.properties
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/src/main/resources/main.properties?rev=1373954&view=auto
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/src/main/resources/main.properties (added)
+++ incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/src/main/resources/main.properties Thu Aug 16 17:54:24 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-std-java/src/test/antunit/src/test/java/org/apache/easyant/example/ExampleTest.java
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/src/test/java/org/apache/easyant/example/ExampleTest.java?rev=1373954&view=auto
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/src/test/java/org/apache/easyant/example/ExampleTest.java (added)
+++ incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/src/test/java/org/apache/easyant/example/ExampleTest.java Thu Aug 16 17:54:24 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-std-java/src/test/antunit/src/test/resources/test.properties
URL: http://svn.apache.org/viewvc/incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/src/test/resources/test.properties?rev=1373954&view=auto
==============================================================================
--- incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/src/test/resources/test.properties (added)
+++ incubator/easyant/buildtypes/trunk/build-std-java/src/test/antunit/src/test/resources/test.properties Thu Aug 16 17:54:24 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