Package org.jboss.classloading.plugins

Examples of org.jboss.classloading.plugins.AbstractClassLoadingDomain


  
   // Public --------------------------------------------------------

   public void testLoadClass() throws Exception
   {
      AbstractClassLoadingDomain domain = new AbstractClassLoadingDomain();
      domain.loadClass("java.lang.String", false, null);
   }
View Full Code Here


      domain.loadClass("java.lang.String", false, null);
   }

   public void testLoadClassFailed() throws Exception
   {
      AbstractClassLoadingDomain domain = new AbstractClassLoadingDomain();
      try
      {
         domain.loadClass("java.lang.rubbish", false, null);
         fail("Should not be here!");
      }
      catch (ClassNotFoundException expected)
      {
      }
View Full Code Here

      }
   }

   public void testLoadResource() throws Exception
   {
      AbstractClassLoadingDomain domain = new AbstractClassLoadingDomain();
      URL resource = domain.loadResource("java/lang/String.class", null);
      assertNotNull(resource);
   }
View Full Code Here

      assertNotNull(resource);
   }

   public void testLoadResourceFailed() throws Exception
   {
      AbstractClassLoadingDomain domain = new AbstractClassLoadingDomain();
      URL resource = domain.loadResource("java/lang/rubbish", null);
      assertNull(resource);
   }
View Full Code Here

      assertNull(resource);
   }
  
   public void testClassCache() throws Exception
   {
      AbstractClassLoadingDomain domain = new AbstractClassLoadingDomain();
      SimpleClassLoader scl = new SimpleClassLoader();
      scl.addClass("xyzzy.Hello", String.class);
      domain.addDomainClassLoader(new DelegatingDomainClassLoader(scl));
     
      domain.loadClass("xyzzy.Hello", false, null);
     
      ClassLoaderStats stats = (ClassLoaderStats) scl.requests.get("xyzzy.Hello");
      assertNotNull(stats);
      assertEquals(1, stats.loadClass);
     
      domain.loadClass("xyzzy.Hello", false, null);
      assertEquals(1, stats.loadClass);
   }
View Full Code Here

      assertEquals(1, stats.loadClass);
   }
  
   public void testClassCacheFailed() throws Exception
   {
      AbstractClassLoadingDomain domain = new AbstractClassLoadingDomain();
      SimpleClassLoader scl = new SimpleClassLoader();
      scl.addClass("xyzzy.Hello", String.class);
      domain.addDomainClassLoader(new DelegatingDomainClassLoader(scl));
     
      try
      {
         domain.loadClass("xyzzy.rubbish", false, null);
         fail("Should not be here!");
      }
      catch (ClassNotFoundException expected)
      {
      }
     
      ClassLoaderStats stats = (ClassLoaderStats) scl.requests.get("xyzzy.rubbish");
      assertNotNull(stats);
      assertEquals(1, stats.loadClass);
     
      try
      {
         domain.loadClass("xyzzy.rubbish", false, null);
         fail("Should not be here!");
      }
      catch (ClassNotFoundException expected)
      {
      }
View Full Code Here

      assertEquals(1, stats.loadClass);
   }
  
   public void testClearClassCache() throws Exception
   {
      AbstractClassLoadingDomain domain = new AbstractClassLoadingDomain();
      SimpleClassLoader scl = new SimpleClassLoader();
      scl.addClass("xyzzy.Hello", String.class);
      DelegatingDomainClassLoader ddcl = new DelegatingDomainClassLoader(scl);
      domain.addDomainClassLoader(ddcl);
     
      domain.loadClass("xyzzy.Hello", false, null);
     
      ClassLoaderStats stats = (ClassLoaderStats) scl.requests.get("xyzzy.Hello");
      assertNotNull(stats);
      assertEquals(1, stats.loadClass);

      domain.removeDomainClassLoader(ddcl);
     
      try
      {
         domain.loadClass("xyzzy.Hello", false, null);
         fail("Should not be here!");
      }
      catch (ClassNotFoundException expected)
      {
      }

      domain.addDomainClassLoader(ddcl);
      domain.loadClass("xyzzy.Hello", false, null);
      assertEquals(2, stats.loadClass);
   }
View Full Code Here

      assertEquals(2, stats.loadClass);
   }
  
   public void testResourceCache() throws Exception
   {
      AbstractClassLoadingDomain domain = new AbstractClassLoadingDomain();
      SimpleClassLoader scl = new SimpleClassLoader();
      scl.addResource("xyzzy/Hello", new URL("file:///"));
      domain.addDomainClassLoader(new DelegatingDomainClassLoader(scl));
     
      URL url = domain.loadResource("xyzzy/Hello", null);
      assertNotNull(url);
     
      ClassLoaderStats stats = (ClassLoaderStats) scl.requests.get("xyzzy/Hello");
      assertNotNull(stats);
      assertEquals(1, stats.getResource);
     
      url = domain.loadResource("xyzzy/Hello", null);
      assertNotNull(url);
      assertEquals(1, stats.getResource);
   }
View Full Code Here

      assertEquals(1, stats.getResource);
   }
  
   public void testResourceCacheFailed() throws Exception
   {
      AbstractClassLoadingDomain domain = new AbstractClassLoadingDomain();
      SimpleClassLoader scl = new SimpleClassLoader();
      scl.addResource("xyzzy/Hello", new URL("file:///"));
      domain.addDomainClassLoader(new DelegatingDomainClassLoader(scl));
     
      URL url = domain.loadResource("xyzzy/rubbish", null);
      assertNull(url);
     
      ClassLoaderStats stats = (ClassLoaderStats) scl.requests.get("xyzzy/rubbish");
      assertNotNull(stats);
      assertEquals(1, stats.getResource);
     
     
      url = domain.loadResource("xyzzy/rubbish", null);
      assertNull(url);
      assertEquals(1, stats.getResource);
   }
View Full Code Here

      assertEquals(1, stats.getResource);
   }
  
   public void testClearResourceCache() throws Exception
   {
      AbstractClassLoadingDomain domain = new AbstractClassLoadingDomain();
      SimpleClassLoader scl = new SimpleClassLoader();
      scl.addResource("xyzzy/Hello", new URL("file:///"));
      DelegatingDomainClassLoader ddcl = new DelegatingDomainClassLoader(scl);
      domain.addDomainClassLoader(ddcl);
     
      URL url = domain.loadResource("xyzzy/Hello", null);
      assertNotNull(url);
     
      ClassLoaderStats stats = (ClassLoaderStats) scl.requests.get("xyzzy/Hello");
      assertNotNull(stats);
      assertEquals(1, stats.getResource);

      domain.removeDomainClassLoader(ddcl);
     
      url = domain.loadResource("xyzzy/Hello", null);
      assertNull(url);

      domain.addDomainClassLoader(ddcl);
      url = domain.loadResource("xyzzy/Hello", null);
      assertNotNull(url);
      assertEquals(2, stats.getResource);
   }
View Full Code Here

TOP

Related Classes of org.jboss.classloading.plugins.AbstractClassLoadingDomain

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.