@Override public StorableDetectionResult create(final IValueDeserializer deserializer) { return new StorableDetectionResult(deserializer); }
@Override public StorableDetectionResult create(final IValueDeserializer deserializer) throws RecordInstantiationException { return new StorableDetectionResult(deserializer); }
@Override @Deprecated public StorableDetectionResult create(final Object[] values) { return new StorableDetectionResult(values); }
private StorableDetectionResult createNDTSP(final String signature, final double value) { return new StorableDetectionResult(signature, value, System.currentTimeMillis(), value, value); }
@Test public void testEquality() { int i = 0; final StorableDetectionResult oneRecord = new StorableDetectionResult(STRING_VALUES.get(i % STRING_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); i = 0; final StorableDetectionResult copiedRecord = new StorableDetectionResult(STRING_VALUES.get(i % STRING_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); Assert.assertEquals(oneRecord, copiedRecord); }
@Test public void testUnequality() { int i = 0; final StorableDetectionResult oneRecord = new StorableDetectionResult(STRING_VALUES.get(i % STRING_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); i = 2; final StorableDetectionResult anotherRecord = new StorableDetectionResult(STRING_VALUES.get(i % STRING_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); Assert.assertNotEquals(oneRecord, anotherRecord); } }
final StorableDetectionResult dr = new StorableDetectionResult(fmp.getName(), fmp.getValue(), fmp.getTime(), fmp.getForecasted(), score); super.deliver(OUTPUT_PORT_ANOMALY_SCORE, dr);
final StorableDetectionResult dr = new StorableDetectionResult(fmp.getName(), fmp.getValue(), fmp.getTime(), fmp.getForecasted(), score); super.deliver(OUTPUT_PORT_ANOMALY_SCORE, dr);
/** * Tests {@link StorableDetectionResult#TestStorableDetectionResult(string, double, long, double, double)}. */ @Test public void testBuffer() { // NOPMD (assert missing) for (int i = 0; i < ARRAY_LENGTH; i++) { // initialize final StorableDetectionResult record = new StorableDetectionResult(STRING_VALUES.get(i % STRING_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); // check values Assert.assertEquals("StorableDetectionResult.applicationName values are not equal.", STRING_VALUES.get(i % STRING_VALUES.size()) == null ? "" : STRING_VALUES.get(i % STRING_VALUES.size()), record.getApplicationName()); Assert.assertEquals("StorableDetectionResult.value values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getValue(), 0.0000001); Assert.assertEquals("StorableDetectionResult.timestamp values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getTimestamp()); Assert.assertEquals("StorableDetectionResult.forecast values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getForecast(), 0.0000001); Assert.assertEquals("StorableDetectionResult.score values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getScore(), 0.0000001); } }
/** * Tests {@link StorableDetectionResult#TestStorableDetectionResult(string, double, long, double, double)}. */ @Test public void testParameterConstruction() { // NOPMD (assert missing) for (int i = 0; i < ARRAY_LENGTH; i++) { // initialize final StorableDetectionResult record = new StorableDetectionResult(STRING_VALUES.get(i % STRING_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); // check values Assert.assertEquals("StorableDetectionResult.applicationName values are not equal.", STRING_VALUES.get(i % STRING_VALUES.size()) == null ? "" : STRING_VALUES.get(i % STRING_VALUES.size()), record.getApplicationName()); Assert.assertEquals("StorableDetectionResult.value values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getValue(), 0.0000001); Assert.assertEquals("StorableDetectionResult.timestamp values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getTimestamp()); Assert.assertEquals("StorableDetectionResult.forecast values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getForecast(), 0.0000001); Assert.assertEquals("StorableDetectionResult.score values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getScore(), 0.0000001); } }