Package org.jboss.arquillian.test.spi.context

Examples of org.jboss.arquillian.test.spi.context.ClassContext


    }

    public void handleBeforeDeploy(@Observes BeforeDeploy event, Container container) throws Throwable {
        List<ManagedSetupTask> setupTasks = getSetupTasks();
        if (!setupTasks.isEmpty()) {
            ClassContext classContext = classContextInstance.get();
            ObjectStore suiteStore = suiteContextInstance.get().getObjectStore();
            ObjectStore classStore = classContext.getObjectStore();
            MBeanServerConnection server = mbeanServerInstance.get();
            Map<String, String> props = container.getContainerConfiguration().getContainerProperties();
            ManagedSetupContext context = new ManagedSetupContext(suiteStore, classStore, server, props);
            for (ManagedSetupTask task : setupTasks) {
                task.beforeDeploy(context);
View Full Code Here


      }
   }

   public void createClassContext(@Observes(precedence=100) EventContext<ClassEvent> context)
   {
      ClassContext classContext = this.classContextInstance.get();
      try
      {
         classContext.activate(context.getEvent().getTestClass().getJavaClass());
         testClassProducer.set(context.getEvent().getTestClass());
         context.proceed();
      }
      finally
      {
         classContext.deactivate();
      }
   }
View Full Code Here

        }
        if (active.containsKey(container.getName())) {
            return;
        }

        final ClassContext classContext = classContextInstance.get();
        if (classContext == null) {
            return;
        }

        final Class<?> currentClass = classContext.getActiveId();
        final ContainerClassHolder holder = new ContainerClassHolder(container.getName(), currentClass);

        ServerSetup setup = currentClass.getAnnotation(ServerSetup.class);
        if (setup == null) {
            return;
View Full Code Here

      }
   }

   public void createClassContext(@Observes(precedence = 100) EventContext<ClassEvent> context)
   {
      ClassContext classContext = this.classContextInstance.get();
      try
      {
         classContext.activate(context.getEvent().getTestClass().getJavaClass());
         testClassProducer.set(context.getEvent().getTestClass());
         context.proceed();
      }
      finally
      {
         classContext.deactivate();
         if (AfterClass.class.isAssignableFrom(context.getEvent().getClass()))
         {
            classContext.destroy(context.getEvent().getTestClass().getJavaClass());
         }
      }
   }
View Full Code Here

        }
    }

    public void handleBeforeDeploy(@Observes BeforeDeploy event, Container container) throws Throwable {

        ClassContext classContext = classContextInstance.get();
        Class<?> currentClass = classContext.getActiveId();
        ContainerSetup setup = currentClass.getAnnotation(ContainerSetup.class);
        if (setup == null || setupTasks != null)
            return;

        // Call {@link ContainerSetupTask} array
View Full Code Here

        }
    }

    public void handleBeforeDeploy(@Observes BeforeDeploy event, Container container) throws Throwable {

        ClassContext classContext = classContextInstance.get();
        Class<?> currentClass = classContext.getActiveId();
        ContainerSetup setup = currentClass.getAnnotation(ContainerSetup.class);
        if (setup == null || setupTasks != null)
            return;

        // Call {@link ContainerSetupTask} array
View Full Code Here

        }
        if (active.containsKey(container.getName())) {
            return;
        }

        final ClassContext classContext = classContextInstance.get();
        if (classContext == null) {
            return;
        }

        final Class<?> currentClass = classContext.getActiveId();
        final ContainerClassHolder holder = new ContainerClassHolder(container.getName(), currentClass);

        ServerSetup setup = currentClass.getAnnotation(ServerSetup.class);
        if (setup == null) {
            return;
View Full Code Here

   public ContainerMethodExecutor getContainerMethodExecutor(ProtocolDefinition protocol, ProtocolConfiguration protocolConfiguration)
   {
      final ApplicationContext applicationContext = applicationContextInst.get();
      final SuiteContext suiteContext = suiteContextInst.get();
     
      final ClassContext classContext = classContextInst.get();
      final Class<?> classContextId = classContext.getActiveId();
     
      final TestContext testContext = testContextInst.get();
      final Object testContextId = testContext.getActiveId();
     
      ContainerMethodExecutor executor = ((Protocol)protocol.getProtocol()).getExecutor(
            protocolConfiguration,
            protocolMetadata.get(), new CommandCallback()
            {
               @Override
               public void fired(Command<?> event)
               {
                  applicationContext.activate();
                  suiteContext.activate();
                  classContext.activate(classContextId);
                  testContext.activate(testContextId);
                  try
                  {
                     remoteEvent.fire(event);
                  }
                  finally
                  {
                     testContext.deactivate();
                     classContext.deactivate();
                     suiteContext.deactivate();
                     applicationContext.deactivate();
                  }
               }
            });
View Full Code Here

      }
   }

   public void createClassContext(@Observes(precedence=100) EventContext<ClassEvent> context)
   {
      ClassContext classContext = this.classContextInstance.get();
      try
      {
         classContext.activate(context.getEvent().getTestClass().getJavaClass());
         context.proceed();
      }
      finally
      {
         classContext.deactivate();
      }
   }
View Full Code Here

    public List<T> getSetupTasks() throws Exception {

        TaskList<T> taskList = null;

        // Get or create the task list with the {@link ClassContext}
        ClassContext classContext = classContextInstance.get();
        if (classContext.isActive()) {
            ObjectStore objectStore = classContext.getObjectStore();
            taskList = objectStore.get(TaskList.class);
            if (taskList == null) {
                taskList = new TaskList<T>();
                Class<?> currentClass = classContext.getActiveId();
                ContainerSetup setup = currentClass.getAnnotation(ContainerSetup.class);
                if (setup != null) {
                    Class<T>[] classes = (Class<T>[]) setup.value();
                    for (Class<T> clazz : classes) {
                        taskList.add(clazz.newInstance());
                    }
                }
                classContext.getObjectStore().add(TaskList.class, taskList);

                ObjectStore suiteStore = getSuiteObjectStore();
                suiteStore.get(TaskList.class).addAll(taskList);
            }
        }
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.test.spi.context.ClassContext

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.