add vUserCount for ScriptBriefResultModel
This commit is contained in:
parent
18d02acba6
commit
09fc24e0a9
|
@ -19,6 +19,7 @@ public class ScriptBriefStatistics extends ScriptStatistics {
|
||||||
private long totalSuccessCountFromBegin;
|
private long totalSuccessCountFromBegin;
|
||||||
|
|
||||||
private long totalElapsedTime;
|
private long totalElapsedTime;
|
||||||
|
private long activeVUserCountThisTime;
|
||||||
private long effectiveCount;
|
private long effectiveCount;
|
||||||
|
|
||||||
private ScriptBriefResultModel lastValidBriefResultModel;
|
private ScriptBriefResultModel lastValidBriefResultModel;
|
||||||
|
@ -68,6 +69,10 @@ public class ScriptBriefStatistics extends ScriptStatistics {
|
||||||
this.totalElapsedTime = totalElapsedTime;
|
this.totalElapsedTime = totalElapsedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setActiveVUserCountThisTime(long activeVUserCountThisTime) {
|
||||||
|
this.activeVUserCountThisTime = activeVUserCountThisTime;
|
||||||
|
}
|
||||||
|
|
||||||
private void setEffectiveCounte(long effetiveCount) {
|
private void setEffectiveCounte(long effetiveCount) {
|
||||||
this.effectiveCount = effetiveCount;
|
this.effectiveCount = effetiveCount;
|
||||||
}
|
}
|
||||||
|
@ -99,6 +104,7 @@ public class ScriptBriefStatistics extends ScriptStatistics {
|
||||||
this.setEffectiveCounte(0);
|
this.setEffectiveCounte(0);
|
||||||
this.setMaxResponseTimeThisTime(Long.MIN_VALUE);
|
this.setMaxResponseTimeThisTime(Long.MIN_VALUE);
|
||||||
this.setMinResponseTimeThisTime(Long.MAX_VALUE);
|
this.setMinResponseTimeThisTime(Long.MAX_VALUE);
|
||||||
|
this.setActiveVUserCountThisTime(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initLastValidBriefResultModel() {
|
private void initLastValidBriefResultModel() {
|
||||||
|
@ -149,6 +155,7 @@ public class ScriptBriefStatistics extends ScriptStatistics {
|
||||||
.getSuccessCountFromBegin();
|
.getSuccessCountFromBegin();
|
||||||
this.totalSuccessThroughputThisTime += briefModel
|
this.totalSuccessThroughputThisTime += briefModel
|
||||||
.getSuccessThroughputThisTime();
|
.getSuccessThroughputThisTime();
|
||||||
|
this.activeVUserCountThisTime += briefModel.getvUserCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScriptBriefResultModel getStatistics() {
|
public ScriptBriefResultModel getStatistics() {
|
||||||
|
@ -190,6 +197,7 @@ public class ScriptBriefStatistics extends ScriptStatistics {
|
||||||
}
|
}
|
||||||
result = dealWithInvalidSamplePoint(result);
|
result = dealWithInvalidSamplePoint(result);
|
||||||
result.setSamplingTime(new Date());
|
result.setSamplingTime(new Date());
|
||||||
|
result.setvUserCount(this.activeVUserCountThisTime);
|
||||||
reset();
|
reset();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ public class ScriptBriefStatisticsTest {
|
||||||
ScriptBriefResultModel actualResult = briefStatistics.getStatistics();
|
ScriptBriefResultModel actualResult = briefStatistics.getStatistics();
|
||||||
ScriptBriefResultModel expectedResult = makeExpectedModelForZeroAgent();
|
ScriptBriefResultModel expectedResult = makeExpectedModelForZeroAgent();
|
||||||
assertTrue(actualResult.equals(expectedResult));
|
assertTrue(actualResult.equals(expectedResult));
|
||||||
|
assertEquals(0, actualResult.getvUserCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScriptBriefResultModel makeExpectedModelForZeroAgent() {
|
private ScriptBriefResultModel makeExpectedModelForZeroAgent() {
|
||||||
|
@ -49,6 +50,7 @@ public class ScriptBriefStatisticsTest {
|
||||||
result.setSuccessThroughputThisTime(0);
|
result.setSuccessThroughputThisTime(0);
|
||||||
result.setTotalFailCountFromBegin(0);
|
result.setTotalFailCountFromBegin(0);
|
||||||
result.setTotalSuccessCountFromBegin(0);
|
result.setTotalSuccessCountFromBegin(0);
|
||||||
|
result.setvUserCount(0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +58,7 @@ public class ScriptBriefStatisticsTest {
|
||||||
public void addOneTest() {
|
public void addOneTest() {
|
||||||
long timeFrame = 200;
|
long timeFrame = 200;
|
||||||
this.getBriefStatistics().add(
|
this.getBriefStatistics().add(
|
||||||
buildOneInputModel(timeFrame, 200, 200, 200, 40000, 1));
|
buildOneInputModel(timeFrame, 200, 200, 200, 40000, 1, 10));
|
||||||
ScriptBriefResultModel actualModel = this.getBriefStatistics()
|
ScriptBriefResultModel actualModel = this.getBriefStatistics()
|
||||||
.getStatistics();
|
.getStatistics();
|
||||||
ScriptBriefResultModel expectedModel = this
|
ScriptBriefResultModel expectedModel = this
|
||||||
|
@ -64,9 +66,22 @@ public class ScriptBriefStatisticsTest {
|
||||||
assertTrue(actualModel.equals(expectedModel));
|
assertTrue(actualModel.equals(expectedModel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void addOneTestWithNegativeVUser() {
|
||||||
|
long timeFrame = 200;
|
||||||
|
this.getBriefStatistics().add(
|
||||||
|
buildOneInputModel(timeFrame, 200, 200, 200, 40000, 1, -2));
|
||||||
|
ScriptBriefResultModel actualModel = this.getBriefStatistics()
|
||||||
|
.getStatistics();
|
||||||
|
ScriptBriefResultModel expectedBriefResultModel = this
|
||||||
|
.makeExepectedModelForOneAgent();
|
||||||
|
expectedBriefResultModel.setvUserCount(-2);
|
||||||
|
assertTrue(actualModel.equals(expectedBriefResultModel));
|
||||||
|
}
|
||||||
|
|
||||||
public static AgentBriefStatusModel buildOneInputModel(long timeFrame,
|
public static AgentBriefStatusModel buildOneInputModel(long timeFrame,
|
||||||
long minRT, long maxRT, long totalRT, long totalSqureRT,
|
long minRT, long maxRT, long totalRT, long totalSqureRT,
|
||||||
long successCount) {
|
long successCount, long vUserCount) {
|
||||||
AgentBriefStatusModel model = new AgentBriefStatusModel();
|
AgentBriefStatusModel model = new AgentBriefStatusModel();
|
||||||
model.setTimeFrame(timeFrame);
|
model.setTimeFrame(timeFrame);
|
||||||
model.setSuccessCountFromBegin(successCount);
|
model.setSuccessCountFromBegin(successCount);
|
||||||
|
@ -80,6 +95,7 @@ public class ScriptBriefStatisticsTest {
|
||||||
model.setFailCountThisTime(FAIL_COUNT);
|
model.setFailCountThisTime(FAIL_COUNT);
|
||||||
model.setTotalResponseTimeThisTime(totalRT);
|
model.setTotalResponseTimeThisTime(totalRT);
|
||||||
model.setTotalSqureResponseTimeThisTime(totalSqureRT);
|
model.setTotalSqureResponseTimeThisTime(totalSqureRT);
|
||||||
|
model.setvUserCount(vUserCount);
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +110,7 @@ public class ScriptBriefStatisticsTest {
|
||||||
result.setSuccessThroughputThisTime(1 * TIME_UNIT_MS / 200);
|
result.setSuccessThroughputThisTime(1 * TIME_UNIT_MS / 200);
|
||||||
result.setTotalFailCountFromBegin(1);
|
result.setTotalFailCountFromBegin(1);
|
||||||
result.setTotalSuccessCountFromBegin(1);
|
result.setTotalSuccessCountFromBegin(1);
|
||||||
|
result.setvUserCount(10);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,9 +118,9 @@ public class ScriptBriefStatisticsTest {
|
||||||
public void addTwoTest() {
|
public void addTwoTest() {
|
||||||
long timeFrame1 = 200, timeFrame2 = 500;
|
long timeFrame1 = 200, timeFrame2 = 500;
|
||||||
this.briefStatistics.add(buildOneInputModel(timeFrame1, 200, 200, 200,
|
this.briefStatistics.add(buildOneInputModel(timeFrame1, 200, 200, 200,
|
||||||
40000, 1));
|
40000, 1, 10));
|
||||||
this.briefStatistics.add(buildOneInputModel(timeFrame2, 190, 210, 400,
|
this.briefStatistics.add(buildOneInputModel(timeFrame2, 190, 210, 400,
|
||||||
80200, 2));
|
80200, 2, 20));
|
||||||
ScriptBriefResultModel actualModel = this.briefStatistics
|
ScriptBriefResultModel actualModel = this.briefStatistics
|
||||||
.getStatistics();
|
.getStatistics();
|
||||||
ScriptBriefResultModel expectedModel = makeExpectedModelForTwoAgent();
|
ScriptBriefResultModel expectedModel = makeExpectedModelForTwoAgent();
|
||||||
|
@ -121,11 +138,8 @@ public class ScriptBriefStatisticsTest {
|
||||||
result.setSuccessThroughputThisTime(9);
|
result.setSuccessThroughputThisTime(9);
|
||||||
result.setTotalFailCountFromBegin(2);
|
result.setTotalFailCountFromBegin(2);
|
||||||
result.setTotalSuccessCountFromBegin(3);
|
result.setTotalSuccessCountFromBegin(3);
|
||||||
|
result.setvUserCount(30);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testAddOneRealModel() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue