Tabnine Logo
ShrinkWrapClassLoader.loadClass
Code IndexAdd Tabnine to your IDE (free)

How to use
loadClass
method
in
org.jboss.shrinkwrap.api.classloader.ShrinkWrapClassLoader

Best Java code snippets using org.jboss.shrinkwrap.api.classloader.ShrinkWrapClassLoader.loadClass (Showing top 6 results out of 315)

origin: org.jboss.arquillian.container/arquillian-weld-se-embedded-1.1

  public Class<?> classForName(String name)
  {
   try
   {
     return classLoader.loadClass(name);
   } 
   catch (Exception e) 
   {
     throw new ResourceLoadingException(e);
   }
  }
});
origin: org.jboss.arquillian.daemon/arquillian-daemon-server

  testClass = isolatedArchiveCL.loadClass(testClassName);
} catch (final ClassNotFoundException cnfe) {
  throw new IllegalStateException("Could not load class " + testClassName + " from deployed archive: "
  testRunnersClass = isolatedArchiveCL.loadClass(CLASS_NAME_ARQ_TEST_RUNNERS);
} catch (final ClassNotFoundException cnfe) {
  throw new IllegalStateException("Could not load class " + CLASS_NAME_ARQ_TEST_RUNNERS
origin: arquillian/arquillian-core

@Test
public void shouldBeAbleToLoadVetoedClasses() throws Exception {
  Archive<JavaArchive> jarWithVetoedServiceImpl = createJarWithVetoedServices();
  ClassLoader emptyParent = null;
  ShrinkWrapClassLoader swClassloader = new ShrinkWrapClassLoader(emptyParent, jarWithVetoedServiceImpl);
  ClassLoader emptyClassLoader = new ClassLoader(null) {
  };
  ClassLoader originalClassLoader = SecurityActions.getThreadContextClassLoader();
  Map<Class<?>, Set<Class<?>>> vetoed = null;
  Class<?> service;
  try {
    Thread.currentThread().setContextClassLoader(emptyClassLoader);
    service = swClassloader.loadClass("org.jboss.arquillian.core.impl.loadable.util.FakeService");
    swClassloader.loadClass("org.jboss.arquillian.core.impl.loadable.util.ShouldBeIncluded");
    swClassloader.loadClass("org.jboss.arquillian.core.impl.loadable.util.ShouldBeExcluded");
    vetoed = new JavaSPIExtensionLoader().loadVetoed(swClassloader);
  } finally {
    Thread.currentThread().setContextClassLoader(originalClassLoader);
  }
  Assert.assertEquals("Unexpected number of vetoed services", 1, vetoed.size());
  Assert.assertEquals("Unexpected number of vetoed services impl", 2, vetoed.get(service).size());
}
origin: org.jboss.arquillian.core/arquillian-core-impl-base

@Test
public void shouldBeAbleToLoadVetoedClasses() throws Exception {
  Archive<JavaArchive> jarWithVetoedServiceImpl = createJarWithVetoedServices();
  ClassLoader emptyParent = null;
  ShrinkWrapClassLoader swClassloader = new ShrinkWrapClassLoader(emptyParent, jarWithVetoedServiceImpl);
  ClassLoader emptyClassLoader = new ClassLoader(null) {
  };
  ClassLoader originalClassLoader = SecurityActions.getThreadContextClassLoader();
  Map<Class<?>, Set<Class<?>>> vetoed = null;
  Class<?> service;
  try {
    Thread.currentThread().setContextClassLoader(emptyClassLoader);
    service = swClassloader.loadClass("org.jboss.arquillian.core.impl.loadable.util.FakeService");
    swClassloader.loadClass("org.jboss.arquillian.core.impl.loadable.util.ShouldBeIncluded");
    swClassloader.loadClass("org.jboss.arquillian.core.impl.loadable.util.ShouldBeExcluded");
    vetoed = new JavaSPIExtensionLoader().loadVetoed(swClassloader);
  } finally {
    Thread.currentThread().setContextClassLoader(originalClassLoader);
  }
  Assert.assertEquals("Unexpected number of vetoed services", 1, vetoed.size());
  Assert.assertEquals("Unexpected number of vetoed services impl", 2, vetoed.get(service).size());
}
origin: arquillian/arquillian-core

@Test
public void shouldBeAbleToAddSelectedProviderFromClassLoader() throws Exception {
  Archive<JavaArchive> jarWithDefaultServiceImpl = createJarWithDefaultServiceImpl();
  Archive<JavaArchive> jarThatReplaceServiceImpl = createJarThatReplaceServiceImpl();
  ClassLoader emptyParent = null;
  ShrinkWrapClassLoader swClassloader =
    new ShrinkWrapClassLoader(emptyParent, jarThatReplaceServiceImpl, jarWithDefaultServiceImpl);
  ClassLoader emptyClassLoader = new ClassLoader(null) {
  };
  ClassLoader originalClassLoader = SecurityActions.getThreadContextClassLoader();
  Collection<?> providers = null;
  Class<?> expectedImplClass = null;
  try {
    Thread.currentThread().setContextClassLoader(emptyClassLoader);
    Class<?> serviceClass = swClassloader.loadClass("org.jboss.arquillian.core.impl.loadable.util.FakeService");
    expectedImplClass = swClassloader.loadClass("org.jboss.arquillian.core.impl.loadable.util.ShouldBeIncluded");
    providers = new JavaSPIExtensionLoader().all(swClassloader, serviceClass);
  } finally {
    Thread.currentThread().setContextClassLoader(originalClassLoader);
  }
  Assert.assertEquals("Unexpected number of providers loaded", 1, providers.size());
  Assert.assertEquals("Wrong provider loaded", expectedImplClass, providers.iterator().next().getClass());
}
origin: org.jboss.arquillian.core/arquillian-core-impl-base

@Test
public void shouldBeAbleToAddSelectedProviderFromClassLoader() throws Exception {
  Archive<JavaArchive> jarWithDefaultServiceImpl = createJarWithDefaultServiceImpl();
  Archive<JavaArchive> jarThatReplaceServiceImpl = createJarThatReplaceServiceImpl();
  ClassLoader emptyParent = null;
  ShrinkWrapClassLoader swClassloader =
    new ShrinkWrapClassLoader(emptyParent, jarThatReplaceServiceImpl, jarWithDefaultServiceImpl);
  ClassLoader emptyClassLoader = new ClassLoader(null) {
  };
  ClassLoader originalClassLoader = SecurityActions.getThreadContextClassLoader();
  Collection<?> providers = null;
  Class<?> expectedImplClass = null;
  try {
    Thread.currentThread().setContextClassLoader(emptyClassLoader);
    Class<?> serviceClass = swClassloader.loadClass("org.jboss.arquillian.core.impl.loadable.util.FakeService");
    expectedImplClass = swClassloader.loadClass("org.jboss.arquillian.core.impl.loadable.util.ShouldBeIncluded");
    providers = new JavaSPIExtensionLoader().all(swClassloader, serviceClass);
  } finally {
    Thread.currentThread().setContextClassLoader(originalClassLoader);
  }
  Assert.assertEquals("Unexpected number of providers loaded", 1, providers.size());
  Assert.assertEquals("Wrong provider loaded", expectedImplClass, providers.iterator().next().getClass());
}
org.jboss.shrinkwrap.api.classloaderShrinkWrapClassLoaderloadClass

Popular methods of ShrinkWrapClassLoader

  • <init>
    Constructs a new ShrinkWrapClassLoader for the specified Archives using the default delegation paren
  • close
  • addArchive
  • addArchives
  • addURL
  • findResource
  • findResources
  • getResource
  • getResources

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • getSupportFragmentManager (FragmentActivity)
  • getResourceAsStream (ClassLoader)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Path (java.nio.file)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now