Examples of ClassContext


Examples of org.jboss.arquillian.impl.core.spi.context.ClassContext

      ManagerImpl manager = ManagerBuilder.from()
         .context(SuiteContextImpl.class)
         .context(ClassContextImpl.class).create();

      SuiteContext suiteContext = manager.getContext(SuiteContext.class);
      ClassContext classContext = manager.getContext(ClassContext.class);

      try
      {
         suiteContext.activate();
         classContext.activate(this.getClass());
        
         Object testObject = new Object();
        
         manager.bind(SuiteScoped.class, Object.class, testObject);
        
         Assert.assertEquals(
               "Verify value was bound to the correct context",
               testObject,
               suiteContext.getObjectStore().get(Object.class));

         Assert.assertNull(
               "Verify value was not bound to any other context",
               classContext.getObjectStore().get(Object.class));
      }
      finally
      {
         classContext.deactivate();
         classContext.destroy(this.getClass());
         suiteContext.deactivate();
         suiteContext.destroy();
      }
   }
View Full Code Here

Examples of org.jboss.arquillian.impl.core.spi.context.ClassContext

      }
   }

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

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

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

      }
   }

   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

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

        }
        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

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

      }
   }

   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

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

        }
    }

    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

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

        }
    }

    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

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

        }
        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

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

   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
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.