diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Calendar.ucls b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Calendar.ucls new file mode 100644 index 00000000..d3a0629e --- /dev/null +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Calendar.ucls @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_RunningAgent.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_RunningAgent.java index 04a8da9f..15fd80d0 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_RunningAgent.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_RunningAgent.java @@ -149,12 +149,17 @@ public class Test_RunningAgent extends TestBase_MakeUpTestPlan { @Test public void test_RatioIntoEffectWithRatioHalf() { - ScheduleModel scheduleModel = new ScheduleModel(); double ratio = 0.5; + int maxLoad = 100; + testRatioCore(ratio, maxLoad); + } + + private void testRatioCore(double ratio, int maxLoad) { + ScheduleModel scheduleModel = new ScheduleModel(); scheduleModel.getPoints().addAll( Arrays.asList(new ScheduleModel.PointModel(0, 0), - new ScheduleModel.PointModel(30, 100))); - ScheduleModel target = scheduleModel.ratioIntoEffect(0.5); + new ScheduleModel.PointModel(30, maxLoad))); + ScheduleModel target = scheduleModel.ratioIntoEffect(ratio); for (int i = 0; i < scheduleModel.getPoints().size(); i++) { assertEquals(target.getPoints().get(i).getTimeInSecond(), scheduleModel.getPoints().get(i).getTimeInSecond()); @@ -163,4 +168,12 @@ public class Test_RunningAgent extends TestBase_MakeUpTestPlan { target.getPoints().get(i).getLoad()); } } + + @Test + public void test_RatioIntoEffectWithVeryLittleLoad() { + double ratio = 0.1; + int maxLoad = 5; + testRatioCore(ratio, maxLoad); + } + } diff --git a/Bench4Q-Share/src/main/java/org/bench4q/share/models/agent/scriptrecord/ScheduleModel.java b/Bench4Q-Share/src/main/java/org/bench4q/share/models/agent/scriptrecord/ScheduleModel.java index fe68a108..11dcb8b0 100644 --- a/Bench4Q-Share/src/main/java/org/bench4q/share/models/agent/scriptrecord/ScheduleModel.java +++ b/Bench4Q-Share/src/main/java/org/bench4q/share/models/agent/scriptrecord/ScheduleModel.java @@ -7,10 +7,12 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; +@XmlRootElement public class ScheduleModel { private List points; - + @XmlElementWrapper + @XmlElement public List getPoints() { return points; } @@ -53,12 +55,12 @@ public class ScheduleModel { return result; } + @XmlRootElement public static class PointModel { // Time Unit is second private long timeInSecond; private int load; - public PointModel() { } @@ -67,6 +69,7 @@ public class ScheduleModel { this.setLoad(load); } + @XmlElement public long getTimeInSecond() { return timeInSecond; } @@ -75,6 +78,7 @@ public class ScheduleModel { this.timeInSecond = timeInSecond; } + @XmlElement public int getLoad() { return load; } diff --git a/Bench4Q-Web/src/main/resources/ipConfig.properties b/Bench4Q-Web/src/main/resources/ipConfig.properties index 61377bd7..06535e4f 100644 --- a/Bench4Q-Web/src/main/resources/ipConfig.properties +++ b/Bench4Q-Web/src/main/resources/ipConfig.properties @@ -1 +1 @@ -masterAddress=localhost:8901 \ No newline at end of file +masterAddress=133.133.2.100:8901 \ No newline at end of file