Issue-ID: AAI-2806
Change-Id: I23dc5efa936d9efe2ecf326064ae5e5046764339
Signed-off-by: Kajur, Harish (vk250x) <vk250x@att.com>
16 files changed:
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-aaf-auth</artifactId>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-aaf-auth</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-annotations</artifactId>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-annotations</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-auth</artifactId>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-auth</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common-docker</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common-docker</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
</parent>
<artifactId>aai-common-images</artifactId>
</parent>
<artifactId>aai-common-images</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<packaging>pom</packaging>
<name>aai-aai-common-images</name>
<description>Contains dockerfiles for aai-common images (alpine and ubuntu based).</description>
<packaging>pom</packaging>
<name>aai-aai-common-images</name>
<description>Contains dockerfiles for aai-common images (alpine and ubuntu based).</description>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common-docker</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common-docker</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
</parent>
<artifactId>aai-haproxy-image</artifactId>
</parent>
<artifactId>aai-haproxy-image</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<packaging>pom</packaging>
<name>aai-aai-haproxy-image</name>
<description>Contains dockerfiles for aai-haproxy image.</description>
<packaging>pom</packaging>
<name>aai-aai-haproxy-image</name>
<description>Contains dockerfiles for aai-haproxy image.</description>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-core</artifactId>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-core</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-els-onap-logging</artifactId>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-els-onap-logging</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
</parent>
<artifactId>aai-parent</artifactId>
<name>aai-parent</name>
</parent>
<artifactId>aai-parent</artifactId>
<name>aai-parent</name>
<slf4j.version>1.7.25</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<mockito.all.version>1.10.19</mockito.all.version>
<slf4j.version>1.7.25</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<mockito.all.version>1.10.19</mockito.all.version>
- <mockito.core.version>2.15.0</mockito.core.version>
+ <mockito.core.version>1.10.19</mockito.core.version>
<netty.handler.version>4.1.43.Final</netty.handler.version>
<netty.version>4.0.56.Final</netty.version>
<opencsv.version>3.1</opencsv.version>
<netty.handler.version>4.1.43.Final</netty.handler.version>
<netty.version>4.0.56.Final</netty.version>
<opencsv.version>3.1</opencsv.version>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-rest</artifactId>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-rest</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.runners.MockitoJUnitRunner;
import org.onap.aai.schemaif.SchemaProviderException;
import org.onap.aai.schemaif.definitions.EdgeSchema;
import org.onap.aai.schemaif.definitions.PropertySchema;
import org.onap.aai.schemaif.definitions.VertexSchema;
import org.onap.aai.schemaif.definitions.types.DataType.Type;
import org.onap.aai.schemaif.SchemaProviderException;
import org.onap.aai.schemaif.definitions.EdgeSchema;
import org.onap.aai.schemaif.definitions.PropertySchema;
import org.onap.aai.schemaif.definitions.VertexSchema;
import org.onap.aai.schemaif.definitions.types.DataType.Type;
-@RunWith(MockitoJUnitRunner.Silent.class)
+@RunWith(MockitoJUnitRunner.class)
public class OxmSchemaProviderTest extends OxmSchemaServiceSetup {
@Test
public class OxmSchemaProviderTest extends OxmSchemaServiceSetup {
@Test
VertexSchema vertSchema = schemaProvider.getVertexSchema("pserver", schemaProvider.getLatestSchemaVersion());
System.out.println(vertSchema.toString());
VertexSchema vertSchema = schemaProvider.getVertexSchema("pserver", schemaProvider.getLatestSchemaVersion());
System.out.println(vertSchema.toString());
- EdgeSchema edgeSchema = schemaProvider.getEdgeSchema("org.onap.relationships.inventory.LocatedIn",
+ EdgeSchema edgeSchema = schemaProvider.getEdgeSchema("org.onap.relationships.inventory.LocatedIn",
"cloud-region", "zone", schemaProvider.getLatestSchemaVersion());
System.out.println(edgeSchema.toString());
"cloud-region", "zone", schemaProvider.getLatestSchemaVersion());
System.out.println(edgeSchema.toString());
// Validate vertex schema
assertTrue(vertSchema.getName().equals("pserver"));
assertTrue(vertSchema.getAnnotationValue("nameProps").equals("pserver-name2"));
assertTrue(vertSchema.getAnnotationValue("dependentOn") == null);
// Validate vertex schema
assertTrue(vertSchema.getName().equals("pserver"));
assertTrue(vertSchema.getAnnotationValue("nameProps").equals("pserver-name2"));
assertTrue(vertSchema.getAnnotationValue("dependentOn") == null);
PropertySchema propSchema = vertSchema.getPropertySchema("hostname");
assertTrue(propSchema.getName().equals("hostname"));
assertTrue(propSchema.getDefaultValue().equals(""));
PropertySchema propSchema = vertSchema.getPropertySchema("hostname");
assertTrue(propSchema.getName().equals("hostname"));
assertTrue(propSchema.getDefaultValue().equals(""));
assertTrue(propSchema.getDataType().getType().compareTo(Type.STRING) == 0);
Object obj = propSchema.validateValue("somestring");
assertTrue(obj instanceof String);
assertTrue(propSchema.getDataType().getType().compareTo(Type.STRING) == 0);
Object obj = propSchema.validateValue("somestring");
assertTrue(obj instanceof String);
propSchema = vertSchema.getPropertySchema("in-maint");
assertTrue(propSchema.getName().equals("in-maint"));
assertTrue(propSchema.getDefaultValue().equals("false"));
propSchema = vertSchema.getPropertySchema("in-maint");
assertTrue(propSchema.getName().equals("in-maint"));
assertTrue(propSchema.getDefaultValue().equals("false"));
obj = propSchema.validateValue("false");
assertTrue(obj instanceof Boolean);
assertTrue(propSchema.getDataType().validateValue("badValue") == null);
obj = propSchema.validateValue("false");
assertTrue(obj instanceof Boolean);
assertTrue(propSchema.getDataType().validateValue("badValue") == null);
propSchema = vertSchema.getPropertySchema("aai-node-type");
assertTrue(propSchema.getName().equals("aai-node-type"));
assertTrue(propSchema.getDefaultValue().equals(""));
propSchema = vertSchema.getPropertySchema("aai-node-type");
assertTrue(propSchema.getName().equals("aai-node-type"));
assertTrue(propSchema.getDefaultValue().equals(""));
assertTrue(!propSchema.isKey());
assertTrue(propSchema.isReserved());
assertTrue(propSchema.getDataType().getType().compareTo(Type.STRING) == 0);
assertTrue(!propSchema.isKey());
assertTrue(propSchema.isReserved());
assertTrue(propSchema.getDataType().getType().compareTo(Type.STRING) == 0);
propSchema = vertSchema.getPropertySchema("pserver-id");
assertTrue(propSchema.getName().equals("pserver-id"));
assertTrue(propSchema.getDefaultValue().equals(""));
propSchema = vertSchema.getPropertySchema("pserver-id");
assertTrue(propSchema.getName().equals("pserver-id"));
assertTrue(propSchema.getDefaultValue().equals(""));
assertTrue(!propSchema.isReserved());
assertTrue(propSchema.isKey());
assertTrue(propSchema.getDataType().getType().compareTo(Type.STRING) == 0);
assertTrue(!propSchema.isReserved());
assertTrue(propSchema.isKey());
assertTrue(propSchema.getDataType().getType().compareTo(Type.STRING) == 0);
propSchema = vertSchema.getPropertySchema("number-of-cpus");
assertTrue(propSchema.getName().equals("number-of-cpus"));
assertTrue(propSchema.getAnnotationValue("source-of-truth-type").equals("openstack"));
propSchema = vertSchema.getPropertySchema("number-of-cpus");
assertTrue(propSchema.getName().equals("number-of-cpus"));
assertTrue(propSchema.getAnnotationValue("source-of-truth-type").equals("openstack"));
assertTrue(obj instanceof Integer);
assertTrue(propSchema.getDataType().validateValue("5.5") == null);
assertTrue(propSchema.getDataType().validateValue("xyz") == null);
assertTrue(obj instanceof Integer);
assertTrue(propSchema.getDataType().validateValue("5.5") == null);
assertTrue(propSchema.getDataType().validateValue("xyz") == null);
// Validate edge schema
assertTrue(edgeSchema.getName().equals("org.onap.relationships.inventory.LocatedIn"));
assertTrue(edgeSchema.getSource().equals("cloud-region"));
// Validate edge schema
assertTrue(edgeSchema.getName().equals("org.onap.relationships.inventory.LocatedIn"));
assertTrue(edgeSchema.getSource().equals("cloud-region"));
assertTrue(edgeSchema.getMultiplicity().equals(EdgeSchema.Multiplicity.MANY_2_ONE));
assertTrue(edgeSchema.getAnnotationValue("contains-other-v").equals("NONE"));
assertTrue(edgeSchema.getPropertySchema("prevent-delete").getDataType().getType().equals(Type.STRING));
assertTrue(edgeSchema.getMultiplicity().equals(EdgeSchema.Multiplicity.MANY_2_ONE));
assertTrue(edgeSchema.getAnnotationValue("contains-other-v").equals("NONE"));
assertTrue(edgeSchema.getPropertySchema("prevent-delete").getDataType().getType().equals(Type.STRING));
// Validate 'dependentOn' annotation
vertSchema = schemaProvider.getVertexSchema("tenant", schemaProvider.getLatestSchemaVersion());
assertTrue(vertSchema.getAnnotationValue("dependentOn").equals("cloud-region"));
// Validate 'dependentOn' annotation
vertSchema = schemaProvider.getVertexSchema("tenant", schemaProvider.getLatestSchemaVersion());
assertTrue(vertSchema.getAnnotationValue("dependentOn").equals("cloud-region"));
@Test
public void testAdjacentEdges() throws SchemaProviderException {
try {
OxmSchemaProvider schemaProvider = new OxmSchemaProvider();
schemaProvider.loadSchema();
@Test
public void testAdjacentEdges() throws SchemaProviderException {
try {
OxmSchemaProvider schemaProvider = new OxmSchemaProvider();
schemaProvider.loadSchema();
- Set<EdgeSchema> edgeSchemaList =
+ Set<EdgeSchema> edgeSchemaList =
schemaProvider.getAdjacentEdgeSchema("snapshot", schemaProvider.getLatestSchemaVersion());
schemaProvider.getAdjacentEdgeSchema("snapshot", schemaProvider.getLatestSchemaVersion());
// Validate edge schema
assertTrue(edgeSchemaList.size() == 2);
// Validate edge schema
assertTrue(edgeSchemaList.size() == 2);
for (EdgeSchema es : edgeSchemaList) {
System.out.println(es.toString());
if (es.getName().equals("org.onap.relationships.inventory.BelongsTo")) {
for (EdgeSchema es : edgeSchemaList) {
System.out.println(es.toString());
if (es.getName().equals("org.onap.relationships.inventory.BelongsTo")) {
@Test
public void testValidSourceTargetEdge() throws SchemaProviderException {
try {
OxmSchemaProvider schemaProvider = new OxmSchemaProvider();
schemaProvider.loadSchema();
@Test
public void testValidSourceTargetEdge() throws SchemaProviderException {
try {
OxmSchemaProvider schemaProvider = new OxmSchemaProvider();
schemaProvider.loadSchema();
- Set<EdgeSchema> edgeSchemaList =
- schemaProvider.getEdgeSchemaForSourceTarget("service-instance", "customer",
+ Set<EdgeSchema> edgeSchemaList =
+ schemaProvider.getEdgeSchemaForSourceTarget("service-instance", "customer",
schemaProvider.getLatestSchemaVersion());
// Validate edge schema
schemaProvider.getLatestSchemaVersion());
// Validate edge schema
assertTrue(edgeSchemaList.iterator().next().getSource().equals("service-instance"));
assertTrue(edgeSchemaList.iterator().next().getTarget().equals("customer"));
assertTrue(edgeSchemaList.iterator().next().getMultiplicity().equals(EdgeSchema.Multiplicity.MANY_2_MANY));
assertTrue(edgeSchemaList.iterator().next().getSource().equals("service-instance"));
assertTrue(edgeSchemaList.iterator().next().getTarget().equals("customer"));
assertTrue(edgeSchemaList.iterator().next().getMultiplicity().equals(EdgeSchema.Multiplicity.MANY_2_MANY));
-
- edgeSchemaList =
- schemaProvider.getEdgeSchemaForSourceTarget("cloud-region", "complex",
+
+ edgeSchemaList =
+ schemaProvider.getEdgeSchemaForSourceTarget("cloud-region", "complex",
schemaProvider.getLatestSchemaVersion());
schemaProvider.getLatestSchemaVersion());
// Validate edge schema
assertTrue(edgeSchemaList.size() == 2);
// Validate edge schema
assertTrue(edgeSchemaList.size() == 2);
for (EdgeSchema es : edgeSchemaList) {
System.out.println(es.toString());
if (es.getName().equals("org.onap.relationships.inventory.FoundIn")) {
for (EdgeSchema es : edgeSchemaList) {
System.out.println(es.toString());
if (es.getName().equals("org.onap.relationships.inventory.FoundIn")) {
-
- edgeSchemaList =
- schemaProvider.getEdgeSchemaForSourceTarget("cloud-region", "bad-node",
+
+ edgeSchemaList =
+ schemaProvider.getEdgeSchemaForSourceTarget("cloud-region", "bad-node",
schemaProvider.getLatestSchemaVersion());
schemaProvider.getLatestSchemaVersion());
// Validate edge schema
assertTrue(edgeSchemaList.size() == 0);
}
// Validate edge schema
assertTrue(edgeSchemaList.size() == 0);
}
@Test
public void testInvalidVertexOrEdge() throws SchemaProviderException {
try {
OxmSchemaProvider schemaProvider = new OxmSchemaProvider();
schemaProvider.loadSchema();
@Test
public void testInvalidVertexOrEdge() throws SchemaProviderException {
try {
OxmSchemaProvider schemaProvider = new OxmSchemaProvider();
schemaProvider.loadSchema();
- VertexSchema vertSchema =
+ VertexSchema vertSchema =
schemaProvider.getVertexSchema("bad-node", schemaProvider.getLatestSchemaVersion());
assertTrue(vertSchema == null);
schemaProvider.getVertexSchema("bad-node", schemaProvider.getLatestSchemaVersion());
assertTrue(vertSchema == null);
- EdgeSchema edgeSchema = schemaProvider.getEdgeSchema("org.onap.relationships.inventory.LocatedIn",
+ EdgeSchema edgeSchema = schemaProvider.getEdgeSchema("org.onap.relationships.inventory.LocatedIn",
"cloud-region", "bad-node", schemaProvider.getLatestSchemaVersion());
assertTrue(edgeSchema == null);
"cloud-region", "bad-node", schemaProvider.getLatestSchemaVersion());
assertTrue(edgeSchema == null);
-
- Set<EdgeSchema> edgeSchemaList =
- schemaProvider.getAdjacentEdgeSchema("org.onap.nodes.bad-node",
+
+ Set<EdgeSchema> edgeSchemaList =
+ schemaProvider.getAdjacentEdgeSchema("org.onap.nodes.bad-node",
schemaProvider.getLatestSchemaVersion());
assertTrue(edgeSchemaList.isEmpty());
}
schemaProvider.getLatestSchemaVersion());
assertTrue(edgeSchemaList.isEmpty());
}
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-schema-ingest</artifactId>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-schema-ingest</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-utils</artifactId>
<relativePath>../aai-parent/pom.xml</relativePath>
</parent>
<artifactId>aai-utils</artifactId>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common</artifactId>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.8-SNAPSHOT</version>
<packaging>pom</packaging>
<name>aai-aai-common</name>
<description>Contains all of the common code for resources and traversal repos</description>
<packaging>pom</packaging>
<name>aai-aai-common</name>
<description>Contains all of the common code for resources and traversal repos</description>
major_version=1
minor_version=6
major_version=1
minor_version=6
base_version=${major_version}.${minor_version}.${patch_version}
base_version=${major_version}.${minor_version}.${patch_version}