@Test
public void testGetTestListAll() {
createPerfTest("new Test1", Status.TESTING, new Date());
createPerfTest("new Test2", Status.FINISHED, new Date());
PerfTest candidate = testService.getNextRunnablePerfTestPerfTestCandidate();
assertThat(candidate, nullValue());
Pageable pageable = new PageRequest(0, 10);
Page<PerfTest> testList = testService.getPagedAll(getTestUser(), null, null, null, pageable);
assertThat(testList.getContent().size(), is(2));
testList = testService.getPagedAll(getTestUser(), null, null, "F", pageable);
assertThat(testList.getContent().size(), is(1));
// test with no paging
testList = testService.getPagedAll(getTestUser(), null, null, null, null);
assertThat(testList.getContent().size(), is(2));
testList = testService.getPagedAll(getTestUser(), null, null, "F", null);
assertThat(testList.getContent().size(), is(1));
List<PerfTest> list = testService.getAllTesting();
assertThat(list.size(), is(1));
for (PerfTest test : list) {
long systemTimeMills = System.currentTimeMillis();
test.setStartTime(new Date(systemTimeMills));
PerfTest testTemp = testService.getOne(getTestUser(), test.getId());
assertThat(testTemp.getId(), is(test.getId()));
assertThat(testTemp.getStartTime().getTime(), is(systemTimeMills));
testService.markAbnormalTermination(testTemp, StopReason.CANCEL_BY_USER);
testService.markProgress(testTemp, "this test will be TESTING again");
testService.markStatusAndProgress(testTemp, Status.TESTING, "this is just test unit");
List<PerfTest> testingList = testService.getAll(getTestUser(), new Status[]{Status.TESTING});
assertThat(testingList.size(), is(1));
Long testCount = testService.count(getTestUser(), new Status[]{Status.TESTING});
assertThat(testCount, is(1L));
GrinderProperties properties = testService.getGrinderProperties(test);
assertThat(properties, not(nullValue()));
}
createPerfTest("new Test2", Status.getProcessingOrTestingTestStatus()[0], new Date());
list = testService.getCurrentlyRunningTest();
assertThat(list.size(), is(2));
PerfTest finishedTest = createPerfTest("new Test3", Status.ABNORMAL_TESTING, new Date());
finishedTest.setPort(0); // need port number for finishing
list = testService.getAllAbnormalTesting();
assertThat(list.size(), is(1));
testService.updatePerfTestAfterTestFinish(finishedTest);