Package org.jboss.classloader.test.support

Examples of org.jboss.classloader.test.support.MockClassLoaderPolicy


  
   public void testPackageNotIndexed() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();

      MockClassLoaderPolicy mock = createMockClassLoaderPolicy();
      mock.setImportAll(true);
      ClassLoader mockClassLoader = system.registerClassLoaderPolicy(mock);

      TestClassLoaderPolicy policy = new TestClassLoaderPolicy();
      system.registerClassLoaderPolicy(policy);
     
View Full Code Here


  
   public void testExportLoaderInvoked() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();

      MockClassLoaderPolicy mock = createMockClassLoaderPolicy();
      mock.setImportAll(true);
      ClassLoader mockClassLoader = system.registerClassLoaderPolicy(mock);

      TestClassLoaderPolicy policy = new TestClassLoaderPolicy();
      policy.packageNames = new String[] { ClassLoaderUtils.getClassPackageName(ClassLoaderDomain.class.getName())};
      TestDelegateLoader exported = new TestDelegateLoader(policy);
View Full Code Here

  
   public void testLazyFactoryInvokedSuccessfully() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();

      MockClassLoaderPolicy policy1 = createMockClassLoaderPolicy();
      TestClassLoaderPolicy policy2 = new TestClassLoaderPolicy();
      TestClassLoaderPolicyFactory factory2 = new TestClassLoaderPolicyFactory(policy2, false);
      policy1.setDelegates(Collections.singletonList(new FilteredDelegateLoader(factory2)));
      ClassLoader classLoader1 = system.registerClassLoaderPolicy(policy1);
      ClassLoader classLoader2 = system.registerClassLoaderPolicy(policy2);

      assertLoadClassFail(TestClass.class, classLoader1);
      assertNull("Should NOT have tried policy2 ", policy2.getResourceInvoked);
View Full Code Here

  
   public void testExportFactoryInvoked() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();

      MockClassLoaderPolicy mock = createMockClassLoaderPolicy();
      mock.setImportAll(true);
      ClassLoader mockClassLoader = system.registerClassLoaderPolicy(mock);

      TestClassLoaderPolicy policy = new TestClassLoaderPolicy();
      TestClassLoaderPolicyFactory factory = new TestClassLoaderPolicyFactory(policy, true);
      policy.packageNames = new String[] { ClassLoaderUtils.getClassPackageName(ClassLoaderDomain.class.getName())};
View Full Code Here

  
   public void testNoDelegateAToB() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();

      MockClassLoaderPolicy pb = createMockClassLoaderPolicy("B");
      pb.setPaths(TestB1.class);
      ClassLoader b = system.registerClassLoaderPolicy(pb);

      MockClassLoaderPolicy pa = createMockClassLoaderPolicy("A");
      pa.setPaths(TestA1.class);
      ClassLoader a = system.registerClassLoaderPolicy(pa);
     
      assertLoadClass(TestB1.class, b, false);
      assertLoadClassFail(TestB1.class, a);
   }
View Full Code Here

  
   public void testDelegateAToB() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();

      MockClassLoaderPolicy pb = createMockClassLoaderPolicy("B");
      pb.setPaths(TestB1.class);
      ClassLoader b = system.registerClassLoaderPolicy(pb);

      MockClassLoaderPolicy pa = createMockClassLoaderPolicy("A");
      pa.setPaths(TestA1.class);
      pa.setDelegates(Collections.singletonList(new FilteredDelegateLoader(pb)));
      ClassLoader a = system.registerClassLoaderPolicy(pa);
     
      Class<?> fromB = assertLoadClass(TestB1.class, b, false);
      Class<?> fromA = assertLoadClass(TestB1.class, a, b, false);
     
View Full Code Here

  
   public void testAbstractFactoryObviousWay() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();
     
      MockClassLoaderPolicy pb = createMockClassLoaderPolicy("B");
      pb.setPaths(TestB1.class);

      MockClassLoaderPolicy pa = createMockClassLoaderPolicy("A");
      pa.setPaths(TestA1.class);

      List<DelegateLoader> delegates = new ArrayList<DelegateLoader>();
      delegates.add(new FilteredDelegateLoader(pa));
      delegates.add(new FilteredDelegateLoader(pb));
      pa.setDelegates(delegates);
      pb.setDelegates(delegates);

      ClassLoader a = system.registerClassLoaderPolicy(pa);
      ClassLoader b = system.registerClassLoaderPolicy(pb);
     
View Full Code Here

  
   public void testDelegateToAnotherCodeSource() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();

      MockClassLoaderPolicy pb = createMockClassLoaderPolicy("B");
      pb.setPaths(ClassLoaderDomain.class);
      ClassLoader b = system.registerClassLoaderPolicy(pb);

      MockClassLoaderPolicy pa = createMockClassLoaderPolicy("A");
      pa.setPaths(TestADelegateClassLoaderDomain.class);
      pa.setDelegates(Collections.singletonList(new FilteredDelegateLoader(pb)));
      ClassLoader a = system.registerClassLoaderPolicy(pa);
     
      Class<?> fromB = assertLoadClass(ClassLoaderDomain.class, b, false);
      Class<?> fromA = assertLoadClass(ClassLoaderDomain.class, a, b, false);
     
View Full Code Here

  
   public void testAbstractFactoryWrongWay() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();
     
      MockClassLoaderPolicy pb = createMockClassLoaderPolicy("B");
      pb.setPaths(TestB1.class);

      MockClassLoaderPolicy pa = createMockClassLoaderPolicy("A");
      pa.setPaths(TestA1.class);

      List<DelegateLoader> delegates = new ArrayList<DelegateLoader>();
      delegates.add(new FilteredDelegateLoader(pa));
      delegates.add(new FilteredDelegateLoader(pb));
      pa.setDelegates(delegates);
      pb.setDelegates(delegates);

      ClassLoader a = system.registerClassLoaderPolicy(pa);
      ClassLoader b = system.registerClassLoaderPolicy(pb);
     
View Full Code Here

   }

   public void testLoadClassFromDefaultPackage() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPath("");
      policy.setPackageNames(new String[] { "" });
      ClassLoader classLoader = system.registerClassLoaderPolicy(policy);
     
      assertLoadClass("TestDefaultPackage", classLoader);
   }
View Full Code Here

TOP

Related Classes of org.jboss.classloader.test.support.MockClassLoaderPolicy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.