org.influxdb.dto.Query Java Examples

The following examples show how to use org.influxdb.dto.Query. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ITPutInfluxDB.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testValidTwoPointWithSameMeasurementBadFormat() {
    String message = "water,country=US,city=newark rain=1,humidity=0.6" + System.lineSeparator()
            + "water,country=US,city=nyc,rain=2,humidity=0.7" + System.lineSeparator();
    byte [] bytes = message.getBytes();
    runner.enqueue(bytes);
    runner.run(1,true,true);
    runner.assertAllFlowFilesTransferred(PutInfluxDB.REL_FAILURE, 1);
    List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(PutInfluxDB.REL_FAILURE);
    assertEquals("Value should be equal", 1, flowFiles.size());
    assertEquals("Value should be equal","{\"error\":\"partial write: unable to parse 'water,country=US,city=nyc,rain=2,humidity=0.7': missing fields dropped=0\"}\n",
        flowFiles.get(0).getAttribute(PutInfluxDB.INFLUX_DB_ERROR_MESSAGE));
    QueryResult result = influxDB.query(new Query("select * from water", dbName));
    assertEquals("size should be same", 1, result.getResults().iterator().next().getSeries().size());
    List<List<Object>> values = result.getResults().iterator().next().getSeries().iterator().next().getValues();
    assertEquals("size should be same", 1, values.size());
}
 
Example #2
Source File: ExecuteInfluxDBQuery.java    From nifi with Apache License 2.0 6 votes vote down vote up
protected List<QueryResult> executeQuery(final ProcessContext context, String database, String query, TimeUnit timeunit,
                                         int chunkSize) throws InterruptedException {
    final CountDownLatch latch = new CountDownLatch(1);
    InfluxDB influx = getInfluxDB(context);
    Query influxQuery = new Query(query, database);

    if (chunkSize > 0) {
        List<QueryResult> results = new LinkedList<>();
        influx.query(influxQuery, chunkSize, result -> {
            if (isQueryDone(result.getError())) {
                latch.countDown();
            } else {
                results.add(result);
            }
        });
        latch.await();

        return results;
    } else {
        return Collections.singletonList(influx.query(influxQuery, timeunit));
    }
}
 
Example #3
Source File: InfluxHistoryTest.java    From monsoon with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private static Answer<QueryResult> keyedQueriesAnswer(Collection<KeyedQuery> queries) {
    final Map<String, String> mapping = queries.stream().collect(Collectors.toMap(KeyedQuery::getQuery, KeyedQuery::getBaseFileName));

    return new Answer<QueryResult>() {
        @Override
        public QueryResult answer(InvocationOnMock invocation) throws Throwable {
            final String q = invocation.getArgumentAt(0, Query.class).getCommand();
            final String file = mapping.get(q);
            if (file != null) {
                LOG.log(Level.INFO, "mapping to \"{1}\" from query: {0}", new Object[]{q, file});
                return new JsonQueryResult(file).getQueryResult();
            }
            throw new AssertionError("unexpected query: " + q);
        }
    };
}
 
Example #4
Source File: TopologyQuery.java    From skywalking with Apache License 2.0 6 votes vote down vote up
private List<Call.CallDetail> buildEndpointCalls(Query query,
                                                 DetectPoint detectPoint) throws IOException {
    QueryResult.Series series = client.queryForSingleSeries(query);

    if (log.isDebugEnabled()) {
        log.debug("SQL: {} result set: {}", query.getCommand(), series);
    }
    if (series == null) {
        return Collections.emptyList();
    }

    List<Call.CallDetail> calls = new ArrayList<>();
    series.getValues().forEach(values -> {
        Call.CallDetail call = new Call.CallDetail();
        String entityId = (String) values.get(1);
        call.buildFromEndpointRelation(entityId, detectPoint);
        calls.add(call);
    });
    return calls;
}
 
Example #5
Source File: UDPInfluxDBTest.java    From influxdb-java with MIT License 6 votes vote down vote up
/**
 * Test writing multiple records to the database using string protocol
 * through UDP.
 */
@Test
public void testWriteMultipleStringDataThroughUDP() throws InterruptedException {
    String measurement = TestUtils.getRandomMeasurement();
    this.influxDB.write(UDP_PORT, measurement + ",atag=test1 idle=100,usertime=10,system=1\n"
            + measurement + ",atag=test2 idle=200,usertime=20,system=2\n"
            + measurement + ",atag=test3 idle=300,usertime=30,system=3");
    Thread.sleep(2000);
    Query query = new Query("SELECT * FROM " + measurement + " GROUP BY *", UDP_DATABASE);
    QueryResult result = this.influxDB.query(query);

    Assertions.assertEquals(3, result.getResults().get(0).getSeries().size());
    Assertions.assertEquals("test1", result.getResults().get(0).getSeries().get(0).getTags().get("atag"));
    Assertions.assertEquals("test2", result.getResults().get(0).getSeries().get(1).getTags().get("atag"));
    Assertions.assertEquals("test3", result.getResults().get(0).getSeries().get(2).getTags().get("atag"));
}
 
