Class MessageValidatorAndMigrator

java.lang.Object
org.apache.plc4x.test.migration.MessageValidatorAndMigrator

public class MessageValidatorAndMigrator extends Object
  • Constructor Details

    • MessageValidatorAndMigrator

      public MessageValidatorAndMigrator()
  • Method Details

    • validateOutboundMessageAndMigrate

      public static void validateOutboundMessageAndMigrate(String testCaseName, Map<String,String> options, org.dom4j.Element referenceXml, List<String> parserArguments, byte[] data, ByteOrder byteOrder, boolean autoMigrate, URI siteURI) throws DriverTestsuiteException
      Validates a outbound message and migrates it to the expectation if the parameter autoMigrate is set to true.

      Passed options should contain a single 'package' option or 'protocolName' and 'outputFlavor'. In case if package is not specified then protocol name and output flavor (e.g read-write) are used to construct lookup package.

      Parameters:
      testCaseName - name of the testcase
      options - map with specific test/lookup options.
      referenceXml - the xml we expect the outbound message to be
      parserArguments - the parser arguments to create an instance of the message
      data - the bytes of the message
      byteOrder - the byte-oder being used
      autoMigrate - indicates if we want to migrate to a new version
      siteURI - the file which we want to auto migrate
      Throws:
      DriverTestsuiteException - if something goes wrong
    • validateOutboundMessageAndMigrate

      public static boolean validateOutboundMessageAndMigrate(String testCaseName, MessageInput<?> messageInput, org.dom4j.Element referenceXml, byte[] data, ByteOrder byteOrder, boolean autoMigrate, URI siteURI) throws DriverTestsuiteException
      Validates a outbound message and migrates it to the expectation if the parameter autoMigrate is set to true
      Parameters:
      testCaseName - name of the testcase
      messageInput - the pre-constructed MessageInput
      referenceXml - the xml we expect the outbound message to be
      data - the bytes of the message
      byteOrder - the byte-order being used
      autoMigrate - indicates if we want to migrate to a new version
      siteURI - the file which we want to auto migrate
      Returns:
      true if migration happened
      Throws:
      DriverTestsuiteException - if something goes wrong
    • validateInboundMessageAndGet

      public static Message validateInboundMessageAndGet(Map<String,String> options, org.dom4j.Element referenceXml)
      Validates a inbound message and migrates it to the expectation if the parameter autoMigrate is set to true
      Parameters:
      options - Options which contain custom 'package' name or keys 'protocolName' (name of the protocol) and 'outputFlavor' (flavor of the output e.g read-write) which are used to construct class lookup root package.
      referenceXml - the xml we expect the outbound message
      Returns:
      the message if all went well
    • validateInboundMessageAndGet

      public static Message validateInboundMessageAndGet(MessageInput messageInput, org.dom4j.Element referenceXml)
      Validates a inbound message and migrates it to the expectation if the parameter autoMigrate is set to true
      Parameters:
      messageInput - the pre-constructed MessageInput
      referenceXml - the xml we expect the outbound messag
      Returns:
      the message if all went well