Package org.jboss.arquillian.performance.annotation

Examples of org.jboss.arquillian.performance.annotation.Performance


    private void verifyPerformance(Test event) throws PerformanceException {
        TestResult result = testResultInst.get();
        if(result != null)
        {
            //check if we have set a threshold
            Performance performance = null;
            Annotation[] annotations =  event.getTestMethod().getDeclaredAnnotations();
            for(Annotation a : annotations)
                if(a.annotationType().getName().equals(Performance.class.getCanonicalName()))
                    performance = (Performance) a;

            if(performance != null)
            {
                //System.out.println("For test: "+event.toString()+", it took: "+(result.getEnd()-result.getStart()));
                if(performance.time() > 0 &&
                        performance.time() < (result.getEnd()-result.getStart()))
                {
                    result.setStatus(TestResult.Status.FAILED);
                    result.setThrowable(
                            new PerformanceException("The test didnt finish within the specified time: "
                                    +performance.time()+"ms, it took "+(result.getEnd()-result.getStart())+"ms."));
                }

                // fetch suiteResult, get the correct classResult and append the test to that
                // classResult.
                PerformanceSuiteResult suiteResult = suiteResultInst.get();
                if(suiteResult != null) {
                    suiteResult.getResult(event.getTestClass().getName()).addMethodResult(
                            new PerformanceMethodResult(
                                    performance.time(),
                                    (result.getEnd()-result.getStart()),
                                    event.getTestMethod()));
                }
            }
        }
View Full Code Here


   {
      TestResult result = testResultInst.get();
      if(result != null)
      {
         //check if we have set a threshold
         Performance performance = null;
         Annotation[] annotations =  event.getTestMethod().getDeclaredAnnotations();
         for(Annotation a : annotations)
            if(a.annotationType().getName().equals(Performance.class.getCanonicalName()))
               performance = (Performance) a;
       
         if(performance != null)
         {
            if(performance.time() > 0 &&
               performance.time() < (result.getEnd()-result.getStart()))
            {
               result.setStatus(Status.FAILED);
               result.setThrowable(
                     new PerformanceException("The test didnt finish within the specified time: "
                           +performance.time()+"ms, it took "+(result.getEnd()-result.getStart())+"ms."));
            }
           
            // fetch suiteResult, get the correct classResult and append the test to that
            // classResult.
            PerformanceSuiteResult suiteResult = suiteResultInst.get();
            if(suiteResult != null)
               suiteResult.getResult(event.getTestClass().getName()).addMethodResult(
                     new PerformanceMethodResult(
                           performance.time(),
                           (result.getEnd()-result.getStart()),
                           event.getTestMethod()));
            else
               System.out.println("PerformanceVerifier didnt get PerformanceSuiteResult!");
         }
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.performance.annotation.Performance

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.