Search in sources :

Example 1 with CustomMapSerialiser

use of uk.gov.gchq.gaffer.serialisation.CustomMapSerialiser in project Gaffer by gchq.

the class RBMBackedTimestampSetSerialiserTest method shouldSerialiserStringRBMBackedTimestampSet.

@Test
public void shouldSerialiserStringRBMBackedTimestampSet() throws SerialisationException {
    // Given
    final Serialiser<CustomMap, byte[]> customMapSerialiser = new CustomMapSerialiser();
    final RBMBackedTimestampSet timestampSet1 = new RBMBackedTimestampSet.Builder().timeBucket(TimeBucket.MINUTE).timestamps(Lists.newArrayList(Instant.ofEpochSecond(10))).timestamps(Lists.newArrayList(Instant.ofEpochSecond(20))).build();
    final RBMBackedTimestampSet timestampSet2 = new RBMBackedTimestampSet.Builder().timeBucket(TimeBucket.MINUTE).timestamps(Lists.newArrayList(Instant.ofEpochSecond(111))).timestamps(Lists.newArrayList(Instant.ofEpochSecond(222))).build();
    final CustomMap<String, RBMBackedTimestampSet> expected = new CustomMap<String, RBMBackedTimestampSet>(new StringSerialiser(), new RBMBackedTimestampSetSerialiser());
    expected.put("OneTimeStamp", timestampSet1);
    expected.put("TwoTimeStamp", timestampSet2);
    // When
    final CustomMap deserialise = customMapSerialiser.deserialise(customMapSerialiser.serialise(expected));
    // Then
    detailedEquals(expected, deserialise, String.class, RBMBackedTimestampSet.class, new StringSerialiser(), new RBMBackedTimestampSetSerialiser());
}
Also used : RBMBackedTimestampSet(uk.gov.gchq.gaffer.time.RBMBackedTimestampSet) StringSerialiser(uk.gov.gchq.gaffer.serialisation.implementation.StringSerialiser) CustomMapSerialiser(uk.gov.gchq.gaffer.serialisation.CustomMapSerialiser) CustomMap(uk.gov.gchq.gaffer.types.CustomMap) ToBytesSerialisationTest(uk.gov.gchq.gaffer.serialisation.ToBytesSerialisationTest) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 CustomMapSerialiser (uk.gov.gchq.gaffer.serialisation.CustomMapSerialiser)1 ToBytesSerialisationTest (uk.gov.gchq.gaffer.serialisation.ToBytesSerialisationTest)1 StringSerialiser (uk.gov.gchq.gaffer.serialisation.implementation.StringSerialiser)1 RBMBackedTimestampSet (uk.gov.gchq.gaffer.time.RBMBackedTimestampSet)1 CustomMap (uk.gov.gchq.gaffer.types.CustomMap)1