You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RegressionComparePackageMode.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import java.io.IOException;
  2. import java.util.Vector;
  3. import common.OutputComparator;
  4. import org.aspectj.testing.Tester;
  5. public class RegressionComparePackageMode {
  6. static final String CORRECT_RESULTS_DIR = "output/regression1";
  7. static final String RUN_RESULTS_DIR = "output/regression2";
  8. static final String[] FILES_TO_COMPARE = { "/bPack/cPack/Class3.html",
  9. "/coordination/Coordinator.html",
  10. "/spacewar/Ship.html",
  11. "/spacewar/Debug.html" } ;
  12. static final String[] AJDOC_ARGS = { "-d",
  13. RUN_RESULTS_DIR,
  14. "-sourcepath",
  15. "input;input/pkgExample",
  16. "spacewar",
  17. "coordination",
  18. "bPack.cPack" };
  19. public static void main(String[] args) { test(); }
  20. /**
  21. * <UL>
  22. * <LI>step 1: run ajdoc as a command
  23. * <LI>step 2: run javadoc
  24. * <LI>step 3: compare differences
  25. * </UL>
  26. */
  27. public static void test() {
  28. OutputComparator outputComparator = new OutputComparator();
  29. System.out.println("> running ajdoc");
  30. org.aspectj.tools.ajdoc.Main.main( AJDOC_ARGS );
  31. for ( int i = 0; i < FILES_TO_COMPARE.length; i++ ) {
  32. Vector diffs = null;
  33. try {
  34. diffs = outputComparator.compareFilesByLine(CORRECT_RESULTS_DIR + FILES_TO_COMPARE[i],
  35. RUN_RESULTS_DIR + FILES_TO_COMPARE[i]);
  36. }
  37. catch (IOException ioe) {
  38. System.out.println("Couldn't compare files: " + ioe.getMessage());
  39. }
  40. String result = "";
  41. if (diffs != null) result = diffs.toString();
  42. Tester.checkEqual(result, "", "diffs from: " + FILES_TO_COMPARE[i]);
  43. }
  44. }
  45. public static void runCommand(String command) {
  46. try {
  47. Runtime runtime = Runtime.getRuntime();
  48. Process result = runtime.exec(command);
  49. }
  50. catch ( Exception ioe ) {
  51. throw new RuntimeException("could not execute: " + command +
  52. ", " + ioe.getMessage() );
  53. }
  54. }
  55. }