@Override protected void checkControllerStateBeforeRecordsPassedToController(final IMonitoringController monitoringController) throws Exception { Assert.assertTrue(monitoringController.isMonitoringEnabled()); Assert.assertEquals(AnalysisController.STATE.RUNNING, this.analysisController.getState()); }
@Override protected void checkControllerStateBeforeRecordsPassedToController(final IMonitoringController monitoringController) throws Exception { Assert.assertTrue(monitoringController.isMonitoringEnabled()); Assert.assertEquals(AnalysisController.STATE.RUNNING, this.analysisController.getState()); }
@Override protected void checkControllerStateBeforeRecordsPassedToController(final IMonitoringController monitoringController) throws Exception { Assert.assertTrue(monitoringController.isMonitoringEnabled()); Assert.assertEquals(AnalysisController.STATE.RUNNING, this.analysisController.getState()); }
@Override protected void checkControllerStateAfterRecordsPassedToController(final IMonitoringController monitoringController) throws Exception { Assert.assertTrue(monitoringController.isMonitoringEnabled()); monitoringController.terminateMonitoring(); this.analysisThread.awaitTermination(); Assert.assertEquals(AnalysisController.STATE.TERMINATED, this.analysisController.getState()); }
@Override protected void checkControllerStateAfterRecordsPassedToController(final IMonitoringController monitoringController) throws Exception { Assert.assertTrue(monitoringController.isMonitoringEnabled()); monitoringController.terminateMonitoring(); this.analysisThread.awaitTermination(); Assert.assertEquals(AnalysisController.STATE.TERMINATED, this.analysisController.getState()); }
@Override protected void checkControllerStateAfterRecordsPassedToController(final IMonitoringController monitoringController) throws Exception { Assert.assertTrue(monitoringController.isMonitoringEnabled()); monitoringController.terminateMonitoring(); this.analysisThread.awaitTermination(); Assert.assertEquals(AnalysisController.STATE.TERMINATED, this.analysisController.getState()); }
/** * Tests the "blocking" mode of the reader. * * @throws InterruptedException * If the thread is interrupted. This should not happen. */ @SuppressWarnings("unused") @Test public void testBlockingMode() throws InterruptedException { final AnalysisController ac = new AnalysisController(); final AnalysisControllerThread thread = new AnalysisControllerThread(ac); final Configuration configuration = new Configuration(); configuration.setProperty(TimeReader.CONFIG_PROPERTY_NAME_NUMBER_IMPULSES, Long.toString(TimeReader.INFINITE_EMITS)); new TimeReader(configuration, ac); // We expect that the reader doesn't return immediately - in this case we expect the AC to run at least five seconds thread.start(); Thread.sleep(5000); Assert.assertEquals(STATE.RUNNING, ac.getState()); ac.terminate(); }
/** * Tests the "non blocking" mode of the reader. * * @throws InterruptedException * If the thread is interrupted. This should not happen. */ @SuppressWarnings("unused") @Test public void testNonBlockingMode() throws InterruptedException { final AnalysisController ac = new AnalysisController(); final AnalysisControllerThread thread = new AnalysisControllerThread(ac); final Configuration configuration = new Configuration(); configuration.setProperty(TimeReader.CONFIG_PROPERTY_NAME_NUMBER_IMPULSES, "1"); configuration.setProperty(TimeReader.CONFIG_PROPERTY_NAME_DELAY_NS, "0"); configuration.setProperty(TimeReader.CONFIG_PROPERTY_NAME_UPDATE_INTERVAL_NS, "1000000000"); new TimeReader(configuration, ac); // We expect the reader to return very fast - in this case we expect the AC to return within five seconds thread.start(); Thread.sleep(6000); Assert.assertEquals(STATE.TERMINATED, ac.getState()); }
Assert.assertEquals(AnalysisController.STATE.TERMINATED, analysisController.getState());
Assert.assertEquals(AnalysisController.STATE.TERMINATED, analysisController.getState());
@Ignore // NOCS @Test public void testRecordsWithoutStringSame() throws IllegalStateException, AnalysisConfigurationException { final AnalysisController analysisController = new AnalysisController(); final ListReader<IMonitoringRecord> reader = new ListReader<>(new Configuration(), analysisController); final StringBufferFilter stringBufferFilter = new StringBufferFilter(new Configuration(), analysisController); final ListCollectionFilter<IMonitoringRecord> collectionFilter = new ListCollectionFilter<>(new Configuration(), analysisController); analysisController.connect(reader, ListReader.OUTPUT_PORT_NAME, stringBufferFilter, StringBufferFilter.INPUT_PORT_NAME_EVENTS); analysisController.connect(stringBufferFilter, StringBufferFilter.OUTPUT_PORT_NAME_RELAYED_EVENTS, collectionFilter, ListCollectionFilter.INPUT_PORT_NAME); final IMonitoringRecord recordIn1 = new EmptyRecord(); reader.addObject(recordIn1); analysisController.run(); Assert.assertEquals(AnalysisController.STATE.TERMINATED, analysisController.getState()); final List<IMonitoringRecord> records = collectionFilter.getList(); Assert.assertEquals("Unexpected number of records", 1, records.size()); final IMonitoringRecord recordOut1 = records.get(0); Assert.assertSame("First output record not same as first input record", recordIn1, recordOut1); // includes no String, hence "as-is" }
private List<IMonitoringRecord> readLog(final String[] monitoringLogDirs) throws AnalysisConfigurationException { final AnalysisController analysisController = new AnalysisController(); final Configuration readerConfiguration = new Configuration(); readerConfiguration.setProperty(AsciiLogReader.CONFIG_PROPERTY_NAME_INPUTDIRS, Configuration.toProperty(monitoringLogDirs)); readerConfiguration.setProperty(AsciiLogReader.CONFIG_PROPERTY_NAME_IGNORE_UNKNOWN_RECORD_TYPES, "false"); final AbstractReaderPlugin reader = new AsciiLogReader(readerConfiguration, analysisController); final ListCollectionFilter<IMonitoringRecord> sinkPlugin = new ListCollectionFilter<>(new Configuration(), analysisController); analysisController.connect(reader, AsciiLogReader.OUTPUT_PORT_NAME_RECORDS, sinkPlugin, ListCollectionFilter.INPUT_PORT_NAME); analysisController.run(); Assert.assertEquals(AnalysisController.STATE.TERMINATED, analysisController.getState()); return sinkPlugin.getList(); } }
Assert.assertEquals(AnalysisController.STATE.TERMINATED, analysisController.getState());
Assert.assertEquals(AnalysisController.STATE.TERMINATED, analysis.getState());