This commit is contained in:
coderfengyun 2013-12-25 09:22:46 +08:00
parent c8acdf5e4e
commit 93b54cd741
4 changed files with 18 additions and 18 deletions

View File

@ -21,12 +21,12 @@ import org.bench4q.agent.scenario.behavior.Behavior;
import org.bench4q.share.models.agent.BehaviorBriefModel;
import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel;
import org.bench4q.share.models.agent.CleanTestResultModel;
import org.bench4q.share.models.agent.PageBriefModel;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.RunScenarioResultModel;
import org.bench4q.share.models.agent.StopTestModel;
import org.bench4q.share.models.agent.statistics.AgentBriefStatusModel;
import org.bench4q.share.models.agent.statistics.AgentBehaviorsBriefModel;
import org.bench4q.share.models.agent.statistics.AgentPageBriefModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
@ -229,14 +229,14 @@ public class TestController {
@RequestMapping(value = "/pageBrief/{runId}/{pageId}")
@ResponseBody
public PageBriefModel pageBrief(@PathVariable UUID runId,
public AgentPageBriefModel pageBrief(@PathVariable UUID runId,
@PathVariable int pageId) {
ScenarioContext context = this.getScenarioEngine().getRunningTests()
.get(runId);
if (context == null || context.isFinished()) {
return null;
}
return (PageBriefModel) context.getDataStatistics()
return (AgentPageBriefModel) context.getDataStatistics()
.getPageBriefStatistics(pageId);
}

View File

@ -6,7 +6,7 @@ import java.util.Map;
import org.bench4q.agent.scenario.BehaviorResult;
import org.bench4q.agent.scenario.PageResult;
import org.bench4q.share.models.agent.PageBriefModel;
import org.bench4q.share.models.agent.statistics.AgentPageBriefModel;
public class PageResultCollector extends AbstractDataCollector {
Map<Integer, PageBrief> pageBriefMap;
@ -50,7 +50,7 @@ public class PageResultCollector extends AbstractDataCollector {
public Object getPageBriefStatistics(int pageId) {
PageBrief pageBrief = guardTheValueOfThePageIdExists(pageId);
PageBriefModel result = new PageBriefModel();
AgentPageBriefModel result = new AgentPageBriefModel();
result.setCountFromBegin(pageBrief.countFromBegin);
result.setCountThisTime(pageBrief.countThisTime);
result.setMaxResponseTimeFromBegin(pageBrief.maxResponseTimeFromBegin);
@ -59,7 +59,7 @@ public class PageResultCollector extends AbstractDataCollector {
result.setPageId(pageId);
long nowTime = new Date().getTime();
result.setTimeFrame(nowTime - pageBrief.lastSampleTime);
result.setLatestTimeResponseTime(pageBrief.latesTimeResponseTime);
result.setLatestResponseTime(pageBrief.latesTimeResponseTime);
pageBrief.resetTemperatyField();
return result;
}

View File

@ -15,11 +15,11 @@ import javax.xml.bind.Unmarshaller;
import org.apache.commons.io.FileUtils;
import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.agent.BehaviorBriefModel;
import org.bench4q.share.models.agent.PageBriefModel;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.RunScenarioResultModel;
import org.bench4q.share.models.agent.statistics.AgentBriefStatusModel;
import org.bench4q.share.models.agent.statistics.AgentBehaviorsBriefModel;
import org.bench4q.share.models.agent.statistics.AgentPageBriefModel;
import org.junit.Test;
import Communication.HttpRequester;
@ -176,8 +176,8 @@ public class TestWithScriptFile {
fail();
}
System.out.println(httpResponse);
PageBriefModel pageBriefModel = (PageBriefModel) MarshalHelper
.unmarshal(PageBriefModel.class, httpResponse.getContent());
AgentPageBriefModel pageBriefModel = (AgentPageBriefModel) MarshalHelper
.unmarshal(AgentPageBriefModel.class, httpResponse.getContent());
assertTrue(pageBriefModel.getCountFromBegin() > 0);
} catch (Exception e) {
this.stopTest();

View File

@ -3,7 +3,7 @@ package org.bench4q.agent.test.datastatistics;
import org.bench4q.agent.datacollector.impl.PageResultCollector;
import org.bench4q.agent.datacollector.interfaces.DataCollector;
import org.bench4q.agent.scenario.PageResult;
import org.bench4q.share.models.agent.PageBriefModel;
import org.bench4q.share.models.agent.statistics.AgentPageBriefModel;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@ -63,7 +63,7 @@ public class PageResultStatisticsTest {
this.getDataCollector().add(
PageResult.buildPageResult(2,
ScenarioStatisticsTest.makeBehaviorList(1)));
PageBriefModel pageBriefModel = (PageBriefModel) this
AgentPageBriefModel pageBriefModel = (AgentPageBriefModel) this
.getDataCollector().getPageBriefStatistics(2);
assertEquals(2, pageBriefModel.getPageId());
assertEquals(1, pageBriefModel.getCountFromBegin());
@ -72,7 +72,7 @@ public class PageResultStatisticsTest {
assertEquals(200, pageBriefModel.getMinResponseTimeFromBegin());
assertTrue(pageBriefModel.getTimeFrame() >= 0);
assertEquals(200, pageBriefModel.getTotalResponseTimeThisTime());
assertEquals(200, pageBriefModel.getLatestTimeResponseTime());
assertEquals(200, pageBriefModel.getLatestResponseTime());
}
@Test
@ -80,7 +80,7 @@ public class PageResultStatisticsTest {
this.getDataCollector().add(
PageResult.buildPageResult(2,
ScenarioStatisticsTest.makeBehaviorList(2)));
PageBriefModel pageBriefModel = (PageBriefModel) this
AgentPageBriefModel pageBriefModel = (AgentPageBriefModel) this
.getDataCollector().getPageBriefStatistics(2);
System.out.println(pageBriefModel.getCountFromBegin());
assertEquals(2, pageBriefModel.getPageId());
@ -90,7 +90,7 @@ public class PageResultStatisticsTest {
assertEquals(220, pageBriefModel.getMinResponseTimeFromBegin());
assertTrue(pageBriefModel.getTimeFrame() >= 0);
assertEquals(220, pageBriefModel.getTotalResponseTimeThisTime());
assertEquals(220, pageBriefModel.getLatestTimeResponseTime());
assertEquals(220, pageBriefModel.getLatestResponseTime());
}
@Test
@ -101,7 +101,7 @@ public class PageResultStatisticsTest {
this.getDataCollector().add(
PageResult.buildPageResult(2,
ScenarioStatisticsTest.makeBehaviorList(2)));
PageBriefModel pageBriefModel = (PageBriefModel) this
AgentPageBriefModel pageBriefModel = (AgentPageBriefModel) this
.getDataCollector().getPageBriefStatistics(2);
assertEquals(2, pageBriefModel.getPageId());
assertEquals(2, pageBriefModel.getCountFromBegin());
@ -110,7 +110,7 @@ public class PageResultStatisticsTest {
assertEquals(200, pageBriefModel.getMinResponseTimeFromBegin());
assertEquals(420, pageBriefModel.getTotalResponseTimeThisTime());
assertTrue(pageBriefModel.getTimeFrame() >= 0);
assertEquals(220, pageBriefModel.getLatestTimeResponseTime());
assertEquals(220, pageBriefModel.getLatestResponseTime());
}
@Test
@ -119,7 +119,7 @@ public class PageResultStatisticsTest {
this.getDataCollector().add(
PageResult.buildPageResult(2,
ScenarioStatisticsTest.makeBehaviorList(2)));
PageBriefModel model = (PageBriefModel) this.getDataCollector()
AgentPageBriefModel model = (AgentPageBriefModel) this.getDataCollector()
.getPageBriefStatistics(2);
assertEquals(2, model.getPageId());
assertEquals(2, model.getCountFromBegin());
@ -128,6 +128,6 @@ public class PageResultStatisticsTest {
assertEquals(200, model.getMinResponseTimeFromBegin());
assertEquals(220, model.getTotalResponseTimeThisTime());
assertTrue(model.getTimeFrame() >= -0);
assertEquals(220, model.getLatestTimeResponseTime());
assertEquals(220, model.getLatestResponseTime());
}
}