summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-context
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugins-context')
-rw-r--r--plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml8
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/pom.xml4
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaMapTest.java18
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java10
4 files changed, 22 insertions, 18 deletions
diff --git a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml
index 0fa93ae29..c1c97b44b 100644
--- a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml
+++ b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
- Modifications Copyright (C) 2019 Nordix Foundation.
+ Modifications Copyright (C) 2019,2023 Nordix Foundation.
Modifications Copyright (C) 2020 Bell Canada.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
@@ -35,7 +35,7 @@
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
- <version>5.0.0</version>
+ <version>${version.curator}</version>
<exclusions>
<!-- The default Zookeeper version in Curator has vulnerabilities -->
<exclusion>
@@ -47,13 +47,13 @@
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
- <version>5.0.0</version>
+ <version>${version.curator}</version>
</dependency>
<!-- This Zookeeper version fixes the vulnerabilities -->
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
- <version>3.6.1</version>
+ <version>${version.zookeeper}</version>
<exclusions>
<!-- Zookeeper uses an ancient version of log4j -->
<exclusion>
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/pom.xml b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/pom.xml
index 3cc7608ca..6157cfcb1 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/pom.xml
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2016-2018 Ericsson. All rights reserved.
- Modifications Copyright (C) 2020 Nordix Foundation.
+ Modifications Copyright (C) 2020,2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
- <version>1.9.2</version>
+ <version>${version.avro}</version>
<exclusions>
<exclusion>
<groupId>org.apache.commons</groupId>
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaMapTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaMapTest.java
index f4d202473..a3e85ed91 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaMapTest.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaMapTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2020-2021,2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +21,9 @@
package org.onap.policy.apex.plugins.context.schema.avro;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThrows;
import java.io.File;
@@ -111,7 +111,8 @@ public class AvroSchemaMapTest {
.createSchemaHelper(testKey, avroSubstSchema1.getKey());
final GenericRecord subst1A = (GenericRecord) schemaHelperSubst1.unmarshal("{\"A-B\":\"foo\"}");
assertEquals(new Utf8("foo"), subst1A.get("A_DasH_B"));
- assertNull(subst1A.get("A-B"));
+ assertThatThrownBy(() -> subst1A.get("A-B")).hasMessage("Not a valid schema field: A-B");
+
final Throwable exception1 = assertThrows(ContextRuntimeException.class,
() -> schemaHelperSubst1.unmarshal("{\"A-B\":123}"));
assertNotNull(exception1.getCause());
@@ -127,7 +128,8 @@ public class AvroSchemaMapTest {
.createSchemaHelper(testKey, avroSubstSchema2.getKey());
final GenericRecord subst2A = (GenericRecord) schemaHelperSubst2.unmarshal("{\"C.D\":123}");
assertEquals(123, subst2A.get("C_DoT_D"));
- assertNull(subst2A.get("C.D"));
+ assertThatThrownBy(() -> subst2A.get("C.D")).hasMessage("Not a valid schema field: C.D");
+
final Throwable exception2 = assertThrows(ContextRuntimeException.class,
() -> schemaHelperSubst2.unmarshal("{\"C_DoT_D\":\"bar\"}"));
assertNotNull(exception2.getCause());
@@ -143,7 +145,8 @@ public class AvroSchemaMapTest {
.createSchemaHelper(testKey, avroSubstSchema3.getKey());
final GenericRecord subst3A = (GenericRecord) schemaHelperSubst3.unmarshal("{\"E:F\":true}");
assertEquals(true, subst3A.get("E_ColoN_F"));
- assertNull(subst3A.get("E:F"));
+ assertThatThrownBy(() -> subst3A.get("E:F")).hasMessage("Not a valid schema field: E:F");
+
final Throwable exception3 = assertThrows(ContextRuntimeException.class,
() -> schemaHelperSubst3.unmarshal("{\"E_ColoN_F\":\"gaz\"}"));
assertNotNull(exception3.getCause());
@@ -264,8 +267,9 @@ public class AvroSchemaMapTest {
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey());
- GenericRecord subRecord = (GenericRecord) schemaHelper.createNewSubInstance("AddressUSRecord");
- assertNull(subRecord.get("streetAddress"));
+ final GenericRecord subRecord = (GenericRecord) schemaHelper.createNewSubInstance("AddressUSRecord");
+ assertThatThrownBy(() -> subRecord.get("streetAddress")).hasMessage("Not a valid schema field: streetAddress");
+
}
/**
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java
index 147798227..2977059c6 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020,2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -143,11 +143,11 @@ public class AvroSchemaRecordTest {
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey());
- GenericRecord subRecord = (GenericRecord) schemaHelper.createNewSubInstance("AddressUSRecord");
- assertEquals(null, subRecord.get("streetAddress"));
+ final GenericRecord subRecord0 = (GenericRecord) schemaHelper.createNewSubInstance("AddressUSRecord");
+ assertThatThrownBy(() -> subRecord0.get("address")).hasMessage("Not a valid schema field: address");
- subRecord = (GenericRecord) schemaHelper.createNewSubInstance("EmailAddress");
- assertEquals(null, subRecord.get("address"));
+ final GenericRecord subRecord1 = (GenericRecord) schemaHelper.createNewSubInstance("EmailAddress");
+ assertThatThrownBy(() -> subRecord0.get("address")).hasMessage("Not a valid schema field: address");
assertThatThrownBy(() -> schemaHelper.createNewSubInstance("IDontExist"))
.hasMessage("AvroTest:0.0.1: the schema \"User\" does not have a subtype of type \"IDontExist\"");