--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+
+public aspect World {
+
+ after() returning : execution(* Hello.*(..)) {
+ System.out.println("World");
+ }
+}
\ No newline at end of file
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+
+public aspect World {
+
+ after() returning : execution(* Hello.*(..)) {
+ System.out.println("World");
+ }
+}
\ No newline at end of file
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+/**
+ * Used to generate Hello.class that is placed in indir for these resource tests.
+ */
+public class Hello {
+
+ public static void main(String[] args) {
+ System.out.println("hello");
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+/**
+ * Used to generate Hello2.class that is placed in MyJar.jar for these tests.
+ */
+public class Hello2 {
+
+ public static void main(String[] args) {
+ System.out.println("hello");
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+
+public aspect World {
+
+ after() returning : execution(* Hello.*(..)) {
+ System.out.println("World");
+ }
+}
\ No newline at end of file
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+
+public aspect World {
+
+ after() returning : execution(* Hello.*(..)) {
+ System.out.println("World");
+ }
+}
\ No newline at end of file
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+
+public aspect World {
+
+ after() returning : execution(* Hello.*(..)) {
+ System.out.println("World");
+ }
+}
\ No newline at end of file
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+/**
+ * Used to generate Hello.class that is placed in indir for these resource tests.
+ */
+public class Hello {
+
+ public static void main(String[] args) {
+ System.out.println("updated hello");
+ }
+
+}
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+/**
+ * Used to generate Hello.class that is placed in indir for these resource tests.
+ */
+public class Hello {
+
+ public static void main(String[] args) {
+ System.out.println("hello");
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+/**
+ * Used to generate Hello2.class that is placed in MyJar.jar for these tests.
+ */
+public class Hello2 {
+
+ public static void main(String[] args) {
+ System.out.println("hello");
+ }
+
+}
\ No newline at end of file
--- /dev/null
+Here is some text...
\ No newline at end of file
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+
+public aspect World {
+
+ after() returning : execution(* Hello.*(..)) {
+ System.out.println("World");
+ }
+}
\ No newline at end of file
--- /dev/null
+Here is some text...
\ No newline at end of file
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+
+public aspect World {
+
+ after() returning : execution(* Hello.*(..)) {
+ System.out.println("World");
+ }
+}
\ No newline at end of file
--- /dev/null
+Here is some text...
\ No newline at end of file
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
+ * ******************************************************************/
+
+/**
+ * Used to generate Hello.class that is placed in indir for these resource tests.
+ */
+public class Hello {
+
+ public static void main(String[] args) {
+ System.out.println("hello");
+ }
+
+}
\ No newline at end of file
copyFileAndDoIncrementalBuild("changes/Aspect.20.java","src/Aspect.java",messageSpec);
run("Main");
}
+
+ public void testIncrementalResourceAdditionToInPath() throws Exception {
+ runTest("incremental with addition of resource to inpath directory");
+ RunResult result = run("Hello");
+ assertTrue("Should have been advised",result.getStdOut().indexOf("World") != -1);
+ nextIncrement(false);
+ assertFalse("Resource file should not exist yet",new File(ajc.getSandboxDirectory(),"AResourceFile.txt").exists());
+ copyFileAndDoIncrementalBuild("changes/AResourceFile.txt", "indir/AResourceFile.txt");
+ // resources are *NOT* copied from inpath directories
+ assertFalse("Resource file should not exist yet",new File(ajc.getSandboxDirectory(),"AResourceFile.txt").exists());
+ }
+
+ public void testAdditionOfResourceToInJar() throws Exception {
+ runTest("incremental with addition of resource to inpath jar");
+ nextIncrement(true);
+ assertFalse("Resource file should not exist yet",new File(ajc.getSandboxDirectory(),"AResourceFile.txt").exists());
+ copyFileAndDoIncrementalBuild("changes/MyJar.20.jar", "MyJar.jar");
+ // resources *are* copied from inpath jars
+ assertAdded("AResourceFile.txt");
+ }
+
+ public void testRemovalOfResourceFromInJar() throws Exception {
+ runTest("incremental with removal of resource from inpath jar");
+ nextIncrement(true);
+ assertAdded("AResourceFile.txt");
+ copyFileAndDoIncrementalBuild("changes/MyJar.20.jar", "MyJar.jar");
+ // resources *are* copied from inpath jars
+ assertDeleted("AResourceFile.txt");
+ }
+
+ public void testAdditionOfClassToInPathJar() throws Exception {
+ runTest("incremental with addition of class to inpath jar");
+ nextIncrement(true);
+ assertFalse("Hello2.class should not exist yet",new File(ajc.getSandboxDirectory(),"Hello2.class").exists());
+ copyFileAndDoIncrementalBuild("changes/MyJar.20.jar", "MyJar.jar");
+ assertAdded("Hello2.class");
+ }
+ public void testRemovalOfClassFromInPathJar() throws Exception {
+ runTest("incremental with removal of class from inpath jar");
+ nextIncrement(true);
+ assertAdded("Hello2.class");
+ copyFileAndDoIncrementalBuild("changes/MyJar.20.jar", "MyJar.jar");
+ assertDeleted("Hello2.class");
+ }
+
+ public void testAdditionOfClassToInJarJar() throws Exception {
+ runTest("incremental with addition of class to injar jar");
+ nextIncrement(true);
+ assertFalse("Hello2.class should not exist yet",new File(ajc.getSandboxDirectory(),"Hello2.class").exists());
+ copyFileAndDoIncrementalBuild("changes/MyJar.20.jar", "MyJar.jar");
+ assertAdded("Hello2.class");
+ }
+
+ public void testRemovalOfClassFromInJarJar() throws Exception {
+ runTest("incremental with removal of class from injar jar");
+ nextIncrement(true);
+ assertAdded("Hello2.class");
+ copyFileAndDoIncrementalBuild("changes/MyJar.20.jar", "MyJar.jar");
+ assertDeleted("Hello2.class");
+ }
+
+ public void testAdditionOfClassToInPathDir() throws Exception {
+ runTest("incremental with addition of class to inpath dir");
+ nextIncrement(true);
+ assertFalse("Hello2.class should not exist yet",new File(ajc.getSandboxDirectory(),"Hello2.class").exists());
+ copyFileAndDoIncrementalBuild("changes/Hello2.20.class", "indir/Hello2.class");
+ assertAdded("Hello2.class");
+ }
+
+ public void testRemovalOfClassFromInPathDir() throws Exception {
+ runTest("incremental with removal of class from inpath dir");
+ nextIncrement(true);
+ assertAdded("Hello2.class");
+ deleteFileAndDoIncrementalBuild("indir/Hello2.class");
+ assertDeleted("Hello2.class");
+ }
+
+ public void testUpdateOfClassInInPathDir() throws Exception {
+ runTest("incremental with update of class in inpath dir");
+ nextIncrement(true);
+ RunResult before = run("Hello");
+ assertTrue("Should say hello",before.getStdOut().startsWith("hello"));
+ copyFileAndDoIncrementalBuild("changes/Hello.20.class", "indir/Hello.class");
+ RunResult after = run("Hello");
+ assertTrue("Should say updated hello",after.getStdOut().startsWith("updated hello"));
+ }
+
private long nextIncrement(boolean doWait) {
long time = System.currentTimeMillis();
if (doWait) {
-->
</ajc-test>
+ <ajc-test dir="incrementalju/resourceTests/resourceAdded"
+ pr="54622"
+ title="incremental with addition of resource to inpath directory">
+ <compile
+ staging="true"
+ sourceroots="src"
+ options="-incremental"
+ inpath="indir">
+ </compile>
+ <!--
+ <inc-compile tag="20">
+ </inc-compile>
+ <run class="Main"/>
+ -->
+ </ajc-test>
+
+
+ <ajc-test dir="incrementalju/resourceTests/resourceAdded"
+ pr="54622"
+ title="incremental with addition of resource to inpath jar">
+ <compile
+ staging="true"
+ sourceroots="src"
+ options="-incremental"
+ inpath="MyJar.jar">
+ </compile>
+ <!--
+ <inc-compile tag="20">
+ <dir-changes added="AResourceFile.txt"/>
+ </inc-compile>
+ <run class="Main"/>
+ -->
+ </ajc-test>
+
+
+ <ajc-test dir="incrementalju/resourceTests/resourceRemoved"
+ pr="54622"
+ title="incremental with removal of resource from inpath jar">
+ <compile
+ staging="true"
+ sourceroots="src"
+ options="-incremental"
+ inpath="MyJar.jar">
+ </compile>
+ <!--
+ <inc-compile tag="20">
+ <dir-changes removed="AResourceFile.txt"/>
+ </inc-compile>
+ <run class="Main"/>
+ -->
+ </ajc-test>
+
+
+ <ajc-test dir="incrementalju/injarTests/classAdded"
+ pr="54621"
+ title="incremental with addition of class to inpath jar">
+ <compile
+ staging="true"
+ sourceroots="src"
+ options="-incremental"
+ inpath="MyJar.jar">
+ </compile>
+ <!--
+ <inc-compile tag="20">
+ <dir-changes added="Hello2"/>
+ </inc-compile>
+ <run class="Main"/>
+ -->
+ </ajc-test>
+
+
+ <ajc-test dir="incrementalju/injarTests/classRemoved"
+ pr="54621"
+ title="incremental with removal of class from inpath jar">
+ <compile
+ staging="true"
+ sourceroots="src"
+ options="-incremental"
+ inpath="MyJar.jar">
+ </compile>
+ <!--
+ <inc-compile tag="20">
+ <dir-changes removed="Hello2"/>
+ </inc-compile>
+ <run class="Main"/>
+ -->
+ </ajc-test>
+
+ <ajc-test dir="incrementalju/injarTests/classAdded"
+ pr="54621"
+ title="incremental with addition of class to injar jar">
+ <compile
+ staging="true"
+ sourceroots="src"
+ options="-incremental,-injars,MyJar.jar">
+ </compile>
+ <!--
+ <inc-compile tag="20">
+ <dir-changes added="Hello2"/>
+ </inc-compile>
+ <run class="Main"/>
+ -->
+ </ajc-test>
+
+
+ <ajc-test dir="incrementalju/injarTests/classRemoved"
+ pr="54621"
+ title="incremental with removal of class from injar jar">
+ <compile
+ staging="true"
+ sourceroots="src"
+ options="-incremental,-injars,MyJar.jar"
+ inpath="MyJar.jar">
+ </compile>
+ <!--
+ <inc-compile tag="20">
+ <dir-changes removed="Hello2"/>
+ </inc-compile>
+ <run class="Main"/>
+ -->
+ </ajc-test>
+
+
+
+ <ajc-test dir="incrementalju/inpathDirTests/classAdded"
+ pr="54621"
+ title="incremental with addition of class to inpath dir">
+ <compile
+ staging="true"
+ sourceroots="src"
+ options="-incremental"
+ inpath="indir">
+ </compile>
+ <!--
+ <inc-compile tag="20">
+ <dir-changes added="Hello2"/>
+ </inc-compile>
+ <run class="Main"/>
+ -->
+ </ajc-test>
+
+
+ <ajc-test dir="incrementalju/inpathDirTests/classRemoved"
+ pr="54621"
+ title="incremental with removal of class from inpath dir">
+ <compile
+ staging="true"
+ sourceroots="src"
+ options="-incremental"
+ inpath="indir">
+ </compile>
+ <!--
+ <inc-compile tag="20">
+ <dir-changes removed="Hello2"/>
+ </inc-compile>
+ <run class="Main"/>
+ -->
+ </ajc-test>
+
+ <ajc-test dir="incrementalju/inpathDirTests/classUpdated"
+ pr="54621"
+ title="incremental with update of class in inpath dir">
+ <compile
+ staging="true"
+ sourceroots="src"
+ options="-incremental"
+ inpath="indir">
+ </compile>
+ <!--
+ <inc-compile tag="20">
+ </inc-compile>
+ <run class="Main"/>
+ -->
+ </ajc-test>
\ No newline at end of file