Package org.jboss.arquillian.core.spi

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


      });
   }
  
   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

   @Test
   public void shouldBeAbleToCreatePrivateContainerConfiguration() throws Exception
   {
      // Override default configured class
      ServiceLoader serviceLoader = Mockito.mock(ServiceLoader.class);
      DeployableContainer<PrivateDummyContainerConfiguration> deployableContainer = Mockito.mock(DeployableContainer.class);

      Mockito.when(serviceLoader.onlyOne(Mockito.same(DeployableContainer.class))).thenReturn(deployableContainer);
      Mockito.when(deployableContainer.getConfigurationClass()).thenReturn(PrivateDummyContainerConfiguration.class);

      String name = "some-name";
      String prop = "prop-value";
View Full Code Here

        }
    }

    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

        }
    }

    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

   @Inject @SuiteScoped
   InstanceProducer<CommandService> commandServiceProducer;

   public void createCommandService(@Observes(precedence = 100) BeforeSuite beforeSuite)
   {
      final ServiceLoader serviceLoader = serviceLoaderInstance.get();
      if (serviceLoader == null)
      {
         throw new IllegalStateException("No " + ServiceLoader.class.getName() + " found in context");
      }

      final CommandService commandService = serviceLoader.onlyOne(CommandService.class);
      if (commandService == null)
      {
         throw new IllegalStateException("No " + CommandService.class.getName() + " found in context");
      }
View Full Code Here

     *          if no provider could be found or there are multiple providers registered.
     */
    private TransactionProvider getTransactionProvider() {

        try {
            ServiceLoader serviceLoader = serviceLoaderInstance.get();

            TransactionProvider transactionProvider = serviceLoader.onlyOne(TransactionProvider.class);

            if (transactionProvider == null) {
                throw new TransactionProviderNotFoundException(
                        "Transaction provider for given test case has not been found.");
            }
View Full Code Here

   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)
         {
            StringBuilder stringBuilder = new StringBuilder()
               .append("Could not add a default container to registry because multiple instances of ")
               .append(DeployableContainer.class.getName())
               .append(" found on classpath (candidates are: ");
            String separator = "";
            for (DeployableContainer s : serviceLoader.all(DeployableContainer.class)) {
               stringBuilder.append(separator)
                  .append(s.getConfigurationClass().getName());
               separator = ", ";
            }
            stringBuilder.append(")");
View Full Code Here

   @Inject @SuiteScoped
   InstanceProducer<CommandService> commandServiceProducer;

   public void createCommandService(@Observes(precedence = 100) BeforeSuite beforeSuite)
   {
      final ServiceLoader serviceLoader = serviceLoaderInstance.get();
      if (serviceLoader == null)
      {
         throw new IllegalStateException("No " + ServiceLoader.class.getName() + " found in context");
      }

      final CommandService commandService = serviceLoader.onlyOne(CommandService.class);
      if (commandService == null)
      {
         throw new IllegalStateException("No " + CommandService.class.getName() + " found in context");
      }
View Full Code Here

      return getCommandService().execute(new ContainerStartedCommand(containerQualifier));
   }

   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

TOP

Related Classes of org.jboss.arquillian.core.spi.ServiceLoader

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.