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.

MigrationTests.java 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*******************************************************************************
  2. * Copyright (c) 2004 IBM
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * Andy Clement - initial API and implementation
  10. *******************************************************************************/
  11. package org.aspectj.systemtest.ajc150;
  12. import java.io.File;
  13. import junit.framework.Test;
  14. import org.aspectj.testing.XMLBasedAjcTestCase;
  15. /**
  16. * Checks if we are obeying migration rules.
  17. */
  18. public class MigrationTests extends XMLBasedAjcTestCase {
  19. public static Test suite() {
  20. return XMLBasedAjcTestCase.loadSuite(MigrationTests.class);
  21. }
  22. protected File getSpecFile() {
  23. return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
  24. }
  25. /**
  26. * Compile a simple java class with an aspect library built with aspectj 1.2.1 - this
  27. * checks that we can load in attributes (especially pointcuts) that were written out
  28. * in the 'old way'
  29. *
  30. */
  31. public void testMigrationFrom121_pointcutsAndAdvice() {
  32. runTest("load aspectj 1.2.1 aspects in aspectj 5");
  33. // CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects121.jar","Program.java"});
  34. // System.err.println(cR.getStandardError());
  35. // assertTrue("Should not coredump: "+cR.getStandardError(),cR.getStandardError().indexOf("Dumping to ajcore")==-1);
  36. // assertTrue("Should be no error messages: \n"+cR.getErrorMessages(),cR.getErrorMessages().size()==0);
  37. // File f = new File(ajc.getSandboxDirectory()+File.separator+"Program.class");
  38. // assertTrue("Missing class file",f.exists());
  39. // run("Program");
  40. }
  41. // /**
  42. // * We cannot support all aspects built prior to AspectJ 1.2.1 - so we don't support any.
  43. // * There are probably many reasons but the first one I've hit is:
  44. // * - Changes for cflow optimizations (counters instead of stacks where we can) mean that an aspect
  45. // * compiled at AspectJ1.2.0 will contain stack cases but AspectJ1.5.0 will look for counter
  46. // * fields in some cases.
  47. // *
  48. // * This means we should get a reasonable failure message in this case.
  49. // */
  50. // public void testMigrationFrom120_pointcutsAndAdvice() {
  51. // CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects120.jar","Program.java"});
  52. // assertTrue("Should have failed",cR.getFailMessages().size()>0);
  53. // assertTrue("Should have produced nice message",cR.getFailMessages().get(0).toString().indexOf("Unable to continue")!=-1);
  54. // }
  55. }