Package org.jboss.classloader.spi

Examples of org.jboss.classloader.spi.ClassLoaderDomain


   {
      ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();
      MBeanServer server = MBeanServerFactory.newMBeanServer();
      server.registerMBean(system, CLASSLOADER_SYSTEM_OBJECT_NAME);

      ClassLoaderDomain defaultDomain = system.getDefaultDomain();
      ClassLoaderDomain domain = system.createAndRegisterDomain("test", ParentPolicy.BEFORE_BUT_JAVA_ONLY, defaultDomain);

      MockClassLoaderPolicy a = createMockClassLoaderPolicy("a");
      a.setPathsAndPackageNames(A.class);
      RealClassLoader clA = (RealClassLoader) system.registerClassLoaderPolicy(domain.getName(), a);

      MockClassLoaderPolicy b = createMockClassLoaderPolicy("b");
      b.setPathsAndPackageNames(B.class);
      RealClassLoader clB = (RealClassLoader) system.registerClassLoaderPolicy(domain.getName(), b);
     
      MockClassLoaderPolicy test = createMockClassLoaderPolicy("test");
      test.setImportAll(true);
      test.setDelegates(Arrays.asList(a.getExported(), b.getExported()));
      test.setPathsAndPackageNames(A.class, B.class);
      RealClassLoader cl = (RealClassLoader) system.registerClassLoaderPolicy(domain, test);
     
      ObjectName testObjectName = cl.getObjectName();
      assertEquals(domain.getObjectName(), server.getAttribute(testObjectName, "ClassLoaderDomain"));
      assertEquals("test", server.getAttribute(testObjectName, "Name"));
      assertTrue((Boolean) server.getAttribute(testObjectName, "ImportAll"));
      assertTrue((Boolean) server.getAttribute(testObjectName, "Valid"));
      Set<String> expectedPackages = makeSet(A.class.getPackage().getName(), B.class.getPackage().getName());
      assertEquals(expectedPackages, server.invoke(testObjectName, "listExportedPackages", null, null));
View Full Code Here


   }
  
   public void testNoParentLoadsFromJBossClassLoadersClassLoader() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      ClassLoaderDomain domain = system.createAndRegisterDomain("test", ParentPolicy.BEFORE, null);
     
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      ClassLoader classLoader = system.registerClassLoaderPolicy(domain, policy);
     
      assertLoadClass(Object.class, classLoader, null, true);
View Full Code Here

   }
  
   public void testBefore() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      ClassLoaderDomain domain = system.createAndRegisterDomain("test", ParentPolicy.BEFORE, null);
     
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPathsAndPackageNames(ClassLoaderDomain.class);
      ClassLoader classLoader = system.registerClassLoaderPolicy(domain, policy);
     
View Full Code Here

   }
  
   public void testBeforeButJavaOnly() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      ClassLoaderDomain domain = system.createAndRegisterDomain("test", ParentPolicy.BEFORE_BUT_JAVA_ONLY, null);
     
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPathsAndPackageNames(ClassLoaderDomain.class);
      ClassLoader classLoader = system.registerClassLoaderPolicy(domain, policy);
     
View Full Code Here

   }
  
   public void testBeforeButJavaOnlyNotFound() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      ClassLoaderDomain domain = system.createAndRegisterDomain("test", ParentPolicy.BEFORE_BUT_JAVA_ONLY, null);
     
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      ClassLoader classLoader = system.registerClassLoaderPolicy(domain, policy);
     
      assertLoadClass(Object.class, classLoader, null, true);
View Full Code Here

   }
  
   public void testAfterNotReached() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      ClassLoaderDomain domain = system.createAndRegisterDomain("test", ParentPolicy.AFTER, null);
     
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPathsAndPackageNames(ClassLoaderDomain.class);
      ClassLoader classLoader = system.registerClassLoaderPolicy(domain, policy);
     
View Full Code Here

   }
  
   public void testAfterReached() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      ClassLoaderDomain domain = system.createAndRegisterDomain("test", ParentPolicy.AFTER, null);
     
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      ClassLoader classLoader = system.registerClassLoaderPolicy(domain, policy);
     
      assertLoadClass(Object.class, classLoader, null, true);
View Full Code Here

   }
  
   public void testAfterButJavaBeforeNotReached() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      ClassLoaderDomain domain = system.createAndRegisterDomain("test", ParentPolicy.AFTER_BUT_JAVA_BEFORE, null);
     
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPathsAndPackageNames(ClassLoaderDomain.class, MutableComboBoxModel.class);
      ClassLoader classLoader = system.registerClassLoaderPolicy(domain, policy);
     
View Full Code Here

   }
  
   public void testAfterButJavaBeforeReached() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      ClassLoaderDomain domain = system.createAndRegisterDomain("test", ParentPolicy.AFTER_BUT_JAVA_BEFORE, null);
     
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPathsAndPackageNames(MutableComboBoxModel.class);
      ClassLoader classLoader = system.registerClassLoaderPolicy(domain, policy);
     
View Full Code Here

   }
  
   public void testAfterButOnlyJavaBeforeNotReached() throws Exception
   {
      ClassLoaderSystem system = createClassLoaderSystem();
      ClassLoaderDomain domain = system.createAndRegisterDomain("test", ParentPolicy.AFTER_BUT_ONLY_JAVA_BEFORE, null);
     
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPathsAndPackageNames(ClassLoaderDomain.class);
      ClassLoader classLoader = system.registerClassLoaderPolicy(domain, policy);
     
View Full Code Here

TOP

Related Classes of org.jboss.classloader.spi.ClassLoaderDomain

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.