Examples of ServiceLoader


Examples of org.jboss.arquillian.core.spi.ServiceLoader

     *
     * @param beforeClass the event fired before execution of test case
     */
    public void initApplicationContext(@Observes BeforeClass beforeClass) {

        ServiceLoader loader = serviceLoader.get();

        // retrieves the list of all registered application context producers
        List<ApplicationContextProducer> applicationContextProducers =
                (List<ApplicationContextProducer>) loader.all(ApplicationContextProducer.class);

        for (ApplicationContextProducer applicationContextProducer : applicationContextProducers) {

            if (applicationContextProducer.supports(beforeClass.getTestClass())) {

View Full Code Here

Examples of org.jboss.arquillian.core.spi.ServiceLoader

    public void testDestroyApplicationContextAfterSuite() throws Exception {

        List<ApplicationContextDestroyer> destroyers = new ArrayList<ApplicationContextDestroyer>();
        destroyers.add(applicationContextDestroyer);

        ServiceLoader serviceLoader = mock(ServiceLoader.class);
        when(serviceLoader.all(ApplicationContextDestroyer.class)).thenReturn(destroyers);

        Instance<ServiceLoader> mockServiceLoader = mock(Instance.class);
        when(mockServiceLoader.get()).thenReturn(serviceLoader);
        TestReflectionHelper.setFieldValue(instance, "serviceLoaderInstance", mockServiceLoader);
View Full Code Here

Examples of org.jboss.arquillian.core.spi.ServiceLoader

     *
     * @return the application context
     */
    private RemoteTestScopeApplicationContext createApplicationContext(TestClass testClass) {

        ServiceLoader serviceLoader = serviceLoaderInstance.get();

        // retrieves the list of all registered application context producers
        Collection<RemoteApplicationContextProducer> applicationContextProducers =
                serviceLoader.all(RemoteApplicationContextProducer.class);

        for (RemoteApplicationContextProducer applicationContextProducer : applicationContextProducers) {

            if (applicationContextProducer.supports(testClass)) {

View Full Code Here

Examples of org.jboss.arquillian.core.spi.ServiceLoader

   private Instance<ServiceLoader> loader;

   public void createRegistry(@Observes ArquillianDescriptor event)
   {
      LocalContainerRegistry reg = new LocalContainerRegistry(injector.get());
      ServiceLoader serviceLoader = loader.get();

      validateConfiguration(event);

      String activeConfiguration = getActivatedConfiguration();
      for(ContainerDef container : event.getContainers())
      {
         if(
               (activeConfiguration != null && activeConfiguration.equals(container.getContainerName())) ||
               (activeConfiguration == null && container.isDefault()))
         {
            reg.create(container, serviceLoader);           
         }
      }
      for(GroupDef group : event.getGroups())
      {
         if(
               (activeConfiguration != null && activeConfiguration.equals(group.getGroupName())) ||
               (activeConfiguration == null && group.isGroupDefault()))
         {
            for(ContainerDef container : group.getGroupContainers())
            {
               reg.create(container, serviceLoader);
            }
         }
      }
      if(activeConfiguration == null && reg.getContainers().size() == 0)
      {
         DeployableContainer<?> deployableContainer = null;
         try
         {
            // 'check' if there are any DeployableContainers on CP
            deployableContainer = serviceLoader.onlyOne(DeployableContainer.class);
         }
         catch (IllegalStateException e)
         {
            throw new IllegalStateException(
                  "Could not add a default container to registry because multipe " +
View Full Code Here

Examples of org.jboss.arquillian.core.spi.ServiceLoader

      event.fire(new AfterKill(deployableContainer));
   }
  
   private ServerKillProcessor getServerKillProcessor()
   {
      ServiceLoader loader = serviceLoader.get();
      if(loader == null)
      {
         throw new IllegalStateException("No " + ServiceLoader.class.getName() + " found in context");
      }
     
View Full Code Here

Examples of org.jboss.arquillian.core.spi.ServiceLoader

      });
   }
  
   private CommandService getCommandService()
   {
      ServiceLoader loader = serviceLoader.get();
      if(loader == null)
      {
         throw new IllegalStateException("No " + ServiceLoader.class.getName() + " found in context");
      }
      CommandService service = loader.onlyOne(CommandService.class);
      if(service == null)
      {
         throw new IllegalStateException("No " + CommandService.class.getName() + " found in context");
      }
      return service;
View Full Code Here

Examples of org.jboss.arquillian.spi.ServiceLoader

    * @param profileBuilder
    * @return
    */
   public static TestRunnerAdaptor build(ProfileBuilder profileBuilder, Configuration configuration)
   {
      ServiceLoader serviceLoader = new DynamicServiceLoader();

      ContextLifecycleManager eventManager = new ContextLifecycleManager(
            configuration,
            new ServiceLoadableProfileBuilder(serviceLoader, profileBuilder),
            serviceLoader
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.