/********************************************************************
- * Copyright (c) 2006 Contributors. All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ * Copyright (c) 2006 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
* Adrian Colyer initial implementation
* Helen Hawkins Converted to new interface (bug 148190)
*******************************************************************/
File projDir = new File(getWorkingDir(), p);
return new File(projDir, "bin" + File.separator + filename);
}
-
+
public void build(String projectName) {
constructUpToDateLstFile(projectName, "build.lst");
doBuild(projectName);
/** @return the number of relationship pairs */
protected void printModel(String projectName) throws Exception {
- dumptree(getModelFor(projectName).getHierarchy().getRoot(), 0);
- PrintWriter pw = new PrintWriter(System.out);
- getModelFor(projectName).dumprels(pw);
- pw.flush();
+ if (AjdeInteractionTestbed.VERBOSE) {
+ dumptree(getModelFor(projectName).getHierarchy().getRoot(), 0);
+ PrintWriter pw = new PrintWriter(System.out);
+ getModelFor(projectName).dumprels(pw);
+ pw.flush();
+ }
}
protected File getProjectRelativePath(String p, String filename) {
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Andy Clement initial implementation
* Helen Hawkins Converted to new interface (bug 148190)
* overlays for incremental builds, that is in here. As is the ability to generate valid build configs based on a directory
* structure. To support this we just need access to a sandbox directory - this sandbox is managed by the superclass (it only
* assumes all builds occur in <sandboxDir>/<projectName>/ )
- *
+ *
* The idea is you can initialize multiple projects in the sandbox and they can all be built independently, hopefully exploiting
* incremental compilation. Between builds you can alter the contents of a project using the alter() method that overlays some set
* of new files onto the current set (adding new files/changing existing ones) - you can then drive a new build and check it behaves
checkWasFullBuild();
// Should both indicate that Location cannot be resolved
assertEquals(2,getErrorMessages(p).size());
- }
-
+ }
+
public void testIncrementalITDInners4() throws Exception {
String p = "prInner4";
initialiseProject(p);
* public void testIncrementalAspectWhitespace() throws Exception { AjdeInteractionTestbed.VERBOSE = true; String p = "xxx";
* initialiseProject(p); configureNonStandardCompileOptions(p, "-showWeaveInfo"); configureShowWeaveInfoMessages(p, true);
* build(p);
- *
+ *
* List weaveMessages = getWeavingMessages(p); if (weaveMessages.size() != 0) { for (Iterator iterator =
* weaveMessages.iterator(); iterator.hasNext();) { Object object = iterator.next(); System.out.println(object); } }
* checkWasFullBuild(); assertNoErrors(p); alter(p, "inc1"); build(p); checkWasntFullBuild(); assertNoErrors(p); }
String p = "pr278255";
initialiseProject(p);
build(p);
- printModelAndRelationships(p);
+ if (AjdeInteractionTestbed.VERBOSE) {
+ printModelAndRelationships(p);
+ }
IRelationshipMap irm = getModelFor(p).getRelationshipMap();
List<IRelationship> l = irm.get("=pr278255<{A.java'X`declare \\@type");
assertNotNull(l);
/*
* A.aj package pack; public aspect A { pointcut p() : call( C.method before() : p() { // line 7 } }
- *
+ *
* C.java package pack; public class C { public void method1() { method2(); // line 6 } public void method2() { } public void
* method3() { method2(); // line 13 }
- *
+ *
* }
*/
public void testDontLoseAdviceMarkers_pr134471() {
// see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=false;
initialiseProject("P4");
build("P4");
- Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after full build where advice is applying");
+ if (AjdeInteractionTestbed.VERBOSE) {
+ Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after full build where advice is applying");
+ }
// should be 4 relationship entries
// In inc1 the first advised line is 'commented out'
alter("P4", "inc1");
build("P4");
checkWasntFullBuild();
- Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after inc build where first advised line is gone");
+ if (AjdeInteractionTestbed.VERBOSE) {
+ Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after inc build where first advised line is gone");
+ }
// should now be 2 relationship entries
// This will be the line 6 entry in C.java
/*
* public void testGenericITD_pr262257() throws IOException { String p = "pr262257"; initialiseProject(p); build(p);
* checkWasFullBuild();
- *
+ *
* dumptree(getModelFor(p).getHierarchy().getRoot(), 0); PrintWriter pw = new PrintWriter(System.out);
* getModelFor(p).dumprels(pw); pw.flush(); }
*/
*/
/*
* public void testProblemCopyingResources_pr138171() { initialiseProject("PR138171");
- *
+ *
* File f=getProjectRelativePath("PR138171","res.txt"); Map m = new HashMap(); m.put("res.txt",f);
* AjdeInteractionTestbed.MyProjectPropertiesAdapter .getInstance().setSourcePathResources(m); build("PR138171"); File f2 =
* getProjectOutputRelativePath("PR138171","res.txt"); boolean successful = f2.setReadOnly();
- *
+ *
* alter("PR138171","inc1"); AjdeInteractionTestbed.MyProjectPropertiesAdapter .getInstance().setSourcePathResources(m);
* build("PR138171"); List msgs = MyTaskListManager.getErrorMessages(); assertTrue("there should be one message but there are "
* +(msgs==null?0:msgs.size())+":\n"+msgs,msgs!=null && msgs.size()==1); IMessage msg = (IMessage)msgs.get(0); String exp =
build("P2");
checkWasntFullBuild();
}
-
+
public void testBuildingBrokenCode_pr240360() {
initialiseProject("pr240360");
// configureNonStandardCompileOptions("pr240360","-proceedOnError");
/**
* The C.java file modified in this test has an inner class - this means the inner class has a this$0 field and <init>(C) ctor
* to watch out for when checking for structural changes
- *
+ *
*/
public void testStateManagement3() {
File binDirForInterproject1 = new File(getFile("interprojectdeps1", "bin"));
/**
* The C.java file modified in this test has an inner class - which has two ctors - this checks how they are mangled with an
* instance of C.
- *
+ *
*/
public void testStateManagement4() {
File binDirForInterproject2 = new File(getFile("interprojectdeps2", "bin"));
/**
* The C.java file modified in this test has an inner class - it has two ctors but also a reference to C.this in it - which will
* give rise to an accessor being created in C
- *
+ *
*/
public void testStateManagement5() {
File binDirForInterproject3 = new File(getFile("interprojectdeps3", "bin"));
* public void testPrReducingDependentBuilds_001_221427() { AjdeInteractionTestbed.VERBOSE=true;
* IncrementalStateManager.debugIncrementalStates=true; initialiseProject("P221427_1"); initialiseProject("P221427_2");
* configureNewProjectDependency("P221427_2","P221427_1");
- *
+ *
* build("P221427_1"); build("P221427_2"); alter("P221427_1","inc1"); // rename private class in super project
* MyStateListener.reset(); build("P221427_1"); build("P221427_2");
- *
+ *
* AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_1","bin")));
* assertTrue("There should be state for project P221427_1",ajs!=null);
* //System.out.println(MyStateListener.getInstance().getDecisions()); checkWasntFullBuild();
* assertTrue("Should be one structural change but there were "+ ajs.getNumberOfStructuralChangesSinceLastFullBuild(),
* ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1);
- *
+ *
* }
- *
+ *
* // Case002: changing a class to final that is extended in a dependent project public void
* testPrReducingDependentBuilds_002_221427() { AjdeInteractionTestbed.VERBOSE=true;
* IncrementalStateManager.debugIncrementalStates=true; initialiseProject("P221427_3"); initialiseProject("P221427_4");
* configureNewProjectDependency("P221427_4","P221427_3");
- *
+ *
* build("P221427_3"); build("P221427_4"); // build OK, type in super project is non-final alter("P221427_3","inc1"); // change
* class declaration in super-project to final MyStateListener.reset(); build("P221427_3"); build("P221427_4"); // build FAIL,
* type in super project is now final
- *
+ *
* AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_3","bin")));
* assertTrue("There should be state for project P221427_3",ajs!=null);
* System.out.println(MyStateListener.getInstance().getDecisions());
- *
+ *
* List errors = getErrorMessages("P221427_4"); if (errors.size()!=1) { if (errors.size()==0)
* fail("Expected error about not being able to extend final class"); for (Iterator iterator = errors.iterator();
* iterator.hasNext();) { Object object = (Object) iterator.next(); System.out.println(object); }
* fail("Expected 1 error but got "+errors.size()); } // assertTrue("Shouldn't be one structural change but there were "+ //
* ajs.getNumberOfStructuralChangesSinceLastFullBuild(), // ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1);
- *
+ *
* }
*/
// test for comment #6 - simulates AJDT core builder test testBug99133a -
build("PR154054");
checkWasntFullBuild();
}
-
+
public void testIncrementalBuildAdviceChange_456801() throws Exception {
initialiseProject("456801");
build("456801");
/**
* Retrieve program elements related to this one regardless of the relationship. A JUnit assertion is made that the number that
* the 'expected' number are found.
- *
+ *
* @param programElement Program element whose related elements are to be found
* @param expected the number of expected related elements
*/
}
}
List<IProgramElement> kids = ipe.getChildren();
- for (IProgramElement kid: kids) {
+ for (IProgramElement kid: kids) {
IProgramElement found = findAdvice(kid, whichOne);
if (found != null) {
return found;