Skip to content
This repository has been archived by the owner on Dec 26, 2024. It is now read-only.

feat: update influxdb-client-java to 2.2.0 #54

Merged
merged 2 commits into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## v1.11.0 [unreleased]

### Others
1. [#54](https://github.com/influxdata/nifi-influxdb-bundle/pull/54): Update `influxdb-client-java` to 2.2.0

## v1.10.0 [2021-04-01]

### Others
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import java.util.List;

import com.google.common.collect.Lists;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.influxdb.client.domain.WritePrecision;
import org.apache.avro.file.DataFileStream;
import org.apache.avro.generic.GenericData;
Expand All @@ -43,8 +45,6 @@
import org.influxdata.nifi.processors.internal.AbstractInfluxDatabaseProcessor;
import org.influxdata.nifi.services.InfluxDatabaseService_2;
import org.influxdata.nifi.services.StandardInfluxDatabaseService_2;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -197,18 +197,18 @@ public void writeToJson() throws InitializationException {
MockFlowFile flowFile = runner.getFlowFilesForRelationship(GetInfluxDatabaseRecord_2.REL_SUCCESS).get(0);

String json = new String(runner.getContentAsByteArray(flowFile));
JSONObject parsedJson = (new JSONArray(json)).getJSONObject(0);
JsonObject parsedJson = (new JsonParser().parse(json).getAsJsonArray()).get(0).getAsJsonObject();

Assert.assertNotNull(parsedJson);
Assert.assertEquals("_result", parsedJson.get("result"));
Assert.assertEquals(0, parsedJson.get("table"));
Assert.assertEquals(0, parsedJson.get("_start"));
Assert.assertEquals(0, parsedJson.get("_time"));
Assert.assertTrue((long) parsedJson.get("_stop") > from.getTime());
Assert.assertEquals("humidity", parsedJson.get("_field"));
Assert.assertEquals("newark", parsedJson.get("city"));
Assert.assertEquals("US", parsedJson.get("country"));
Assert.assertEquals(0.6D, parsedJson.get("_value"));
Assert.assertEquals("_result", parsedJson.get("result").getAsString());
Assert.assertEquals(0, parsedJson.get("table").getAsInt());
Assert.assertEquals(0, parsedJson.get("_start").getAsInt());
Assert.assertEquals(0, parsedJson.get("_time").getAsInt());
Assert.assertTrue(parsedJson.get("_stop").getAsLong() > from.getTime());
Assert.assertEquals("humidity", parsedJson.get("_field").getAsString());
Assert.assertEquals("newark", parsedJson.get("city").getAsString());
Assert.assertEquals("US", parsedJson.get("country").getAsString());
Assert.assertEquals((Object) 0.6D, parsedJson.get("_value").getAsDouble());
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
<dependency>
<groupId>com.influxdb</groupId>
<artifactId>influxdb-client-java</artifactId>
<version>1.11.0</version>
<version>2.2.0</version>
</dependency>

<dependency>
Expand Down