List of usage examples for org.joda.time DateTime toDateTime
public DateTime toDateTime()
this
. From source file:pl.lstypka.jevidence.mapper.ExecutionMapper.java
License:Apache License
private void fillExecutionProperties(Execution execution) { DateTime startedAt = null; DateTime finishedAt = null;/*from w w w.j a va 2 s. co m*/ int passed = 0; int failed = 0; int error = 0; int skipped = 0; for (TestClass testClass : execution.getTestClasses()) { fillTestClassDate(testClass); // date properties if (startedAt == null || startedAt.isAfter(testClass.getStartedAt())) { startedAt = testClass.getStartedAt(); } if (finishedAt == null || finishedAt.isBefore(testClass.getFinishedAt())) { finishedAt = testClass.getFinishedAt(); } // test numbers passed += testClass.getPassed(); failed += testClass.getFailed(); error += testClass.getErrors(); skipped += testClass.getSkipped(); } execution.setStartedAt(startedAt); execution.setFinishedAt(finishedAt); execution.setDuration(new Duration(startedAt.toDateTime(), finishedAt.toDateTime()).getMillis()); execution.setPassed(passed); execution.setFailed(failed); execution.setErrors(error); execution.setSkipped(skipped); }
From source file:pl.lstypka.jevidence.mapper.ExecutionMapper.java
License:Apache License
private void fillTestClassDate(TestClass testClass) { DateTime startedAt = null; DateTime finishedAt = null;/*from www . j a v a 2s .c o m*/ int passed = 0; int failed = 0; int error = 0; int skipped = 0; for (Test test : testClass.getTests()) { // check date if (startedAt == null || startedAt.isAfter(test.getStartedAt())) { startedAt = test.getStartedAt(); } if (finishedAt == null || finishedAt.isBefore(test.getFinishedAt())) { finishedAt = test.getFinishedAt(); } // check test numbers switch (test.getStatus()) { case SUCCESS: passed++; break; case FAILED: failed++; break; case ERROR: error++; break; case SKIPPED: skipped++; break; } } testClass.setStartedAt(startedAt); testClass.setFinishedAt(finishedAt); testClass.setDuration(new Duration(startedAt.toDateTime(), finishedAt.toDateTime()).getMillis()); testClass.setPassed(passed); testClass.setFailed(failed); testClass.setErrors(error); testClass.setSkipped(skipped); }