@Override public NamedDoubleRecord create(final IValueDeserializer deserializer) throws RecordInstantiationException { return new NamedDoubleRecord(deserializer); }
@Override public NamedDoubleRecord create(final IValueDeserializer deserializer) { return new NamedDoubleRecord(deserializer); }
@Override @Deprecated public NamedDoubleRecord create(final Object[] values) { return new NamedDoubleRecord(values); }
/** * Creates inputs with timestamps. */ private List<NamedDoubleRecord> createInputEventSetOER() { final List<NamedDoubleRecord> retList = new ArrayList<>(); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 1369127812664L, 10341.94)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_B, 1369128812669L, 8341.00)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 1369129812674L, 78.26)); return retList; }
@Test public void testUnequality() { int i = 0; final NamedDoubleRecord oneRecord = new NamedDoubleRecord(STRING_VALUES.get(i % STRING_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); i = 2; final NamedDoubleRecord anotherRecord = new NamedDoubleRecord(STRING_VALUES.get(i % STRING_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); Assert.assertNotEquals(oneRecord, anotherRecord); } }
retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 1500000, 500000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_B, 2200000, 125000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 2400000, 100000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 2600000, 100000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_B, 2500000, 162200)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 2900000, 200000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_B, 4360000, 620000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 4300000, 200000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 4400000, 50000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_B, 4100000, 70000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 4640000, 40000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 4900000, 100000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 4900000, 800000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 5300000, 200000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_B, 5350000, 789000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 7200000, 100000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_B, 7300000, 678000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_B, 9170000, 70866000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 9150000, 50000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_B, 11200000, 706000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 11000000, 10200000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_B, 15400000, 13900000)); retList.add(new NamedDoubleRecord(OP_SIGNATURE_A, 15400000, 13900000));
@Test public void testEquality() { int i = 0; final NamedDoubleRecord oneRecord = new NamedDoubleRecord(STRING_VALUES.get(i % STRING_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); i = 0; final NamedDoubleRecord copiedRecord = new NamedDoubleRecord(STRING_VALUES.get(i % STRING_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); Assert.assertEquals(oneRecord, copiedRecord); }
/** * Tests {@link NamedDoubleRecord#TestNamedDoubleRecord(string, long, double)}. */ @Test public void testParameterConstruction() { // NOPMD (assert missing) for (int i = 0; i < ARRAY_LENGTH; i++) { // initialize final NamedDoubleRecord record = new NamedDoubleRecord(STRING_VALUES.get(i % STRING_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); // check values Assert.assertEquals("NamedDoubleRecord.applicationName values are not equal.", STRING_VALUES.get(i % STRING_VALUES.size()) == null ? "" : STRING_VALUES.get(i % STRING_VALUES.size()), record.getApplicationName()); Assert.assertEquals("NamedDoubleRecord.timestamp values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getTimestamp()); Assert.assertEquals("NamedDoubleRecord.responseTime values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getResponseTime(), 0.0000001); } }
/** * Tests {@link NamedDoubleRecord#TestNamedDoubleRecord(string, long, double)}. */ @Test public void testBuffer() { // NOPMD (assert missing) for (int i = 0; i < ARRAY_LENGTH; i++) { // initialize final NamedDoubleRecord record = new NamedDoubleRecord(STRING_VALUES.get(i % STRING_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); // check values Assert.assertEquals("NamedDoubleRecord.applicationName values are not equal.", STRING_VALUES.get(i % STRING_VALUES.size()) == null ? "" : STRING_VALUES.get(i % STRING_VALUES.size()), record.getApplicationName()); Assert.assertEquals("NamedDoubleRecord.timestamp values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getTimestamp()); Assert.assertEquals("NamedDoubleRecord.responseTime values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getResponseTime(), 0.0000001); } }
/** * Receives OperationExecutionRecords and delivers them converted to NamedDoubleRecords. * * @param oer * OperationExecutionRecord object to be converted */ @InputPort(name = RecordConverter.INPUT_PORT_NAME_OER, eventTypes = { OperationExecutionRecord.class }) public void convert(final OperationExecutionRecord oer) { // string, long, double final long timestamp = oer.getLoggingTimestamp(); final String application = oer.getHostname() + ":" + oer.getOperationSignature(); final double response = oer.getTout() - oer.getTin(); if (response >= 0.0d) { final NamedDoubleRecord ndr = new NamedDoubleRecord(application, timestamp, response); super.deliver(OUTPUT_PORT_NAME_NDR, ndr); } } }
/** * Receives OperationExecutionRecords and delivers them converted to NamedDoubleRecords. * * @param oer * OperationExecutionRecord object to be converted */ @InputPort(name = RecordConverter.INPUT_PORT_NAME_OER, eventTypes = { OperationExecutionRecord.class }) public void convert(final OperationExecutionRecord oer) { // string, long, double final long timestamp = oer.getLoggingTimestamp(); final String application = oer.getHostname() + ":" + oer.getOperationSignature(); final double response = oer.getTout() - oer.getTin(); if (response >= 0.0d) { final NamedDoubleRecord ndr = new NamedDoubleRecord(application, timestamp, response); super.deliver(OUTPUT_PORT_NAME_NDR, ndr); } } }