/** * Sets up the test. * * @exception Exception An error occurred */ protected final void setUp() throws Exception { super.setUp(); PropertyConfigurator.configure("./target/classes/props/log4j.properties"); if (SnmpAgent.getInstance() == null) { MessageLayer.main(new String[] {}); } readerDevice = ReaderDevice.getInstance(); ReadPoint[] readPoints = readerDevice.getAllReadPoints(); for (int i = 0; i < readPoints.length; i++) { if (readPoints[i] instanceof AntennaReadPoint) antReadPoint = (AntennaReadPoint) readPoints[i]; row = SnmpTableRow.getSnmpTableRow( new RowObjectContainer( TableTypeEnum.EPCG_ANT_READ_POINT_TABLE, new Object[] {antReadPoint})); return; } fail(); }
/** 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 } }