Package org.jboss.classloader.test.support

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


      NoMatchClassFilter filter = new NoMatchClassFilter(MockLoader.class);
      ParentPolicy pp = new ParentPolicy(filter, ClassFilter.NOTHING);
      ClassLoaderDomain parent = system.createAndRegisterDomain("parent", ParentPolicy.BEFORE_BUT_JAVA_ONLY);
      ClassLoaderDomain child = system.createAndRegisterDomain("child", pp, parent);
     
      MockClassLoaderPolicy parentPolicy = createMockClassLoaderPolicy();
      parentPolicy.setPathsAndPackageNames(MockLoader.class, Loader.class);
      system.registerClassLoaderPolicy(parent, parentPolicy);
     
      MockClassLoaderPolicy childPolicy = createMockClassLoaderPolicy();
      childPolicy.setPathsAndPackageNames(MockLoader.class, Loader.class);
      ClassLoader classLoader = system.registerClassLoaderPolicy(child, childPolicy);
     
      assertLoadClass(MockLoader.class, classLoader);
      assertTrue("Should have been filtered", filter.filtered);
   }
View Full Code Here


   }
  
   public void testGetResource() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPrefix("a/");
      policy.setPath("com/acme/p1");
      ClassLoader classLoader = system.registerClassLoaderPolicy(policy);
     
      assertGetResource("a/", "com/acme/p1/testResource", classLoader);
   }
View Full Code Here

   }
  
   public void testGetResourceFromDefaultPackage() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPrefix("a/");
      policy.setPath("");
      ClassLoader classLoader = system.registerClassLoaderPolicy(policy);
     
      assertGetResource("a/", "testResource", classLoader);
   }
View Full Code Here

   }
  
   public void testGetResourceFromDelegate() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPrefix("a/");
      policy.setPath("com/acme/p1");

      MockClassLoaderPolicy policy2 = createMockClassLoaderPolicy();
      policy2.setDelegates(Collections.singletonList(new FilteredDelegateLoader(policy)));
     
      system.registerClassLoaderPolicy(policy);
      ClassLoader classLoader = system.registerClassLoaderPolicy(policy2);
     
      assertGetResource("a/", "com/acme/p1/testResource", classLoader);
View Full Code Here

   }
  
   public void testGetResourceFromDefaultPackageFromDelegate() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPrefix("a/");
      policy.setPath("");

      MockClassLoaderPolicy policy2 = createMockClassLoaderPolicy();
      policy2.setDelegates(Collections.singletonList(new FilteredDelegateLoader(policy)));
     
      system.registerClassLoaderPolicy(policy);
      ClassLoader classLoader = system.registerClassLoaderPolicy(policy2);
     
      assertGetResource("a/", "testResource", classLoader);
View Full Code Here

   }
  
   public void testGetResourceWithDotFromDelegate() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPrefix("a/");
      policy.setPath("com/acme/p1");
      policy.setPackageNames(new String[] { "com.acme.p1" } );

      MockClassLoaderPolicy policy2 = createMockClassLoaderPolicy();
      policy2.setDelegates(Collections.singletonList(new FilteredDelegateLoader(policy)));
     
      system.registerClassLoaderPolicy(policy);
      ClassLoader classLoader = system.registerClassLoaderPolicy(policy2);
     
      assertGetResource("a/", "com/acme/p1/testResource.xml", classLoader);
View Full Code Here

   }
  
   public void testGetResourceWithDotFromDelegatNotFound() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPrefix("a/");
      policy.setPath("com/acme/p1");
      policy.setPackageNames(new String[] { "com.acme.p1" } );

      MockClassLoaderPolicy policy2 = createMockClassLoaderPolicy();
      policy2.setDelegates(Collections.singletonList(new FilteredDelegateLoader(policy)));
     
      system.registerClassLoaderPolicy(policy);
      ClassLoader classLoader = system.registerClassLoaderPolicy(policy2);
     
      assertGetResourceFail("testResource.xml", classLoader);
View Full Code Here

   }
  
   public void testGetResourceUsingAllImports() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPrefix("a/");
      policy.setPath("com/acme/p1");
      policy.setPackageNames(new String[] { "com.acme.p1" } );

      MockClassLoaderPolicy policy2 = createMockClassLoaderPolicy();
      policy2.setImportAll(true);
     
      system.registerClassLoaderPolicy(policy);
      ClassLoader classLoader = system.registerClassLoaderPolicy(policy2);
     
      assertGetResource("a/", "com/acme/p1/testResource", classLoader);
View Full Code Here

   }
  
   public void testGetResourceFromDefaultPackageUsingAllImports() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPrefix("a/");
      policy.setPath("");
      policy.setPackageNames(new String[] { "" } );

      MockClassLoaderPolicy policy2 = createMockClassLoaderPolicy();
      policy2.setImportAll(true);
     
      system.registerClassLoaderPolicy(policy);
      ClassLoader classLoader = system.registerClassLoaderPolicy(policy2);
     
      assertGetResource("a/", "testResource", classLoader);
View Full Code Here

   }
  
   public void testGetResourceNotFound() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPrefix("a/");
      policy.setPath("com/acme/p1");
      policy.setPackageNames(new String[] { "com.acme.p1" } );

      MockClassLoaderPolicy policy2 = createMockClassLoaderPolicy();
     
      system.registerClassLoaderPolicy(policy);
      ClassLoader classLoader = system.registerClassLoaderPolicy(policy2);
     
      assertGetResourceFail("com/acme/p1/testResource", 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.