/** Assertions for AfterConstructorFailedObjectEvent. */ private void assertAfterConstructorFailedObjectEvent( final AfterConstructorFailedObjectEvent record) { Assert.assertEquals( "'timestamp' value assertion failed.", record.getTimestamp(), PROPERTY_TIMESTAMP); Assert.assertEquals( "'traceId' value assertion failed.", record.getTraceId(), PROPERTY_TRACE_ID); Assert.assertEquals( "'orderIndex' value assertion failed.", record.getOrderIndex(), PROPERTY_ORDER_INDEX); Assert.assertEquals( "'operationSignature' value assertion failed.", record.getOperationSignature(), PROPERTY_OPERATION_SIGNATURE); Assert.assertEquals( "'classSignature' value assertion failed.", record.getClassSignature(), PROPERTY_CLASS_SIGNATURE); Assert.assertEquals("'cause' value assertion failed.", record.getCause(), PROPERTY_CAUSE); Assert.assertEquals( "'objectId' value assertion failed.", record.getObjectId(), PROPERTY_OBJECT_ID); }
/** * Test property order processing of {@link * kieker.common.record.flow.trace.operation.constructor.object.AfterConstructorFailedObjectEvent} * constructors and different serialization routines. */ @Test public void testAfterConstructorFailedObjectEventPropertyOrder() { // NOPMD final IRegistry<String> stringRegistry = this.makeStringRegistry(); final Object[] values = { PROPERTY_TIMESTAMP, PROPERTY_TRACE_ID, PROPERTY_ORDER_INDEX, PROPERTY_OPERATION_SIGNATURE, PROPERTY_CLASS_SIGNATURE, PROPERTY_CAUSE, PROPERTY_OBJECT_ID, }; final ByteBuffer inputBuffer = APIEvaluationFunctions.createByteBuffer( AfterConstructorFailedObjectEvent.SIZE, this.makeStringRegistry(), values); final AfterConstructorFailedObjectEvent recordInitParameter = new AfterConstructorFailedObjectEvent( PROPERTY_TIMESTAMP, PROPERTY_TRACE_ID, PROPERTY_ORDER_INDEX, PROPERTY_OPERATION_SIGNATURE, PROPERTY_CLASS_SIGNATURE, PROPERTY_CAUSE, PROPERTY_OBJECT_ID); final AfterConstructorFailedObjectEvent recordInitBuffer = new AfterConstructorFailedObjectEvent(inputBuffer, this.makeStringRegistry()); final AfterConstructorFailedObjectEvent recordInitArray = new AfterConstructorFailedObjectEvent(values); this.assertAfterConstructorFailedObjectEvent(recordInitParameter); this.assertAfterConstructorFailedObjectEvent(recordInitBuffer); this.assertAfterConstructorFailedObjectEvent(recordInitArray); // test to array final Object[] valuesParameter = recordInitParameter.toArray(); Assert.assertArrayEquals( "Result array of record initialized by parameter constructor differs from predefined array.", values, valuesParameter); final Object[] valuesBuffer = recordInitBuffer.toArray(); Assert.assertArrayEquals( "Result array of record initialized by buffer constructor differs from predefined array.", values, valuesBuffer); final Object[] valuesArray = recordInitArray.toArray(); Assert.assertArrayEquals( "Result array of record initialized by parameter constructor differs from predefined array.", values, valuesArray); // test write to buffer final ByteBuffer outputBufferParameter = ByteBuffer.allocate(AfterConstructorFailedObjectEvent.SIZE); recordInitParameter.writeBytes(outputBufferParameter, stringRegistry); Assert.assertArrayEquals( "Byte buffer do not match (parameter).", inputBuffer.array(), outputBufferParameter.array()); final ByteBuffer outputBufferBuffer = ByteBuffer.allocate(AfterConstructorFailedObjectEvent.SIZE); recordInitParameter.writeBytes(outputBufferBuffer, stringRegistry); Assert.assertArrayEquals( "Byte buffer do not match (buffer).", inputBuffer.array(), outputBufferBuffer.array()); final ByteBuffer outputBufferArray = ByteBuffer.allocate(AfterConstructorFailedObjectEvent.SIZE); recordInitParameter.writeBytes(outputBufferArray, stringRegistry); Assert.assertArrayEquals( "Byte buffer do not match (array).", inputBuffer.array(), outputBufferArray.array()); }