Codota Logo
ServiceLoader
Code IndexAdd Codota to your IDE (free)

How to use
ServiceLoader
in
org.jboss.arquillian.container.test.spi.util

Best Java code snippets using org.jboss.arquillian.container.test.spi.util.ServiceLoader (Showing top 18 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: org.jboss.arquillian.container/arquillian-container-test-spi

  /**
   * Dynamically loads an instance of a test runner.
   *
   * @return A Initialized TestRunner
   *
   * @throws IllegalStateException
   *     if multiple TestRunners found in classpath.
   */
  public static TestRunner getTestRunner(ClassLoader classLoader) {
    ServiceLoader<TestRunner> serviceLoader = ServiceLoader.load(TestRunner.class, classLoader);

    if (serviceLoader.getProviders().size() > 1) {
      throw new IllegalStateException("Multiple TestRunners found, only one allowed. Check your classpath");
    }

    return serviceLoader.iterator().next();
  }
}
origin: org.jboss.arquillian.container/arquillian-container-test-spi

/**
 * Creates a new service loader for the given service type and class loader.
 *
 * @param service
 *     The interface or abstract class representing the service
 * @param loader
 *     The class loader to be used to load provider-configuration
 *     files and provider classes, or null if the system class loader
 *     (or, failing that, the bootstrap class loader) is to be used
 *
 * @return A new service loader
 */
public static <S> ServiceLoader<S> load(Class<S> service, ClassLoader loader) {
  if (loader == null) {
    loader = service.getClassLoader();
  }
  return new ServiceLoader<S>(service, loader);
}
origin: arquillian/arquillian-core

public Set<S> getProviders() {
  if (providers == null) {
    reload();
  }
  return Collections.unmodifiableSet(providers);
}
origin: arquillian/arquillian-core

  public ServiceLoader<AutomaticDeployment> find() {
    return ServiceLoader.load(AutomaticDeployment.class);
  }
};
origin: arquillian/arquillian-core

@Before
public void setUpTest() {
  DeploymentConfiguration.DeploymentContentBuilder content = new DeploymentConfiguration.DeploymentContentBuilder(ShrinkWrap.create(
    JavaArchive.class));
  when(automaticDeployment.generateDeploymentScenario(any(TestClass.class))).thenReturn(content.get());
  final List<AutomaticDeployment> deploymentContents = new ArrayList<AutomaticDeployment>();
  deploymentContents.add(automaticDeployment);
  when(automaticDeploymentLocator.find()).thenReturn(serviceLoader);
  when(serviceLoader.iterator()).thenReturn(deploymentContents.iterator());
}
origin: org.jboss.arquillian.container/arquillian-container-test-spi

providers.add(createInstance(line));
origin: org.jboss.arquillian.container/arquillian-container-test-impl-base

  public ServiceLoader<AutomaticDeployment> find() {
    return ServiceLoader.load(AutomaticDeployment.class);
  }
};
origin: org.jboss.arquillian.container/arquillian-container-test-impl-base

@Before
public void setUpTest() {
  DeploymentConfiguration.DeploymentContentBuilder content = new DeploymentConfiguration.DeploymentContentBuilder(ShrinkWrap.create(
    JavaArchive.class));
  when(automaticDeployment.generateDeploymentScenario(any(TestClass.class))).thenReturn(content.get());
  final List<AutomaticDeployment> deploymentContents = new ArrayList<AutomaticDeployment>();
  deploymentContents.add(automaticDeployment);
  when(automaticDeploymentLocator.find()).thenReturn(serviceLoader);
  when(serviceLoader.iterator()).thenReturn(deploymentContents.iterator());
}
origin: arquillian/arquillian-core

providers.add(createInstance(line));
origin: arquillian/arquillian-core

  /**
   * Dynamically loads an instance of a test runner.
   *
   * @return A Initialized TestRunner
   *
   * @throws IllegalStateException
   *     if multiple TestRunners found in classpath.
   */
  public static TestRunner getTestRunner(ClassLoader classLoader) {
    ServiceLoader<TestRunner> serviceLoader = ServiceLoader.load(TestRunner.class, classLoader);

    if (serviceLoader.getProviders().size() > 1) {
      throw new IllegalStateException("Multiple TestRunners found, only one allowed. Check your classpath");
    }

    return serviceLoader.iterator().next();
  }
}
origin: org.jboss.arquillian.container/arquillian-container-test-spi

