Search in sources :

Example 1 with InfluxDBResultMapper

use of org.influxdb.impl.InfluxDBResultMapper in project cas by apereo.

the class InfluxDbConnectionFactoryTests method verifyWritePoint.

@Test
public void verifyWritePoint() {
    final Point p = Point.measurement("events").time(System.currentTimeMillis(), TimeUnit.MILLISECONDS).addField("hostname", "cas.example.org").build();
    factory.write(p, CAS_EVENTS_DATABASE);
    final QueryResult result = factory.query("*", "events", CAS_EVENTS_DATABASE);
    final InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
    final List<InfluxEvent> resultEvents = resultMapper.toPOJO(result, InfluxEvent.class);
    assertNotNull(resultEvents);
    assertEquals(1, resultEvents.size());
    assertEquals("cas.example.org", resultEvents.iterator().next().hostname);
}
Also used : QueryResult(org.influxdb.dto.QueryResult) InfluxDBResultMapper(org.influxdb.impl.InfluxDBResultMapper) Point(org.influxdb.dto.Point) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Point (org.influxdb.dto.Point)1 QueryResult (org.influxdb.dto.QueryResult)1 InfluxDBResultMapper (org.influxdb.impl.InfluxDBResultMapper)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1