Package org.jboss.arquillian.core.spi

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


   }

   @Test
   public void shouldHandleLifeCycleEvents() throws Exception
   {
      Manager manager = getManager();
      EventTestRunnerAdaptor adaptor = new EventTestRunnerAdaptor(manager);
     
      Class<?> testClass = getClass();
      Method testMethod = testClass.getMethod("shouldHandleLifeCycleEvents");
      Object testInstance = this;
View Full Code Here


    private void doFilterHttp(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
            throws IOException, ServletException {

        try {
            ManagerBuilder builder = ManagerBuilder.from().extension(Class.forName(DEFAULT_EXTENSION_CLASS));
            Manager manager = builder.create();

            manager.start();

            manager.bind(ApplicationScoped.class, Manager.class, manager);

            manager.fire(new BeforeSuite());
            manager.fire(new BeforeRequest(request, response));

            manager.bind(RequestScoped.class, ServletRequest.class, request);
            manager.bind(RequestScoped.class, ServletResponse.class, response);
            manager.bind(RequestScoped.class, HttpServletRequest.class, request);
            manager.bind(RequestScoped.class, HttpServletResponse.class, response);
            manager.bind(RequestScoped.class, FilterChain.class, filterChain);

            try {
                manager.fire(new ProcessHttpRequest());
            } finally {
                manager.fire(new AfterRequest(request, response));
                manager.fire(new AfterSuite());

                manager.shutdown();
            }

        } catch (ClassNotFoundException e) {
            throw new IllegalStateException("Default service loader can't be found: " + DEFAULT_EXTENSION_CLASS, e);
        }
View Full Code Here

   }

   @Test
   public void shouldHandleLifeCycleEvents() throws Exception
   {
      Manager manager = getManager();
      EventTestRunnerAdaptor adaptor = new EventTestRunnerAdaptor(manager);
     
      Class<?> testClass = getClass();
      Method testMethod = testClass.getMethod("shouldHandleLifeCycleEvents");
      Object testInstance = this;
View Full Code Here

   }

   @Test
   public void shouldHandleLifeCycleEvents() throws Exception
   {
      Manager manager = getManager();
      EventTestRunnerAdaptor adaptor = new EventTestRunnerAdaptor(manager);
     
      Class<?> testClass = getClass();
      Method testMethod = testClass.getMethod("shouldHandleLifeCycleEvents");
      Object testInstance = this;
     
      TestMethodExecutor testExecutor = Mockito.mock(TestMethodExecutor.class);
      Mockito.when(testExecutor.getInstance()).thenReturn(testInstance);
      Mockito.when(testExecutor.getMethod()).thenReturn(testMethod);

      // ApplicationContext is auto started, deactivate to be future proof
      manager.getContext(ApplicationContext.class).deactivate();
     
      verifyNoActiveContext(manager);

      adaptor.beforeSuite();
      assertEventFired(BeforeSuite.class, 1);
View Full Code Here

   private static List<String> callOrder = new ArrayList<String>();

   @Test
   public void shouldExecuteProducersOnSameEventBeforeConsumers() throws Exception
   {
      Manager manager = ManagerBuilder.from()
                  .extensions(ConsumerOne.class, ProducerOne.class, ProducerTwo.class).create();
     
      manager.fire("test");
     
      Assert.assertEquals("ProducerOne", callOrder.get(0));
      Assert.assertEquals("ProducerTwo", callOrder.get(1));
      Assert.assertEquals("ConsumerOne", callOrder.get(2));
   }
View Full Code Here

   @Test
   public void shouldBeAbleToUseProtectedFieldsAndMethods() throws Exception
   {
      Class<?> observerClass = SecurityActions.loadClass(
            this.getClass().getPackage().getName() + ".test.PrivateObserver");
      Manager manager = ManagerBuilder.from().extension(observerClass).create();

      manager.fire("Test");

      Field wasCalled = observerClass.getField("wasCalled");
      wasCalled.setAccessible(true);
      Assert.assertTrue((Boolean)wasCalled.get(null));
   }
View Full Code Here

      }
   }

   private void loadContainer(Class<?>... extensions) throws Exception
   {
      Manager manager = startManager(extensions);
      try
      {
         perform(manager, selectContainer(manager));
      }
      catch (Exception e)
      {
         manager.shutdown();
         throw e;
      }
   }
View Full Code Here

      }
   }

   private Manager startManager(Class<?>... extensions)
   {
      Manager manager = getFromContext(Manager.class);
      if (isStarted(manager))
         return manager;

      manager = startNewManager(extensions);
      putInContext(Manager.class, manager);
View Full Code Here

      return manager != null;
   }

   Manager startNewManager(Class<?>... extensions)
   {
      Manager manager = ManagerBuilder.from().extensions(extensions).create();
      manager.start();
      return manager;
   }
View Full Code Here

    private void executePutOperation(HttpServletRequest request, HttpServletResponse response) throws IOException, ClassNotFoundException {
        if (request.getContentLength() > 0) {
            ObjectInputStream input = new ObjectInputStream(new BufferedInputStream(request.getInputStream()));
            CommandPayload payload = (CommandPayload) input.readObject();
            Command operation = payload.getCommand();
            Manager manager = (Manager)request.getAttribute(ARQUILLIAN_MANAGER_ATTRIBUTE);
            // execute remote Event
            try{
                manager.fire(new ActivateManager(manager));
                manager.inject(operation);
                operation.perform();
                manager.fire(new PassivateManager(manager));
            } catch (Throwable e) {
                payload.setThrowable(e);
            }
            response.setStatus(HttpServletResponse.SC_OK);
            ObjectOutputStream output = new ObjectOutputStream(response.getOutputStream());
View Full Code Here

TOP

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

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.