Package org.jboss.arquillian.spi

Examples of org.jboss.arquillian.spi.TestResult


      return new Statement()
      {
         @Override
         public void evaluate() throws Throwable
         {
            TestResult result = deployableTest.get().test(new TestMethodExecutor()
            {
               public void invoke() throws Throwable
               {
                  try
                  {
                     Object parameterValues = TestEnrichers.enrich(deployableTest.get().getActiveContext(), getMethod());
                     method.invokeExplosively(test, (Object[])parameterValues);
                  }
                  catch (Throwable e)
                  {
                     // Force a way to return the thrown Exception from the Container the client.
                     caughtTestException.set(e);
                     throw e;
                  }
               }
              
               public Method getMethod()
               {
                  return method.getMethod();
               }
              
               public Object getInstance()
               {
                  return test;
               }
            });
            if(result.getThrowable() != null)
            {
               throw result.getThrowable();
            }
         }
      };
   }
View Full Code Here


        
         Class<?> testClass = SecurityActions.getThreadContextClassLoader().loadClass(className);
        
         TestRunner runner = TestRunners.getTestRunner();
        
         TestResult testResult = runner.execute(testClass, methodName);

         if(OUTPUT_MODE_SERIALIZED.equalsIgnoreCase(outputMode))
         {
            writeObject(testResult, response);
         }
View Full Code Here

      }
   }
  
   private TestResult createFailedResult(Throwable throwable)
   {
      return new TestResult(Status.FAILED, throwable);
   }
View Full Code Here

      {
         TestEnrichers.enrich(testMethodExecutor.getInstance());

         testMethodExecutor.invoke();
        
         return new TestResult()
         {
            private static final long serialVersionUID = 1L;

            @Override
            public Throwable getThrowable() { return null; }
           
            @Override
            public Status getStatus() { return Status.PASSED; }
         };
      }
      catch (final Throwable e)
      {
         return new TestResult()
         {
            private static final long serialVersionUID = 1L;

            @Override
            public Status getStatus() {return Status.FAILED; }
View Full Code Here

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

      TestResult result = null;
      try
      {
         ObjectName objectName = new ObjectName(JMXTestRunnerMBean.OBJECT_NAME);
         JMXTestRunnerMBean testRunner = getMBeanProxy(objectName, JMXTestRunnerMBean.class);

         ExecutionType type = (ExecutionType)properties.get(ExecutionType.class);
         if (type == ExecutionType.EMBEDDED)
         {
            byte[] resultBytes = testRunner.runTestMethodSerialized(testClass, testMethod, properties);
            ByteArrayInputStream resultStream = new ByteArrayInputStream(resultBytes);
            ObjectInputStream ois = new ObjectInputStream(resultStream);
            result = (TestResult)ois.readObject();
         }
         else
         {
            result = testRunner.runTestMethod(testClass, testMethod, properties);
         }
      }
      catch (final Throwable e)
      {
         result = new TestResult(Status.FAILED);
         result.setThrowable(e);
      }
      finally
      {
         result.setEnd(System.currentTimeMillis());
      }
      return result;
   }
View Full Code Here

      return runTestMethodInternal(className, methodName, props);
   }

   public byte[] runTestMethodSerialized(String className, String methodName, Properties props)
   {
      TestResult result = runTestMethodInternal(className, methodName, props);

      // Marshall the TestResult
      try
      {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

         mbeanServerAssociation.set(mbeanServer);
        
         TestRunner runner = TestRunners.getTestRunner(JMXTestRunner.class.getClassLoader());
         Class<?> testClass = testClassLoader.loadTestClass(className);
        
         TestResult testResult = runner.execute(testClass, methodName);
         return testResult;
      }
      catch (Throwable th)
      {
         return new TestResult(Status.FAILED, th);
      }
      finally
      {
         mbeanServerAssociation.remove();
      }
View Full Code Here

      return new Statement()
      {
         @Override
         public void evaluate() throws Throwable
         {
            TestResult result = deployableTest.get().test(new TestMethodExecutor()
            {
               @Override
               public void invoke(Object... parameters) throws Throwable
               {
                  try
                  {
                     //Object parameterValues = TestEnrichers.enrich(deployableTest.get().getActiveContext(), getMethod());
                     method.invokeExplosively(test, parameters); //, (Object[])parameterValues);
                  }
                  catch (Throwable e)
                  {
                     // Force a way to return the thrown Exception from the Container the client.
                     caughtTestException.set(e);
                     throw e;
                  }
               }
              
               public Method getMethod()
               {
                  return method.getMethod();
               }
              
               public Object getInstance()
               {
                  return test;
               }
            });
            if(result.getThrowable() != null)
            {
               throw result.getThrowable();
            }
         }
      };
   }
View Full Code Here

                        "?outputMode=serializedObject&className=" + testClass.getName() +
                        "&methodName=" + testMethodExecutor.getMethod().getName();
     
      try
      {
         TestResult result = execute(url);
         return result;
      }
      catch (Exception e)
      {
         throw new IllegalStateException("Error launching test " + testClass.getName() + " " + testMethodExecutor.getMethod(), e);
View Full Code Here

               ois.close();
               if (!(o instanceof TestResult))
               {
                  throw new IllegalStateException("Error reading test results - expected a TestResult but got " + o);
               }
               TestResult result = (TestResult) o;
               return result;
            }
            else if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_NOT_FOUND)
            {
               throw new IllegalStateException(
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.