*/
@Test
public void testSavePerfTestExist() {
String testName = "test1";
String newName = "new test1";
PerfTest test = createPerfTest(testName, Status.READY, new Date());
test.setTestName(newName);
PerfTest newTest = new PerfTest();
newTest.setId(test.getId());
newTest.setTestName(newName);
newTest.setStatus(Status.SAVED);
newTest.setThreshold(test.getThreshold());
newTest.setDuration(test.getDuration());
newTest.setVuserPerAgent(test.getVuserPerAgent());
newTest.setScheduledTime(test.getScheduledTime());
newTest.setIgnoreSampleCount(test.getIgnoreSampleCount());
newTest.setTargetHosts(test.getTargetHosts());
newTest.setScriptName(test.getScriptName());
newTest.setProcesses(2);
newTest.setThreads(2);
newTest.setVuserPerAgent(newTest.getProcesses() * newTest.getThreads());
newTest.setRegion(config.getRegion());
newTest.setAgentCount(1);
ModelMap model = new ModelMap();
controller.saveOne(getTestUser(), newTest, false, model);
controller.getOne(getTestUser(), newTest.getId(), model);
PerfTest testInDB = (PerfTest) model.get(PARAM_TEST);
assertThat(testInDB.getTestName(), is(newName));
assertThat(testInDB.getId(), is(test.getId()));
model.clear();
newTest.setStatus(Status.READY);
controller.saveOne(getTestUser(), newTest, false, model);
controller.getOne(getTestUser(), newTest.getId(), model);
testInDB = (PerfTest) model.get(PARAM_TEST);
assertThat(testInDB.getTestName(), is(newName));
assertThat(testInDB.getId(), is(test.getId()));
// test status id "START_TESTING", can not be saved.
newTest.setStatus(Status.START_TESTING);
try {
newTest.setStatus(Status.START_TESTING);