Class TestKitHelper

java.lang.Object
org.apache.camel.support.DefaultExchangeHolder
de.ikor.sip.foundation.core.util.SIPExchangeHelper
de.ikor.sip.foundation.testkit.util.TestKitHelper
All Implemented Interfaces:
Serializable

public class TestKitHelper extends SIPExchangeHelper
Utility class that changes the Exchange
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    getRouteId(org.apache.camel.Exchange exchange)
    Get route id from the Exchange
    static boolean
    Checks if header is Test Kit specific header
    static org.apache.camel.Exchange
    parseExchangeProperties(EndpointProperties properties, org.apache.camel.CamelContext camelContext)
    Create exchange from test definition
    static org.apache.camel.Consumer
    resolveConsumer(org.apache.camel.Exchange exchange, org.apache.camel.CamelContext camelContext)
    Get camel consumer based on exchange route id
    static org.apache.camel.Endpoint
    resolveEndpoint(org.apache.camel.Exchange exchange, org.apache.camel.CamelContext camelContext)
    Get camel endpoint based on exchange route id
    static org.apache.camel.Route
    resolveRoute(org.apache.camel.Exchange exchange, org.apache.camel.CamelContext camelContext)
    Get camel route based on exchange route id
    static void
    unmarshallExchangeBodyFromJson(org.apache.camel.Exchange inputExchange, com.fasterxml.jackson.databind.ObjectMapper mapper, Class<?> requestModelClass)
    Checks if header is Test Kit specific header

    Methods inherited from class de.ikor.sip.foundation.core.util.SIPExchangeHelper

    filterNonSerializableHeaders, reassignNonSerializableValue

    Methods inherited from class org.apache.camel.support.DefaultExchangeHolder

    addProperty, addVariable, getValidExchangePropertyValue, getValidHeaderValue, marshal, marshal, marshal, marshal, toString, unmarshal

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TestKitHelper

      public TestKitHelper()
  • Method Details

    • getRouteId

      public static String getRouteId(org.apache.camel.Exchange exchange)
      Get route id from the Exchange
      Parameters:
      exchange - that should be mapped
      Returns:
      route id
    • resolveEndpoint

      public static org.apache.camel.Endpoint resolveEndpoint(org.apache.camel.Exchange exchange, org.apache.camel.CamelContext camelContext)
      Get camel endpoint based on exchange route id
      Parameters:
      exchange - for fetching the route id
      camelContext - in which endpoints are defined
      Returns:
      Endpoint
    • resolveRoute

      public static org.apache.camel.Route resolveRoute(org.apache.camel.Exchange exchange, org.apache.camel.CamelContext camelContext)
      Get camel route based on exchange route id
      Parameters:
      exchange - for fetching the route id
      camelContext - in which routes are defined
      Returns:
      Route
    • resolveConsumer

      public static org.apache.camel.Consumer resolveConsumer(org.apache.camel.Exchange exchange, org.apache.camel.CamelContext camelContext)
      Get camel consumer based on exchange route id
      Parameters:
      exchange - for fetching the route id
      camelContext - in which consumers are defined
      Returns:
      Route
    • parseExchangeProperties

      public static org.apache.camel.Exchange parseExchangeProperties(EndpointProperties properties, org.apache.camel.CamelContext camelContext)
      Create exchange from test definition
      Parameters:
      properties - with route id and payload for exchange body
      camelContext - camel context
      Returns:
      Exchange
    • isTestKitHeader

      public static boolean isTestKitHeader(String key)
      Checks if header is Test Kit specific header
      Parameters:
      key - of header for checking
      Returns:
      boolean
    • unmarshallExchangeBodyFromJson

      public static void unmarshallExchangeBodyFromJson(org.apache.camel.Exchange inputExchange, com.fasterxml.jackson.databind.ObjectMapper mapper, Class<?> requestModelClass)
      Checks if header is Test Kit specific header
      Parameters:
      inputExchange - which body is converted from json to pojo
      mapper - for json unmarshalling
      requestModelClass - model of the pojo class