/** * This method prepares the test setup. * * @throws IllegalStateException * If something went wrong during the test setup (should not happen). * @throws AnalysisConfigurationException * If something went wrong during the test setup (should not happen). */ @Before public void before() throws IllegalStateException, AnalysisConfigurationException { this.analysisController = new AnalysisController(); this.countingFilter = new CountingFilter(new Configuration(), this.analysisController); this.simpleListReader = new ListReader<Object>(new Configuration(), this.analysisController); this.analysisController.connect(this.simpleListReader, ListReader.OUTPUT_PORT_NAME, this.countingFilter, CountingFilter.INPUT_PORT_NAME_EVENTS); }
@Ignore // NOCS @Test public void testRecords() throws IOException, IllegalStateException, AnalysisConfigurationException { final IAnalysisController analysisController = new AnalysisController(); final Configuration configurationFSReader = new Configuration(); configurationFSReader.setProperty(FSReader.CONFIG_PROPERTY_NAME_INPUTDIRS, this.tmpFolder.getRoot().getCanonicalPath()); final FSReader reader = new FSReader(configurationFSReader, analysisController); final CountingFilter sink = new CountingFilter(new Configuration(), analysisController); analysisController.connect(reader, FSReader.OUTPUT_PORT_NAME_RECORDS, sink, CountingFilter.INPUT_PORT_NAME_EVENTS); analysisController.run(); Assert.assertEquals(AnalysisController.STATE.TERMINATED, analysisController.getState()); Assert.assertEquals(5L, sink.getMessageCount()); // 5 records are expected } }
configuration.setProperty(TimeReader.CONFIG_PROPERTY_NAME_NUMBER_IMPULSES, "10"); final TimeReader tr = new TimeReader(configuration, ac); final CountingFilter cf = new CountingFilter(new Configuration(), ac);
/** * This test should make sure that the timer delivers a correct amount of records within a given limit. * * @throws InterruptedException * If the test thread is interrupted. * @throws IllegalStateException * If the analysis is in the wrong state. * @throws AnalysisConfigurationException * If the analysis is somehow invalid configured. */ @Test public void testIntervalTimer() throws InterruptedException, IllegalStateException, AnalysisConfigurationException { // Running 5 seconds, firing one event per 100 ms, we expect to receive approx. 50 events. final AnalysisController ac = new AnalysisController(); final AnalysisControllerThread thread = new AnalysisControllerThread(ac); final Configuration configuration = new Configuration(); configuration.setProperty(TimeReader.CONFIG_PROPERTY_NAME_UPDATE_INTERVAL_NS, "100000000"); final TimeReader tr = new TimeReader(configuration, ac); final CountingFilter cf = new CountingFilter(new Configuration(), ac); ac.connect(tr, TimeReader.OUTPUT_PORT_NAME_TIMESTAMP_RECORDS, cf, CountingFilter.INPUT_PORT_NAME_EVENTS); thread.start(); Thread.sleep(5000); ac.terminate(); Assert.assertTrue(cf.getMessageCount() > 40); Assert.assertTrue(cf.getMessageCount() < 60); }
uncountedRecordsCountingFilter = new CountingFilter(configuration, this.analysisController); this.analysisController.connect(monitoringThroughputFilter, MonitoringThroughputFilter.OUTPUT_PORT_NAME_UNCOUNTED_RECORDS, uncountedRecordsCountingFilter, CountingFilter.INPUT_PORT_NAME_EVENTS); relayedRecordsCountingFilter = new CountingFilter(configuration, this.analysisController); this.analysisController.connect(monitoringThroughputFilter, MonitoringThroughputFilter.OUTPUT_PORT_NAME_RELAYED_RECORDS, relayedRecordsCountingFilter, CountingFilter.INPUT_PORT_NAME_EVENTS);
this.countingFilterReader = new CountingFilter(new Configuration(), this.analysisController); this.analysisController.connect(this.simpleListReader, ListReader.OUTPUT_PORT_NAME, this.countingFilterReader, CountingFilter.INPUT_PORT_NAME_EVENTS); this.countingFilterDelayed = new CountingFilter(new Configuration(), this.analysisController); this.analysisController.connect(throughputFilter, AnalysisThroughputFilter.OUTPUT_PORT_NAME_RELAYED_OBJECTS, this.countingFilterDelayed, CountingFilter.INPUT_PORT_NAME_EVENTS);
final CountingFilter countingFilter = new CountingFilter(countinConfiguration, analysis);
final CountingFilter countingFilter1 = new CountingFilter(confCountingFilter1, analysisController); final CountingFilter countingFilter2 = new CountingFilter(confCountingFilter2, analysisController);