Пример #1
0
  /*
   * This tests if we restart after failure
   */
  @Test
  public void test_one() {
    QEA qea =
        QEABuilder.change(RoverCaseStudy.makeGrantCancelSingle(), QEAType.QVARN_FVAR_NONDET_QEA);
    Monitor monitor = MonitorFactory.create(RestartMode.REMOVE, qea);

    assertEquals(monitor.step(GRANT, task_one, resource_one), WEAK_SUCCESS);
    assertEquals(monitor.step(GRANT, task_two, resource_one), FAILURE);

    assertEquals(monitor.step(GRANT, task_one, resource_one), WEAK_SUCCESS);
    assertEquals(monitor.step(GRANT, task_two, resource_one), FAILURE);
  }
Пример #2
0
  /*
   * This tests if we restart after success
   */
  @Test
  public void test_three() {

    QEA qea = QEABuilder.change(DemoQEAs.makePropositionalDepend(), QEAType.QVARN_FVAR_NONDET_QEA);
    Monitor monitor = MonitorFactory.create(RestartMode.REMOVE, qea);

    assertEquals(monitor.step(e, 5), WEAK_FAILURE);
    // System.out.println(monitor);
    assertEquals(monitor.step(f, 4), WEAK_FAILURE);
    // System.out.println(monitor);
    assertEquals(monitor.step(f, 6), SUCCESS);
    // System.out.println(monitor);
    assertEquals(monitor.step(f, 3), WEAK_FAILURE);
    // System.out.println(monitor);
    assertEquals(monitor.step(f, 7), SUCCESS);
    // System.out.println(monitor);

  }