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

Commit

Permalink
chore: update to Apache NiFi 1.14.0 (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar authored Jul 29, 2021
1 parent 134944c commit ecae435
Show file tree
Hide file tree
Showing 17 changed files with 258 additions and 209 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## v1.13.0 [unreleased]

### Others
1. [#60](https://github.com/influxdata/nifi-influxdb-bundle/pull/60): Update to Apache NiFi 1.14.0

## v1.12.0 [2021-07-09]

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The Nar compatibility matrix:

Nar Version | NiFi Version
----------------------------------------------------------------------------------------------------------------------------------------| ------------
[nifi-influx-database-nar-1.13.0-SNAPSHOT.nar](https://github.com/influxdata/nifi-influxdb-bundle/releases/download/v1.13.0-SNAPSHOT/nifi-influx-database-nar-1.13.0-SNAPSHOT.nar) | 1.13.2
[nifi-influx-database-nar-1.13.0-SNAPSHOT.nar](https://github.com/influxdata/nifi-influxdb-bundle/releases/download/v1.13.0-SNAPSHOT/nifi-influx-database-nar-1.13.0-SNAPSHOT.nar) | 1.14.0
[nifi-influx-database-nar-1.12.0.nar](https://github.com/influxdata/nifi-influxdb-bundle/releases/download/v1.12.0/nifi-influx-database-nar-1.12.0.nar) | 1.13.2
[nifi-influx-database-nar-1.11.0.nar](https://github.com/influxdata/nifi-influxdb-bundle/releases/download/v1.11.0/nifi-influx-database-nar-1.11.0.nar) | 1.13.2
[nifi-influx-database-nar-1.10.0.nar](https://github.com/influxdata/nifi-influxdb-bundle/releases/download/v1.10.0/nifi-influx-database-nar-1.10.0.nar) | 1.13.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ public void setUp() throws Exception {

GetInfluxDatabaseRecord_2 putInfluxDatabase_2 = new GetInfluxDatabaseRecord_2();
runner = TestRunners.newTestRunner(putInfluxDatabase_2);
runner.setValidateExpressionUsage(false);
runner.setProperty(GetInfluxDatabaseRecord_2.INFLUX_DB_SERVICE, "influxdb-service");
runner.setProperty(GetInfluxDatabaseRecord_2.ORG, organization.getId());
runner.setProperty(GetInfluxDatabaseRecord_2.QUERY, "from(bucket:\"" + bucketName + "\") |> range(start: 0)");
runner.setProperty(GetInfluxDatabaseRecord_2.LOG_LEVEL, "BODY");
runner.setProperty(GetInfluxDatabaseRecord_2.LOG_LEVEL, "BODY");

InfluxDatabaseService_2 influxDatabaseService = Mockito.spy(new StandardInfluxDatabaseService_2());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public void setUp() throws Exception {

GetInfluxDatabase_2 putInfluxDatabase_2 = new GetInfluxDatabase_2();
runner = TestRunners.newTestRunner(putInfluxDatabase_2);
runner.setValidateExpressionUsage(false);
runner.setProperty(GetInfluxDatabase_2.INFLUX_DB_SERVICE, "influxdb-service");
runner.setProperty(GetInfluxDatabase_2.ORG, organization.getId());
runner.setProperty(GetInfluxDatabase_2.QUERY, "from(bucket:\"" + bucketName + "\") |> range(start: 0)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@

import com.influxdb.query.FluxRecord;
import com.influxdb.query.FluxTable;
import org.influxdata.nifi.processors.internal.AbstractInfluxDatabaseProcessor;
import org.influxdata.nifi.serialization.InfluxLineProtocolReader;
import org.influxdata.nifi.services.InfluxDatabaseService_2;
import org.influxdata.nifi.services.StandardInfluxDatabaseService_2;
import org.influxdata.nifi.util.InfluxDBUtils;

import org.apache.nifi.reporting.InitializationException;
import org.apache.nifi.serialization.record.MockRecordParser;
import org.apache.nifi.serialization.record.RecordFieldType;
import org.apache.nifi.util.MockProcessContext;
import org.apache.nifi.util.MockProcessorInitializationContext;
import org.apache.nifi.util.TestRunners;
import org.influxdata.nifi.processors.internal.AbstractInfluxDatabaseProcessor;
import org.influxdata.nifi.serialization.InfluxLineProtocolReader;
import org.influxdata.nifi.services.InfluxDatabaseService_2;
import org.influxdata.nifi.services.StandardInfluxDatabaseService_2;
import org.influxdata.nifi.util.InfluxDBUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -58,6 +57,7 @@ public void setUp() throws Exception {

PutInfluxDatabaseRecord_2 processor = new PutInfluxDatabaseRecord_2();
runner = TestRunners.newTestRunner(processor);
runner.setValidateExpressionUsage(false);
runner.setProperty(PutInfluxDatabaseRecord_2.INFLUX_DB_SERVICE, "influxdb-service");
runner.setProperty(AbstractInfluxDatabaseProcessor.RECORD_READER_FACTORY, "recordReader");
runner.setProperty(InfluxDBUtils.MEASUREMENT, "testRecordMeasurement");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void setUp() throws Exception {

PutInfluxDatabase_2 putInfluxDatabase_2 = new PutInfluxDatabase_2();
runner = TestRunners.newTestRunner(putInfluxDatabase_2);
runner.setValidateExpressionUsage(false);
runner.setProperty(PutInfluxDatabase_2.INFLUX_DB_SERVICE, "influxdb-service");
runner.setProperty(PutInfluxDatabase_2.BUCKET, bucketName);
runner.setProperty(PutInfluxDatabase_2.ORG, "my-org");
Expand Down
6 changes: 6 additions & 0 deletions nifi-influx-database-services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
<version>${nifi.version}</version>
</dependency>

<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-security-utils</artifactId>
<version>${nifi.version}</version>
</dependency>

<dependency>
<groupId>org.influxdb</groupId>
<artifactId>influxdb-java</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
import java.security.GeneralSecurityException;
import java.util.Objects;

import edu.umd.cs.findbugs.annotations.NonNull;
import okhttp3.OkHttpClient;
import org.apache.nifi.controller.AbstractControllerService;
import org.apache.nifi.security.util.ClientAuth;
import org.apache.nifi.security.util.SslContextFactory;
import org.apache.nifi.security.util.TlsConfiguration;
import org.apache.nifi.ssl.SSLContextService;

/**
Expand All @@ -43,7 +40,7 @@ abstract class AbstractInfluxDatabaseService extends AbstractControllerService {
*/
void configureSSL(@NonNull final OkHttpClient.Builder okHttpClient,
@NonNull final ClientAuth clientAuth,
@NonNull final SSLContextService sslService) throws GeneralSecurityException
@NonNull final SSLContextService sslService)
{

Objects.requireNonNull(okHttpClient, "OkHttpClient.Builder is required");
Expand All @@ -59,8 +56,7 @@ void configureSSL(@NonNull final OkHttpClient.Builder okHttpClient,
sslContext.getDefaultSSLParameters().setWantClientAuth(false);
}
final SSLSocketFactory socketFactory = sslContext.getSocketFactory();
final TlsConfiguration tlsConfiguration = sslService.createTlsConfiguration();
final X509TrustManager trustManager = SslContextFactory.getX509TrustManager(tlsConfiguration);
final X509TrustManager trustManager = sslService.createTrustManager();
okHttpClient.sslSocketFactory(socketFactory, trustManager);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected InfluxDB connect(final String username,
final SSLContextService sslService,
final ClientAuth clientAuth,
final String influxDbUrl,
final long connectionTimeout) throws IOException, GeneralSecurityException {
final long connectionTimeout) throws IOException {


OkHttpClient.Builder builder = new OkHttpClient.Builder().connectTimeout(connectionTimeout, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.influxdata.nifi.services;

import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -107,7 +106,7 @@ protected InfluxDBClient connect(final String token,
final SSLContextService sslService,
final ClientAuth clientAuth,
final String influxDbUrl,
final long connectionTimeout) throws IOException, GeneralSecurityException {
final long connectionTimeout) throws IOException {


OkHttpClient.Builder builder = new OkHttpClient.Builder().connectTimeout(connectionTimeout, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@
*/
package org.influxdata.nifi.services;

import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;

import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.domain.HealthCheck;

import edu.umd.cs.findbugs.annotations.NonNull;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.processor.AbstractProcessor;
Expand Down Expand Up @@ -63,9 +60,10 @@ protected void setUp(@NonNull final Supplier<Answer> answerConnect) throws Excep
testRunner = TestRunners.newTestRunner(ServiceProcessor.class);
testRunner.addControllerService("influxdb-service", service);
testRunner.setProperty(service, InfluxDatabaseService_2.INFLUX_DB_ACCESS_TOKEN, "my-token");
testRunner.setValidateExpressionUsage(false);
}

protected void assertConnectToDatabase() throws IOException, GeneralSecurityException {
protected void assertConnectToDatabase() {

InfluxDBClient client = service.create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void defaultSettingsIsValid() {
}

@Test
public void defaultSettings() throws IOException, GeneralSecurityException {
public void defaultSettings() throws IOException {

testRunner.enableControllerService(service);

Expand All @@ -59,7 +59,7 @@ public void defaultSettings() throws IOException, GeneralSecurityException {
}

@Test
public void sslContextService() throws InitializationException, IOException, GeneralSecurityException {
public void sslContextService() throws InitializationException, IOException {

SSLContextService sslContextService = Mockito.mock(SSLContextService.class);
when(sslContextService.getIdentifier()).thenReturn("inluxdb-ssl");
Expand All @@ -82,7 +82,7 @@ public void sslContextService() throws InitializationException, IOException, Gen
}

@Test
public void clientAuth() throws IOException, GeneralSecurityException {
public void clientAuth() throws IOException {

testRunner.setProperty(service, InfluxDatabaseService_2.CLIENT_AUTH, ClientAuth.NONE.name());
testRunner.assertValid(service);
Expand All @@ -99,7 +99,7 @@ public void clientAuth() throws IOException, GeneralSecurityException {
}

@Test
public void url() throws IOException, GeneralSecurityException {
public void url() throws IOException {

testRunner.setProperty(service, InfluxDatabaseService_2.INFLUX_DB_URL, "http://influxdb:8886");
testRunner.assertValid(service);
Expand All @@ -126,7 +126,7 @@ public void urlValidation() {
}

@Test
public void dbConnectionTimeout() throws IOException, GeneralSecurityException {
public void dbConnectionTimeout() throws IOException {

testRunner.setProperty(service, InfluxDatabaseService_2.INFLUX_DB_CONNECTION_TIMEOUT, "100 mins");
testRunner.assertValid(service);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import java.util.Map;
import java.util.concurrent.TimeUnit;

import org.influxdata.nifi.processors.MapperOptions;

import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.expression.ExpressionLanguageScope;
import org.apache.nifi.flowfile.FlowFile;
Expand All @@ -36,6 +34,7 @@
import org.apache.nifi.util.MockVariableRegistry;
import org.apache.nifi.util.TestRunner;
import org.apache.nifi.util.TestRunners;
import org.influxdata.nifi.processors.MapperOptions;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -46,7 +45,7 @@ public class TestPropertyValueUtils {
.displayName("Enum value")
.defaultValue(PropertyEnum.ONE.name())
.required(true)
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.allowableValues(Arrays.stream(PropertyEnum.values()).map(Enum::name).toArray(String[]::new))
.sensitive(false)
.build();
Expand All @@ -56,7 +55,7 @@ public class TestPropertyValueUtils {
.displayName("List value")
.defaultValue("")
.required(true)
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.sensitive(false)
.build();

Expand Down
36 changes: 2 additions & 34 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-nar-bundles</artifactId>
<version>1.13.2</version>
<version>1.14.0</version>
</parent>

<artifactId>nifi-influx-database-bundle</artifactId>
Expand Down Expand Up @@ -103,16 +103,10 @@
<!-- skip until remove org.json from Java client -->
<enforcer.skip>true</enforcer.skip>

<!--
TODO after update NiFi:
- remote nifi.groovy.version property
- remove pluginRepositories
-->
<nifi.version>1.13.2</nifi.version>
<nifi.version>1.14.0</nifi.version>

<plugin.surefire.version>2.22.0</plugin.surefire.version>
<plugin.jacoco.version>0.8.2</plugin.jacoco.version>
<nifi.groovy.version>2.5.6</nifi.groovy.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -406,30 +400,4 @@

</repositories>

<pluginRepositories>
<pluginRepository>
<id>bintray</id>
<name>Groovy Bintray</name>
<url>https://dl.bintray.com/groovy/maven</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>maven2</id>
<name>maven2</name>
<url>https://repo1.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>

</pluginRepositories>

</project>
2 changes: 1 addition & 1 deletion scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#

ARG NIFI_IMAGE=apache/nifi:1.13.2
ARG NIFI_IMAGE=apache/nifi:1.14.0

FROM $NIFI_IMAGE

Expand Down
Loading

0 comments on commit ecae435

Please sign in to comment.