/** * Runs the setup by starting the enclosed analysis controller. * * @throws AnalysisConfigurationException * If an invalid configuration is detected */ public void run() throws AnalysisConfigurationException { this.analysisController.run(); }
public void startAndWaitForTermination() throws IllegalStateException, AnalysisConfigurationException { this.analysisController.run(); }
@Override protected boolean performTask() { boolean success = false; try { new AnalysisController(new File(this.kaxFilename)).run(); success = true; } catch (final IOException ex) { LOGGER.error("The given file could not be loaded", ex); } catch (final AnalysisConfigurationException ex) { LOGGER.error("The given configuration file is invalid", ex); } catch (final Exception ex) { // NOPMD NOCS (log all errors) LOGGER.error("Error", ex); } return success; }
@Override protected boolean performTask() { boolean success = false; try { new AnalysisController(new File(this.kaxFilename)).run(); success = true; } catch (final IOException ex) { LOG.error("The given file could not be loaded", ex); } catch (final AnalysisConfigurationException ex) { LOG.error("The given configuration file is invalid", ex); } catch (final Exception ex) { // NOPMD NOCS (log all errors) LOG.error("Error", ex); } return success; }
@Override public void run() { try { TestAnalysis.this.getAnalysisController().run(); } catch (IllegalStateException | AnalysisConfigurationException e) { throw new IllegalStateException("Should never happen", e); } } };
this.analysisController.run(); if (this.analysisController.getState() != AnalysisController.STATE.TERMINATED) {
public List<IMonitoringRecord> runAnalysis(final File workingDirectory) throws IllegalStateException, AnalysisConfigurationException { final File[] directories = workingDirectory.listFiles(FILE_FILTER); if (null == directories) { return Collections.emptyList(); } final Configuration conf = new Configuration(); final AnalysisController analysisController = new AnalysisController(); try { conf.setProperty(AsciiLogReader.CONFIG_PROPERTY_NAME_INPUTDIRS, Configuration.toProperty(directories)); final AsciiLogReader reader = new AsciiLogReader(conf, analysisController); final ListCollectionFilter<IMonitoringRecord> collectionSink = new ListCollectionFilter<>( new Configuration(), analysisController); analysisController.connect(reader, AsciiLogReader.OUTPUT_PORT_NAME_RECORDS, collectionSink, ListCollectionFilter.INPUT_PORT_NAME); analysisController.run(); return collectionSink.getList(); } finally { this.deleteTempoararyFiles(directories); } }
@Test public void testIt() throws Exception { final AbstractTraceProcessingFilter filter = this.provideWriterFilter(this.outputFile.getAbsolutePath(), this.analysisController); final ListReader<Object> reader = new ListReader<Object>(new Configuration(), this.analysisController); final List<Object> eventList = this.createTraces(); reader.addAllObjects(eventList); this.analysisController.connect(reader, ListReader.OUTPUT_PORT_NAME, filter, this.provideFilterInputName()); this.analysisController.connect(filter, AbstractTraceAnalysisFilter.REPOSITORY_PORT_NAME_SYSTEM_MODEL, this.modelRepo); this.analysisController.run(); final String actualFileContent = StringUtils.readOutputFileAsString(this.outputFile); final String expectedFileContent = this.provideExpectedFileContent(eventList); Assert.assertEquals("Unexpected file content", expectedFileContent, actualFileContent); }
controller.run();
simpleSinkFilter, ListCollectionFilter.INPUT_PORT_NAME); analysisController.run();
ListCollectionFilter.INPUT_PORT_NAME); Assert.assertEquals(0, sinkPlugin.getList().size()); controller.run();
reader.addObject(stringIn2); analysisController.run(); 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(); } }
ListCollectionFilter.INPUT_PORT_NAME); Assert.assertEquals(0, sinkPlugin.getList().size()); controller.run();
ListCollectionFilter.INPUT_PORT_NAME); Assert.assertEquals(0, sinkPlugin.getList().size()); controller.run();
controller.run();
ListCollectionFilter.INPUT_PORT_NAME); controller.run();
controller.run();
reader.addObject(recordIn2); analysisController.run(); Assert.assertEquals(AnalysisController.STATE.TERMINATED, analysisController.getState());