diff --git a/build.xml b/build.xml
index 699a1dd9b..bbef59f5f 100644
--- a/build.xml
+++ b/build.xml
@@ -30,8 +30,11 @@
-
-
+
+
+
+
+
@@ -154,7 +157,8 @@
-
+
+
@@ -162,7 +166,7 @@
but not all of them -->
-
+
@@ -185,7 +189,7 @@
-
+
@@ -1507,7 +1511,7 @@
-
+
@@ -1517,10 +1521,10 @@
-
+
-
+
@@ -1610,9 +1614,9 @@
IllegalAccessExceptions otherwise. -->
-
-
@@ -1622,15 +1626,15 @@
unless="tests.and.ant.share.classloader"/>
-
-
-
diff --git a/src/etc/testcases/taskdefs/apt.xml b/src/etc/testcases/taskdefs/apt.xml
new file mode 100644
index 000000000..a9724b04c
--- /dev/null
+++ b/src/etc/testcases/taskdefs/apt.xml
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/apt/AptExample.java b/src/etc/testcases/taskdefs/apt/AptExample.java
new file mode 100644
index 000000000..3552a6217
--- /dev/null
+++ b/src/etc/testcases/taskdefs/apt/AptExample.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.
+ *
+ */
+/**
+ */
+@Distributed(
+ protocol="CORBA",
+ distribution=Distributed.DistributionTypes.FEDERATED
+ )
+public class AptExample {
+}
diff --git a/src/etc/testcases/taskdefs/apt/Distributed.java b/src/etc/testcases/taskdefs/apt/Distributed.java
new file mode 100644
index 000000000..e9733c1a2
--- /dev/null
+++ b/src/etc/testcases/taskdefs/apt/Distributed.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.
+ *
+ */
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ */
+@Documented
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.TYPE)
+public @interface Distributed {
+
+ public DistributionTypes distribution() default DistributionTypes.LOCAL;
+
+ public String protocol() default "RMI";
+
+ public enum DistributionTypes { SINGLETON, LOCAL, FAULT_TOLERANT, FEDERATED, MOBILE};
+
+
+}
diff --git a/src/etc/testcases/taskdefs/apt/DistributedAnnotationFactory.java b/src/etc/testcases/taskdefs/apt/DistributedAnnotationFactory.java
new file mode 100644
index 000000000..ed3bebe08
--- /dev/null
+++ b/src/etc/testcases/taskdefs/apt/DistributedAnnotationFactory.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.
+ *
+ */
+import com.sun.mirror.apt.AnnotationProcessorFactory;
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.Arrays;
+import java.util.Collections;
+
+
+/**
+ * This was the first piece of Java1.5 code in the source tree.
+ * @since 20050-03-09T21:29:25Z
+ */
+public class DistributedAnnotationFactory implements AnnotationProcessorFactory {
+
+ private static final Collection supportedAnnotations
+ = Collections.unmodifiableCollection(Arrays.asList("*"));
+
+ public Collection supportedOptions() {
+ return Collections.emptySet();
+ }
+
+ public Collection supportedAnnotationTypes() {
+ return supportedAnnotations;
+ }
+
+ public AnnotationProcessor getProcessorFor(
+ Set annotationTypeDeclarations,
+ AnnotationProcessorEnvironment env) {
+ return new DistributedAnnotationProcessor(env);
+ }
+}
diff --git a/src/etc/testcases/taskdefs/apt/DistributedAnnotationProcessor.java b/src/etc/testcases/taskdefs/apt/DistributedAnnotationProcessor.java
new file mode 100644
index 000000000..75ccb9ef6
--- /dev/null
+++ b/src/etc/testcases/taskdefs/apt/DistributedAnnotationProcessor.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.
+ *
+ */
+
+//found in tools.jar, not the JRE runtime.
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.util.SimpleDeclarationVisitor;
+import static com.sun.mirror.util.DeclarationVisitors.*;
+
+import java.util.Map;
+
+/**
+ * Annotation processor outputs stuff
+ */
+
+public class DistributedAnnotationProcessor implements AnnotationProcessor {
+
+ public AnnotationProcessorEnvironment env;
+
+ public DistributedAnnotationProcessor(AnnotationProcessorEnvironment env) {
+ this.env = env;
+ }
+
+ public void echo(String text) {
+ env.getMessager().printNotice(text);
+ }
+
+ public void process() {
+ echo("DistributedAnnotationProcessor-is-go");
+
+ Map options=env.getOptions();
+ for(String key:options.keySet()) {
+ echo("Option ["+key+"] = "+options.get(key));
+ }
+
+ //work time
+ for (TypeDeclaration typeDecl : env.getSpecifiedTypeDeclarations()) {
+ typeDecl.accept(getDeclarationScanner(new ClassVisitor(),
+ NO_OP));
+ }
+ }
+
+ private class ClassVisitor extends SimpleDeclarationVisitor {
+ public void visitClassDeclaration(ClassDeclaration d) {
+ echo("visiting "+ d.getQualifiedName());
+ }
+ }
+}
diff --git a/src/testcases/org/apache/tools/ant/BuildFileTest.java b/src/testcases/org/apache/tools/ant/BuildFileTest.java
index b0f63e329..565b8f108 100644
--- a/src/testcases/org/apache/tools/ant/BuildFileTest.java
+++ b/src/testcases/org/apache/tools/ant/BuildFileTest.java
@@ -81,6 +81,17 @@ public abstract class BuildFileTest extends TestCase {
realLog.indexOf(substring) >= 0);
}
+ /**
+ * Assert that the given substring is in the output messages
+ * @since Ant1.7
+ */
+
+ protected void assertOutputContaining(String substring) {
+ String realOutput = getOutput();
+ assertTrue("expecting output to contain \"" + substring + "\" output was \""
+ + realOutput + "\"",
+ realOutput.indexOf(substring) >= 0);
+ }
/**
* Assert that the given message has been logged with a priority
* <= INFO when running the given target.
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/AptTest.java b/src/testcases/org/apache/tools/ant/taskdefs/AptTest.java
new file mode 100644
index 000000000..d94cb427c
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/AptTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.tools.ant.taskdefs;
+
+import org.apache.tools.ant.BuildFileTest;
+
+/**
+ */
+public class AptTest extends BuildFileTest {
+ public AptTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/apt.xml");
+ }
+
+ /**
+ * Tears down the fixture, for example, close a network connection. This
+ * method is called after a test is executed.
+ */
+ protected void tearDown() throws Exception {
+ executeTarget("clean");
+ }
+
+ public void testApt() {
+ executeTarget("testApt");
+ }
+
+ public void testAptFork() {
+ executeTarget("testAptFork");
+ }
+
+ public void testListAnnotationTypes() {
+ executeTarget("testListAnnotationTypes");
+ assertLogContaining("Set of annotations found:");
+ assertLogContaining("Distributed");
+ }
+
+ public void testAptNewFactory() {
+ executeTarget("testAptNewFactory");
+ assertProcessed();
+ }
+
+ public void testAptNewFactoryFork() {
+ executeTarget("testAptNewFactoryFork");
+ assertProcessed();
+ }
+
+ private void assertProcessed() {
+ assertLogContaining("DistributedAnnotationProcessor-is-go");
+ assertLogContaining("[-Abuild.dir=");
+ assertLogContaining("visiting DistributedAnnotationFactory");
+ }
+}
+