Example #1
0
 /**
  * The automated tests using assert statements. This method is called by SPASS-meter at end of
  * monitoring upon the <code>EndSystem</code> annotation.
  *
  * @since 1.00
  */
 public static void asserts() {
   TestEnvironment.assertEqualsTimer(ID_TIMER_START_FINISH, WAIT_TIME, TOLERANCE);
   // just to be sure - same as ID_TIMER_START_FINISH
   TestEnvironment.assertEqualsTimer(recIdStartStopOneStep, WAIT_TIME, TOLERANCE);
   // cannot use real timer id as value is being overridden
   TestEnvironment.assertEqualsTimer(recIdStartStopTwoSteps, WAIT_TIME, TOLERANCE);
   TestEnvironment.assertEqualsTimer(recIdRestartStopResumeTwoSteps, WAIT_TIME, TOLERANCE);
   TestEnvironment.assertEqualsTimer(recIdRestartStopResumeOneStep, WAIT_TIME, TOLERANCE);
   TestEnvironment.success(AnnotationId.ID_TIMER);
 }
  /**
   * The automated tests using assert statements. This method is called by SPASS-meter at end of
   * monitoring upon the <code>EndSystem</code> annotation.
   *
   * @since 1.00
   */
  public static void asserts() {
    long tolerance = 100 * 1000 * 1000; // ms
    boolean includeOuter = true;
    if (TestEnvironment.isIndirectTest()) {
      // accounted by setting
      includeOuter = false;
    }
    assertChain(MonitoringGroupValue.ALLOCATED_MEMORY, includeOuter);
    // no statement about used memory - this depends on the JVM
    //        assertChain(MonitoringGroupValue.SYSTEM_TIME, false);

    // chain sequence is not ensured
    // due to unknown scheduling policy
    TestEnvironment.assertEquals(
        Runnable1.class.getName(),
        MonitoringGroupValue.SYSTEM_TIME,
        r1.getElapsedSystemTime(),
        tolerance);
    TestEnvironment.assertEquals(
        Runnable2.class.getName(),
        MonitoringGroupValue.SYSTEM_TIME,
        r2.getElapsedSystemTime(),
        tolerance);
    TestEnvironment.assertEquals(
        Runnable3.class.getName(),
        MonitoringGroupValue.SYSTEM_TIME,
        r3.getElapsedSystemTime(),
        tolerance);

    TestEnvironment.assertEquals(
        Runnable1.class.getName(),
        MonitoringGroupValue.CPU_TIME,
        r1.getElapsedCpuTime(),
        tolerance);
    TestEnvironment.assertEquals(
        Runnable2.class.getName(),
        MonitoringGroupValue.CPU_TIME,
        r2.getElapsedCpuTime(),
        tolerance);
    TestEnvironment.assertEquals(
        Runnable3.class.getName(),
        MonitoringGroupValue.CPU_TIME,
        r3.getElapsedCpuTime(),
        tolerance);

    assertZero(MonitoringGroupValue.FILE_READ);
    assertZero(MonitoringGroupValue.FILE_WRITE);
    assertZero(MonitoringGroupValue.NET_READ);
    assertZero(MonitoringGroupValue.NET_WRITE);
    assertZero(MonitoringGroupValue.TOTAL_READ);
    assertZero(MonitoringGroupValue.TOTAL_WRITE);
    TestEnvironment.success(ThreadedTest.class.getName());
  }