protected void enrichEndpointConfiguration ( EndpointConfiguration endpointConfiguration , Map < String , String > parameters , TestContext context ) { for ( Map . Entry < String , String > parameterEntry : parameters . entrySet ( ) ) { Field field = ReflectionUtils . findField ( endpointConfiguration . getClass ( ) , parameterEntry . getKey ( ) ) ; if ( field == null ) { throw new CitrusRuntimeException ( String . format ( "Unable to find parameter field on endpoint configuration '%s'" , parameterEntry . getKey ( ) ) ) ; } Method setter = ReflectionUtils . findMethod ( endpointConfiguration . getClass ( ) , "set" + parameterEntry . getKey ( ) . substring ( 0 , 1 ) . toUpperCase ( ) + parameterEntry . getKey ( ) . substring ( 1 ) , field . getType ( ) ) ; if ( setter == null ) { throw new CitrusRuntimeException ( String . format ( "Unable to find parameter setter on endpoint configuration '%s'" , "set" + parameterEntry . getKey ( ) . substring ( 0 , 1 ) . toUpperCase ( ) + parameterEntry . getKey ( ) . substring ( 1 ) ) ) ; } if ( parameterEntry . getValue ( ) != null ) { ReflectionUtils . invokeMethod ( setter , endpointConfiguration , TypeConversionUtils . convertStringToType ( parameterEntry . getValue ( ) , field . getType ( ) , context ) ) ; } else { ReflectionUtils . invokeMethod ( setter , endpointConfiguration , field . getType ( ) . cast ( null ) ) ; } } }
Sets properties on endpoint configuration using method reflection .