use of com.hortonworks.streamline.streams.notification.store.hbase.Serializer in project streamline by hortonworks.
the class NotificationMapperTest method testTableMutations.
@Test
public void testTableMutations() throws Exception {
Map<String, Object> fieldAndValues = new HashMap<>();
fieldAndValues.put("one", "A");
Notification notification = new NotificationImpl.Builder(fieldAndValues).id("notification-id").dataSourceIds(Arrays.asList("dsrcid-1")).eventIds(Arrays.asList("eventid-1")).notifierName("test-notifier").ruleId("rule-1").build();
List<TableMutation> tms = notificationMapper.tableMutations(notification);
System.out.println(tms);
assertEquals(1, tms.size());
TableMutation tm = tms.get(0);
assertEquals("Notification", tm.tableName());
assertEquals(1, tm.updates().size());
Put put = tm.updates().get(0);
assertTrue(put.has("f".getBytes(), "one".getBytes(), new Serializer().serialize("A")));
assertTrue(put.has("d".getBytes(), "dsrcid-1".getBytes(), "1".getBytes()));
assertTrue(put.has("e".getBytes(), "eventid-1".getBytes(), "1".getBytes()));
assertTrue(put.has("nn".getBytes(), "test-notifier".getBytes(), "1".getBytes()));
assertTrue(put.has("r".getBytes(), "rule-1".getBytes(), "1".getBytes()));
assertTrue(put.has("s".getBytes(), "qs".getBytes(), "NEW".getBytes()));
}
Aggregations