Example #6
Source File: MetadataQuery.java    From skywalking with Apache License 2.0 6 votes vote down vote up
private List<Service> buildServices(Query query) throws IOException {
    QueryResult.Series series = client.queryForSingleSeries(query);
    if (log.isDebugEnabled()) {
        log.debug("SQL: {} result: {}", query.getCommand(), series);
    }

    ArrayList<Service> services = Lists.newArrayList();
    if (Objects.nonNull(series)) {
        for (List<Object> values : series.getValues()) {
            Service service = new Service();
            service.setId((String) values.get(1));
            service.setName((String) values.get(2));
            services.add(service);
        }
    }
    return services;
}
 
Example #7
Source File: InfluxHistory.java    From monsoon with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public long getFileSize() {
    final QueryResult result = getInfluxDB().query(new Query(String.format("select sum(\"diskBytes\") as \"diskBytes\" from (select last(\"diskBytes\"::field) as \"diskBytes\" from \"shard\" where \"database\"::tag = '%s' group by * limit 1)", getDatabase().replace("'", "\\'")), "_internal"), TimeUnit.MILLISECONDS);
    throwOnResultError(result);
    return result.getResults().stream()
            .filter(r -> !r.hasError())
            .filter(r -> r.getSeries() != null)
            .flatMap(r -> r.getSeries().stream())
            .map(s -> getColumnFromSeries(s, "diskBytes"))
            .filter(Optional::isPresent)
            .flatMap(Optional::get)
            .map(Number.class::cast)
            .mapToLong(Number::longValue)
            .findAny()
            .orElse(0);
}
 
Example #8
Source File: TopologyQuery.java    From skywalking with Apache License 2.0 6 votes vote down vote up
private List<Call.CallDetail> buildServiceCalls(Query query,
                                                DetectPoint detectPoint) throws IOException {
    QueryResult.Series series = client.queryForSingleSeries(query);

    if (log.isDebugEnabled()) {
        log.debug("SQL: {} result set: {}", query.getCommand(), series);
    }
    if (series == null) {
        return Collections.emptyList();
    }

    List<Call.CallDetail> calls = new ArrayList<>();
    series.getValues().forEach(values -> {
        Call.CallDetail call = new Call.CallDetail();
        String entityId = String.valueOf(values.get(1));
        int componentId = ((Number) values.get(2)).intValue();
        call.buildFromServiceRelation(entityId, componentId, detectPoint);
        calls.add(call);
    });
    return calls;
}
 
Example #9
Source File: InfluxDBMethodInterceptorTest.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    // write
    writeArguments = new Object[] {
        "sw8", "auto_gen", InfluxDB.ConsistencyLevel.ALL, TimeUnit.SECONDS,
        "weather,location=us-midwest temperature=82 1465839830100400200"
    };
    writeArgumentTypes = new Class[] {
        String.class, String.class, InfluxDB.ConsistencyLevel.class, TimeUnit.class, String.class
    };

    // query
    queryArguments = new Object[] {
        new Query("select * from weather limit 1", "sw8")
    };
    queryArgumentTypes = new Class[] {
        Query.class
    };

    interceptor = new InfluxDBMethodInterceptor();
    when(enhancedInstance.getSkyWalkingDynamicField()).thenReturn("http://127.0.0.1:8086");
}
 
Example #10
Source File: InfluxDBImpl.java    From influxdb-java with MIT License 6 votes vote down vote up
/**
 * Calls the influxDBService for the query.
 */
private Call<QueryResult> callQuery(final Query query) {
  Call<QueryResult> call;
  if (query instanceof BoundParameterQuery) {
      BoundParameterQuery boundParameterQuery = (BoundParameterQuery) query;
      call = this.influxDBService.postQuery(getDatabase(query), query.getCommandWithUrlEncoded(),
              boundParameterQuery.getParameterJsonWithUrlEncoded());
  } else {
      if (query.requiresPost()) {
        call = this.influxDBService.postQuery(getDatabase(query), query.getCommandWithUrlEncoded());
      } else {
        call = this.influxDBService.query(getDatabase(query), query.getCommandWithUrlEncoded());
      }
  }
  return call;
}
 
