Package org.jboss.arquillian.spi

Examples of org.jboss.arquillian.spi.TestResult


      /* (non-Javadoc)
       * @see org.jboss.arquillian.spi.ContainerMethodExecutor#invoke(org.jboss.arquillian.spi.TestMethodExecutor)
       */
      public TestResult invoke(TestMethodExecutor testMethodExecutor)
      {
         TestResult result = new TestResult();
         try
         {
            testMethodExecutor.invoke();
            result.setStatus(Status.PASSED);
         }
         catch (final Throwable e)
         {
            result.setStatus(Status.FAILED);
            result.setThrowable(e);
         }
         finally
         {
            result.setEnd(System.currentTimeMillis());
         }
         return result;
      }
View Full Code Here


   /* (non-Javadoc)
    * @see org.jboss.arquillian.spi.event.suite.EventHandler#callback(org.jboss.arquillian.spi.Context, java.lang.Object)
    */
   public void callback(Context context, Test event) throws Exception
   {
      TestResult result = new TestResult();
      try
      {
         event.getTestMethodExecutor().invoke();
         result.setStatus(Status.PASSED);
      }
      catch (Throwable e)
      {
         result.setStatus(Status.FAILED);
         result.setThrowable(e);
      }
      finally
      {
         result.setEnd(System.currentTimeMillis());        
      }
      context.add(TestResult.class, result);
   }
View Full Code Here

   public void callback(Context context, Test event) throws Exception
   {
      ContainerMethodExecutor executor = context.get(ContainerMethodExecutor.class);
      Validate.stateNotNull(executor, "No " + ContainerMethodExecutor.class.getName() + " found in context");
     
      TestResult result = executor.invoke(event.getTestMethodExecutor());
      context.add(TestResult.class, result);
   }
View Full Code Here

      }
      if(result.getIgnoreCount() > 0)
      {
         status = Status.SKIPPED;
      }
      return new TestResult(status, throwable);
   }
View Full Code Here

      return new Statement()
      {
         @Override
         public void evaluate() throws Throwable
         {
            TestResult result = deployableTest.get().test(new TestMethodExecutor()
            {
               public void invoke() throws Throwable
               {
                  Object parameterValues = TestEnrichers.enrich(deployableTest.get().getActiveContext(), getMethod());
                  method.invokeExplosively(test, (Object[])parameterValues);
               }
              
               public Method getMethod()
               {
                  return method.getMethod();
               }
              
               public Object getInstance()
               {
                  return test;
               }
            });
            if(result.getThrowable() != null)
            {
               throw result.getThrowable();
            }
         }
      };
   }
View Full Code Here

      return runTestMethodInternal(className, methodName, props);
   }

   public InputStream runTestMethodEmbedded(String className, String methodName, Map<String, String> props)
   {
      TestResult result = runTestMethodInternal(className, methodName, props);

      // Marshall the TestResult
      try
      {
         return new ByteArrayInputStream(Utils.serialize(result));
View Full Code Here

         ClassLoader oldThreadContextCL = SecurityActions.getThreadContextClassLoader();
         try
         {
            DynamicServiceLoader.setClassLoaderAssociation(serviceClassLoader);
            SecurityActions.setThreadContextClassLoader(SecurityActions.getClassLoader(testClass));
            TestResult testResult = runner.execute(testClass, methodName);
            return testResult;
         }
         finally
         {
            SecurityActions.setThreadContextClassLoader(oldThreadContextCL);
            DynamicServiceLoader.setClassLoaderAssociation(null);
         }
      }
      catch (Throwable th)
      {
         return new TestResult(Status.FAILED, th);
      }
   }
View Full Code Here

      Object testInstance = testMethodExecutor.getInstance();
      String testClass = testInstance.getClass().getName();
      String testMethod = testMethodExecutor.getMethod().getName();

      TestResult result = null;
      NotificationListener listener = null;
      try
      {
         JMXTestRunnerMBean testRunner = getMBeanProxy(JMXTestRunnerMBean.OBJECT_NAME, JMXTestRunnerMBean.class);
         listener = registerNotificationListener(JMXTestRunnerMBean.OBJECT_NAME, testRunner, testInstance);

         if (executionType == ExecutionType.EMBEDDED)
         {
            InputStream resultStream = testRunner.runTestMethodEmbedded(testClass, testMethod, props);
            result = Utils.deserialize(resultStream, TestResult.class);
         }
         else if (executionType == ExecutionType.REMOTE)
         {
            result = testRunner.runTestMethod(testClass, testMethod, props);
         }
      }
      catch (final Throwable e)
      {
         result = new TestResult(Status.FAILED);
         result.setThrowable(e);
      }
      finally
      {
         result.setEnd(System.currentTimeMillis());

         unregisterNotificationListener(JMXTestRunnerMBean.OBJECT_NAME, listener);
      }
      return result;
   }
View Full Code Here

      runner.setXmlSuites(
            Arrays.asList(createSuite(testClass, methodName)));
     
      runner.run();

      TestResult testResult = resultListener.getTestResult();
     
      resetExecutionMode();
     
      return testResult;
   }
View Full Code Here

      deployableTest.getDeployer().undeploy(archive);
   }

   public void run(final IHookCallBack callback, final ITestResult testResult)
   {
      TestResult result = methodExecutor.invoke(new TestMethodExecutor()
      {
         @Override
         public void invoke() throws Throwable
         {
            callback.runTestMethod(testResult);
         }
        
         @Override
         public Method getMethod()
         {
            return testResult.getMethod().getMethod();
         }
        
         @Override
         public Object getInstance()
         {
            return Arquillian.this;
         }
      });
      if(result.getThrowable() != null)
      {
         testResult.setThrowable(result.getThrowable());
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.spi.TestResult

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.