コード例 #1
0
 /** {@inheritDoc} */
 @Override
 public Configuration getCurrentConfiguration() {
   final Configuration configuration = new Configuration();
   configuration.setProperty(CONFIG_PROPERTY_NAME_TIMEUNIT, this.timeunit.name());
   configuration.setProperty(
       CONFIG_PROPERTY_NAME_TIME_RESOLUTION, Long.toString(this.timerResolution));
   return configuration;
 }
コード例 #2
0
  /**
   * Set up for the AnomalyScoreCalculationFilterTest.
   *
   * @throws IllegalStateException If illegal state
   * @throws AnalysisConfigurationException If wrong configuration
   */
  @Before
  public void setUp() throws IllegalStateException, AnalysisConfigurationException {
    this.controller = new AnalysisController();

    // READER
    final Configuration readerScoreCalcConfiguration = new Configuration();
    readerScoreCalcConfiguration.setProperty(
        ListReader.CONFIG_PROPERTY_NAME_AWAIT_TERMINATION, Boolean.TRUE.toString());
    final ListReader<ForecastMeasurementPair> theReaderScoreCalc =
        new ListReader<ForecastMeasurementPair>(readerScoreCalcConfiguration, this.controller);
    theReaderScoreCalc.addAllObjects(this.createInputEventSetScoreCalc());

    final Configuration scoreConfiguration = new Configuration();
    final AnomalyScoreCalculationFilter scoreCalc =
        new AnomalyScoreCalculationFilter(scoreConfiguration, this.controller);

    // SINK 1
    this.sinkAnomalyScore =
        new ListCollectionFilter<StorableDetectionResult>(new Configuration(), this.controller);

    // CONNECTION
    this.controller.connect(
        theReaderScoreCalc,
        ListReader.OUTPUT_PORT_NAME,
        scoreCalc,
        AnomalyScoreCalculationFilter.INPUT_PORT_CURRENT_FORECAST_PAIR);
    this.controller.connect(
        scoreCalc,
        AnomalyScoreCalculationFilter.OUTPUT_PORT_ANOMALY_SCORE,
        this.sinkAnomalyScore,
        ListCollectionFilter.INPUT_PORT_NAME);
  }
コード例 #3
0
  @Override
  protected List<IMonitoringRecord> readEvents() throws Exception {
    final AnalysisController analysisController = new AnalysisController();

    final Configuration dbReaderConfig = new Configuration();
    dbReaderConfig.setProperty(DbReader.CONFIG_PROPERTY_NAME_DRIVERCLASSNAME, DRIVERCLASSNAME);
    dbReaderConfig.setProperty(
        DbReader.CONFIG_PROPERTY_NAME_CONNECTIONSTRING, this.getConnectionString());
    dbReaderConfig.setProperty(DbReader.CONFIG_PROPERTY_NAME_TABLEPREFIX, TABLEPREFIX);

    final DbReader dbReader = new DbReader(dbReaderConfig, analysisController);
    final ListCollectionFilter<IMonitoringRecord> sinkFilter =
        new ListCollectionFilter<IMonitoringRecord>(new Configuration(), analysisController);

    analysisController.connect(
        dbReader,
        DbReader.OUTPUT_PORT_NAME_RECORDS,
        sinkFilter,
        ListCollectionFilter.INPUT_PORT_NAME);
    analysisController.run();
    return sinkFilter.getList();
  }
コード例 #4
0
  public void init() throws IllegalStateException, AnalysisConfigurationException {
    final Configuration producerConfig = new Configuration();
    producerConfig.setProperty(
        ObjectProducer.CONFIG_PROPERTY_NAME_OBJECTS_TO_CREATE, Long.toString(this.numInputObjects));
    final ObjectProducer<T> producer =
        new ObjectProducer<T>(producerConfig, this.ac, this.inputObjectCreator);

    EmptyPassOnFilter predecessor = new EmptyPassOnFilter(new Configuration(), this.ac);
    this.ac.connect(
        producer, ObjectProducer.OUTPUT_PORT_NAME, predecessor, EmptyPassOnFilter.INPUT_PORT_NAME);
    for (int idx = 0; idx < (this.numNoopFilters - 1); idx++) {
      final EmptyPassOnFilter newPredecessor = new EmptyPassOnFilter(new Configuration(), this.ac);
      this.ac.connect(
          predecessor,
          EmptyPassOnFilter.OUTPUT_PORT_NAME,
          newPredecessor,
          EmptyPassOnFilter.INPUT_PORT_NAME);
      predecessor = newPredecessor;
    }
  }
コード例 #5
0
 /**
  * Here, we make sure that the reader aborts on the first occurrence of an unknown type.
  *
  * @param config The configuration to modify.
  */
 @Override
 protected void refineFSReaderConfiguration(final Configuration config) {
   config.setProperty(
       FSReader.CONFIG_PROPERTY_NAME_IGNORE_UNKNOWN_RECORD_TYPES, Boolean.FALSE.toString());
 }