* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Xerox/PARC initial implementation
+ * Xerox/PARC initial implementation
+ * Helen Hawkins Converted to new interface (bug 148190)
* ******************************************************************/
*/
public class AspectJBuildManagerTest extends AjdeTestCase {
- public AspectJBuildManagerTest(String name) {
- super(name);
- }
-
public static TestSuite suite() {
TestSuite result = new TestSuite();
result.addTestSuite(AspectJBuildManagerTest.class);
public void testSequence() {
AsmManager.dumpModelPostBuild=true; // or you wont get a .ajsym file
try {
- assertTrue("initialization", ideManager != null);
- assertTrue("compile of non-existing build config success", !testerBuildListener.getBuildSucceeded());
// XXX should fail? empty configs fail b/c no sources specified
- doSynchronousBuild("empty.lst");
- assertTrue("compile of empty build config", testerBuildListener.getBuildSucceeded());
+ initialiseProject("AspectJBuildManagerTest");
+ doBuild("empty.lst");
+ assertTrue("Expected there to be no error messages from the build but found that" +
+ " there were some " + getErrorMessages("empty.lst"),getErrorMessages("empty.lst").isEmpty());
// TODO-path
- doSynchronousBuild("../examples/figures-coverage/all.lst");
- assertTrue("compile success", testerBuildListener.getBuildSucceeded());
- File file = new File(Ajde.getDefault().getProjectProperties().getOutputPath() + "/figures/Main.class");
+ initialiseProject("figures-coverage");
+ doBuild("all.lst");
+ assertTrue("Expected there to be no error messages from the build but found that" +
+ " there were some " + getErrorMessages("empty.lst"),getErrorMessages("empty.lst").isEmpty());
+ File file = new File(getCompilerForConfigFileWithName("all.lst").getCompilerConfiguration().getOutputLocationManager().getDefaultOutputLocation() + "/figures/Main.class");
if (file.exists()) {
file.delete();
} else {
}
// TODO-path
- file = openFile("../examples/figures-coverage/all.ajsym");
+ file = openFile("all.ajsym");
if (file.exists()) {
file.delete();
} else {
- assertTrue("expected .ajsym" + file, false);
+ assertTrue("expected .ajsym: " + file, false);
}
} finally {
AsmManager.dumpModelPostBuild=false;
}
}
-
- protected void setUp() throws Exception {
- super.setUp("AspectJBuildManagerTest");
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
}
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Xerox/PARC initial implementation
+ * Xerox/PARC initial implementation
+ * Helen Hawkins Converted to new interface (bug 148190)
* ******************************************************************/
package org.aspectj.ajde.internal;
-import java.io.*;
-import java.util.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
import junit.framework.TestSuite;
-import org.aspectj.ajde.*;
-import org.aspectj.ajde.NullIdeTaskListManager.SourceLineTask;
+import org.aspectj.ajde.AjdeTestCase;
import org.aspectj.ajde.ui.BuildConfigModel;
-//import org.aspectj.ajde.ui.internal.AjcBuildOptions;
-//import org.aspectj.bridge.Message;
+import org.aspectj.ajde.ui.utils.TestMessageHandler.TestMessage;
public class LstBuildConfigManagerTest extends AjdeTestCase {
-// private AjcBuildOptions buildOptions = null;
private BuildConfigManager buildConfigManager = new LstBuildConfigManager();
-// private LstBuildConfigFileUpdater fileUpdater = new LstBuildConfigFileUpdater();
-
- public LstBuildConfigManagerTest(String name) {
- super(name);
- }
public static void main(String[] args) {
junit.swingui.TestRunner.run(LstBuildConfigManagerTest.class);
result.addTestSuite(LstBuildConfigManagerTest.class);
return result;
}
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ initialiseProject("LstBuildConfigManagerTest");
+ }
public void testConfigParserErrorMessages() {
- doSynchronousBuild("dir-entry.lst");
- List messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks();
- NullIdeTaskListManager.SourceLineTask message = (NullIdeTaskListManager.SourceLineTask)messages.get(0);
+ doBuild("dir-entry.lst");
+ List messages = getMessages("dir-entry.lst");
+ TestMessage message = (TestMessage)messages.get(0);
assertEquals(message.getContainedMessage().getSourceLocation().getSourceFile().getAbsolutePath(), openFile("dir-entry.lst").getAbsolutePath());
- doSynchronousBuild("bad-injar.lst");
- messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks();
- message = (NullIdeTaskListManager.SourceLineTask)messages.get(0);
+ doBuild("bad-injar.lst");
+ messages = getMessages("bad-injar.lst");
+ message = (TestMessage)messages.get(0);
assertTrue(message.getContainedMessage().getMessage().indexOf("skipping missing, empty or corrupt inpath entry") != -1);
}
public void testErrorMessages() throws IOException {
- doSynchronousBuild("invalid-entry.lst");
- assertTrue("compile failed", testerBuildListener.getBuildSucceeded());
+ doBuild("invalid-entry.lst");
+ assertFalse("expected there to be error messages because the build failed but didn't" +
+ " find any", getErrorMessages("invalid-entry.lst").isEmpty());
- List messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks();
- SourceLineTask message = (SourceLineTask)messages.get(0);
+ List messages = getMessages("invalid-entry.lst");
+ TestMessage message = (TestMessage)messages.get(0);
assertTrue(message.getContainedMessage().getMessage(), message.getContainedMessage().getMessage().indexOf("aaa.bbb") != -1);
}
assertTrue("single file", true);
}
-// private void verifyFile(String configFile, String fileContents) {
-// StringTokenizer st = new StringTokenizer(fileContents, ";");
-// BuildConfigModel model1 = buildConfigManager.buildModel(configFile);
-// File testFile = new File(configFile + "-test.lst");
-// model1.setSourceFile(testFile.getPath());
-// buildConfigManager.writeModel(model1);
-// List newList = fileUpdater.readConfigFile(testFile.getPath());
-// testFile.delete();
-//
-// assertTrue("contents: " + newList, verifyLists(st, newList));
-// }
-//
-// private boolean verifyLists(StringTokenizer st, List list) {
-// Iterator it = list.iterator();
-// while (st.hasMoreElements()) {
-// String s1 = (String)st.nextElement();
-// String s2 = (String)it.next();
-// if (!s1.equals(s2)) return false;
-// }
-// if (it.hasNext()) {
-// return false;
-// } else {
-// return true;
-// }
-// }
-
- protected void setUp() throws Exception {
- super.setUp("LstBuildConfigManagerTest");
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
-// private static final String WILDCARDS_FILE = "C:/Dev/aspectj/tests/ajde/examples/figures-coverage/test-config.lst";
-// private static final String BAD_PATHS_FILE = "C:/Dev/aspectj/tests/ajde/examples/figures-coverage/test-error.lst";
-// private static final String INCLUDES_FILE = "C:/Dev/aspectj/tests/ajde/examples/spacewar/spacewar/demo.lst";
-
-// private static final String WILDCARDS_FILE_CONTENTS;
-// private static final String BAD_PATHS_FILE_CONTENTS;
-// private static final String INCLUDES_FILE_CONTENTS;
-
- static {
-// WILDCARDS_FILE_CONTENTS =
-// "figures/Debug.java;" +
-// "figures/Figure.java;" +
-// "figures/FigureElement.java;" +
-// "figures/Main.java;" +
-// "figures/composites/Line.java;" +
-// "figures/composites/Square.java;" +
-// "figures/primitives/planar/Point.java;" +
-// "figures/primitives/solid/SolidPoint.java;";
-
-// BAD_PATHS_FILE_CONTENTS = WILDCARDS_FILE_CONTENTS;
-//
-// // TODO-path
-// INCLUDES_FILE_CONTENTS =
-// "../coordination/Condition.java;" +
-// "../coordination/CoordinationAction.java;" +
-// "../coordination/Coordinator.java;" +
-// "../coordination/Exclusion.java;" +
-// "../coordination/MethodState.java;" +
-// "../coordination/Mutex.java;" +
-// "../coordination/Selfex.java;" +
-// "../coordination/TimeoutException.java;" +
-// "Bullet.java;" +
-// "Display.java;" +
-// "Display1.java;" +
-// "Display2.java;" +
-// "EnergyPacket.java;" +
-// "EnergyPacketProducer.java;" +
-// "EnsureShipIsAlive.java;" +
-// "Game.java;" +
-// "GameSynchronization.java;" +
-// "Pilot.java;" +
-// "Player.java;" +
-// "Registry.java;" +
-// "RegistrySynchronization.java;" +
-// "Robot.java;" +
-// "SWFrame.java;" +
-// "Ship.java;" +
-// "SpaceObject.java;" +
-// "Timer.java;";
- }
}
-
-//public void testWildcards() {
-// verifyFile(WILDCARDS_FILE, WILDCARDS_FILE_CONTENTS);
-//}
-//
-//public void testIncludes() {
-// verifyFile(INCLUDES_FILE, INCLUDES_FILE_CONTENTS);
-//}
-