Skip to content

Instantly share code, notes, and snippets.

@jsanda
Created August 2, 2017 22:11
Show Gist options
  • Save jsanda/e28cdab45c01554e6de7bcf2ef57def5 to your computer and use it in GitHub Desktop.
Save jsanda/e28cdab45c01554e6de7bcf2ef57def5 to your computer and use it in GitHub Desktop.
@Test
public void findAllMetricIdentifiersShouldReturnDistinctResult() throws Exception {
String tenant = "DISTINCT";
String metric = "METRIC";
long timestamp = now().getMillis();
String tempTable1 = dataAccess.getTempTableName(timestamp);
String tempTable2 = dataAccess.getTempTableName(now().minusHours(3).getMillis());
session.execute("insert into " + tempTable1 + " (tenant_id, type, metric, time) values ('" + tenant +
"', 0, '" + metric + "', " + timestamp + ")");
session.execute("insert into " + tempTable2 + " (tenant_id, type, metric, time) values ('" + tenant +
"', 0, '" + metric + "', " + timestamp + ")");
Observable<Row> rows = dataAccess.findAllMetricIdentifiersInData();
// This assertion fails
assertEquals(rows.toList().toBlocking().first().size(), 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment