Update build-std-groovy to use high level targets, and add according tests
git-svn-id: https://svn.apache.org/repos/asf/incubator/easyant/buildtypes/trunk@1374522 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/build-std-groovy/module.ivy b/build-std-groovy/module.ivy
index 1c69304..78ccd05 100644
--- a/build-std-groovy/module.ivy
+++ b/build-std-groovy/module.ivy
@@ -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-std-groovy" revision="0.2">
+ <info organisation="org.apache.easyant.buildtypes" module="build-std-groovy" revision="0.9">
<ea:build organisation="org.apache.easyant.buildtypes" module="build-std-ant-plugin" revision="0.1"/>
</info>
<configurations>
diff --git a/build-std-groovy/src/main/resources/build-std-groovy.ant b/build-std-groovy/src/main/resources/build-std-groovy.ant
index b127585..84098ac 100644
--- a/build-std-groovy/src/main/resources/build-std-groovy.ant
+++ b/build-std-groovy/src/main/resources/build-std-groovy.ant
@@ -23,28 +23,36 @@
<property file="${org.apache.easyant.buildtypes#build-std-groovy.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-groovy;0.2" />
- <ea:import mrid="org.apache.easyant.plugins#compile-test-groovy;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-jar;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-groovy;0.9" />
+ <ea:import mrid="org.apache.easyant.plugins#compile-test-groovy;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-jar;0.9" />
<!-- plugin binding -->
- <bindtargets targets="compile-groovy:compile,manifest:manifest,resources-std:copy-resources" extensionPoint="package-jar:jar-ready" />
- <bindtargets targets="compile-test-groovy:compile,resources-std:copy-test-resources" extensionPoint="abstract-test:test-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-jar:jar" extensionPoint="ivy-publication:publish-ready" />
- <!-- friendly target names -->
- <target name="clean" depends="clean-std:clean" description="Clean the project" />
- <target name="compile" depends="compile-groovy:compile" description="Compile the project" />
- <target name="test" depends="test-junit:run" description="Launch the unit tests" />
+ <!-- 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 the repository" />
+ <target name="install" depends="ivy-publication:publish-local" description="Install the artifacts into local repository" />
</project>
diff --git a/build-std-groovy/src/test/antunit/build-std-groovy-test.xml b/build-std-groovy/src/test/antunit/build-std-groovy-test.xml
new file mode 100644
index 0000000..003399b
--- /dev/null
+++ b/build-std-groovy/src/test/antunit/build-std-groovy-test.xml
@@ -0,0 +1,62 @@
+<!--
+ 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-groovy-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-groovy:clean" depends="clean">
+ <au:assertLogContains text="Cleaning ${target}..."/>
+ <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-std-groovy:clean' is [clean-test, setUp, clean-std:clean, clean, test-build-std-groovy:clean]" level="debug"/>
+ </target>
+
+ <target name="test-build-std-groovy:compile" depends="compile">
+ <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-std-groovy: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-groovy:init, -compile-groovy:configure, compile-groovy:compile, compile-test-groovy:configure, compile-test-groovy:compile, compile-test-groovy:compile-integration, abstract-compile:compile-finished, compile, test-build-std-groovy:compile]" level="debug"/>
+ </target>
+
+ <target name="test-build-std-groovy: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-groovy: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-groovy:init, -compile-groovy:configure, compile-groovy:compile, compile-test-groovy:configure, compile-test-groovy:compile, compile-test-groovy: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-groovy:test]" level="debug"/>
+ </target>
+
+ <target name="test-build-std-groovy:package" depends="package">
+ <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-std-groovy: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-groovy:init, -compile-groovy:configure, compile-groovy:compile, compile-test-groovy:configure, compile-test-groovy:compile, compile-test-groovy: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-groovy:package]" level="debug"/>
+ </target>
+
+</project>
diff --git a/build-std-groovy/src/test/antunit/module.ivy b/build-std-groovy/src/test/antunit/module.ivy
new file mode 100644
index 0000000..5bc9469
--- /dev/null
+++ b/build-std-groovy/src/test/antunit/module.ivy
@@ -0,0 +1,31 @@
+<!--
+ 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 module="build-std-groovy" 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" />
+ <dependency org="org.codehaus.groovy" name="groovy-all" rev="2.0.0" conf="test->default"/>
+
+ </dependencies>
+</ivy-module>
diff --git a/build-std-groovy/src/test/antunit/src/main/groovy/org/apache/easyant/example/Example.groovy b/build-std-groovy/src/test/antunit/src/main/groovy/org/apache/easyant/example/Example.groovy
new file mode 100644
index 0000000..b0775bb
--- /dev/null
+++ b/build-std-groovy/src/test/antunit/src/main/groovy/org/apache/easyant/example/Example.groovy
@@ -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 + "!";
+ }
+}
diff --git a/build-std-groovy/src/test/antunit/src/main/resources/main.properties b/build-std-groovy/src/test/antunit/src/main/resources/main.properties
new file mode 100644
index 0000000..f2bef19
--- /dev/null
+++ b/build-std-groovy/src/test/antunit/src/main/resources/main.properties
@@ -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
diff --git a/build-std-groovy/src/test/antunit/src/test/groovy/org/apache/easyant/example/ExampleTest.groovy b/build-std-groovy/src/test/antunit/src/test/groovy/org/apache/easyant/example/ExampleTest.groovy
new file mode 100644
index 0000000..a52ce8e
--- /dev/null
+++ b/build-std-groovy/src/test/antunit/src/test/groovy/org/apache/easyant/example/ExampleTest.groovy
@@ -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"));
+ }
+}
diff --git a/build-std-groovy/src/test/antunit/src/test/resources/test.properties b/build-std-groovy/src/test/antunit/src/test/resources/test.properties
new file mode 100644
index 0000000..d08a419
--- /dev/null
+++ b/build-std-groovy/src/test/antunit/src/test/resources/test.properties
@@ -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