Example #11
Source File: BuiltQueryTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testIntoWithSelection() {
  Query query =
      new Query(
          "SELECT column1,MAX(column2),MAX(column3) INTO \"copy_NOAA_water_database\".\"autogen\".:MEASUREMENT FROM \"NOAA_water_database\".\"autogen\"./.*/ GROUP BY *;",
          DATABASE);
  Query select =
      select()
          .column("column1")
          .max("column2")
          .max("column3")
          .into("\"copy_NOAA_water_database\".\"autogen\".:MEASUREMENT")
          .from(DATABASE, "\"NOAA_water_database\".\"autogen\"./.*/")
          .groupBy(new RawText("*"));

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #12
Source File: InfluxDBTest.java    From influxdb-java with MIT License 6 votes vote down vote up
/**
 * Tests for callback query.
 */
@Test
public void testCallbackQuery() throws Throwable {
  final AsyncResult<QueryResult> result = new AsyncResult<>();
  final Consumer<QueryResult> firstQueryConsumer = new Consumer<QueryResult>() {
    @Override
    public void accept(QueryResult queryResult) {
      influxDB.query(new Query("DROP DATABASE mydb2", "mydb"), result.resultConsumer, result.errorConsumer);
    }
  };

  this.influxDB.query(new Query("CREATE DATABASE mydb2", "mydb"), firstQueryConsumer, result.errorConsumer);

  // Will throw exception in case of error.
  result.result();
}
 
Example #13
Source File: SelectionSubQueryImplTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testSubQueryRawTable() {
  Query query =
      new Query(
          "SELECT column1,column2 FROM (SELECT * FROM /*/) WHERE column1 = 1 GROUP BY time;",
          DATABASE);
  Query select =
      select()
          .requiresPost()
          .column("column1")
          .column("column2")
          .fromSubQueryRaw(DATABASE, "/*/")
          .close()
          .where(eq("column1", 1))
          .groupBy("time");

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #14
Source File: SelectionSubQueryImplTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testSubQueryWithTextOnWhere() {
  Query query =
      new Query(
          "SELECT column1,column2 FROM (SELECT * FROM foobar WHERE arbitrary text) WHERE column1 = 1 GROUP BY time;",
          DATABASE);
  Query select =
      select()
          .requiresPost()
          .column("column1")
          .column("column2")
          .fromSubQuery(DATABASE, "foobar")
          .where("arbitrary text")
          .close()
          .where(eq("column1", 1))
          .groupBy("time");

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #15
Source File: SelectionSubQueryImplTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testSubQueryWithLimit() {
  Query query =
      new Query(
          "SELECT column1,column2 FROM (SELECT * FROM foobar LIMIT 1) WHERE column1 = 1 GROUP BY time;",
          DATABASE);
  Query select =
      select()
          .requiresPost()
          .column("column1")
          .column("column2")
          .fromSubQuery(DATABASE, "foobar")
          .limit(1)
          .close()
          .where(eq("column1", 1))
          .groupBy("time");

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #16
Source File: SelectionSubQueryImplTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testSubQueryCountAll() {
  Query query =
      new Query(
          "SELECT column1,column2 FROM (SELECT COUNT(*) FROM foobar) WHERE column1 = 1 GROUP BY time;",
          DATABASE);
  Query select =
      select()
          .requiresPost()
          .column("column1")
          .column("column2")
          .fromSubQuery(DATABASE)
          .countAll()
          .from("foobar")
          .close()
          .where(eq("column1", 1))
          .groupBy("time");

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #17
Source File: SelectionSubQueryImplTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testSubQueryAs() {
  Query query =
      new Query(
          "SELECT column1,column2 FROM (SELECT column1 AS newname FROM foobar) WHERE column1 = 1 GROUP BY time;",
          DATABASE);
  Query select =
      select()
          .requiresPost()
          .column("column1")
          .column("column2")
          .fromSubQuery(DATABASE)
          .column("column1")
          .as("newname")
          .from("foobar")
          .close()
          .where(eq("column1", 1))
          .groupBy("time");

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #18
Source File: SelectionSubQueryImplTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testSubQueryColumns() {
  Query query =
      new Query(
          "SELECT column1,column2 FROM (SELECT column1,column2 FROM foobar) WHERE column1 = 1 GROUP BY time;",
          DATABASE);
  Query select =
      select()
          .requiresPost()
          .column("column1")
          .column("column2")
          .fromSubQuery(DATABASE)
          .column("column1")
          .column("column2")
          .from("foobar")
          .close()
          .where(eq("column1", 1))
          .groupBy("time");

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #19
Source File: BuiltQueryTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testOrAndConjunction() {
  Query query =
      new Query(
          "SELECT test1 FROM foobar WHERE test1 = 1 OR test2 = 'a' OR test3 = 'b' AND test4 = 'c';",
          DATABASE);
  Query select =
      select()
          .column("test1")
          .from(DATABASE, "foobar")
          .where(eq("test1", 1))
          .or(eq("test2", "a"))
          .or(eq("test3", "b"))
          .and(eq("test4", "c"));

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #20
Source File: SelectionSubQueryImplTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testSubQueryGroupByFillFromSelect() {
  Query query =
          new Query(
                  "SELECT column1,column2 FROM (SELECT * FROM foobar GROUP BY column1 fill(100)) WHERE column1 = 1 GROUP BY time;",
                  DATABASE);
  Query select =
          select()
                  .requiresPost()
                  .column("column1")
                  .column("column2")
                  .fromSubQuery(DATABASE)
                  .from("foobar")
                  .groupBy("column1")
                  .fill(100)
                  .close()
                  .where(eq("column1", 1))
                  .groupBy("time");

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #21
Source File: BuiltQueryTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testMean() {
  Query query =
      new Query(
          "SELECT MEAN(test1) FROM foobar WHERE test1 = 4 AND test2 > 'a' AND test2 <= 'z';",
          DATABASE);
  Query select =
      select()
          .mean("test1")
          .from(DATABASE, "foobar")
          .where(eq("test1", 4))
          .and(gt("test2", "a"))
          .and(lte("test2", "z"));

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #22
Source File: SelectionSubQueryImplTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testSubQueryTimeZoneColumns() {
  Query query =
      new Query(
          "SELECT column1,column2 FROM (SELECT column1,column2 FROM foobar tz('America/Chicago')) WHERE column1 = 1 GROUP BY time;",
          DATABASE);
  Query select =
      select()
          .requiresPost()
          .column("column1")
          .column("column2")
          .fromSubQuery(DATABASE)
          .column("column1")
          .column("column2")
          .from("foobar")
          .tz("America/Chicago")
          .close()
          .where(eq("column1", 1))
          .groupBy("time");

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #23
Source File: ITPutInfluxDB.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testValidTwoPointWithDifferentMeasurement() {
    String message = "water,country=US,city=newark rain=1,humidity=0.6" + System.lineSeparator()
            + "testm,country=US,city=chicago rain=10,humidity=0.9" + System.lineSeparator();
    byte [] bytes = message.getBytes();
    runner.enqueue(bytes);
    runner.run(1,true,true);
    runner.assertAllFlowFilesTransferred(PutInfluxDB.REL_SUCCESS, 1);
    List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(PutInfluxDB.REL_SUCCESS);
    assertEquals("Value should be equal", 1, flowFiles.size());
    assertEquals("Value should be equal",null, flowFiles.get(0).getAttribute(PutInfluxDB.INFLUX_DB_ERROR_MESSAGE));
    QueryResult result = influxDB.query(new Query("select * from water, testm", dbName));
    assertEquals("size should be same", 2, result.getResults().iterator().next().getSeries().size());
    List<List<Object>> values = result.getResults().iterator().next().getSeries().iterator().next().getValues();
    assertEquals("size should be same", 1, values.size());
}
 
Example #24
Source File: BuiltQueryTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testTimezone() {
  Query query =
      new Query(
          "SELECT test1 FROM foobar GROUP BY test2,test3 SLIMIT 1 tz('America/Chicago');",
          DATABASE);
  Query select =
      select()
          .column("test1")
          .from(DATABASE, "foobar")
          .groupBy("test2", "test3")
          .sLimit(1)
          .tz("America/Chicago");

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #25
Source File: UDPInfluxDBTest.java    From influxdb-java with MIT License 6 votes vote down vote up
/**
 * Test writing multiple separate records to the database using string
 * protocol through UDP.
 */
@Test
public void testWriteMultipleStringDataLinesThroughUDP() throws InterruptedException {
    String measurement = TestUtils.getRandomMeasurement();
    this.influxDB.write(UDP_PORT, Arrays.asList(
            measurement + ",atag=test1 idle=100,usertime=10,system=1",
            measurement + ",atag=test2 idle=200,usertime=20,system=2",
            measurement + ",atag=test3 idle=300,usertime=30,system=3"
    ));
    Thread.sleep(2000);
    Query query = new Query("SELECT * FROM " + measurement + " GROUP BY *", UDP_DATABASE);
    QueryResult result = this.influxDB.query(query);

    Assertions.assertEquals(3, result.getResults().get(0).getSeries().size());
    Assertions.assertEquals("test1", result.getResults().get(0).getSeries().get(0).getTags().get("atag"));
    Assertions.assertEquals("test2", result.getResults().get(0).getSeries().get(1).getTags().get("atag"));
    Assertions.assertEquals("test3", result.getResults().get(0).getSeries().get(2).getTags().get("atag"));
}
 
Example #26
Source File: TicketTest.java    From influxdb-java with MIT License 6 votes vote down vote up
/**
 * Test for ticket #39
 *
 */
@Test
public void testTicket39() {
	String dbName = "ticket39_" + System.currentTimeMillis();
	this.influxDB.query(new Query("CREATE DATABASE " + dbName));
	BatchPoints batchPoints = BatchPoints
			.database(dbName)
			.tag("async", "true")
			.retentionPolicy(TestUtils.defaultRetentionPolicy(this.influxDB.version()))
			.consistency(InfluxDB.ConsistencyLevel.ALL)
			.build();
	Point.Builder builder = Point.measurement("my_type");
	builder.addField("my_field", "string_value");
	Point point = builder.build();
	batchPoints.point(point);
	this.influxDB.write(batchPoints);
	this.influxDB.query(new Query("DROP DATABASE " + dbName));
}
 
Example #27
Source File: UDPInfluxDBTest.java    From influxdb-java with MIT License 6 votes vote down vote up
/**
 * Test the implementation of {@link InfluxDB#write(int, Point)}'s async
 * support.
 */
@Test
public void testAsyncWritePointThroughUDP() throws InterruptedException {
    this.influxDB.enableBatch(1, 1, TimeUnit.SECONDS);
    try {
        Assertions.assertTrue(this.influxDB.isBatchEnabled());
        String measurement = TestUtils.getRandomMeasurement();
        Point point = Point.measurement(measurement).tag("atag", "test").addField("used", 80L).addField("free", 1L).build();
        this.influxDB.write(UDP_PORT, point);
        Thread.sleep(2000);
        Query query = new Query("SELECT * FROM " + measurement + " GROUP BY *", UDP_DATABASE);
        QueryResult result = this.influxDB.query(query);
        Assertions.assertFalse(result.getResults().get(0).getSeries().get(0).getTags().isEmpty());
    } finally {
        this.influxDB.disableBatch();
    }
}
 
Example #28
Source File: BuiltQueryTest.java    From influxdb-java with MIT License 6 votes vote down vote up
@Test
public void testFill() {
  Query query =
      new Query(
          "SELECT water_level FROM h2o_feet WHERE time > 24043524m - 6m GROUP BY water_level fill(100);",
          DATABASE);
  Query select =
      select()
          .column("water_level")
          .from(DATABASE, "h2o_feet")
          .where(gt("time", op(ti(24043524L, MINUTE), SUB, ti(6L, MINUTE))))
          .groupBy("water_level")
          .fill(100);

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}
 
Example #29
Source File: InfluxDBTest.java    From influxdb-java with MIT License 5 votes vote down vote up
@Test
public void testChunkingOnFailure() throws InterruptedException {

	if (this.influxDB.version().startsWith("0.") || this.influxDB.version().startsWith("1.0")) {
		// do not test version 0.13 and 1.0
		return;
	}

	CountDownLatch countDownLatch = new CountDownLatch(1);
	Query query = new Query("XXXSELECT * FROM disk", "not-existing-db");
	this.influxDB.query(query, 2,
       //onNext - process result
       (cancellable, queryResult) -> {
         //assert that this is not executed in this test case
         Assertions.fail("onNext() is executed!");
       },
       //onComplete
       () -> Assertions.fail("onComplete() is executed !"),
			//onFailure
			throwable -> {
         Assertions.assertTrue(throwable.getLocalizedMessage().contains("error parsing query: found XXXSELECT"));
				countDownLatch.countDown();
			});

	Assertions.assertTrue(countDownLatch.await(2, TimeUnit.SECONDS));

}
 
Example #30
Source File: BuiltQueryTest.java    From influxdb-java with MIT License 5 votes vote down vote up
@Test
public void testMinWithLimit() {
  Query query = new Query("SELECT MIN(test1) FROM foobar LIMIT 1 OFFSET 20;", DATABASE);
  Query select = select().min("test1").from(DATABASE, "foobar").limit(1, 20);

  assertEquals(query.getCommand(), select.getCommand());
  assertEquals(query.getDatabase(), select.getDatabase());
}