-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
query
parameter for POST variants is serialized into HTTP body
- Loading branch information
Showing
11 changed files
with
170 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.influxdb; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.concurrent.CountDownLatch; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import org.influxdb.dto.Query; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; | ||
import org.junit.platform.runner.JUnitPlatform; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* @author Jakub Bednar (30/08/2021 11:31) | ||
*/ | ||
@RunWith(JUnitPlatform.class) | ||
@EnabledIfEnvironmentVariable(named = "INFLUXDB_VERSION", matches = "2\\.0") | ||
public class InfluxDB2Test { | ||
|
||
private InfluxDB influxDB; | ||
|
||
@BeforeEach | ||
public void setUp() throws NoSuchFieldException, IllegalAccessException { | ||
String url = String.format("http://%s:%s", TestUtils.getInfluxIP(), TestUtils.getInfluxPORT(true)); | ||
influxDB = InfluxDBFactory | ||
.connect(url, "my-user", "my-password") | ||
.setDatabase("mydb") | ||
.setRetentionPolicy("autogen"); | ||
} | ||
|
||
@AfterEach | ||
public void cleanup() { | ||
influxDB.close(); | ||
} | ||
|
||
@Test | ||
public void testQuery() throws InterruptedException { | ||
|
||
String measurement = TestUtils.getRandomMeasurement(); | ||
|
||
// prepare data | ||
List<String> records = new ArrayList<>(); | ||
records.add(measurement + ",test=a value=1 1"); | ||
records.add(measurement + ",test=a value=2 2"); | ||
influxDB.write(records); | ||
|
||
// query data | ||
final CountDownLatch countDownLatch = new CountDownLatch(1); | ||
influxDB.query(new Query("SELECT * FROM " + measurement), 2, queryResult -> countDownLatch.countDown()); | ||
|
||
Assertions.assertTrue(countDownLatch.await(2, TimeUnit.SECONDS)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters