This is an automated email from the ASF dual-hosted git repository.
pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new eef4ea1fc6 NIFI-10138 Updated Atlas tests to use Jackson 2
eef4ea1fc6 is described below
commit eef4ea1fc6d9e11008da61ebecde6dc8e6c1a2c9
Author: exceptionfactory <[email protected]>
AuthorDate: Fri Jun 17 14:08:28 2022 -0500
NIFI-10138 Updated Atlas tests to use Jackson 2
- Replaced Jackson 1 dependencies with Jackson 2
- Removed commons-beanutils override that is no longer necessary with new
Hadoop version
Signed-off-by: Pierre Villard <[email protected]>
This closes #6136.
---
.../nifi-atlas-reporting-task/pom.xml | 38 ++--------------------
.../atlas/emulator/AtlasAPIV2ServerEmulator.java | 10 +++---
.../atlas/reporting/ITReportLineageToAtlas.java | 4 +--
3 files changed, 8 insertions(+), 44 deletions(-)
diff --git
a/nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/pom.xml
b/nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/pom.xml
index c70262787d..5a34540c23 100644
--- a/nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/pom.xml
+++ b/nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/pom.xml
@@ -56,21 +56,6 @@
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-kerberos-credentials-service-api</artifactId>
</dependency>
-
- <!-- Explicitly force beanutils 1.9.4 in order to avoid
vulnerabilities in earlier versions.
- Can remove this once atlas client which depends on hadoop-common
uses a more recent version. -->
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.9.4</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-client-v2</artifactId>
@@ -90,28 +75,9 @@
</exclusion>
</exclusions>
</dependency>
-
- <dependency>
- <groupId>org.codehaus.jettison</groupId>
- <artifactId>jettison</artifactId>
- <version>1.1</version>
- <exclusions>
- <exclusion>
- <!-- jersey-json has dependency to newer
javax.xml.stream:stax-api:jar -->
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-jaxrs</artifactId>
- <version>1.9.13</version>
- </dependency>
<dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-xc</artifactId>
- <version>1.9.13</version>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
</dependency>
<!-- test -->
diff --git
a/nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/test/java/org/apache/nifi/atlas/emulator/AtlasAPIV2ServerEmulator.java
b/nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/test/java/org/apache/nifi/atlas/emulator/AtlasAPIV2ServerEmulator.java
index 0de6e8fe41..de2df80fa2 100644
---
a/nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/test/java/org/apache/nifi/atlas/emulator/AtlasAPIV2ServerEmulator.java
+++
b/nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/test/java/org/apache/nifi/atlas/emulator/AtlasAPIV2ServerEmulator.java
@@ -16,6 +16,8 @@
*/
package org.apache.nifi.atlas.emulator;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.atlas.model.discovery.AtlasSearchResult;
import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.model.instance.AtlasEntityHeader;
@@ -26,8 +28,6 @@ import org.apache.atlas.v1.model.instance.Referenceable;
import org.apache.atlas.v1.model.notification.HookNotificationV1;
import org.apache.nifi.atlas.AtlasUtils;
import org.apache.nifi.atlas.NiFiTypes;
-import org.codehaus.jackson.map.DeserializationConfig;
-import org.codehaus.jackson.map.ObjectMapper;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
@@ -243,10 +243,8 @@ public class AtlasAPIV2ServerEmulator {
private static <T> T readInputJSON(HttpServletRequest req, Class<? extends
T> clazz) throws IOException {
return new ObjectMapper()
-
.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false)
- .reader()
- .withType(clazz)
- .readValue(req.getInputStream());
+ .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .readValue(req.getInputStream(), clazz);
}
private static final AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
diff --git
a/nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/test/java/org/apache/nifi/atlas/reporting/ITReportLineageToAtlas.java
b/nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/test/java/org/apache/nifi/atlas/reporting/ITReportLineageToAtlas.java
index 57c139417b..abd2c755d7 100644
---
a/nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/test/java/org/apache/nifi/atlas/reporting/ITReportLineageToAtlas.java
+++
b/nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/test/java/org/apache/nifi/atlas/reporting/ITReportLineageToAtlas.java
@@ -43,7 +43,7 @@ import org.apache.nifi.state.MockStateManager;
import org.apache.nifi.util.MockComponentLog;
import org.apache.nifi.util.MockConfigurationContext;
import org.apache.nifi.util.MockPropertyValue;
-import org.codehaus.jackson.map.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -522,7 +522,7 @@ public class ITReportLineageToAtlas {
private Lineage getLineage() throws Exception {
final URL url = new
URL("http://localhost:21000/api/atlas/v2/debug/lineage/");
try (InputStream in = url.openStream()) {
- Lineage lineage = new
ObjectMapper().reader().withType(Lineage.class).readValue(in);
+ Lineage lineage = new ObjectMapper().readValue(in, Lineage.class);
return lineage;
}
}