use of org.apache.beam.runners.samza.runtime.SamzaStoreStateInternals.ByteArraySerdeFactory in project beam by apache.
the class SamzaTimerInternalsFactoryTest method testByteArray.
@Test
public void testByteArray() {
ByteArray key1 = ByteArray.of("hello world".getBytes(StandardCharsets.UTF_8));
Serde<ByteArray> serde = new ByteArraySerdeFactory().getSerde("", null);
byte[] keyBytes = serde.toBytes(key1);
ByteArray key2 = serde.fromBytes(keyBytes);
assertEquals(key1, key2);
Map<ByteArray, String> map = new HashMap<>();
map.put(key1, "found it");
assertEquals("found it", map.get(key2));
map.remove(key1);
assertTrue(!map.containsKey(key2));
assertTrue(map.isEmpty());
}
Aggregations