diff options
author | wisberg <wisberg> | 2002-12-16 17:58:19 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2002-12-16 17:58:19 +0000 |
commit | d842c4f1139629c1f062b74ba818d233b2c31043 (patch) | |
tree | 842d3871620bc0eb60edcd95e55804d67e0f61fa /ajbrowser/testsrc | |
parent | 3ce247199704eae6b2c92c6e38c69584e3250c52 (diff) | |
download | aspectj-d842c4f1139629c1f062b74ba818d233b2c31043.tar.gz aspectj-d842c4f1139629c1f062b74ba818d233b2c31043.zip |
initial version
Diffstat (limited to 'ajbrowser/testsrc')
4 files changed, 234 insertions, 0 deletions
diff --git a/ajbrowser/testsrc/AjbrowserModuleTests.java b/ajbrowser/testsrc/AjbrowserModuleTests.java new file mode 100644 index 000000000..ba3ba08a9 --- /dev/null +++ b/ajbrowser/testsrc/AjbrowserModuleTests.java @@ -0,0 +1,29 @@ +/* ******************************************************************* + * Copyright (c) 1999-2001 Xerox Corporation, + * 2002 Palo Alto Research Center, Incorporated (PARC). + * 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: + * Xerox/PARC initial implementation + * ******************************************************************/ + + +// default package + +import junit.framework.*; + +public class AjbrowserModuleTests extends TestCase { + + public static Test suite() { + TestSuite suite = new TestSuite(AjbrowserModuleTests.class.getName()); + suite.addTest(org.aspectj.tools.ajbrowser.AjbrowserTests.suite()); + return suite; + } + + public AjbrowserModuleTests(String name) { super(name); } + +} diff --git a/ajbrowser/testsrc/org/aspectj/tools/ajbrowser/AjbrowserTests.java b/ajbrowser/testsrc/org/aspectj/tools/ajbrowser/AjbrowserTests.java new file mode 100644 index 000000000..0830ab385 --- /dev/null +++ b/ajbrowser/testsrc/org/aspectj/tools/ajbrowser/AjbrowserTests.java @@ -0,0 +1,32 @@ +/* ******************************************************************* + * Copyright (c) 1999-2001 Xerox Corporation, + * 2002 Palo Alto Research Center, Incorporated (PARC). + * 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: + * Xerox/PARC initial implementation + * ******************************************************************/ + + +package org.aspectj.tools.ajbrowser; + +import junit.framework.*; + +public class AjbrowserTests extends TestCase { + + public static Test suite() { + TestSuite suite = new TestSuite(AjbrowserTests.class.getName()); + suite.addTestSuite(AjbrowserTests.class); + //$JUnit-BEGIN$ + //suite.addTestSuite(BrowserManagerTest.class); + //$JUnit-END$ + return suite; + } + + public AjbrowserTests(String name) { super(name); } + public void testNothing() {} +} diff --git a/ajbrowser/testsrc/org/aspectj/tools/ajbrowser/BrowserManagerTest.java b/ajbrowser/testsrc/org/aspectj/tools/ajbrowser/BrowserManagerTest.java new file mode 100644 index 000000000..4c14046b2 --- /dev/null +++ b/ajbrowser/testsrc/org/aspectj/tools/ajbrowser/BrowserManagerTest.java @@ -0,0 +1,93 @@ +/* ******************************************************************* + * Copyright (c) 1999-2001 Xerox Corporation, + * 2002 Palo Alto Research Center, Incorporated (PARC). + * 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: + * Xerox/PARC initial implementation + * ******************************************************************/ + + +package org.aspectj.tools.ajbrowser; + +import java.io.File; +import javax.swing.*; +import junit.framework.*; +//import org.aspectj.asm.*; +import org.aspectj.bridge.*; +import org.aspectj.bridge.IMessage; +import org.aspectj.ajde.*; + +/** + * @author Mik Kersten + */ +public class BrowserManagerTest extends TestCase { + + public BrowserManagerTest(String name) { + super(name); + } + + public static TestSuite suite() { + TestSuite result = new TestSuite(); + result.addTestSuite(BrowserManagerTest.class); + return result; + } + + public void testInitNoArgs() { + //String[] args = { "C:/Dev/aspectj/modules/ajde/testdata/examples/figures-coverage/all.lst" }; + String[] args = { }; + BrowserManager.getDefault().init(args, true); + } + + public void testAddProjectTask() { + BrowserManager.getDefault().init(new String[]{}, true); + Ajde.getDefault().getTaskListManager().addProjectTask( + "project-level task", + IMessage.ERROR); + + assertTrue("confirmation result", verifySuccess("Project task is visible.")); + } + + public void testAddSourceLineTasks() { + BrowserManager.getDefault().init(new String[]{}, true); + ISourceLocation dummyLocation = new SourceLocation(new File("<file>"), -1, -1); + Ajde.getDefault().getTaskListManager().addSourcelineTask( + "error task", + dummyLocation, + IMessage.ERROR); + + Ajde.getDefault().getTaskListManager().addSourcelineTask( + "warning task", + dummyLocation, + IMessage.WARNING); + + Ajde.getDefault().getTaskListManager().addSourcelineTask( + "info task", + dummyLocation, + IMessage.INFO); + + assertTrue("confirmation result", verifySuccess("3 kinds of sourceline tasks are visible.")); + } + + + private boolean verifySuccess(String message) { + int result = JOptionPane.showConfirmDialog( + BrowserManager.getDefault().getRootFrame(), + "Verify Results", + message, + JOptionPane.YES_NO_OPTION); + return result == JOptionPane.YES_OPTION; + } + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } +} diff --git a/ajbrowser/testsrc/org/aspectj/tools/ajbrowser/JemmyDriver.java b/ajbrowser/testsrc/org/aspectj/tools/ajbrowser/JemmyDriver.java new file mode 100644 index 000000000..effc3c681 --- /dev/null +++ b/ajbrowser/testsrc/org/aspectj/tools/ajbrowser/JemmyDriver.java @@ -0,0 +1,80 @@ +/* ******************************************************************* + * Copyright (c) 1999-2001 Xerox Corporation, + * 2002 Palo Alto Research Center, Incorporated (PARC). + * 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: + * Xerox/PARC initial implementation + * ******************************************************************/ + + +package org.aspectj.tools.ajbrowser; +// +//import org.netbeans.jemmy.Test; +//import org.netbeans.jemmy.Scenario; +//import org.netbeans.jemmy.ClassReference; +//import org.netbeans.jemmy.operators.JFrameOperator; +//import org.netbeans.jemmy.operators.JButtonOperator; +// +///** +// * Programmatically drives AJBrowser gui, +// * currently to do a build. +// */ +//public class JemmyDriver implements Scenario { +// +// public static final String CUT +// = "org.aspectj.tools.ajbrowser.Main"; +// public static final String DRIVER +// = "org.aspectj.tools.ajbrowser.JemmyDriver"; +// +// // XXX need to fix literal path locations +// public static final String USERDIR +// = "j:/home/wes/dev/tools/aj/examples"; +// public static final String FILENAME_RELATIVE +// = USERDIR + "spacewar/debug.lst"; +// public static final String FILENAME +// = USERDIR + "/" + FILENAME_RELATIVE; +// +// public static void main(String[] argv) { +// // 0 is (this) class name +// // 1 is the location of the work directory +// // others are parameters +// String[] params = {DRIVER, USERDIR, FILENAME}; +// Test.main(params); +// } +// +// public int runIt(Object param) { +// try { +// String[] args = new String[]{}; +// // grab parameter - pass in .lst file +// if (null != param) { +// Class c = param.getClass(); +// if (c.isArray() && +// (String.class == c.getComponentType())) { +// args = (String[]) param; +// if (0 < args.length) { +// if (FILENAME.equals(args[0])) { +// System.out.println("got file..."); +// } +// } +// } +// } +// // start application with our .lst file +// new ClassReference(CUT).startApplication(args); +// // wait frame +// JFrameOperator mainFrame = new JFrameOperator("AspectJ Browser"); +// // do a build - hangs if no list file +// new JButtonOperator(mainFrame, "Build").push(); +// +// } catch(Exception e) { +// e.printStackTrace(); +// return(1); +// } +// return(0); +// } +// +//} |