use of com.hortonworks.streamline.streams.notification.store.hbase.mappers.TableMutation in project streamline by hortonworks.
the class HBaseNotificationStoreIntegrationTest method testStoreNotification.
@Test
public void testStoreNotification() throws IOException {
Notification notification = NotificationTestObjectFactory.getOne();
sut.store(notification);
// rely on result of tableMutations() to avoid checking manually
// didn't check each cell's value but comparing will be covered by testGetNotification()
List<TableMutation> expectedMutations = notificationMapper.tableMutations(notification);
checkMutationsReflectToHBase(expectedMutations);
}
use of com.hortonworks.streamline.streams.notification.store.hbase.mappers.TableMutation in project streamline by hortonworks.
the class HBaseNotificationStoreIntegrationTest method testUpdateNotificationStatus.
@Test
public void testUpdateNotificationStatus() throws Exception {
Notification notification = NotificationTestObjectFactory.getOne();
sut.store(notification);
Notification.Status newStatus = Notification.Status.FAILED;
Notification fetchedNotification = sut.updateNotificationStatus(notification.getId(), newStatus);
assertEquals(fetchedNotification.getId(), notification.getId());
assertEquals(fetchedNotification.getStatus(), newStatus);
// rely on result of status() to avoid checking manually
List<TableMutation> expectedMutations = notificationMapper.status(notification, newStatus);
checkMutationsReflectToHBase(expectedMutations);
}
use of com.hortonworks.streamline.streams.notification.store.hbase.mappers.TableMutation in project streamline by hortonworks.
the class HBaseNotificationStore method store.
private void store(List<TableMutation> tableMutations) throws IOException {
for (TableMutation tm : tableMutations) {
LOG.debug("Insert/Update {} row(s), Delete {} row(s) in table {}", tm.updates().size(), tm.deletes().size(), tm.tableName());
Table table = tables.get(tm.tableName()).get();
if (!tm.updates().isEmpty()) {
table.put(tm.updates());
}
if (!tm.deletes().isEmpty()) {
table.delete(tm.deletes());
}
}
}
Aggregations