public Map < String , Object > buildMessageHeaders ( final TestContext context , final String messageType ) { try { final Map < String , Object > headers = context . resolveDynamicValuesInMap ( messageHeaders ) ; headers . put ( MessageHeaders . MESSAGE_TYPE , messageType ) ; for ( final Map . Entry < String , Object > entry : headers . entrySet ( ) ) { final String value = entry . getValue ( ) . toString ( ) ; if ( MessageHeaderType . isTyped ( value ) ) { final MessageHeaderType type = MessageHeaderType . fromTypedValue ( value ) ; final Constructor < ? > constr = type . getHeaderClass ( ) . getConstructor ( String . class ) ; entry . setValue ( constr . newInstance ( MessageHeaderType . removeTypeDefinition ( value ) ) ) ; } } MessageHeaderUtils . checkHeaderTypes ( headers ) ; return headers ; } catch ( final RuntimeException e ) { throw e ; } catch ( final Exception e ) { throw new CitrusRuntimeException ( "Failed to build message content" , e ) ; } }
Build message headers .