public void afterSecurityScan( TestCaseRunner testRunner, SecurityTestRunContext runContext, SecurityScanResult securityCheckResult) { if (securityCheckResult.getSecurityScan().getTestStep().getId().equals(testStep.getId())) { if (securityCheckResult.getStatus() == ResultStatus.CANCELED) { progressBar.setString(STATE_CANCEL); progressBar.setBackground(UNKNOWN_COLOR); } else // progressbar can change its color only if not missing // assertions or parameters if (securityCheckResult.getStatus() == ResultStatus.FAILED) { progressBar.setForeground(FAILED_COLOR); } else if (securityCheckResult.getStatus() == ResultStatus.OK) { SecurityScan securityScan = securityCheckResult.getSecurityScan(); if (securityScan.getAssertionCount() == 0) { if (!progressBar.getForeground().equals(FAILED_COLOR)) progressBar.setForeground(MISSING_ASSERTION_COLOR); progressBar.setString(STATE_MISSING_ASSERTIONS); } // or if there is no parameters. if (securityScan instanceof AbstractSecurityScanWithProperties && ((AbstractSecurityScanWithProperties) securityScan) .getParameterHolder() .getParameterList() .size() == 0) { if (!progressBar.getForeground().equals(FAILED_COLOR)) progressBar.setForeground(MISSING_ASSERTION_COLOR); if (!progressBar.getString().equals(STATE_MISSING_ASSERTIONS)) progressBar.setString(STATE_MISSING_PARAMETERS); } // can not change to OK color if any of previous scans // failed or missing assertions/parameters if (!progressBar.getForeground().equals(FAILED_COLOR) && !progressBar.getForeground().equals(MISSING_ASSERTION_COLOR)) { progressBar.setForeground(OK_COLOR); } } progressBar.setValue(((SecurityTestRunContext) runContext).getCurrentScanIndex() + 1); ((DefaultTreeModel) tree.getModel()).nodeChanged(node); } }
@Override public void afterStep( TestCaseRunner testRunner, SecurityTestRunContext runContext, SecurityTestStepResult result) { if (runContext.getCurrentStep().getId().equals(testStep.getId())) { if (!(progressBar.getString().equals(STATE_CANCEL) || progressBar.getString().equals(STATE_MISSING_ASSERTIONS) || progressBar.getString().equals(STATE_MISSING_PARAMETERS)) && securityTest.getSecurityTestStepResultMap().get(testStep) != null) { SecurityTestStepResult results = securityTest.getSecurityTestStepResultMap().get(testStep); /* * This is hack since SecurityTestStepResult.getStatus() do not * returns real state of execution. * * SKIPPED state overides all except FAILED , which is wrong. */ boolean skipped = results.getSecurityScanResultList().size() > 0; for (SecurityScanResult res : results.getSecurityScanResultList()) { if (res.getStatus() == ResultStatus.SKIPPED) continue; else { skipped = false; break; } } if (skipped) { progressBar.setString("SKIPPED"); progressBar.setForeground(UNKNOWN_COLOR); } else { progressBar.setString(STATE_DONE); } } } else progressBar.setBackground(UNKNOWN_COLOR); progressBar.setValue(progressBar.getMaximum() == 0 ? 1 : progressBar.getMaximum()); ((DefaultTreeModel) tree.getModel()).nodeChanged(node); }