/**
 * Creates a new service loader for the given service type, using the current
 * thread's context class loader.
 * <p>
 * An invocation of this convenience method of the form
 * <p>
 * {@code ServiceLoader.load(service)</code>}
 * <p>
 * is equivalent to
 * <p>
 * <code>ServiceLoader.load(service,
 * Thread.currentThread().getContextClassLoader())</code>
 *
 * @param service
 *     The interface or abstract class representing the service
 *
 * @return A new service loader
 */
public static <S> ServiceLoader<S> load(Class<S> service) {
  return load(service, Thread.currentThread().getContextClassLoader());
}
origin: org.jboss.arquillian.container/arquillian-container-test-spi

public Set<S> getProviders() {
  if (providers == null) {
    reload();
  }
  return Collections.unmodifiableSet(providers);
}
origin: arquillian/arquillian-core

/**
 * Creates a new service loader for the given service type and class loader.
 *
 * @param service
 *     The interface or abstract class representing the service
 * @param loader
 *     The class loader to be used to load provider-configuration
 *     files and provider classes, or null if the system class loader
 *     (or, failing that, the bootstrap class loader) is to be used
 *
 * @return A new service loader
 */
public static <S> ServiceLoader<S> load(Class<S> service, ClassLoader loader) {
  if (loader == null) {
    loader = service.getClassLoader();
  }
  return new ServiceLoader<S>(service, loader);
}
origin: arquillian/arquillian-core

/**
 * Creates a new service loader for the given service type, using the current
 * thread's context class loader.
 * <p>
 * An invocation of this convenience method of the form
 * <p>
 * {@code ServiceLoader.load(service)</code>}
 * <p>
 * is equivalent to
 * <p>
 * <code>ServiceLoader.load(service,
 * Thread.currentThread().getContextClassLoader())</code>
 *
 * @param service
 *     The interface or abstract class representing the service
 *
 * @return A new service loader
 */
public static <S> ServiceLoader<S> load(Class<S> service) {
  return load(service, Thread.currentThread().getContextClassLoader());
}
origin: arquillian/arquillian-core

reload();
origin: org.wildfly.arquillian/wildfly-arquillian-protocol-jmx

ArquillianConfig(Set<String> testClasses, String deploymentUnitName) {
  this.serviceName = getServiceName(deploymentUnitName);
  this.testClasses.addAll(testClasses);
  for(ArquillianConfigServiceCustomizer customizer : ServiceLoader.load(ArquillianConfigServiceCustomizer.class)) {
    serviceCustomizers.add(customizer);
  }
}
origin: org.jboss.arquillian.container/arquillian-container-test-spi

reload();
origin: wildfly/wildfly-arquillian

ArquillianConfig(Set<String> testClasses, String deploymentUnitName) {
  this.serviceName = getServiceName(deploymentUnitName);
  this.testClasses.addAll(testClasses);
  for(ArquillianConfigServiceCustomizer customizer : ServiceLoader.load(ArquillianConfigServiceCustomizer.class)) {
    serviceCustomizers.add(customizer);
  }
}
org.jboss.arquillian.container.test.spi.utilServiceLoader

Javadoc

This class handles looking up service providers on the class path. It implements the Service Provider section of the JAR File Specification.

The Service Provider programmatic lookup was not specified prior to Java 6 so this interface allows use of the specification prior to Java 6.

The API is copied from java.util.ServiceLoader

Most used methods

  • load
    Creates a new service loader for the given service type and class loader.
  • iterator
    Lazily loads the available providers of this loader's service. The iterator returned by this method
  • <init>
  • createInstance
  • getProviders
  • reload
    Clear this loader's provider cache so that all providers will be reloaded. After invoking this metho

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • getExternalFilesDir (Context)
  • requestLocationUpdates (LocationManager)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • JCheckBox (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now