From: acolyer Date: Thu, 5 Aug 2004 13:31:23 +0000 (+0000) Subject: tests for Bugzilla Bug 54618 X-Git-Tag: for_ajdt1_1_12~40 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=df1bd2ae60d197da65ca6fb9afdd7bdb894f5c03;p=aspectj.git tests for Bugzilla Bug 54618 Test to see if we can compile incrementally ignores path change --- diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjStateTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjStateTest.java new file mode 100644 index 000000000..04b06a145 --- /dev/null +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjStateTest.java @@ -0,0 +1,125 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.aspectj.ajdt.internal.core.builder; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import junit.framework.TestCase; + + +public class AjStateTest extends TestCase { + + private AjState aRightState; + private AjBuildConfig oldConfig; + private AjBuildConfig newConfig; + + public void testNoChange() { + assertTrue("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + public void testAddEntryToClasspath() { + newConfig.getClasspath().add("anotherEntry"); + assertFalse("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + public void testRemoveEntryFromClasspath() { + newConfig.getClasspath().remove(0); + assertFalse("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + public void testReorderClasspath() { + Object o = newConfig.getClasspath().remove(0); + newConfig.getClasspath().add(o); + assertFalse("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + public void testAddEntryToAspectpath() { + newConfig.getAspectpath().add(new File("anotherEntry.jar")); + assertFalse("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + public void testRemoveEntryFromAspectpath() { + newConfig.getAspectpath().remove(0); + assertFalse("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + public void testReorderAspectpath() { + Object o = newConfig.getClasspath().remove(0); + newConfig.getAspectpath().add(o); + assertFalse("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + public void testAddEntryToInpath() { + newConfig.getInpath().add(new File("anotherEntry")); + assertFalse("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + public void testRemoveEntryFromInpath() { + newConfig.getInpath().remove(0); + assertFalse("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + public void testReorderInpath() { + Object o = newConfig.getClasspath().remove(0); + newConfig.getInpath().add(o); + assertFalse("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + public void testAddEntryToInjars() { + newConfig.getInJars().add(new File("anotherEntry.jar")); + assertFalse("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + public void testRemoveEntryFromInjars() { + newConfig.getInJars().remove(0); + assertFalse("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + public void testReorderInjars() { + Object o = newConfig.getClasspath().remove(0); + newConfig.getInJars().add(o); + assertFalse("Can do incremental",aRightState.prepareForNextBuild(newConfig)); + } + + /* (non-Javadoc) + * @see junit.framework.TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + aRightState = new AjState(null); + oldConfig = new AjBuildConfig(); + newConfig = new AjBuildConfig(); + List cp = new ArrayList(); + cp.add("adir"); + cp.add("ajar.jar"); + oldConfig.setClasspath(cp); + newConfig.setClasspath(new ArrayList(cp)); + List ap = new ArrayList(); + ap.add(new File("aLib.jar")); + ap.add(new File("anotherLib.jar")); + oldConfig.setAspectpath(ap); + newConfig.setAspectpath(new ArrayList(ap)); + List ip = new ArrayList(); + ip.add(new File("adir")); + ip.add(new File("ajar.jar")); + oldConfig.setInPath(ip); + newConfig.setInPath(new ArrayList(ip)); + List ij = new ArrayList(); + ij.add(new File("aLib.jar")); + ij.add(new File("anotherLib.jar")); + oldConfig.setInJars(ij); + newConfig.setInJars(new ArrayList(ij)); + aRightState.prepareForNextBuild(oldConfig); + aRightState.successfulCompile(oldConfig); + } +} diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjdtBuilderTests.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjdtBuilderTests.java index ddf0c10b7..ebf12d945 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjdtBuilderTests.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjdtBuilderTests.java @@ -24,6 +24,7 @@ public class AjdtBuilderTests extends TestCase { suite.addTestSuite(AjBuildManagerTest.class); suite.addTestSuite(AsmBuilderTest.class); suite.addTestSuite(AjCompilerOptionsTest.class); + suite.addTestSuite(AjStateTest.class); //$JUnit-END$ return suite; }