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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 org.aspectj.testing.XMLBasedAjcTestCase;
  13. import junit.framework.Test;
  14. /**
  15. * Checks if we are obeying migration rules.
  16. */
  17. public class MigrationTests extends XMLBasedAjcTestCase {
  18. public static Test suite() {
  19. return XMLBasedAjcTestCase.loadSuite(MigrationTests.class);
  20. }
  21. protected java.net.URL getSpecFile() {
  22. return getClassResource("ajc150.xml");
  23. }
  24. /**
  25. * Compile a simple java class with an aspect library built with aspectj 1.2.1 - this
  26. * checks that we can load in attributes (especially pointcuts) that were written out
  27. * in the 'old way'
  28. *
  29. */
  30. public void testMigrationFrom121_pointcutsAndAdvice() {
  31. runTest("load aspectj 1.2.1 aspects in aspectj 5");
  32. // CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects121.jar","Program.java"});
  33. // System.err.println(cR.getStandardError());
  34. // assertTrue("Should not coredump: "+cR.getStandardError(),cR.getStandardError().indexOf("Dumping to ajcore")==-1);
  35. // assertTrue("Should be no error messages: \n"+cR.getErrorMessages(),cR.getErrorMessages().size()==0);
  36. // File f = new File(ajc.getSandboxDirectory()+File.separator+"Program.class");
  37. // assertTrue("Missing class file",f.exists());
  38. // run("Program");
  39. }
  40. // /**
  41. // * We cannot support all aspects built prior to AspectJ 1.2.1 - so we don't support any.
  42. // * There are probably many reasons but the first one I've hit is:
  43. // * - Changes for cflow optimizations (counters instead of stacks where we can) mean that an aspect
  44. // * compiled at AspectJ1.2.0 will contain stack cases but AspectJ1.5.0 will look for counter
  45. // * fields in some cases.
  46. // *
  47. // * This means we should get a reasonable failure message in this case.
  48. // */
  49. // public void testMigrationFrom120_pointcutsAndAdvice() {
  50. // CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects120.jar","Program.java"});
  51. // assertTrue("Should have failed",cR.getFailMessages().size()>0);
  52. // assertTrue("Should have produced nice message",cR.getFailMessages().get(0).toString().indexOf("Unable to continue")!=-1);
  53. // }
  54. }