src/main/java/com/capitalone/dashboard/event/TestResultEventListener.java
/**
     * Create and save performance object for every test_result type is performance
     * @param event
     */
Create and save performance object for every test_result type is performance
@param event
Create and save performance object for every test_result type is performance @param event
@Override
    public void onAfterSave(AfterSaveEvent<TestResult> event) {
        TestResult testResult = event.getSource();
        LOGGER.info("TestResult save event triggered");
        if (!TestSuiteType.Performance.equals(testResult.getType())) {
            LOGGER.info("TestResult save event ignored since its not performance type");
            return;
        }
        List<TestCapability> testCapabilities = new ArrayList<>(testResult.getTestCapabilities());
        if (CollectionUtils.isEmpty(testCapabilities)){
            LOGGER.info("No Test Capabilities found for the test result : " + testResult.getId());
            return;
        }
        testCapabilities.sort(Comparator.comparing(TestCapability::getTimestamp).reversed());
        TestCapability lastExecutedTestCapabiblity = testCapabilities.iterator().next();
        lastExecutedTestCapabiblity.getTestSuites().forEach(testSuite -> testSuite.getTestCases().forEach(testCase ->
                extractPerformanceMetrics(testCase, lastExecutedTestCapabiblity)));
        CollectorItem perfCollectorItem = getPerfCollectorItem(testResult);
        createPerformanceDoc(testResult, lastExecutedTestCapabiblity, perfCollectorItem);
        LOGGER.info("New performance document created from test_result successfully");
        }
@ Override public void onAfterSave ( AfterSaveEvent < TestResult > event ) { TestResult testResult = event . getSource ( ) ; LOGGER . info ( "TestResult save event triggered" ) ; if ( ! TestSuiteType . Performance . equals ( testResult . getType ( ) ) ) { LOGGER . info ( "TestResult save event ignored since its not performance type" ) ; return ; } List < TestCapability > testCapabilities = new ArrayList < > ( testResult . getTestCapabilities ( ) ) ; if ( CollectionUtils . isEmpty ( testCapabilities ) ) { LOGGER . info ( "No Test Capabilities found for the test result : " + testResult . getId ( ) ) ; return ; } testCapabilities . sort ( Comparator . comparing ( TestCapability :: getTimestamp ) . reversed ( ) ) ; TestCapability lastExecutedTestCapabiblity = testCapabilities . iterator ( ) . next ( ) ; lastExecutedTestCapabiblity . getTestSuites ( ) . forEach ( testSuite -> testSuite . getTestCases ( ) . forEach ( testCase -> extractPerformanceMetrics ( testCase , lastExecutedTestCapabiblity ) ) ) ; CollectorItem perfCollectorItem = getPerfCollectorItem ( testResult ) ; createPerformanceDoc ( testResult , lastExecutedTestCapabiblity , perfCollectorItem ) ; LOGGER . info ( "New performance document created from test_result successfully" ) ; }
Create and save performance object for every test_result type is performance
 @param event
Create and save performance object for every test_result type is performance @param event
// Ignore anything other than performance tests