@Override public void newEndOfFileRecord() { this.newMonitoringRecord(EOF); } }
/** * {@inheritDoc} */ @Override protected AbstractReaderPlugin createReader(final IAnalysisController analysisInstance) { final Configuration configuration = new Configuration(); configuration.setProperty(FSReader.CONFIG_PROPERTY_NAME_INPUTDIRS, Configuration.toProperty(this.inputDirs)); configuration.setProperty(FSReader.CONFIG_PROPERTY_NAME_IGNORE_UNKNOWN_RECORD_TYPES, Boolean.toString(true)); return new FSReader(configuration, analysisInstance); }
/** * This method tests that the analysis controller makes sure that component names are unique. */ @Test public void testComponentNameRegistering() { final IAnalysisController ac = new AnalysisController(); final Configuration readerConfig1 = new Configuration(); final Configuration readerConfig2 = new Configuration(); readerConfig1.setProperty(AbstractAnalysisComponent.CONFIG_NAME, "reader"); readerConfig2.setProperty(AbstractAnalysisComponent.CONFIG_NAME, "reader"); final FSReader reader1 = new FSReader(readerConfig1, ac); final FSReader reader2 = new FSReader(readerConfig2, ac); // make sure the first reader is named as intended Assert.assertEquals("reader", reader1.getName()); // make sure the the second reader is named beginning with the simple class name Assert.assertTrue(reader2.getName().startsWith(FSReader.class.getSimpleName())); // make sure that both reader names differ Assert.assertNotEquals(reader1.getName(), reader2.getName()); } }
/** * {@inheritDoc} */ @Override protected AbstractReaderPlugin createReader(final IAnalysisController analysisInstance) { final Configuration configuration = new Configuration(); configuration.setProperty(FSReader.CONFIG_PROPERTY_NAME_INPUTDIRS, Configuration.toProperty(this.inputDirs)); configuration.setProperty(FSReader.CONFIG_PROPERTY_NAME_IGNORE_UNKNOWN_RECORD_TYPES, Boolean.toString(true)); return new FSReader(configuration, analysisInstance); }
private FSReader createReader() { final Configuration conf = new Configuration(null); conf.setProperty(FSReader.CONFIG_PROPERTY_NAME_INPUTDIRS, Configuration.toProperty(ConvertLegacyValues.fileListToStringArray(this.settings.getInputDirs()))); conf.setProperty(FSReader.CONFIG_PROPERTY_NAME_IGNORE_UNKNOWN_RECORD_TYPES, Boolean.TRUE.toString()); return new FSReader(conf, this.analysisController); }
@Override public void newEndOfFileRecord() { this.newMonitoringRecord(EOF); } }
conf.setProperty(FSReader.CONFIG_PROPERTY_NAME_INPUTDIRS, Configuration.toProperty(this.inputDirs)); conf.setProperty(FSReader.CONFIG_PROPERTY_NAME_IGNORE_UNKNOWN_RECORD_TYPES, Boolean.TRUE.toString()); reader = new FSReader(conf, this.analysisController);
@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 } }
final FSReader reader = new FSReader(confFSReader, analysisController);