Package org.jboss.classloading.spi.dependency.policy.mock

Examples of org.jboss.classloading.spi.dependency.policy.mock.MockClassLoadingMetaData


      return createMetaData(deployment, name, version, false, packages);
   }

   protected static ClassLoadingMetaData createMetaData(PredeterminedManagedObjectAttachments deployment, String name, Version version, boolean useVersionOnPackages, Class<?>... packages)
   {
      MockClassLoadingMetaData classLoadingMetaData = new MockClassLoadingMetaData(name, version);

      classLoadingMetaData.setPaths(packages);
     
      CapabilitiesMetaData capabilities = classLoadingMetaData.getCapabilities();
      Capability capability = classLoadingMetaDataFactory.createModule(name, version);
      capabilities.addCapability(capability);

      if (packages != null)
      {
         for (Class<?> pkg : packages)
         {
            if (useVersionOnPackages)
               capability = classLoadingMetaDataFactory.createPackage(pkg.getPackage().getName(), version);
            else
               capability = classLoadingMetaDataFactory.createPackage(pkg.getPackage().getName());
            capabilities.addCapability(capability);
         }
      }

      classLoadingMetaData.setCapabilities(capabilities);
      return classLoadingMetaData;
   }
View Full Code Here


      // We have a module capability
      Object version = getVersion();
      Capability capability = factory.createModule(getName(), version);
      capabilities.add(capability);

      MockClassLoadingMetaData metadata = getClassLoadingMetaData();
      String[] exported = metadata.getExportedPackages();
      // Do we determine package capabilities?
      if (exported != null)
      {
         for (String packageName : exported)
         {
View Full Code Here

   }
  
   @Override
   protected MockClassLoaderPolicy determinePolicy()
   {
      MockClassLoadingMetaData metaData = getClassLoadingMetaData();
      MockClassLoaderPolicy policy = MockClassLoaderHelper.createMockClassLoaderPolicy(getContextName());
      policy.setPrefix(metaData.getPrefix());
      policy.setPackageNames(getPackageNames());
      policy.setPaths(metaData.getPaths());
      policy.setIncluded(metaData.getIncludedClasses());
      policy.setExcluded(metaData.getExcludedClasses());
      policy.setImportAll(isImportAll());
      policy.setDelegates(getDelegates());
      return policy;
   }
View Full Code Here

   }

   @Override
   public void visit(ResourceVisitor visitor, ResourceFilter filter, ResourceFilter recurseFilter, URL... urls)
   {
      MockClassLoadingMetaData mclmd = getClassLoadingMetaData();
      String[] paths = mclmd.getPaths();
      if (paths != null && paths.length > 0)
      {
         ClassLoader classLoader = getClassLoader();
         if (classLoader == null)
            throw new IllegalStateException("ClassLoader has not been constructed for " + getContextName());

         Collection<String> included = toCollection(mclmd.getIncludedClasses());
         ClassFilter includedFilter = getIncluded();
         Collection<String> excluded = toCollection(mclmd.getExcludedClasses());
         ClassFilter excludedFilter = getExcluded();

         for (String path : paths)
         {
            if (included.isEmpty() == false && included.contains(path) == false)
View Full Code Here

      return createMetaData(name, version, false, paths);
   }

   protected static ClassLoadingMetaData createMetaData(String name, Version version, boolean useVersionOnPackages, String... paths)
   {
      MockClassLoadingMetaData classLoadingMetaData = new MockClassLoadingMetaData(name, version);

      classLoadingMetaData.setPaths(paths);

      CapabilitiesMetaData capabilities = classLoadingMetaData.getCapabilities();
      Capability capability = classLoadingMetaDataFactory.createModule(name, version);
      capabilities.addCapability(capability);

      if (paths != null)
      {
         for (String path : paths)
         {
            if (useVersionOnPackages)
               capability = classLoadingMetaDataFactory.createPackage(path, version);
            else
               capability = classLoadingMetaDataFactory.createPackage(path);
            capabilities.addCapability(capability);
         }
      }

      classLoadingMetaData.setCapabilities(capabilities);
      return classLoadingMetaData;
   }
View Full Code Here

      return createMetaData(deployment, name, version, false, packages);
   }

   protected static ClassLoadingMetaData createMetaData(PredeterminedManagedObjectAttachments deployment, String name, Version version, boolean useVersionOnPackages, Class<?>... packages)
   {
      MockClassLoadingMetaData classLoadingMetaData = new MockClassLoadingMetaData(name, version);

      classLoadingMetaData.setPaths(packages);
     
      CapabilitiesMetaData capabilities = classLoadingMetaData.getCapabilities();
      Capability capability = classLoadingMetaDataFactory.createModule(name, version);
      capabilities.addCapability(capability);

      if (packages != null)
      {
         for (Class<?> pkg : packages)
         {
            if (useVersionOnPackages)
               capability = classLoadingMetaDataFactory.createPackage(pkg.getPackage().getName(), version);
            else
               capability = classLoadingMetaDataFactory.createPackage(pkg.getPackage().getName());
            capabilities.addCapability(capability);
         }
      }

      classLoadingMetaData.setCapabilities(capabilities);
      return classLoadingMetaData;
   }
View Full Code Here

      super(name);
   }

   protected MockClassLoadingMetaData createClassLoadingMetaData(String name)
   {
      MockClassLoadingMetaData clmd = new MockClassLoadingMetaData(name);
      clmd.setPaths(paths);
      return clmd;
   }
View Full Code Here

      return clmd;
   }

   public void testIncluded() throws Exception
   {
      MockClassLoadingMetaData a = createClassLoadingMetaData("a");
      a.setIncluded(new PackageClassFilter(new String[]{A.class.getPackage().getName(), B.class.getPackage().getName()}));
      testMockClassLoadingMetaData(a);
   }
View Full Code Here

      testMockClassLoadingMetaData(a);
   }

   public void testExcluded() throws Exception
   {
      MockClassLoadingMetaData a = createClassLoadingMetaData("a");
      a.setExcluded(new PackageClassFilter(new String[]{C.class.getPackage().getName()}));
      testMockClassLoadingMetaData(a);
   }
View Full Code Here

      testMockClassLoadingMetaData(a);
   }

   public void testFiltered() throws Exception
   {
      MockClassLoadingMetaData a = createClassLoadingMetaData("a");
      testMockClassLoadingMetaData(a, new MockFilteredResourceVisitor("C.class"));
   }
View Full Code Here

TOP

Related Classes of org.jboss.classloading.spi.dependency.policy.mock.MockClassLoadingMetaData

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.