diff --git a/Bench4Q-Monitor-Sigar/src/test/java/org/bench4q/monitor/Test_LimitableFieldsModel.java b/Bench4Q-Monitor-Sigar/src/test/java/org/bench4q/monitor/Test_LimitableFieldsModel.java new file mode 100644 index 00000000..67a4669a --- /dev/null +++ b/Bench4Q-Monitor-Sigar/src/test/java/org/bench4q/monitor/Test_LimitableFieldsModel.java @@ -0,0 +1,18 @@ +package org.bench4q.monitor; + +import java.util.List; + +import org.bench4q.monitor.model.LimitableFieldsModel; +import org.junit.Test; + +public class Test_LimitableFieldsModel { + @Test + public void testLimitableFieldsModelGet(){ + LimitableFieldsModel limitList = new LimitableFieldsModel(); + List result = limitList.getFields(); + for (int i = 0; i < result.size(); i++){ + System.out.println(result.get(i).toString()); + } + } + +} diff --git a/Bench4Q-Monitor-Sigar/src/test/java/org/bench4q/monitor/Test_MonitorMain.java b/Bench4Q-Monitor-Sigar/src/test/java/org/bench4q/monitor/Test_MonitorMain.java new file mode 100644 index 00000000..54a9766d --- /dev/null +++ b/Bench4Q-Monitor-Sigar/src/test/java/org/bench4q/monitor/Test_MonitorMain.java @@ -0,0 +1,20 @@ +package org.bench4q.monitor; + +import static org.junit.Assert.*; + +import org.bench4q.monitor.model.MonitorMain; +import org.hyperic.sigar.SigarException; +import org.junit.Test; + +public class Test_MonitorMain { + @Test + public void testContructMonitorMainWithNull() { + MonitorMain result = null; + try { + result = new MonitorMain(null); + } catch (SigarException e) { + e.printStackTrace(); + } + assertNotNull(result); + } +} diff --git a/Bench4Q-Monitor-Sigar/src/test/java/org/bench4q/monitor/controler/Test_MainControler.java b/Bench4Q-Monitor-Sigar/src/test/java/org/bench4q/monitor/controler/Test_MainControler.java new file mode 100644 index 00000000..aed2bd05 --- /dev/null +++ b/Bench4Q-Monitor-Sigar/src/test/java/org/bench4q/monitor/controler/Test_MainControler.java @@ -0,0 +1,42 @@ +package org.bench4q.monitor.controler; + +import java.util.ArrayList; +import java.util.List; + +import org.bench4q.monitor.model.LimitModel; +import org.bench4q.monitor.model.MonitorMain; +import org.hyperic.sigar.SigarException; +import org.junit.Assert; +import org.junit.Test; + +public class Test_MainControler { + @Test + public void testSubmitLimit() { + LimitModel.ParameterModel params1 = new LimitModel.ParameterModel(); + LimitModel.ParameterModel params2 = new LimitModel.ParameterModel(); + LimitModel.ParameterModel params3 = new LimitModel.ParameterModel(); + LimitModel.ParameterModel params4 = new LimitModel.ParameterModel(); + params1.setName("memoryUsedPercent"); + params1.setLimit(100); + params2.setName("processorTimePercent"); + params2.setLimit(10); + params3.setName("userTimePercent"); + params3.setLimit(100); + params4.setName("privilegedTimePercent"); + params4.setLimit(100); + List list = new ArrayList(); + list.add(params1); + list.add(params2); + list.add(params3); + list.add(params4); + LimitModel limits = new LimitModel(); + limits.setParams(list); + MonitorMain result = null; + try { + result = new MonitorMain(limits); + } catch (SigarException e) { + e.printStackTrace(); + } + Assert.assertEquals(false,result.getIsReachLimit()); + } +}