java.lang.Object
test.de.iip_ecosphere.platform.services.environment.DataMapperTest

public class DataMapperTest extends Object
Tests DataMapper.
Author:
Holger Eichelberger, SSE
  • Field Details

    • count

      private static int count
  • Constructor Details

    • DataMapperTest

      public DataMapperTest()
  • Method Details

    • createTestInputStream

      private static InputStream createTestInputStream()
      Creates a test input stream with 2 elements.
      Returns:
      the input stream
    • assertMyInput1

      private static void assertMyInput1(DataMapperTest.MyInput1 input)
      Asserts an instance of DataMapperTest.MyInput1 against createTestInputStream().
      Parameters:
      input - the input instance
    • assertMyInput2

      private static void assertMyInput2(DataMapperTest.MyInput2 input)
      Asserts an instance of DataMapperTest.MyInput2 against createTestInputStream().
      Parameters:
      input - the input instance
    • testJsonDataMapper

      public void testJsonDataMapper() throws IOException
      Tests DataMapper.mapJsonData(InputStream, Class, Consumer).
      Throws:
      IOException - shall not occur
    • testGenericJsonDataMapper

      public void testGenericJsonDataMapper() throws IOException
      Tests DataMapper.mapJsonData(InputStream, Class, Consumer) with DataMapper.MappingConsumer.
      Throws:
      IOException - shall not occur
    • testCreateBaseDataUnitClass

      public void testCreateBaseDataUnitClass()
      Tests DataMapper.createBaseDataUnitClass(Class).
    • testBaseDataUnitSerialization

      public void testBaseDataUnitSerialization() throws IOException
      Tests serialization/deserialization for base data units. Replays part of the mocking connector wrappers.
      Throws:
      IOException - shall not occur
    • serialize

      protected <T> byte[] serialize(T data) throws IOException
      Dynamically select a serializer (adapted from AbtractTransportConnector).
      Type Parameters:
      T - the type of the data
      Parameters:
      data - the data to serialize
      Returns:
      the serialized bytes
      Throws:
      IOException - in case that problems occur during serialization