aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ajdoc
diff options
context:
space:
mode:
authorwisberg <wisberg>2002-12-16 18:51:06 +0000
committerwisberg <wisberg>2002-12-16 18:51:06 +0000
commit144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch)
treeb12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/ajdoc
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/ajdoc')
-rw-r--r--tests/ajdoc/JavadocCompareClassMode.java200
-rw-r--r--tests/ajdoc/JavadocComparePackageMode.java64
-rw-r--r--tests/ajdoc/RegressionComparePackageMode.java66
-rw-r--r--tests/ajdoc/common/OutputComparator.java35
-rw-r--r--tests/ajdoc/input/applesAspectJ/Apple.java119
-rw-r--r--tests/ajdoc/input/applesAspectJ/AppleCrate.java52
-rw-r--r--tests/ajdoc/input/applesAspectJ/BigRigAspect.java22
-rw-r--r--tests/ajdoc/input/applesAspectJ/TransportAspect.java44
-rw-r--r--tests/ajdoc/input/applesJava/Apple.java114
-rw-r--r--tests/ajdoc/input/applesJava/AppleCrate.java52
-rw-r--r--tests/ajdoc/input/applesJava/BigRigAspect.java15
-rw-r--r--tests/ajdoc/input/applesJava/TransportAspect.java24
-rw-r--r--tests/ajdoc/input/pkgExample/Class1.java16
-rw-r--r--tests/ajdoc/input/pkgExample/aPack/Class2.java7
-rw-r--r--tests/ajdoc/input/pkgExample/aPack/I1.java7
-rw-r--r--tests/ajdoc/input/pkgExample/bPack/cPack/Class3.java12
-rw-r--r--tests/ajdoc/package.html18
17 files changed, 867 insertions, 0 deletions
diff --git a/tests/ajdoc/JavadocCompareClassMode.java b/tests/ajdoc/JavadocCompareClassMode.java
new file mode 100644
index 000000000..2ec00490b
--- /dev/null
+++ b/tests/ajdoc/JavadocCompareClassMode.java
@@ -0,0 +1,200 @@
+
+import java.io.*;
+import java.util.*;
+import common.OutputComparator;
+//import org.aspectj.testing.Tester;
+
+public class JavadocCompareClassMode {
+
+ /** wait a minimum (of 1 second) for processes to complete */
+ static final int MIN_SECS = 1;
+ /** wait a maximum (of 4 hours) for processes to complete */
+ static final int MAX_SECS = 4*60*60;
+
+ static final String INPUT_FILES = "input/applesJava/*.java";
+ static final String FILE_1 = "Apple.html";
+ static final String FILE_2 = "AppleCrate.html";
+ static final String OUTPUT_DIR = "output";
+ static final String AJDOC_DIR = OUTPUT_DIR + File.separator + "ajdoc";
+ static final String JAVADOC_DIR = OUTPUT_DIR + File.separator + "javadoc";
+ static final String AJDOC_CALL = "java org.aspectj.tools.ajdoc.Main -d " + AJDOC_DIR + " " + INPUT_FILES;
+ static final String JAVADOC_CALL = "javadoc -package -d " + JAVADOC_DIR + " " + INPUT_FILES;
+
+ public static void main(String[] args) { test(System.out); }
+
+ public static boolean ensureDir(String dirPath, StringBuffer errSink) {
+ boolean result = false;
+ if (dirPath != null) {
+ try {
+ File dir = new File(dirPath);
+ if (!dir.exists()) {
+ dir.mkdir();
+ }
+ result = (dir.exists() && dir.isDirectory());
+ } catch (SecurityException e) {
+ if (null != errSink) {
+ errSink.append(e.getClass().getName());
+ errSink.append(" ensuring directory ");
+ errSink.append(dirPath);
+ errSink.append(": ");
+ errSink.append(e.getMessage());
+ }
+ }
+ }
+ return result;
+ } // ensureDir
+
+ /**
+ * This implements a basic three-step test:
+ * <UL>
+ * <LI>step 1: exec ajdoc as a command on INPUT_FILES
+ * <LI>step 2: exec javadoc in the same way
+ * <LI>step 3: find differences in files FILE_1 and FILE_2
+ * </UL>
+ */
+ public static void test(PrintStream sink) {
+ OutputComparator outputComparator = new OutputComparator();
+
+ sink.println("> Setup directories");
+ StringBuffer errSink = new StringBuffer();
+ if (! ensureDir(OUTPUT_DIR, errSink)) {
+ sink.println("Error: " + errSink.toString());
+ return;
+ }
+ if (! ensureDir(AJDOC_DIR, errSink)) {
+ sink.println("Error: " + errSink.toString());
+ return;
+ }
+ if (! ensureDir(JAVADOC_DIR, errSink)) {
+ sink.println("Error: " + errSink.toString());
+ return;
+ }
+
+ String toolName = "> ajdoc";
+ sink.println(toolName + " running ");
+ int result = runCommand(AJDOC_CALL);
+ sink.println(toolName + " result " + result);
+
+ toolName = "> javadoc";
+ sink.println(toolName + " running ");
+ result = runCommand(JAVADOC_CALL);
+ sink.println(toolName + " result " + result);
+
+ toolName = "> compare";
+ sink.println(toolName + " running ");
+ String[] files = new String[] { FILE_1, FILE_2 };
+ Vector diffs = null;
+ result = -2;
+ for (int i = 0; i < files.length; i++) {
+ String file = files[i];
+ String ajdocFile = AJDOC_DIR + "/" + file;
+ String javadocFile = JAVADOC_DIR + "/" + file;
+ try {
+ diffs = outputComparator.compareFilesByLine(ajdocFile, javadocFile);
+ if (diffs == null) {
+ sink.println("No differences in file " + file);
+ result = 0;
+ } else {
+ result = diffs.size();
+ sink.println("Start of Differences in file " + FILE_1);
+ sink.println(diffs.toString());
+ sink.println("end of Differences in file " + FILE_1);
+ }
+ } catch (IOException e) {
+ sink.println("Exception comparing: " + file);
+ e.printStackTrace(sink);
+ result = -1;
+ }
+ }
+ sink.println(toolName + " result " + result);
+ }
+
+ /** write in to out */
+ static void writeStream(InputStream in, PrintStream out) {
+ if ((null == in) || (null == out)) {
+ return;
+ }
+ try {
+ BufferedReader lines = new BufferedReader(new InputStreamReader(in));
+ String line;
+ while (null != (line = lines.readLine())) {
+ out.println(line);
+ }
+ } catch (IOException e) {
+ e.printStackTrace(out);
+ }
+ }
+
+ /**
+ * Complete a running process, handling timeout and streams appropriately.
+ * @param process the Process to run
+ * @param secsToWait an int for the number of seconds to wait before timing out
+ * - use Integer.MAXVALUE to mean no timeout (otherwise,
+ * IllegalArgumentException unless (MIN_SECS <= secsToWait <= MAX_SECS))
+ * @param outSink the PrintStream sink for the process output stream
+ * (use null to ignore process output stream).
+ * @param errSink the PrintStream sink for the process error stream
+ * (use null to ignore process error stream).
+ * @returns Integer.MIN_VALUE if interrupted while waiting for process to complete,
+ * Integer.MAX_VALUE if timed out,
+ * or the int returned by <code>Process.waitFor()</code> otherwise.
+ * @throws IllegalArgumentException if any parms are null or invalid
+ */
+ public static int completeProcess(final Process process, int secsToWait,
+ PrintStream outSink,
+ PrintStream errSink) {
+ if (null == process) throw new IllegalArgumentException("null process");
+ if ((Integer.MAX_VALUE != secsToWait)
+ && ((MIN_SECS > secsToWait) || ((MAX_SECS < secsToWait)))) {
+ throw new IllegalArgumentException("invalid time: " + secsToWait);
+ }
+ // setup timeout
+ TimerTask task = null;
+ if (Integer.MAX_VALUE != secsToWait) {
+ Timer t = new Timer(true);
+ task = new TimerTask() {
+ public void run() {
+ process.destroy();
+ }
+ };
+ t.schedule(task, secsToWait*1000l);
+ }
+
+ // try to wait for the process
+ int status = Integer.MAX_VALUE;
+ try {
+ status = process.waitFor();
+ } catch (InterruptedException ie) {
+ status = Integer.MIN_VALUE; // ignore
+ }
+ finally {
+ if (null != task) task.cancel();
+ if (errSink != null) writeStream(process.getErrorStream(), errSink);
+ // misnamed API: the "input" stream is our input from the process output
+ if (outSink != null) writeStream(process.getInputStream(), outSink);
+ }
+ return status;
+ } // completeProcess
+
+ /**
+ * Run command, delegating process handling to runProcess.
+ * @param command the String passed to Runtime.exec
+ * @return the int returned from process.waitFor();
+ */
+ public static int runCommand(String command) {
+ int result = -1;
+ try {
+ System.out.println("Running " + command);
+ Process process = Runtime.getRuntime().exec(command);
+ System.out.println("waiting for Result.." );
+ final int seconds = 60;
+ result = completeProcess(process, seconds, System.out, System.err);
+ System.out.println("Result: " + result + " for " + command);
+ } catch (Exception e) {
+ throw new RuntimeException("could not execute: " + command +
+ ", " + e.getMessage() );
+ }
+ return result;
+ }
+
+}
diff --git a/tests/ajdoc/JavadocComparePackageMode.java b/tests/ajdoc/JavadocComparePackageMode.java
new file mode 100644
index 000000000..3d4efbf6b
--- /dev/null
+++ b/tests/ajdoc/JavadocComparePackageMode.java
@@ -0,0 +1,64 @@
+
+import java.io.IOException;
+import java.util.Vector;
+import common.OutputComparator;
+import org.aspectj.testing.Tester;
+
+public class JavadocComparePackageMode {
+
+ static final String INPUT_FILES = "-classpath input/pkgExample aPack bPack.cPack";
+ static final String FILE_1 = "aPack/Class2.html";
+ static final String FILE_2 = "bPack/cPack/Class3.html";
+ static final String AJDOC_DIR = "output/packageMode1";
+ static final String JAVADOC_DIR = "output/packageMode2";
+ static final String AJDOC_CALL = "java org.aspectj.tools.ajdoc.Main -d " + AJDOC_DIR + " " + INPUT_FILES;
+ static final String JAVADOC_CALL = "javadoc -package -d " + JAVADOC_DIR + " " + INPUT_FILES;
+
+ public static void main(String[] args) { test(); }
+
+ /**
+ * <UL>
+ * <LI>step 1: run ajdoc as a command
+ * <LI>step 2: run javadoc
+ * <LI>step 3: compare differences
+ * </UL>
+ */
+ public static void test() {
+ OutputComparator outputComparator = new OutputComparator();
+
+ System.out.println("> running ajdoc");
+ runCommand(AJDOC_CALL);
+ System.out.println("> running javadoc");
+ runCommand(JAVADOC_CALL);
+
+ Vector diffs1 = null;
+ Vector diffs2 = null;
+ try {
+ diffs1 = outputComparator.compareFilesByLine(AJDOC_DIR + "/" + FILE_1,
+ JAVADOC_DIR + "/" + FILE_1);
+ diffs2 = outputComparator.compareFilesByLine(AJDOC_DIR + "/" + FILE_1,
+ JAVADOC_DIR + "/" + FILE_1);
+ }
+ catch (IOException ioe) {
+ System.out.println("Couldn't compare files: " + ioe.getMessage());
+ }
+ String result1 = "";
+ String result2 = "";
+ if (diffs1 != null) result1 = diffs1.toString();
+ if (diffs2 != null) result2 = diffs2.toString();
+ Tester.checkEqual(result1, "", "diffs from: " + FILE_1);
+ Tester.checkEqual(result2, "", "diffs from: " + FILE_2);
+ }
+
+ public static void runCommand(String command) {
+ try {
+ Runtime runtime = Runtime.getRuntime();
+ Process result = runtime.exec(command);
+ }
+ catch ( Exception ioe ) {
+ throw new RuntimeException("could not execute: " + command +
+ ", " + ioe.getMessage() );
+ }
+ }
+
+}
diff --git a/tests/ajdoc/RegressionComparePackageMode.java b/tests/ajdoc/RegressionComparePackageMode.java
new file mode 100644
index 000000000..1f1546120
--- /dev/null
+++ b/tests/ajdoc/RegressionComparePackageMode.java
@@ -0,0 +1,66 @@
+
+import java.io.IOException;
+import java.util.Vector;
+import common.OutputComparator;
+import org.aspectj.testing.Tester;
+
+public class RegressionComparePackageMode {
+
+ static final String CORRECT_RESULTS_DIR = "output/regression1";
+ static final String RUN_RESULTS_DIR = "output/regression2";
+ static final String[] FILES_TO_COMPARE = { "/bPack/cPack/Class3.html",
+ "/coordination/Coordinator.html",
+ "/spacewar/Ship.html",
+ "/spacewar/Debug.html" } ;
+ static final String[] AJDOC_ARGS = { "-d",
+ RUN_RESULTS_DIR,
+ "-sourcepath",
+ "input;input/pkgExample",
+ "spacewar",
+ "coordination",
+ "bPack.cPack" };
+
+
+
+ public static void main(String[] args) { test(); }
+
+ /**
+ * <UL>
+ * <LI>step 1: run ajdoc as a command
+ * <LI>step 2: run javadoc
+ * <LI>step 3: compare differences
+ * </UL>
+ */
+ public static void test() {
+ OutputComparator outputComparator = new OutputComparator();
+
+ System.out.println("> running ajdoc");
+ org.aspectj.tools.ajdoc.Main.main( AJDOC_ARGS );
+
+ for ( int i = 0; i < FILES_TO_COMPARE.length; i++ ) {
+ Vector diffs = null;
+ try {
+ diffs = outputComparator.compareFilesByLine(CORRECT_RESULTS_DIR + FILES_TO_COMPARE[i],
+ RUN_RESULTS_DIR + FILES_TO_COMPARE[i]);
+ }
+ catch (IOException ioe) {
+ System.out.println("Couldn't compare files: " + ioe.getMessage());
+ }
+ String result = "";
+ if (diffs != null) result = diffs.toString();
+ Tester.checkEqual(result, "", "diffs from: " + FILES_TO_COMPARE[i]);
+ }
+ }
+
+ public static void runCommand(String command) {
+ try {
+ Runtime runtime = Runtime.getRuntime();
+ Process result = runtime.exec(command);
+ }
+ catch ( Exception ioe ) {
+ throw new RuntimeException("could not execute: " + command +
+ ", " + ioe.getMessage() );
+ }
+ }
+
+}
diff --git a/tests/ajdoc/common/OutputComparator.java b/tests/ajdoc/common/OutputComparator.java
new file mode 100644
index 000000000..130f4d857
--- /dev/null
+++ b/tests/ajdoc/common/OutputComparator.java
@@ -0,0 +1,35 @@
+package common;
+
+import java.io.*;
+import java.util.Vector;
+
+public class OutputComparator
+{
+ /**
+ * Ignores lines that contain "Generated by javadoc on".
+ *
+ * @return the lines that don't match in the two files as a Vector of Strings,
+ * or null if they are the same.
+ */
+ public Vector compareFilesByLine(String file1, String file2) throws IOException {
+ Vector diffLines = new Vector();
+ BufferedReader reader1 = new BufferedReader(new FileReader(file1));
+ BufferedReader reader2 = new BufferedReader(new FileReader(file2));
+ String line1 = reader1.readLine();
+ String line2 = reader2.readLine();
+ while (line1 != null && line2 != null) {
+ if (!line1.trim().equals(line2.trim()) &&
+ line1.indexOf("Generated by javadoc on") == -1 ) {
+ diffLines.addElement(line1 + " != " + line2);
+ }
+ line1 = reader1.readLine();
+ line2 = reader2.readLine();
+ }
+ if (diffLines.size() == 0) {
+ return null;
+ }
+ else {
+ return diffLines;
+ }
+ }
+}
diff --git a/tests/ajdoc/input/applesAspectJ/Apple.java b/tests/ajdoc/input/applesAspectJ/Apple.java
new file mode 100644
index 000000000..2b817b7ad
--- /dev/null
+++ b/tests/ajdoc/input/applesAspectJ/Apple.java
@@ -0,0 +1,119 @@
+
+import java.io.Serializable;
+import java.io.IOException;
+
+/**
+ * This class represents an apple that has the following two attributes
+ * <UL>
+ * <LI>a variety (i.e. "Macintosh" or "Granny Smith")
+ * <LI>a brusing factor represnting how badly bruised the apple is
+ * </UL>
+ *
+ * @author Mik Kersten
+ * @version $Version$
+ */
+
+public class Apple implements Serializable
+{
+ private String variety = null;
+ private int bruising = 0;
+
+ /**
+ * Default constructor.
+ *
+ * @param newVariety the type of variety for this apple
+ */
+ public Apple( String newVariety )
+ {
+ variety = newVariety;
+ }
+
+ /**
+ * This inner class represents apple seeds.
+ */
+ public class AppleSeed {
+ private int weight = 0;
+ private SeedContents seedContents = null;
+
+ /**
+ * Crosscut Apple serialization methods.
+ */
+ crosscut seedCrosscut(): Apple && void writeObject( java.io.ObjectOutputStream out );
+
+ /**
+ * This is how you get poison from the apple.
+ */
+ public void getArsenic() {
+ System.out.println( ">> getting arsenic" );
+ }
+
+ /**
+ * Reperesents the contents of the seeds.
+ */
+ public class SeedContents {
+ public String core = null;
+ public String shell = null;
+ }
+ }
+
+ /**
+ * Sets the bruising factor of the apple.
+ *
+ * @param bruiseFactor the new bruising factor
+ */
+ public void bruise( int bruiseFactor )
+ {
+ bruising = bruising + bruiseFactor;
+
+ if ( bruising > 100 ) bruising = 100;
+ if ( bruising < 0 ) bruising = 0;
+ }
+
+
+ /**
+ * Returns the bruising factor.
+ *
+ * @return bruising the bruising factor associated with the apple
+ */
+ public int getBruising()
+ {
+ return bruising;
+ }
+
+
+ /**
+ * Serializes the apple object.
+ *
+ * @param oos stream that the object is written to
+ */
+ private void writeObject( java.io.ObjectOutputStream oos )
+ throws IOException
+ {
+ // TODO: implement
+ }
+
+
+ /**
+ * Reads in the apple object.
+ *
+ * @param ois stream that the object is read from
+ */
+ private void readObject( java.io.ObjectInputStream ois )
+ throws IOException, ClassNotFoundException
+ {
+ // TODO: implement
+ }
+}
+
+/**
+ * Stub class to represent apple peeling.
+ */
+class ApplePealer
+{
+ /**
+ * Stub for peeling the apple.
+ */
+ public void peelApple() {
+ System.out.println( ">> peeling the apple..." );
+ }
+}
diff --git a/tests/ajdoc/input/applesAspectJ/AppleCrate.java b/tests/ajdoc/input/applesAspectJ/AppleCrate.java
new file mode 100644
index 000000000..fb9457006
--- /dev/null
+++ b/tests/ajdoc/input/applesAspectJ/AppleCrate.java
@@ -0,0 +1,52 @@
+
+import java.io.Serializable;
+import java.io.IOException;
+
+/**
+ * This class represents an apple crate that is used for transporting apples.
+ * The apples are contained in an array of <CODE>Apple</CODE> objects.
+ *
+ * @author Mik Kersten
+ * @version $Version$
+ *
+ * @see Apple
+ */
+
+public class AppleCrate implements Serializable
+{
+ Apple[] crateContents = null;
+
+ /**
+ * Default constructor.
+ *
+ * @param newCrateContents an array of <CODE>Apple</CODE> objects
+ */
+ public AppleCrate( Apple[] newCrateContents )
+ {
+ crateContents = newCrateContents;
+ }
+
+ /**
+ * A crate is sellable if the apples are bruised 50% or less on average.
+ *
+ * @return <CODE>true</CODE> if the the apples can be sold
+ */
+ public boolean isSellable()
+ {
+ int bruising = 0;
+ for ( int i = 0; i < crateContents.length; i++ )
+ {
+ bruising = bruising + crateContents[i].getBruising();
+ }
+
+ if ( (bruising/crateContents.length) > 50 )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/tests/ajdoc/input/applesAspectJ/BigRigAspect.java b/tests/ajdoc/input/applesAspectJ/BigRigAspect.java
new file mode 100644
index 000000000..32b1577be
--- /dev/null
+++ b/tests/ajdoc/input/applesAspectJ/BigRigAspect.java
@@ -0,0 +1,22 @@
+
+/**
+ * This aspect represents upacking apples after an airplane trip.
+ *
+ * @author Mik Kersten
+ * @version $Version$
+ */
+
+public class BigRigAspect extends TransportAspect
+{
+ /**
+ * Bruise apples with a bruising factor of 15 after unpacking.
+ */
+ static advice unpackCrosscut() {
+ after {
+ bruise( 40 );
+ }
+ before {
+ bruise( 10 );
+ }
+ }
+}
diff --git a/tests/ajdoc/input/applesAspectJ/TransportAspect.java b/tests/ajdoc/input/applesAspectJ/TransportAspect.java
new file mode 100644
index 000000000..1e9ac2eda
--- /dev/null
+++ b/tests/ajdoc/input/applesAspectJ/TransportAspect.java
@@ -0,0 +1,44 @@
+
+/**
+ * This aspect crosscuts the process of shipping apples.
+ *
+ * @author Mik Kersten
+ * @version $Version$
+ */
+
+public class TransportAspect
+{
+ private introduction AppleCrate
+ {
+
+ /**
+ * Represents the name of the given crate. Initialized to be
+ * a placeholder.
+ */
+ private String crateName = "temp crate";
+
+ /**
+ * Bruises each apple in the crate according to the bruise facor. The bruise
+ * factor is an integer that is passed as a parameter.
+ */
+ private void bruiser( int bruiseFactor )
+ {
+ for ( int i = 0; i < crateContents.length; i++ )
+ {
+ crateContents[i].bruise( bruiseFactor );
+ }
+ }
+ }
+
+ /**
+ * Crosscut <CODE>Apple</CODE> serialization methods. This can be used for bruising
+ * apples and doing other silly things when the apples are being packed.
+ */
+ crosscut packCrosscut(): Apple && void writeObject( java.io.ObjectOutputStream out );
+
+ /**
+ * Crosscut <CODE>Apple</CODE> de-serialization methods. This can be used for doing
+ * silly things. It is to be used when the apples are unpacked.
+ */
+ crosscut unpackCrosscut(): Apple && void readObject( java.io.ObjectInputStream in );
+}
diff --git a/tests/ajdoc/input/applesJava/Apple.java b/tests/ajdoc/input/applesJava/Apple.java
new file mode 100644
index 000000000..08a4724ca
--- /dev/null
+++ b/tests/ajdoc/input/applesJava/Apple.java
@@ -0,0 +1,114 @@
+
+import java.io.Serializable;
+import java.io.IOException;
+
+/**
+ * This class represents an apple that has the following two attributes
+ * <UL>
+ * <LI>a variety (i.e. "Macintosh" or "Granny Smith")
+ * <LI>a brusing factor represnting how badly bruised the apple is
+ * </UL>
+ *
+ * @author Mik Kersten
+ * @version $Version$
+ */
+
+public class Apple implements Serializable
+{
+ private String variety = null;
+ private int bruising = 0;
+
+ /**
+ * Default constructor.
+ *
+ * @param newVariety the type of variety for this apple
+ */
+ public Apple( String newVariety )
+ {
+ variety = newVariety;
+ }
+
+ /**
+ * This inner class represents apple seeds.
+ */
+ public class AppleSeed {
+ private int weight = 0;
+ private SeedContents seedContents = null;
+
+ /**
+ * This is how you get poison from the apple.
+ */
+ public void getArsenic() {
+ System.out.println( ">> getting arsenic" );
+ }
+
+ /**
+ * Reperesents the contents of the seeds.
+ */
+ public class SeedContents {
+ public String core = null;
+ public String shell = null;
+ }
+ }
+
+ /**
+ * Sets the bruising factor of the apple.
+ *
+ * @param bruiseFactor the new bruising factor
+ */
+ public void bruise( int bruiseFactor )
+ {
+ bruising = bruising + bruiseFactor;
+
+ if ( bruising > 100 ) bruising = 100;
+ if ( bruising < 0 ) bruising = 0;
+ }
+
+
+ /**
+ * Returns the bruising factor.
+ *
+ * @return bruising the bruising factor associated with the apple
+ */
+ public int getBruising()
+ {
+ return bruising;
+ }
+
+
+ /**
+ * Serializes the apple object.
+ *
+ * @param oos stream that the object is written to
+ */
+ private void writeObject( java.io.ObjectOutputStream oos )
+ throws IOException
+ {
+ // TODO: implement
+ }
+
+
+ /**
+ * Reads in the apple object.
+ *
+ * @param ois stream that the object is read from
+ */
+ private void readObject( java.io.ObjectInputStream ois )
+ throws IOException, ClassNotFoundException
+ {
+ // TODO: implement
+ }
+}
+
+/**
+ * Stub class to represent apple peeling.
+ */
+class ApplePealer
+{
+ /**
+ * Stub for peeling the apple.
+ */
+ public void peelApple() {
+ System.out.println( ">> peeling the apple..." );
+ }
+}
diff --git a/tests/ajdoc/input/applesJava/AppleCrate.java b/tests/ajdoc/input/applesJava/AppleCrate.java
new file mode 100644
index 000000000..fb9457006
--- /dev/null
+++ b/tests/ajdoc/input/applesJava/AppleCrate.java
@@ -0,0 +1,52 @@
+
+import java.io.Serializable;
+import java.io.IOException;
+
+/**
+ * This class represents an apple crate that is used for transporting apples.
+ * The apples are contained in an array of <CODE>Apple</CODE> objects.
+ *
+ * @author Mik Kersten
+ * @version $Version$
+ *
+ * @see Apple
+ */
+
+public class AppleCrate implements Serializable
+{
+ Apple[] crateContents = null;
+
+ /**
+ * Default constructor.
+ *
+ * @param newCrateContents an array of <CODE>Apple</CODE> objects
+ */
+ public AppleCrate( Apple[] newCrateContents )
+ {
+ crateContents = newCrateContents;
+ }
+
+ /**
+ * A crate is sellable if the apples are bruised 50% or less on average.
+ *
+ * @return <CODE>true</CODE> if the the apples can be sold
+ */
+ public boolean isSellable()
+ {
+ int bruising = 0;
+ for ( int i = 0; i < crateContents.length; i++ )
+ {
+ bruising = bruising + crateContents[i].getBruising();
+ }
+
+ if ( (bruising/crateContents.length) > 50 )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/tests/ajdoc/input/applesJava/BigRigAspect.java b/tests/ajdoc/input/applesJava/BigRigAspect.java
new file mode 100644
index 000000000..05be8a5e7
--- /dev/null
+++ b/tests/ajdoc/input/applesJava/BigRigAspect.java
@@ -0,0 +1,15 @@
+
+/**
+ * This aspect represents upacking apples after an airplane trip.
+ *
+ * @author Mik Kersten
+ * @version $Version$
+ */
+
+public class BigRigAspect extends TransportAspect
+{
+ /**
+ * Default constructor
+ */
+ public BigRigAspect() {}
+}
diff --git a/tests/ajdoc/input/applesJava/TransportAspect.java b/tests/ajdoc/input/applesJava/TransportAspect.java
new file mode 100644
index 000000000..b9256998f
--- /dev/null
+++ b/tests/ajdoc/input/applesJava/TransportAspect.java
@@ -0,0 +1,24 @@
+
+/**
+ * This aspect crosscuts the process of shipping apples.
+ *
+ * @author Mik Kersten
+ * @version $Version$
+ */
+
+public class TransportAspect
+{
+ private String crateName = "temp crate";
+
+ /**
+ * Bruises each apple in the crate according to the bruise facor. The bruise
+ * factor is an integer that is passed as a parameter.
+ */
+ private void bruiser( int bruiseFactor )
+ {
+ for ( int i = 0; i < 5; i++ )
+ {
+ System.out.println( "bruising" );
+ }
+ }
+}
diff --git a/tests/ajdoc/input/pkgExample/Class1.java b/tests/ajdoc/input/pkgExample/Class1.java
new file mode 100644
index 000000000..f551cea93
--- /dev/null
+++ b/tests/ajdoc/input/pkgExample/Class1.java
@@ -0,0 +1,16 @@
+
+import aPack.I1;
+
+public class Class1 implements aPack.I1
+{
+ public void method1() {
+ }
+
+ private void method2() {
+ }
+}
+
+class Class1A
+{
+ static final String FOO = "foo";
+} \ No newline at end of file
diff --git a/tests/ajdoc/input/pkgExample/aPack/Class2.java b/tests/ajdoc/input/pkgExample/aPack/Class2.java
new file mode 100644
index 000000000..335cd239b
--- /dev/null
+++ b/tests/ajdoc/input/pkgExample/aPack/Class2.java
@@ -0,0 +1,7 @@
+
+package aPack;
+
+class Class2
+{
+ static final String BAR = "bar";
+}
diff --git a/tests/ajdoc/input/pkgExample/aPack/I1.java b/tests/ajdoc/input/pkgExample/aPack/I1.java
new file mode 100644
index 000000000..0c0f6bdf1
--- /dev/null
+++ b/tests/ajdoc/input/pkgExample/aPack/I1.java
@@ -0,0 +1,7 @@
+
+package aPack;
+
+public interface I1
+{
+ public void method1();
+}
diff --git a/tests/ajdoc/input/pkgExample/bPack/cPack/Class3.java b/tests/ajdoc/input/pkgExample/bPack/cPack/Class3.java
new file mode 100644
index 000000000..6c4169a90
--- /dev/null
+++ b/tests/ajdoc/input/pkgExample/bPack/cPack/Class3.java
@@ -0,0 +1,12 @@
+package bPack.cPack;
+
+public class Class3
+{
+ /**
+ * Nothing doing.
+ */
+ public void doNothingAtAll()
+ {
+
+ }
+}
diff --git a/tests/ajdoc/package.html b/tests/ajdoc/package.html
new file mode 100644
index 000000000..1b1c9799f
--- /dev/null
+++ b/tests/ajdoc/package.html
@@ -0,0 +1,18 @@
+<html>
+<body>
+This is an incomplete attempt to write regression tests for ajdoc by
+comparison with javadoc. It aims to run both tools against the
+same pure-java sources and compare the output line-by-line, assuming
+they should be the same where non-AspectJ elements are concerned.
+<p>
+It relies entirely on CLASSPATH and PATH being set correctly, and it
+generates output directory in the current working directory.
+<p>
+General example of how to run:
+<li>Compile the sources</li>
+<li>Setup CLASSPATH, including compiled sources and JDK tools.jar (for javadoc)</li>
+<li>Setup PATH, so that "java" invokes a 1.2 or later java vm </li>
+<li>Invoke from the directory with input/ as a subdirectory:
+<br><code>java JavadocCompareClassMode</code></li>
+</body>
+</html>