Package org.jboss.arquillian.core.spi

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<RemoteApplicationContextProducer> applicationContextProducers =
                (List<RemoteApplicationContextProducer>) loader.all(RemoteApplicationContextProducer.class);

        for (RemoteApplicationContextProducer applicationContextProducer : applicationContextProducers) {

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

View Full Code Here


     *
     * @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<ClientApplicationContextProducer> applicationContextProducers =
                (List<ClientApplicationContextProducer>) loader.all(ClientApplicationContextProducer.class);

        for (ClientApplicationContextProducer applicationContextProducer : applicationContextProducers) {

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

View Full Code Here

      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 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)
      {
         try
         {
            DeployableContainer<?> deployableContainer = serviceLoader.onlyOne(DeployableContainer.class);
            if(deployableContainer != null)
            {
               reg.create(new ContainerDefImpl("arquillian.xml").setContainerName("default"), serviceLoader);
            }
         }
View Full Code Here

      getCommandService().execute(new KillContainerCommand(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

    private Container createServerContainer(ContainerRegistry registry, final Server server, final int operationTimeout) {
        ContainerDef def = new ContainerDefImpl("arquillian")
                                .container(server.getContainerName())
                                .setMode("custom");

        return registry.create(def, new ServiceLoader() {

            @Override
            public <X> X onlyOne(Class<X> serviceClass, Class<? extends X> defaultServiceClass) {
                return serviceLoaderInstance.get().onlyOne(serviceClass, defaultServiceClass);
            }
View Full Code Here

            final Domain domain, final ServerGroup serverGroup, final int operationTimeout) {
        ContainerDef def = new ContainerDefImpl("arquillian")
                                .container(serverGroup.getContainerName())
                                .setMode("suite");

        return registry.create(def, new ServiceLoader() {

            @Override
            public <X> X onlyOne(Class<X> serviceClass, Class<? extends X> defaultServiceClass) {
                return serviceLoaderInstance.get().onlyOne(serviceClass, defaultServiceClass);
            }
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 the credentials provider
    */
   private CredentialsProvider getCredentialsProvider()
   {
      // get the credentials provider
      ServiceLoader service = serviceLoader.get();
      return service.onlyOne(CredentialsProvider.class);
   }
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.