Author: bodewig
Date: Thu Oct 30 21:59:16 2008
New Revision: 709347

URL: http://svn.apache.org/viewvc?rev=709347&view=rev
Log:
An example build file running AntUnit

Added:
    
ant/sandbox/javafront/src/main/org/apache/ant/javafront/builder/CopyBuilder.java
   (with props)
Modified:
    ant/sandbox/javafront/src/etc/examples/AntUnitTest.java
    
ant/sandbox/javafront/src/main/org/apache/ant/javafront/builder/TagBuilder.java

Modified: ant/sandbox/javafront/src/etc/examples/AntUnitTest.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/javafront/src/etc/examples/AntUnitTest.java?rev=709347&r1=709346&r2=709347&view=diff
==============================================================================
--- ant/sandbox/javafront/src/etc/examples/AntUnitTest.java (original)
+++ ant/sandbox/javafront/src/etc/examples/AntUnitTest.java Thu Oct 30 21:59:16 
2008
@@ -23,7 +23,7 @@
 import org.apache.tools.ant.Project;
 
 @AntProject(Name="example using AntUnit", BaseDir="../../..",
-            DefaultTarget="describe")
+            DefaultTarget="antunit")
 public class AntUnitTest extends BuildFileBase {
     public AntUnitTest(Project p) {
         super(p);
@@ -36,4 +36,36 @@
         build().newTag("echo")
             .withNestedText("Demonstrates running an AntUnit test.").execute();
     }
+
+    @AntTarget
+    public void setUp() {
+        build().newTag("mkdir")
+            .withAttribute("dir", "build/testoutput").execute();
+    }
+
+    @AntTarget
+    public void tearDown() {
+        build().newTag("delete")
+            .withAttribute("dir", "build/testoutput").execute();
+    }
+
+    @AntTarget
+    public void testCopy() {
+        build().newCopy().withAttribute("verbose", "true")
+            .file("build.xml").toDir("build/testoutput")
+            .execute();
+        build().newTag("assertFileExists", "antlib:org.apache.ant.antunit")
+            .withAttribute("file", "build/testoutput/build.xml")
+            .execute();
+    }
+
+    @AntTarget(Description="runs the test")
+    public void antunit() {
+        build().newTag("antunit", "antlib:org.apache.ant.antunit")
+            .withChild(build().newTag("plainlistener",
+                                      "antlib:org.apache.ant.antunit"))
+            .withChild(build().newTag("file").withAttribute("file",
+                                                            "${ant.file}"))
+            .execute();
+    }
 }
\ No newline at end of file

Added: 
ant/sandbox/javafront/src/main/org/apache/ant/javafront/builder/CopyBuilder.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/javafront/src/main/org/apache/ant/javafront/builder/CopyBuilder.java?rev=709347&view=auto
==============================================================================
--- 
ant/sandbox/javafront/src/main/org/apache/ant/javafront/builder/CopyBuilder.java
 (added)
+++ 
ant/sandbox/javafront/src/main/org/apache/ant/javafront/builder/CopyBuilder.java
 Thu Oct 30 21:59:16 2008
@@ -0,0 +1,38 @@
+/*
+ *  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.ant.javafront.builder;
+
+import org.apache.tools.ant.Project;
+
+public class CopyBuilder extends Tag<CopyBuilder> {
+    CopyBuilder(Project p) {
+        super(p, "copy");
+    }
+
+    public NeedsToDir file(String name) {
+        withAttribute("file", name);
+        return new NeedsToDir();
+    }
+
+    public class NeedsToDir {
+        public CopyBuilder toDir(String value) {
+            withAttribute("todir", value);
+            return CopyBuilder.this;
+        }
+    }
+}
\ No newline at end of file

Propchange: 
ant/sandbox/javafront/src/main/org/apache/ant/javafront/builder/CopyBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
ant/sandbox/javafront/src/main/org/apache/ant/javafront/builder/TagBuilder.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/javafront/src/main/org/apache/ant/javafront/builder/TagBuilder.java?rev=709347&r1=709346&r2=709347&view=diff
==============================================================================
--- 
ant/sandbox/javafront/src/main/org/apache/ant/javafront/builder/TagBuilder.java 
(original)
+++ 
ant/sandbox/javafront/src/main/org/apache/ant/javafront/builder/TagBuilder.java 
Thu Oct 30 21:59:16 2008
@@ -54,4 +54,8 @@
     public PropertyBuilder newProperty() {
         return new PropertyBuilder(project);
     }
+
+    public CopyBuilder newCopy() {
+        return new CopyBuilder(project);
+    }
 }
\ No newline at end of file


Reply via email to