@Override public NamedDoubleRecord create(final IValueDeserializer deserializer) { return new NamedDoubleRecord(deserializer); }
/** * {@inheritDoc} */ @Override public int hashCode() { int code = 0; code += this.getApplicationName().hashCode(); code += ((int)this.getTimestamp()); code += ((int)this.getResponseTime()); return code; }
/** * {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (obj == null) return false; if (obj == this) return true; if (obj.getClass() != this.getClass()) return false; final NamedDoubleRecord castedRecord = (NamedDoubleRecord) obj; if (this.getLoggingTimestamp() != castedRecord.getLoggingTimestamp()) return false; if (!this.getApplicationName().equals(castedRecord.getApplicationName())) return false; if (this.getTimestamp() != castedRecord.getTimestamp()) return false; if (isNotEqual(this.getResponseTime(), castedRecord.getResponseTime())) return false; return true; }
/** * 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); } }
/** * {@inheritDoc} */ @Override public void registerStrings(final IRegistry<String> stringRegistry) { // NOPMD (generated code) stringRegistry.get(this.getApplicationName()); } /**
/** * Tests the latency of the previously converted OperationExecutionRecord. */ @Test public void testConversionLatency() { Assert.assertEquals("Check whether latency has been computed correctly", RecordConverterTest.timeOut - RecordConverterTest.timeIn, this.conversionResult.getResponseTime(), 0d); }
/** * Tests the timestamp of the previously converted OperationExecutionRecord. */ @Test public void testConversionTimestamp() { Assert.assertEquals("Check whether timestamp is still intact", RecordConverterTest.loggingTimestamp, this.conversionResult.getTimestamp()); }
/** * 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); } }
/** * Tests the identifiers of the previously converted OperationExecutionRecord. */ @Test public void testConversionIdentifier() { Assert.assertEquals("Check whether host and appname have been extracted correctly", RecordConverterTest.hostAppInput + ":" + RecordConverterTest.operationSignature, this.conversionResult.getApplicationName()); }
/** * {@inheritDoc} * * @deprecated since 1.13. Use {@link #serialize(IValueSerializer)} with an array serializer instead. */ @Override @Deprecated public Object[] toArray() { return new Object[] { this.getApplicationName(), this.getTimestamp(), this.getResponseTime() }; } /**
if (this.getLoggingTimestamp() != castedRecord.getLoggingTimestamp()) { return false; if (!this.getApplicationName().equals(castedRecord.getApplicationName())) { return false; if (this.getTimestamp() != castedRecord.getTimestamp()) { return false; if (isNotEqual(this.getResponseTime(), castedRecord.getResponseTime())) { return false;
@Override public NamedDoubleRecord create(final IValueDeserializer deserializer) throws RecordInstantiationException { return new NamedDoubleRecord(deserializer); }
@InputPort(name = INPUT_PORT_NAME_VALUE, eventTypes = { NamedDoubleRecord.class }) public void inputExecutionRecord(final NamedDoubleRecord record) { final long timestampMillis = this.timeunit.convert(record.getTimestamp(), super.recordsTimeUnitFromProjectContext); final NamedDoubleTimeSeriesPoint tspoint = new NamedDoubleTimeSeriesPoint(timestampMillis, record.getResponseTime(), record.getApplicationName()); super.deliver(OUTPUT_PORT_NAME_VALUE, tspoint); }
@Override @Deprecated public NamedDoubleRecord create(final Object[] values) { return new NamedDoubleRecord(values); }
/** * {@inheritDoc} */ @Override public void serialize(final IValueSerializer serializer) throws BufferOverflowException { //super.serialize(serializer); serializer.putString(this.getApplicationName()); serializer.putLong(this.getTimestamp()); serializer.putDouble(this.getResponseTime()); } /**
/** * 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; }
/** * {@inheritDoc} */ @Override public void serialize(final IValueSerializer serializer) throws BufferOverflowException { //super.serialize(serializer); serializer.putString(this.getApplicationName()); serializer.putLong(this.getTimestamp()); serializer.putDouble(this.getResponseTime()); }
@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); } }
@InputPort(name = INPUT_PORT_NAME_VALUE, eventTypes = { NamedDoubleRecord.class }) public void inputExecutionRecord(final NamedDoubleRecord record) { final long timestampMillis = this.timeunit.convert(record.getTimestamp(), super.recordsTimeUnitFromProjectContext); final NamedDoubleTimeSeriesPoint tspoint = new NamedDoubleTimeSeriesPoint(timestampMillis, record.getResponseTime(), record.getApplicationName()); super.deliver(OUTPUT_PORT_NAME_VALUE, tspoint); }
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));