コード例 #1
0
  /** Tests the <code>rowStatusChanged()</code> method. */
  public final void testRowStatusChanged() {
    SnmpTableRow row =
        SnmpTableRow.getSnmpTableRow(
            new RowObjectContainer(
                TableTypeEnum.EPCG_RD_PNT_SRC_TABLE, new Object[] {source, readPoint}));
    RowStatusEvent event;

    event = new RowStatusEvent(row, null, row, null, RowStatus.destroy, RowStatus.createAndGo);
    rowStatusListener.rowStatusChanged(event);
    try {
      source.getReadPoint(readPoint.getName());
    } catch (ReaderProtocolException rpe) {
      fail();
    }

    event = new RowStatusEvent(row, null, row, null, RowStatus.active, RowStatus.notInService);
    rowStatusListener.rowStatusChanged(event);
    try {
      source.getReadPoint(readPoint.getName());
      fail();
    } catch (ReaderProtocolException rpe) {
      // ok
    }

    event = new RowStatusEvent(row, null, row, null, RowStatus.notInService, RowStatus.active);
    rowStatusListener.rowStatusChanged(event);
    try {
      source.getReadPoint(readPoint.getName());
    } catch (ReaderProtocolException rpe) {
      fail();
    }

    event = new RowStatusEvent(row, null, row, null, RowStatus.active, RowStatus.destroy);
    rowStatusListener.rowStatusChanged(event);
    try {
      source.getReadPoint(readPoint.getName());
      fail();
    } catch (ReaderProtocolException rpe) {
      // ok
    }

    event = new RowStatusEvent(row, null, row, null, RowStatus.destroy, RowStatus.createAndWait);
    rowStatusListener.rowStatusChanged(event);
    try {
      source.getReadPoint(readPoint.getName());
      fail();
    } catch (ReaderProtocolException rpe) {
      // ok
    }

    event = new RowStatusEvent(row, null, row, null, RowStatus.notInService, RowStatus.active);
    rowStatusListener.rowStatusChanged(event);
    try {
      source.getReadPoint(readPoint.getName());
    } catch (ReaderProtocolException rpe) {
      fail();
    }

    event = new RowStatusEvent(row, null, row, null, RowStatus.active, RowStatus.destroy);
    rowStatusListener.rowStatusChanged(event);
    try {
      source.getReadPoint(readPoint.getName());
      fail();
    } catch (ReaderProtocolException rpe) {
      // ok
    }
  }
コード例 #2
0
  /**
   * Does the cleanup.
   *
   * @exception Exception An error occurred
   */
  protected final void tearDown() throws Exception {
    super.tearDown();

    readerDevice.getReadPoints().remove(readPoint.getName());
    readerDevice.removeSources(new Source[] {source});
  }