Lines 30-37
Link Here
|
30 |
/** |
30 |
/** |
31 |
* @author websterm |
31 |
* @author websterm |
32 |
* |
32 |
* |
33 |
* To change the template for this generated type comment go to |
|
|
34 |
* Window>Preferences>Java>Code Generation>Code and Comments |
35 |
*/ |
33 |
*/ |
36 |
public class WeavingURLClassLoaderTest extends TestCase { |
34 |
public class WeavingURLClassLoaderTest extends TestCase { |
37 |
|
35 |
|
Lines 432-437
Link Here
|
432 |
} |
430 |
} |
433 |
} |
431 |
} |
434 |
|
432 |
|
|
|
433 |
public void testWeavingURLClassLoaderOddJars() throws Exception { |
434 |
URL classes = FileUtil.getFileURL(new File(TEST_BASE+"/test.jar/main.file")); |
435 |
URL aspectjrt = FileUtil.getFileURL(new File(ASPECTJRT)); |
436 |
URL aspects = FileUtil.getFileURL(new File(TEST_BASE+"/aspectNoExt")); |
437 |
URL[] classURLs = new URL[] { aspects, classes, aspectjrt }; |
438 |
URL[] aspectURLs = new URL[] { aspects }; |
439 |
WeavingURLClassLoader loader = new WeavingURLClassLoader(classURLs,aspectURLs,getClass().getClassLoader()); |
440 |
|
441 |
Class clazz = loader.loadClass("packag.Main"); |
442 |
invokeMain(clazz,new String[] { }); |
443 |
} |
444 |
|
445 |
public void testWeavingURLClassLoaderMissingJars() throws Exception { |
446 |
try { |
447 |
URL classes = FileUtil.getFileURL(new File(TEST_BASE+"/test.jar/main.file")); |
448 |
URL aspectjrt = FileUtil.getFileURL(new File(ASPECTJRT)); |
449 |
URL aspects = FileUtil.getFileURL(new File(TEST_BASE+"/MissingFile")); |
450 |
URL[] classURLs = new URL[] { aspects, classes, aspectjrt }; |
451 |
URL[] aspectURLs = new URL[] { aspects }; |
452 |
WeavingURLClassLoader loader = new WeavingURLClassLoader(classURLs,aspectURLs,getClass().getClassLoader()); |
453 |
|
454 |
Class clazz = loader.loadClass("packag.Main"); |
455 |
invokeMain(clazz,new String[] { }); |
456 |
fail("Should reject bad aspect MissingFile"); |
457 |
} catch (AbortException ae) { |
458 |
assertTrue("Unexpected cause: "+ae.getMessage(), ae.getMessage().indexOf("bad aspect library")!=-1); |
459 |
} |
460 |
} |
461 |
|
435 |
private void doTestZipAspects(String aspectLib) throws Exception { |
462 |
private void doTestZipAspects(String aspectLib) throws Exception { |
436 |
File classZip = new File(TEST_BASE + "/main.zip"); |
463 |
File classZip = new File(TEST_BASE + "/main.zip"); |
437 |
File zipLib = new File(aspectLib); |
464 |
File zipLib = new File(aspectLib); |