コード例 #1
0
 /**
  * Tests the listPowerDayStatistic method to see if sampling-interval string is valid.
  *
  * @throws Exception If a problem occurs.
  */
 @Test
 public void testListPowerDayStatisticDaySamplingInterval() throws Exception {
   command = "powerstats generated SIM_KAHE_1 day 2009-11-01 sampling-interval lol " + statMax;
   if (verboseMode) {
     System.out.println(CARRIAGE_RETURN + "> " + command);
     System.out.println("Checking if sampling-interval is not a valid number...");
   }
   commandList = commandProcessor.parseCommand(command);
   cli.errorEncountered = false;
   commandProcessor.processCommand(cli, commandList);
   assertTrue(ASSERT_STRING_MESSAGE, cli.errorEncountered);
   if (verboseMode) {
     System.out.println(result);
     System.out.println(OK_MESSAGE);
   }
 }
コード例 #2
0
 /**
  * Tests the listPowerDayStatistic method to see if the value of sampling interval is positive.
  *
  * @throws Exception If a problem occurs.
  */
 @Test
 public void testListPowerDayStatisticDayNegativeInterval() throws Exception {
   command = "powerstats consumed SIM_KAHE_1 day 2009-11-01 sampling-interval -60 " + statMax;
   if (verboseMode) {
     System.out.println(CARRIAGE_RETURN + "> " + command);
     System.out.println("Checking if maximum statistic is returned...");
   }
   commandList = commandProcessor.parseCommand(command);
   cli.errorEncountered = false;
   commandProcessor.processCommand(cli, commandList);
   assertTrue("Checking sampling interval", cli.errorEncountered);
   if (verboseMode) {
     System.out.println(result);
     System.out.println(OK_MESSAGE);
   }
 }
コード例 #3
0
 /**
  * Tests the listPowerDayStatistic method to see if maximum statistic value is returned.
  *
  * @throws Exception If a problem occurs.
  */
 @Test
 public void testListPowerDayStatisticDayNoDataMaximum() throws Exception {
   command = "powerstats consumed SIM_KAHE_1 day 2009-11-01 sampling-interval 60 " + statMax;
   if (verboseMode) {
     System.out.println(CARRIAGE_RETURN + "> " + command);
     System.out.println("Checking if maximum statistic is returned...");
   }
   commandList = commandProcessor.parseCommand(command);
   cli.errorEncountered = false;
   commandProcessor.processCommand(cli, commandList);
   result = (new PowerStatsDay()).doCommand(cli, commandList);
   assertEquals("Checking max value", "No data for SIM_KAHE_1 on 2009-11-01.", result);
   if (verboseMode) {
     System.out.println(result);
     System.out.println(OK_MESSAGE);
   }
 }
コード例 #4
0
 /**
  * Tests the listPowerDayStatistic method to see if maximum statistic value is returned.
  *
  * @throws Exception If a problem occurs.
  */
 @Test
 public void testListPowerDayStatisticDayMaximum() throws Exception {
   command = "powerstats generated SIM_OAHU_GRID day 2009-11-01 sampling-interval 120 " + statMax;
   if (verboseMode) {
     System.out.println(CARRIAGE_RETURN + "> " + command);
     System.out.println("Checking if maximum statistic is returned...");
   }
   commandList = commandProcessor.parseCommand(command);
   cli.errorEncountered = false;
   commandProcessor.processCommand(cli, commandList);
   result = (new PowerStatsDay()).doCommand(cli, commandList);
   int max = Integer.parseInt(result.substring(0, result.indexOf('.')));
   assertTrue("Checking max value", max >= (Integer.MIN_VALUE + 1));
   if (verboseMode) {
     System.out.println(result);
     System.out.println(OK_MESSAGE);
   }
 }