3 Replies Latest reply on Jul 11, 2013 5:49 AM by Claus Ibsen

    TypeConverters not found during testing with camel-test-blueprint

    Alexander Sahler Newbie

      Hi all.

       

      I do unit testing with camel-test-blueprint using the backport to 2.9.0.fuse-70-084.

      So far it's working but I got a problem when using convertBodyTo tags in my route.

       

      The testing of the type converters itself works when using a DefaultCamelContext() with normal unit testing (JUnit 4.11).

       

      But camel-test-blueprint seems not to find the typeConverters.

       

      In the test output I see a line

      [         Blueprint Extender: 3] Activator                      INFO  Found 1 @Converter classes to load
      

       

      but later on the tracer tells me:

      [st) thread #4 - MinaThreadPool] Tracer                         INFO  ID-ppcdev8-36395-1355393651810-2-2 >>> (isoMuxActivationOneShot) direct://isoMuxActivationOneShot --> convertBodyTo[com.brodos.schema.contentcard.request.v2.ActivationRequest] <<< Pattern:InOut, BodyType:com.brodos.iso8583.control.core.context.PPUContext, Body:PPUContext: serial='0100003000035', productid='0'
      [st) thread #4 - MinaThreadPool] DefaultErrorHandler            ERROR Failed delivery for (MessageId: ID-ppcdev8-36395-1355393651810-2-3 on ExchangeId: ID-ppcdev8-36395-1355393651810-2-2). Exhausted after delivery attempt: 1 caught: org.apache.camel.InvalidPayloadException: No body available of type: com.brodos.schema.contentcard.request.v2.ActivationRequest but has value: PPUContext: serial='0100003000035', productid='0' of type: com.brodos.iso8583.control.core.context.PPUContext on: Message: PPUContext: serial='0100003000035', productid='0'. Caused by: No type converter available to convert from type: com.brodos.iso8583.control.core.context.PPUContext to the required type: com.brodos.schema.contentcard.request.v2.ActivationRequest with value PPUContext: serial='0100003000035', productid='0'. Exchange[Message: PPUContext: serial='0100003000035', productid='0']. Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: com.brodos.iso8583.control.core.context.PPUContext to the required type: com.brodos.schema.contentcard.request.v2.ActivationRequest with value PPUContext: serial='0100003000035', productid='0']
      

       

      The type converter is implemented:

       

      @Converter
      public class ContextConverter {
      ...
          @Converter
          public static ActivationRequest convertToActivationReservationRequest(PPUContext ctx) {
              log.info("Entering convertToActivationReservationRequest");
              ....
      

       

      The deployment in fuse-70-084 environment works correctly. The type converter is found and used. However, unit tests with camel-test-blueprint fails.