@Override protected List<IMonitoringRecord> readEvents() throws AnalysisConfigurationException { return this.sinkFilter.getList(); } }
/** * {@inheritDoc} */ @Override public Configuration getCurrentConfiguration() { final Configuration configuration = new Configuration(); configuration.setProperty(CONFIG_PROPERTY_NAME_MAX_NUMBER_OF_ENTRIES, String.valueOf(this.maxNumberOfEntries)); configuration.setProperty(CONFIG_PROPERTY_NAME_LIST_FULL_BEHAVIOR, this.listFullBehavior.name()); return configuration; } }
/** * This method represents the input port of this filter. * * @param event * The next event. */ @InputPort(name = INPUT_PORT_NAME_EVENTS, eventTypes = { Object.class }, description = "Receives incoming objects to be counted and forwarded") public final void inputEvent(final Object event) { final Long count = CountingFilter.this.counter.incrementAndGet(); this.updateDisplays(); super.deliver(OUTPUT_PORT_NAME_RELAYED_EVENTS, event); super.deliver(OUTPUT_PORT_NAME_COUNT, count); }
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(); } }
@Test public void testNormal() throws IllegalStateException, AnalysisConfigurationException, InterruptedException { final List<Entry<Long, Integer>> eventList = this.passEventListToReader(this.simpleListReader); Assert.assertEquals(0, this.sinkPlugin.size()); this.analysisController.run(); Assert.assertEquals(AnalysisController.STATE.TERMINATED, this.analysisController.getState()); // Make sure that all events have been provided to the delay filter (otherwise the test make no sense) Assert.assertEquals("Test invalid: Unexpected number of events provided TO the delay filter", eventList.size(), this.countingFilterReader.getMessageCount()); // Make sure that all events have been passed through the delay filter Assert.assertEquals("Unexpected number of events relayed by the delay filter", eventList.size(), this.countingFilterDelayed.getMessageCount()); this.checkTiming(); // Make sure that exactly the right objects have been passed this.checkRelayedRecords(); } }
/** * This method initializes the setup. */ @Before public void before() { this.controller = new AnalysisController(); this.reader = new ListReader<>(new Configuration(), this.controller); this.sinkPlugin = new ListCollectionFilter<>(new Configuration(), this.controller); }
@Override protected List<IMonitoringRecord> readEvents() throws AnalysisConfigurationException { return this.sinkFilter.getList(); } }
/** * {@inheritDoc} */ @Override public Configuration getCurrentConfiguration() { final Configuration configuration = new Configuration(); configuration.setProperty(CONFIG_PROPERTY_NAME_MAX_NUMBER_OF_ENTRIES, String.valueOf(this.maxNumberOfEntries)); configuration.setProperty(CONFIG_PROPERTY_NAME_LIST_FULL_BEHAVIOR, this.listFullBehavior.name()); return configuration; } }
/** * This method represents the input port of this filter. * * @param event * The next event. */ @InputPort(name = INPUT_PORT_NAME_EVENTS, eventTypes = { Object.class }, description = "Receives incoming objects to be counted and forwarded") public final void inputEvent(final Object event) { final Long count = CountingFilter.this.counter.incrementAndGet(); this.updateDisplays(); super.deliver(OUTPUT_PORT_NAME_RELAYED_EVENTS, event); super.deliver(OUTPUT_PORT_NAME_COUNT, count); }
@Override protected List<IMonitoringRecord> readEvents() { return this.sinkFilter.getList(); } }
@Override protected List<IMonitoringRecord> readEvents() throws AnalysisConfigurationException { return this.sinkFilter.getList(); } }
@Override protected List<IMonitoringRecord> readEvents() throws AnalysisConfigurationException { return this.sinkFilter.getList(); }
public List<IMonitoringRecord> getList() { return this.sinkPlugin.getList(); }
/** * Returns the result produced by this setup. Note that this method does not invoke {@link #run()} automatically. * * @return See above */ public List<T> getResult() { return this.getResultCollectionPlugin().getList(); }
private final void checkRelayedRecords() { final List<EmptyRecord> relayedEvents = this.sinkPlugin.getList(); Assert.assertEquals(this.inputRecords, relayedEvents); }
private final void checkTiming() throws InterruptedException { final List<Long> throughput = this.sinkThroughput.getList(); final long[] actualArray = new long[throughput.size()]; for (int i = 0; i < actualArray.length; i++) { actualArray[i] = throughput.get(i); } Assert.assertArrayEquals("Unexpected throughput", actualArray, this.expectedThroughputListOffsetSecondsInterval5Secs); }
private void checkCorrectRelayedCount() { final List<Long> counts = this.sinkPluginRelayedRecords.getList(); final long count = counts.get(counts.size() - 1); Assert.assertEquals("Count should be 27 at the end of the test, but counted " + count, 27, count); }
private void checkCorrectUncountedCount() { final List<Long> counts = this.sinkPluginUncountedRecords.getList(); final long count = counts.get(0); Assert.assertEquals("Count should be 1 at the end of the test, but counted " + count, 1, count); } }
private void checkCorrectCount() { final List<Long> counts = this.sinkPluginCount.getList(); final long firstCount = counts.get(0); // first count of interval Assert.assertEquals("First Count should be 10 at the end of the test, but counted " + firstCount, 10, firstCount); final long secondCount = counts.get(1); // second count of interval Assert.assertEquals("second Count should be 10 at the end of the test, but counted " + secondCount, 10, secondCount); final long thirdCount = counts.get(2); // second count of interval Assert.assertEquals("third Count should be 5 at the end of the test, but counted " + thirdCount, 5, thirdCount); }
/** * Converts the OperationExecutionRecord using the previously set up filter structure. * * @param oer * @throws IllegalStateException * exception that can possibly be thrown by AnalysisController * @throws AnalysisConfigurationException * exception that can possibly be thrown by AnalysisController */ private void convertRecord(final OperationExecutionRecord oer) throws IllegalStateException, AnalysisConfigurationException { this.simpleListReader.addObject(oer); this.analysisController.run(); this.conversionResult = this.listCollectionfilter.getList().get(0); }