summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrudence Au <prudence.au@amdocs.com>2018-08-21 15:35:51 -0400
committerPrudence Au <prudence.au@amdocs.com>2018-08-21 15:51:02 -0400
commit4941e70b8bd9700be474d3ebe40def9d70d23693 (patch)
tree9ce6bbe4e2472fc900608239deac052a39dfd125
parentb1b32354811fd9c856bf9ce611d36591d7a81404 (diff)
Add JUnit tests
Change-Id: Iedc215a9d77670a697822683457e7eeb4a7cc335 Issue-ID: LOG-521 Signed-off-by: Prudence Au <prudence.au@amdocs.com>
-rw-r--r--pom.xml697
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VnfInstance.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/exception/AuditException.java10
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringServiceImpl.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java4
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JerseyConfigurationTest.java34
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelatedToPropertyTest.java55
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipDatumTest.java58
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipListTest.java88
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipTest.java76
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java102
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/ServiceInstanceTest.java96
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/TestSrpingServiceImpl.java22
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java99
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModulesTest.java56
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java138
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfcInstanceTest.java87
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/WebConfigurationTest.java38
18 files changed, 1307 insertions, 357 deletions
diff --git a/pom.xml b/pom.xml
index 890c471..f37937f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,356 +1,367 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <groupId>org.onap.logging-analytics.pomba</groupId>
- <artifactId>pomba-aai-context-builder</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <groupId>org.onap.logging-analytics.pomba</groupId>
+ <artifactId>pomba-aai-context-builder</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
- <parent>
- <groupId>org.onap.oparent</groupId>
- <artifactId>oparent</artifactId>
- <version>1.1.1</version>
- <relativePath />
- </parent>
+ <parent>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>1.1.1</version>
+ <relativePath />
+ </parent>
- <properties>
- <aai.rest.client.version>1.2.1</aai.rest.client.version>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <logback.version>1.2.3</logback.version>
- <swagger.directory>${project.build.directory}/generated-resources/swagger</swagger.directory>
- <!--docker -->
- <docker.tag>${project.version}-${timestamp}</docker.tag>
- <docker.latest.tag>${project.version}-latest</docker.latest.tag>
- </properties>
+ <properties>
+ <aai.rest.client.version>1.2.1</aai.rest.client.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <logback.version>1.2.3</logback.version>
+ <swagger.directory>${project.build.directory}/generated-resources/swagger</swagger.directory>
+ <!--docker -->
+ <docker.tag>${project.version}-${timestamp}</docker.tag>
+ <docker.latest.tag>${project.version}-latest</docker.latest.tag>
+ </properties>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>1.5.12.RELEASE</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>1.5.12.RELEASE</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-security</artifactId>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-security</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jersey</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.logging-analytics.pomba</groupId>
- <artifactId>pomba-audit-common</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <!-- logging dependencies -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</artifactId>
- <version>1.2.2-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.7</version>
- </dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- </dependency>
- <dependency>
- <groupId>com.jayway.jsonpath</groupId>
- <artifactId>json-path</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.aai</groupId>
- <artifactId>rest-client</artifactId>
- <version>${aai.rest.client.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.aai</groupId>
- <artifactId>rest-client</artifactId>
- <version>${aai.rest.client.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-core</artifactId>
- <version>1.5.9</version>
- </dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-annotations</artifactId>
- <version>1.5.9</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jersey</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.logging-analytics.pomba</groupId>
+ <artifactId>pomba-audit-common</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ <!-- logging dependencies -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.logging-analytics</groupId>
+ <artifactId>logging-slf4j</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.jayway.jsonpath</groupId>
+ <artifactId>json-path</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.aai</groupId>
+ <artifactId>rest-client</artifactId>
+ <version>${aai.rest.client.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.aai</groupId>
+ <artifactId>rest-client</artifactId>
+ <version>${aai.rest.client.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-core</artifactId>
+ <version>1.5.9</version>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>1.5.9</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.10.19</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <build>
- <finalName>${project.artifactId}</finalName>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
+ <build>
+ <finalName>${project.artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
- <resources>
- <resource>
- <targetPath>config</targetPath>
- <directory>config</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- </resources>
- </build>
+ <resources>
+ <resource>
+ <targetPath>config</targetPath>
+ <directory>config</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
- <profiles>
- <profile>
- <id>docker</id>
- <build>
- <plugins>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.19.1</version>
- <configuration>
- <verbose>true</verbose>
- <apiVersion>1.23</apiVersion>
- <images>
- <image>
- <name>onap/${project.artifactId}</name>
- <alias>${project.artifactId}</alias>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>${project.basedir}/target/docker-stage</dockerFileDir>
- <tags>
- <tag>${docker.snapshot.tag}</tag>
- <tag>${docker.latest.tag}</tag>
- </tags>
- </build>
- </image>
- </images>
- </configuration>
- <executions>
- <execution>
- <id>generate-images</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
- <execution>
- <id>push-images</id>
- <phase>deploy</phase>
- <goals>
- <goal>build</goal>
- <goal>push</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>3.1.0</version>
- <executions>
- <execution>
- <id>copy-resources</id>
- <!-- here the phase you need -->
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.outputDirectory}</outputDirectory>
- <resources>
- <resource>
- <directory>
- ${project.build.directory}/generated-resources/swagger
- </directory>
- <targetPath>META-INF/resources/swagger</targetPath>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.19.1</version>
+ <configuration>
+ <verbose>true</verbose>
+ <apiVersion>1.23</apiVersion>
+ <images>
+ <image>
+ <name>onap/${project.artifactId}</name>
+ <alias>${project.artifactId}</alias>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${project.basedir}/target/docker-stage</dockerFileDir>
+ <tags>
+ <tag>${docker.snapshot.tag}</tag>
+ <tag>${docker.latest.tag}</tag>
+ </tags>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-images</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>build</goal>
+ <goal>push</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <id>copy-resources</id>
+ <!-- here the phase you need -->
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.outputDirectory}</outputDirectory>
+ <resources>
+ <resource>
+ <directory>
+ ${project.build.directory}/generated-resources/swagger
+ </directory>
+ <targetPath>META-INF/resources/swagger</targetPath>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <plugin>
- <groupId>com.github.kongchen</groupId>
- <artifactId>swagger-maven-plugin</artifactId>
- <version>3.1.3</version>
- <configuration>
- <apiSources>
- <apiSource>
- <locations>org.onap.pomba.contextbuilder.aai.service.rs</locations>
- <basePath>/aaicontextbuilder</basePath>
- <info>
- <title>${project.artifactId} Service</title>
- <version>${project.version}</version>
- </info>
- <swaggerDirectory>${swagger.directory}</swaggerDirectory>
- </apiSource>
- </apiSources>
- </configuration>
- <executions>
- <execution>
- <!-- <phase>compile</phase> -->
- <phase>package</phase>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- <executions>
- <execution>
- <id>copy-dockerfile</id>
- <goals>
- <goal>copy-resources</goal>
- </goals><!-- here the phase you need -->
- <phase>package</phase>
- <configuration>
- <outputDirectory>${project.basedir}/target/docker-stage</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/docker</directory>
- <includes>
- <include>Dockerfile</include>
- </includes>
- <filtering>true</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- <execution>
- <id>copy-properties</id>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <phase>validate</phase>
- <configuration>
- <outputDirectory>${project.basedir}/target/docker-stage/config</outputDirectory>
- <resources>
- <resource>
- <directory>config</directory>
- <includes>
- <include>*.properties</include>
- <include>*.xml</include>
- </includes>
- <filtering>false</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- <execution>
- <id>copy-script</id>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <outputDirectory>${project.basedir}/target/docker-stage/</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/docker</directory>
- <includes>
- <include>*.sh</include>
- </includes>
- <filtering>false</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- <execution>
- <id>copy-jar</id>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <outputDirectory>${project.basedir}/target/docker-stage/</outputDirectory>
- <resources>
- <resource>
- <directory>target</directory>
- <includes>
- <include>*.jar</include>
- </includes>
- <filtering>false</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ <plugin>
+ <groupId>com.github.kongchen</groupId>
+ <artifactId>swagger-maven-plugin</artifactId>
+ <version>3.1.3</version>
+ <configuration>
+ <apiSources>
+ <apiSource>
+ <locations>org.onap.pomba.contextbuilder.aai.service.rs</locations>
+ <basePath>/aaicontextbuilder</basePath>
+ <info>
+ <title>${project.artifactId} Service</title>
+ <version>${project.version}</version>
+ </info>
+ <swaggerDirectory>${swagger.directory}</swaggerDirectory>
+ </apiSource>
+ </apiSources>
+ </configuration>
+ <executions>
+ <execution>
+ <!-- <phase>compile</phase> -->
+ <phase>package</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>copy-dockerfile</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals><!-- here the phase you need -->
+ <phase>package</phase>
+ <configuration>
+ <outputDirectory>${project.basedir}/target/docker-stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/docker</directory>
+ <includes>
+ <include>Dockerfile</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-properties</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${project.basedir}/target/docker-stage/config</outputDirectory>
+ <resources>
+ <resource>
+ <directory>config</directory>
+ <includes>
+ <include>*.properties</include>
+ <include>*.xml</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-script</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <outputDirectory>${project.basedir}/target/docker-stage/</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/docker</directory>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-jar</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <outputDirectory>${project.basedir}/target/docker-stage/</outputDirectory>
+ <resources>
+ <resource>
+ <directory>target</directory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VnfInstance.java b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VnfInstance.java
index 26949ed..6346d3a 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VnfInstance.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VnfInstance.java
@@ -267,7 +267,7 @@ public class VnfInstance {
return orchestrationStatus;
}
- public void setoOrchestrationStatus(String orchestrationStatus) {
+ public void setOrchestrationStatus(String orchestrationStatus) {
this.orchestrationStatus = orchestrationStatus;
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/exception/AuditException.java b/src/main/java/org/onap/pomba/contextbuilder/aai/exception/AuditException.java
index 042c651..d78ff84 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/exception/AuditException.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/exception/AuditException.java
@@ -32,16 +32,6 @@ public class AuditException extends Exception {
super(message);
}
- /**
- * Constructor for an instance of this exception with a message and status.
- * @param httpStatus
- * @param message
- */
- public AuditException(Status httpStatus, String message) {
- super(message);
- this.httpStatus = httpStatus;
- }
-
public AuditException(String message, Status httpStatus) {
super(message);
this.setHttpStatus(httpStatus);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringServiceImpl.java
index 989dbc3..9a542a4 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringServiceImpl.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringServiceImpl.java
@@ -47,7 +47,7 @@ public class SpringServiceImpl implements SpringService {
String url = "serviceInstanceId=" + serviceInstanceId + " modelVersion="+modelVersionId +
" modelInvariantId="+ modelInvariantId + " serviceType="+serviceType + " customerId="+ customerId;
- log.info(LogMessages.AAI_CONTEXT_BUILDER_URL + url);
+ log.info(LogMessages.AAI_CONTEXT_BUILDER_URL, url);
ModelContext context = null;
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java
index 8681d21..a997ebc 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java
@@ -121,10 +121,10 @@ public class RestUtil {
authorization = headers.getRequestHeaders().getFirst(AUTHORIZATION);
if (authorization != null && !authorization.trim().isEmpty() && authorization.startsWith("Basic")) {
if (!authorization.equals(basicAuthorization)) {
- throw new AuditException(Status.UNAUTHORIZED, AuditError.MISMATCH);
+ throw new AuditException(AuditError.MISMATCH, Status.UNAUTHORIZED);
};
} else {
- throw new AuditException(Status.UNAUTHORIZED, AuditError.MISSING_AUTHORIZATION_HEADER);
+ throw new AuditException(AuditError.MISSING_AUTHORIZATION_HEADER, Status.UNAUTHORIZED);
}
}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JerseyConfigurationTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JerseyConfigurationTest.java
new file mode 100644
index 0000000..a0570c3
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JerseyConfigurationTest.java
@@ -0,0 +1,34 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.ws.rs.client.Client;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.JerseyConfiguration;
+
+public class JerseyConfigurationTest {
+ @Test
+ public void testJerseyConfiguration() {
+ JerseyConfiguration jerseyConfiguration = new JerseyConfiguration();
+ Client client = jerseyConfiguration.jerseyClient();
+ String protocol = client.getSslContext().getProtocol();
+ assertEquals("TLS", protocol);
+ }
+}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelatedToPropertyTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelatedToPropertyTest.java
new file mode 100644
index 0000000..6a3c0ac
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelatedToPropertyTest.java
@@ -0,0 +1,55 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty;
+
+public class RelatedToPropertyTest {
+
+ @Test
+ public void testRelatedToPropertyWithParameters() {
+ RelatedToProperty relatedToProperty = new RelatedToProperty("propertyKey", "propertyValue");
+ assertEquals("propertyKey", relatedToProperty.getPropertyKey());
+ assertEquals("propertyValue", relatedToProperty.getPropertyValue());
+ }
+
+ @Test
+ public void testRelatedToProperty() {
+ RelatedToProperty relatedToProperty = new RelatedToProperty();
+ relatedToProperty.setPropertyKey("propertyKey");
+ relatedToProperty.setPropertyValue("propertyValue");
+ assertEquals("propertyKey", relatedToProperty.getPropertyKey());
+ assertEquals("propertyValue", relatedToProperty.getPropertyValue());
+ String relatedToPropertyString = relatedToProperty.toString();
+ assertTrue(relatedToPropertyString.contains("[propertyKey=propertyKey,propertyValue=propertyValue]"));
+ }
+
+ @Test
+ public void testRelatedToPropertyIsEqual() {
+ RelatedToProperty relatedToProperty1 = new RelatedToProperty("propertyKey1", "propertyValue1");
+ RelatedToProperty relatedToProperty2 = new RelatedToProperty("propertyKey2", "propertyValue2");
+ RelatedToProperty relatedToProperty3 = new RelatedToProperty("propertyKey1", "propertyValue1");
+ assertTrue(relatedToProperty1.equals(relatedToProperty1));
+ assertTrue(!relatedToProperty1.equals(relatedToProperty2));
+ assertTrue(relatedToProperty1.equals(relatedToProperty3));
+ }
+}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipDatumTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipDatumTest.java
new file mode 100644
index 0000000..490e3d3
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipDatumTest.java
@@ -0,0 +1,58 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum;
+
+public class RelationshipDatumTest {
+ @Test
+ public void testRelationshipDatum() {
+ RelationshipDatum relationshipDatum = new RelationshipDatum();
+
+ relationshipDatum.setRelationshipKey("relationshipKey");
+ relationshipDatum.setRelationshipValue("relationshipValue");
+
+ assertEquals("relationshipKey", relationshipDatum.getRelationshipKey());
+ assertEquals("relationshipValue", relationshipDatum.getRelationshipValue());
+ }
+
+ @Test
+ public void testRelationshipDatumWithParameters() {
+ RelationshipDatum relationshipDatum = new RelationshipDatum("relationshipKey", "relationshipValue");
+
+ assertEquals("relationshipKey", relationshipDatum.getRelationshipKey());
+ assertEquals("relationshipValue", relationshipDatum.getRelationshipValue());
+ String relationshipDatumString = relationshipDatum.toString();
+ assertTrue(relationshipDatumString.contains("[relationshipKey=relationshipKey,relationshipValue=relationshipValue]"));
+ }
+
+ @Test
+ public void testRelationshipDatumEqual() {
+ RelationshipDatum relationshipDatum1 = new RelationshipDatum("relationshipKey1", "relationshipValue1");
+ RelationshipDatum relationshipDatum2 = new RelationshipDatum("relationshipKey2", "relationshipValue2");
+ RelationshipDatum relationshipDatum3 = new RelationshipDatum("relationshipKey1", "relationshipValue1");
+
+ assertTrue(relationshipDatum1.equals(relationshipDatum1));
+ assertTrue(!relationshipDatum1.equals(relationshipDatum2));
+ assertTrue(relationshipDatum1.equals(relationshipDatum3));
+ }
+}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipListTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipListTest.java
new file mode 100644
index 0000000..f904f25
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipListTest.java
@@ -0,0 +1,88 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty;
+import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
+import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum;
+import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
+
+public class RelationshipListTest {
+ @Test
+ public void testRelationshipList() {
+ RelationshipList relationshipList = new RelationshipList();
+ Relationship relationship = new Relationship();
+ List<Relationship> list = new ArrayList<Relationship>();
+ list.add(relationship);
+ relationshipList.setRelationship(list);
+
+ assertTrue(relationshipList.getRelationship().size() == 1);
+
+ relationship.setRelatedLink("relatedLink");
+ relationship.setRelatedTo("relatedTo");
+
+ RelatedToProperty relatedToProperty = new RelatedToProperty();
+ List<RelatedToProperty> relatedToPropertyList = new ArrayList<RelatedToProperty>();
+ relatedToPropertyList.add(relatedToProperty);
+ relationship.setRelatedToProperty(relatedToPropertyList);
+ list.add(relationship);
+ relationshipList.setRelationship(list);
+
+ String relationshipListString = relationshipList.toString();
+ assertTrue(relationshipListString.contains("[relationship="));
+
+ }
+
+ @Test
+ public void testRelationshipListWithParameters() {
+ Relationship relationship = new Relationship("relatedTo", "relatedLink", new ArrayList<RelationshipDatum>(), new ArrayList<RelatedToProperty>());
+ List<Relationship> listOfRelationship = new ArrayList<Relationship>();
+ listOfRelationship.add(relationship);
+ RelationshipList relationshipList = new RelationshipList(listOfRelationship);
+
+ assertTrue(relationshipList.getRelationship().size() == 1);
+ }
+
+ @Test
+ public void testRelationshipListEquals() {
+
+ Relationship relationship1 = new Relationship("relatedTo1", "relatedLink1", new ArrayList<RelationshipDatum>(), new ArrayList<RelatedToProperty>());
+ List<Relationship> listOfRelationship = new ArrayList<Relationship>();
+ listOfRelationship.add(relationship1);
+ RelationshipList relationshipList1 = new RelationshipList(listOfRelationship);
+
+ Relationship relationship2 = new Relationship("relatedTo2", "relatedLink2", new ArrayList<RelationshipDatum>(), new ArrayList<RelatedToProperty>());
+ List<Relationship> listOfRelationship2 = new ArrayList<Relationship>();
+ listOfRelationship.add(relationship2);
+ RelationshipList relationshipList2 = new RelationshipList(listOfRelationship2);
+
+ Relationship relationship3 = new Relationship("relatedTo1", "relatedLink1", new ArrayList<RelationshipDatum>(), new ArrayList<RelatedToProperty>());
+ List<Relationship> listOfRelationship3 = new ArrayList<Relationship>();
+ listOfRelationship.add(relationship3);
+ RelationshipList relationshipList3 = new RelationshipList(listOfRelationship3);
+
+ assertTrue(relationshipList1.equals(relationshipList1));
+ assertTrue(!relationshipList1.equals(relationshipList2));
+ assertTrue(!relationshipList1.equals(relationshipList3));
+ }
+}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipTest.java
new file mode 100644
index 0000000..786ea13
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipTest.java
@@ -0,0 +1,76 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty;
+import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
+import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum;
+
+public class RelationshipTest {
+
+ @Test
+ public void testRelationshipWithParameters() {
+ List<RelationshipDatum> relationshipDatum = new ArrayList<RelationshipDatum>();
+ List<RelatedToProperty> relatedToProperty = new ArrayList<RelatedToProperty>();
+ Relationship relationship = new Relationship("relatedTo", "relatedLink", relationshipDatum, relatedToProperty);
+
+ assertEquals("relatedTo", relationship.getRelatedTo());
+ assertEquals("relatedLink", relationship.getRelatedLink());
+ assertTrue(relationship.getRelationshipData().isEmpty());
+ assertTrue(relationship.getRelatedToProperty().isEmpty());
+ }
+
+ @Test
+ public void testRelationship() {
+ Relationship relationship = new Relationship();
+ List<RelationshipDatum> relationshipDatum = new ArrayList<RelationshipDatum>();
+ List<RelatedToProperty> relatedToProperty = new ArrayList<RelatedToProperty>();
+
+ relationship.setRelatedLink("relatedLink");
+ relationship.setRelatedTo("relatedTo");
+ relationship.setRelatedToProperty(relatedToProperty);
+ relationship.setRelationshipData(relationshipDatum);
+
+ assertEquals("relatedTo", relationship.getRelatedTo());
+ assertEquals("relatedLink", relationship.getRelatedLink());
+ assertTrue(relationship.getRelationshipData().isEmpty());
+ assertTrue(relationship.getRelatedToProperty().isEmpty());
+
+ String relationshipString = relationship.toString();
+ assertTrue(relationshipString.contains("[relatedTo=relatedTo,relatedLink=relatedLink,relationshipData=[],relatedToProperty=[]]"));
+ }
+
+ @Test
+ public void testRelationshipEquals() {
+ List<RelationshipDatum> relationshipDatum = new ArrayList<RelationshipDatum>();
+ List<RelatedToProperty> relatedToProperty = new ArrayList<RelatedToProperty>();
+ Relationship relationship1 = new Relationship("relatedTo1", "relatedLink1", relationshipDatum, relatedToProperty);
+ Relationship relationship2 = new Relationship("relatedTo2", "relatedLink2", relationshipDatum, relatedToProperty);
+ Relationship relationship3 = new Relationship("relatedTo1", "relatedLink1", relationshipDatum, relatedToProperty);
+ assertTrue(relationship1.equals(relationship1));
+ assertTrue(!relationship1.equals(relationship2));
+ assertTrue(relationship1.equals(relationship3));
+ }
+
+}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java
new file mode 100644
index 0000000..9757a2c
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java
@@ -0,0 +1,102 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.exception.AuditException;
+import org.onap.pomba.contextbuilder.aai.util.RestUtil;
+
+public class RestUtilTest {
+
+ @Test
+ public void testValidateURL() {
+ // Missing ServiceInstanceId or it is null
+ try {
+ RestUtil.validateURL("", "modelVersionId", "modelInvariantId", "serviceType", "customerId");
+ } catch (AuditException e) {
+ assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: serviceInstanceId"));
+ }
+
+ try {
+ RestUtil.validateURL(null, "modelVersionId", "modelInvariantId", "serviceType", "customerId");
+ } catch (AuditException e) {
+ assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: serviceInstanceId"));
+ }
+
+ // Missing ModelVersionId or it is null
+ try {
+ RestUtil.validateURL("serviceInstanceId", "", "modelInvariantId", "serviceType", "customerId");
+ } catch (AuditException e) {
+ assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: modelVersionId"));
+ }
+
+ try {
+ RestUtil.validateURL("serviceInstanceId", null, "modelInvariantId", "serviceType", "customerId");
+ } catch (AuditException e) {
+ assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: modelVersionId"));
+ }
+
+ // Missing ModelInvariantId or it is null
+ try {
+ RestUtil.validateURL("serviceInstanceId", "modelVersionId", "", "serviceType", "customerId");
+ } catch (AuditException e) {
+ assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: modelInvariantId"));
+ }
+
+ try {
+ RestUtil.validateURL("serviceInstanceId", "modelVersionId", null, "serviceType", "customerId");
+ } catch (AuditException e) {
+ assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: modelInvariantId"));
+ }
+
+ // Missing ServiceType or it is null
+ try {
+ RestUtil.validateURL("serviceInstanceId", "modelVersionId", "modelInvariantId", "", "customerId");
+ } catch (AuditException e) {
+ assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: serviceType"));
+ }
+
+ try {
+ RestUtil.validateURL("serviceInstanceId", "modelVersionId", "modelInvariantId", null, "customerId");
+ } catch (AuditException e) {
+ assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: serviceType"));
+ }
+
+ // Missing CustomerId or it is null
+ try {
+ RestUtil.validateURL("serviceInstanceId", "modelVersionId", "modelInvariantId", "serviceType", "");
+ } catch (AuditException e) {
+ assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: customerId"));
+ }
+
+
+ try {
+ RestUtil.validateURL("serviceInstanceId", "modelVersionId", "modelInvariantId", "serviceType", null);
+ } catch (AuditException e) {
+ assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: customerId"));
+ }
+ }
+
+ @Test
+ public void testIsEmptyJson() {
+ assertTrue(RestUtil.isEmptyJson("{}"));
+ assertTrue(!RestUtil.isEmptyJson("{Not Empty}"));
+ }
+}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/ServiceInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/ServiceInstanceTest.java
new file mode 100644
index 0000000..74e5994
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/ServiceInstanceTest.java
@@ -0,0 +1,96 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty;
+import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
+import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum;
+import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
+import org.onap.pomba.contextbuilder.aai.datatype.ServiceInstance;
+
+public class ServiceInstanceTest {
+ @Test
+ public void testServiceInstance() {
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ serviceInstance.setServiceInstanceName("serviceInstanceName");
+ serviceInstance.setServiceType("serviceType");
+ serviceInstance.setServiceRole("serviceRole");
+ serviceInstance.setEnvironmentContext("environmentContext");
+ serviceInstance.setWorkloadContext("workloadContext");
+ serviceInstance.setModelInvariantId("modelInvariantId");
+ serviceInstance.setModelVersionId("modelVersionId");
+ serviceInstance.setResourceVersion("resourceVersion");
+ serviceInstance.setOrchestrationStatus("orchestrationStatus");
+ RelationshipList relationshipList = new RelationshipList();
+ List<Relationship> listOfRelationship = new ArrayList<Relationship>();
+ Relationship relationship = new Relationship("relatedTo", "relatedLink", new ArrayList<RelationshipDatum>(), new ArrayList<RelatedToProperty>());
+ listOfRelationship.add(relationship);
+ relationshipList.setRelationship(listOfRelationship);
+
+ serviceInstance.setRelationshipList(relationshipList);
+
+ assertEquals("serviceInstanceId", serviceInstance.getServiceInstanceId());
+ assertEquals("serviceInstanceName", serviceInstance.getServiceInstanceName());
+ assertEquals("serviceType", serviceInstance.getServiceType());
+ assertEquals("serviceRole", serviceInstance.getServiceRole());
+ assertEquals("environmentContext", serviceInstance.getEnvironmentContext());
+ assertEquals("workloadContext", serviceInstance.getWorkloadContext());
+ assertEquals("modelInvariantId", serviceInstance.getModelInvariantId());
+ assertEquals("modelVersionId", serviceInstance.getModelVersionId());
+ assertEquals("resourceVersion", serviceInstance.getResourceVersion());
+ assertEquals("orchestrationStatus", serviceInstance.getOrchestrationStatus());
+ assertEquals("relatedTo", serviceInstance.getRelationshipList().getRelationship().get(0).getRelatedTo());
+ }
+
+ @Test
+ public void testServiceInstanceWithParameters() {
+ ServiceInstance serviceInstance = new ServiceInstance("serviceInstanceId", "serviceInstanceName", "serviceType", "serviceRole", "environmentContext", "workloadContext", "modelInvariantId", "modelVersionId", "resourceVersion", "orchestrationStatus", new RelationshipList());
+
+ assertEquals("serviceInstanceId", serviceInstance.getServiceInstanceId());
+ assertEquals("serviceInstanceName", serviceInstance.getServiceInstanceName());
+ assertEquals("serviceType", serviceInstance.getServiceType());
+ assertEquals("serviceRole", serviceInstance.getServiceRole());
+ assertEquals("environmentContext", serviceInstance.getEnvironmentContext());
+ assertEquals("workloadContext", serviceInstance.getWorkloadContext());
+ assertEquals("modelInvariantId", serviceInstance.getModelInvariantId());
+ assertEquals("modelVersionId", serviceInstance.getModelVersionId());
+ assertEquals("resourceVersion", serviceInstance.getResourceVersion());
+ assertEquals("orchestrationStatus", serviceInstance.getOrchestrationStatus());
+
+ String serviceInstanceString = serviceInstance.toString();
+ assertTrue(serviceInstanceString.contains("[serviceInstanceId=serviceInstanceId,serviceInstanceName=serviceInstanceName,serviceType=serviceType,serviceRole=serviceRole,environmentContext=environmentContext,workloadContext=workloadContext,modelInvariantId=modelInvariantId,modelVersionId=modelVersionId,resourceVersion=resourceVersion,orchestrationStatus=orchestrationStatus,"));
+ }
+
+ @Test
+ public void testServiceInstanceEquals() {
+ ServiceInstance serviceInstance1 = new ServiceInstance("serviceInstanceId1", "serviceInstanceName1", "serviceType1", "serviceRole1", "environmentContext1", "workloadContext1", "modelInvariantId1", "modelVersionId1", "resourceVersion1", "orchestrationStatus1", new RelationshipList());
+ ServiceInstance serviceInstance2 = new ServiceInstance("serviceInstanceId2", "serviceInstanceName2", "serviceType2", "serviceRole2", "environmentContext2", "workloadContext2", "modelInvariantId2", "modelVersionId2", "resourceVersion2", "orchestrationStatus2", new RelationshipList());
+ ServiceInstance serviceInstance3 = new ServiceInstance("serviceInstanceId1", "serviceInstanceName1", "serviceType1", "serviceRole1", "environmentContext1", "workloadContext1", "modelInvariantId1", "modelVersionId1", "resourceVersion1", "orchestrationStatus1", new RelationshipList());
+
+ assertTrue(serviceInstance1.equals(serviceInstance1));
+ assertTrue(!serviceInstance1.equals(serviceInstance2));
+ assertTrue(serviceInstance1.equals(serviceInstance3));
+ }
+}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/TestSrpingServiceImpl.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/TestSrpingServiceImpl.java
new file mode 100644
index 0000000..13d52f9
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/TestSrpingServiceImpl.java
@@ -0,0 +1,22 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+public class TestSrpingServiceImpl {
+
+}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java
new file mode 100644
index 0000000..b79f8ca
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java
@@ -0,0 +1,99 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty;
+import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
+import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum;
+import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
+import org.onap.pomba.contextbuilder.aai.datatype.VfModule;
+
+public class VfModuleTest {
+ @Test
+ public void testVfModule() {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setVfModuleName("vfModuleName");
+ vfModule.setHeatStackId("heatStackId");
+ vfModule.setOrchestrationStatus("orchestrationStatus");
+ vfModule.setIsBaseVfModule(true);
+ vfModule.setResourceVersion("resourceVersion");
+ vfModule.setModelInvariantId("modelInvariantId");
+ vfModule.setModelVersionId("modelVersionId");
+ vfModule.setModelCustomizationId("modelCustomizationId");
+ vfModule.setModuleIndex(1);
+
+ RelationshipList relationshipList = new RelationshipList();
+ List<Relationship> listOfRelationship = new ArrayList<Relationship>();
+ Relationship relationship = new Relationship("relatedTo", "relatedLink", new ArrayList<RelationshipDatum>(), new ArrayList<RelatedToProperty>());
+ listOfRelationship.add(relationship);
+ relationshipList.setRelationship(listOfRelationship);
+
+ vfModule.setRelationshipList(relationshipList);
+
+ assertEquals("vfModuleId", vfModule.getVfModuleId());
+ assertEquals("vfModuleName", vfModule.getVfMduleName());
+ assertEquals("heatStackId", vfModule.getHeatStackId());
+ assertEquals("orchestrationStatus", vfModule.getOrchestrationStatus());
+ assertTrue(vfModule.getIsBaseVfModule());
+ assertEquals("resourceVersion", vfModule.getResourceVersion());
+ assertEquals("modelInvariantId", vfModule.getModelInvariantId());
+ assertEquals("modelVersionId", vfModule.getModelVersionId());
+ assertEquals("modelCustomizationId", vfModule.getModelCustomizationId());
+ assertEquals(new Integer(1), vfModule.getModuleIndex());
+ assertEquals("relatedTo", vfModule.getRelationshipList().getRelationship().get(0).getRelatedTo());
+ }
+
+ @Test
+ public void testVfModuleWithParameters() {
+ VfModule vfModule = new VfModule("vfModuleId", "vfModuleName", "heatStackId", "orchestrationStatus", true, "resourceVersion", "modelInvariantId", "modelVersionId", "modelCustomizationId", 1, new RelationshipList() );
+
+ assertEquals("vfModuleId", vfModule.getVfModuleId());
+ assertEquals("vfModuleName", vfModule.getVfMduleName());
+ assertEquals("heatStackId", vfModule.getHeatStackId());
+ assertEquals("orchestrationStatus", vfModule.getOrchestrationStatus());
+ assertTrue(vfModule.getIsBaseVfModule());
+ assertEquals("resourceVersion", vfModule.getResourceVersion());
+ assertEquals("modelInvariantId", vfModule.getModelInvariantId());
+ assertEquals("modelVersionId", vfModule.getModelVersionId());
+ assertEquals("modelCustomizationId", vfModule.getModelCustomizationId());
+ assertEquals(new Integer(1), vfModule.getModuleIndex());
+
+ String vfModuleString = vfModule.toString();
+ assertTrue(vfModuleString.contains("[vfModuleId=vfModuleId,vfModuleName=vfModuleName,heatStackId=heatStackId,orchestrationStatus=orchestrationStatus,isBaseVfModule=true,resourceVersion=resourceVersion,modelInvariantId=modelInvariantId,modelVersionId=modelVersionId,modelCustomizationId=modelCustomizationId,moduleIndex=1"));
+
+ }
+
+ @Test
+ public void testVfModuleEquals() {
+ VfModule vfModule1 = new VfModule("vfModuleId1", "vfModuleName1", "heatStackId1", "orchestrationStatus1", true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", 1, new RelationshipList() );
+ VfModule vfModule2 = new VfModule("vfModuleId2", "vfModuleName2", "heatStackId2", "orchestrationStatus2", true, "resourceVersion2", "modelInvariantId2", "modelVersionId2", "modelCustomizationId2", 1, new RelationshipList() );
+ VfModule vfModule3 = new VfModule("vfModuleId1", "vfModuleName1", "heatStackId1", "orchestrationStatus1", true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", 1, new RelationshipList() );
+
+ assertTrue(vfModule1.equals(vfModule1));
+ assertTrue(!vfModule1.equals(vfModule2));
+ assertTrue(vfModule1.equals(vfModule3));
+ }
+
+}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModulesTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModulesTest.java
new file mode 100644
index 0000000..3e1588c
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModulesTest.java
@@ -0,0 +1,56 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.VfModule;
+import org.onap.pomba.contextbuilder.aai.datatype.VfModules;
+
+public class VfModulesTest {
+ @Test
+ public void testVfModules() {
+ VfModules vfModules = new VfModules();
+
+ List<VfModule> vfModuleList = new ArrayList<VfModule>();
+ vfModuleList.add(new VfModule());
+ vfModules.setVfModule(vfModuleList);
+
+ assertTrue(vfModules.getVfModule().get(0) instanceof VfModule);
+ }
+
+ @Test
+ public void testVfModulesWithParameters() {
+ VfModules vfModules = new VfModules(new ArrayList<VfModule>());
+
+ String vfModulesString = vfModules.toString();
+ assertTrue(vfModulesString.contains("[vfModule="));
+ }
+
+ @Test
+ public void testVfModulesEquals() {
+ VfModules vfModules1 = new VfModules(new ArrayList<VfModule>());
+ VfModules vfModules2 = new VfModules(new ArrayList<VfModule>());
+
+ assertTrue(vfModules1.equals(vfModules1));
+ assertTrue(vfModules1.equals(vfModules2));
+ }
+}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java
new file mode 100644
index 0000000..dd2a3fc
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java
@@ -0,0 +1,138 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
+import org.onap.pomba.contextbuilder.aai.datatype.VfModules;
+import org.onap.pomba.contextbuilder.aai.datatype.VnfInstance;
+
+public class VnfInstanceTest {
+ @Test
+ public void testVnfInstance() {
+ VnfInstance vnfInstance = new VnfInstance();
+
+ vnfInstance.setServiceId("serviceId");
+ vnfInstance.setModelCustomizationId("modelCustomizationId");
+ vnfInstance.setVnfType("vnfType");
+ vnfInstance.setIpv4Loopback0Address("ipv4Loopback0Address");
+ vnfInstance.setNfFunction("nfFunction");
+ vnfInstance.setModelInvariantId("modelInvariantId");
+ vnfInstance.setResourceVersion("resourceVersion");
+ vnfInstance.setVnfName2("vnfName2");
+ vnfInstance.setRelationshipList(new RelationshipList());
+ vnfInstance.setNmLanV6Address("nmLanV6Address");
+ vnfInstance.setNfRole("nfRole");
+ vnfInstance.setNfType("nfType");
+ vnfInstance.setModelVersionId("modelVersionId");
+ vnfInstance.setIpv4OamAddress("ipv4OamAddress");
+ vnfInstance.setVnfName("vnfName");
+ vnfInstance.setInMaintenance(true);
+ vnfInstance.setMsoCatalogKey("msoCatalogKey");
+ vnfInstance.setProvisionStatus("provisionStatus");
+ vnfInstance.setVfModules(new VfModules());
+ vnfInstance.setEquipmentRole("equipmentRole");
+ vnfInstance.setVnfId("vnfId");
+ vnfInstance.setOrchestrationStatus("orchestrationStatus");
+ vnfInstance.setNfNamingCode("nfNamingCode");
+ vnfInstance.setHeatStackId("heatStackId");
+ vnfInstance.setIsClosedLoopDisabled(true);
+ vnfInstance.setLicenseKey("licenseKey");
+ vnfInstance.setManagementV6Address("managementV6Address");
+
+ assertEquals("serviceId", vnfInstance.getServiceId());
+ assertEquals("modelCustomizationId", vnfInstance.getModelCustomizationId());
+ assertEquals("vnfType", vnfInstance.getVnfType());
+ assertEquals("ipv4Loopback0Address", vnfInstance.getIpv4Loopback0Address());
+ assertEquals("nfFunction", vnfInstance.getNfFunction());
+ assertEquals("modelInvariantId", vnfInstance.getModelInvariantId());
+ assertEquals("resourceVersion", vnfInstance.getResourceVersion());
+ assertEquals("vnfName2", vnfInstance.getVnfName2());
+ assertTrue(vnfInstance.getRelationshipList() instanceof RelationshipList);
+ assertEquals("nmLanV6Address", vnfInstance.getNmLanV6Address());
+ assertEquals("nfRole", vnfInstance.getNfRole());
+ assertEquals("nfType", vnfInstance.getNfType());
+ assertEquals("modelVersionId", vnfInstance.getModelVersionId());
+ assertEquals("ipv4OamAddress", vnfInstance.getIpv4OamAddress());
+ assertEquals("vnfName", vnfInstance.getVnfName());
+ assertTrue(vnfInstance.getInMaintenance());
+ assertEquals("msoCatalogKey", vnfInstance.getMsoCatalogKey());
+ assertEquals("provisionStatus", vnfInstance.getProvisionStatus());
+ assertTrue(vnfInstance.getVfModules() instanceof VfModules);
+ assertEquals("equipmentRole", vnfInstance.getEquipmentRole());
+ assertEquals("vnfId", vnfInstance.getVnfId());
+ assertEquals("orchestrationStatus", vnfInstance.getOrchestrationStatus());
+ assertEquals("nfNamingCode", vnfInstance.getNfNamingCode());
+ assertEquals("heatStackId", vnfInstance.getHeatStackId());
+ assertTrue(vnfInstance.getIsClosedLoopDisabled());
+ assertEquals("licenseKey", vnfInstance.getLicenseKey());
+ assertEquals("managementV6Address", vnfInstance.getManagementV6Address());
+
+ }
+
+ @Test
+ public void testVnfInstanceWithParameters() {
+ VnfInstance vnfInstance = new VnfInstance("vnfId", "vnfName", "vnfName2", "vnfType", "serviceId", "provisionStatus", "licenseKey", "equipmentRole", "orchestrationStatus", "heatStackId", "msoCatalogKey", "ipv4OamAddress", "ipv4Loopback0Address", "nmLanV6Address", "managementV6Address", true, true, "resourceVersion", "modelInvariantId", "modelVersionId", "modelCustomizationId", "nfType", "nfFunction", "nfRole", "nfNamingCode", new RelationshipList(), new VfModules());
+
+ assertEquals("serviceId", vnfInstance.getServiceId());
+ assertEquals("modelCustomizationId", vnfInstance.getModelCustomizationId());
+ assertEquals("vnfType", vnfInstance.getVnfType());
+ assertEquals("ipv4Loopback0Address", vnfInstance.getIpv4Loopback0Address());
+ assertEquals("nfFunction", vnfInstance.getNfFunction());
+ assertEquals("modelInvariantId", vnfInstance.getModelInvariantId());
+ assertEquals("resourceVersion", vnfInstance.getResourceVersion());
+ assertEquals("vnfName2", vnfInstance.getVnfName2());
+ assertTrue(vnfInstance.getRelationshipList() instanceof RelationshipList);
+ assertEquals("nmLanV6Address", vnfInstance.getNmLanV6Address());
+ assertEquals("nfRole", vnfInstance.getNfRole());
+ assertEquals("nfType", vnfInstance.getNfType());
+ assertEquals("modelVersionId", vnfInstance.getModelVersionId());
+ assertEquals("ipv4OamAddress", vnfInstance.getIpv4OamAddress());
+ assertEquals("vnfName", vnfInstance.getVnfName());
+ assertTrue(vnfInstance.getInMaintenance());
+ assertEquals("msoCatalogKey", vnfInstance.getMsoCatalogKey());
+ assertEquals("provisionStatus", vnfInstance.getProvisionStatus());
+ assertTrue(vnfInstance.getVfModules() instanceof VfModules);
+ assertEquals("equipmentRole", vnfInstance.getEquipmentRole());
+ assertEquals("vnfId", vnfInstance.getVnfId());
+ assertEquals("orchestrationStatus", vnfInstance.getOrchestrationStatus());
+ assertEquals("nfNamingCode", vnfInstance.getNfNamingCode());
+ assertEquals("heatStackId", vnfInstance.getHeatStackId());
+ assertTrue(vnfInstance.getIsClosedLoopDisabled());
+ assertEquals("licenseKey", vnfInstance.getLicenseKey());
+ assertEquals("managementV6Address", vnfInstance.getManagementV6Address());
+
+ String vnfInstanceString = vnfInstance.toString();
+ assertTrue(vnfInstanceString.contains("[vnfId=vnfId,vnfName=vnfName,vnfName2=vnfName2,vnfType=vnfType,serviceId=serviceId,provisionStatus=provisionStatus,licenseKey=licenseKey,equipmentRole=equipmentRole,orchestrationStatus=orchestrationStatus,heatStackId=heatStackId,msoCatalogKey=msoCatalogKey,ipv4OamAddress=ipv4OamAddress,ipv4Loopback0Address=ipv4Loopback0Address,nmLanV6Address=nmLanV6Address,managementV6Address=managementV6Address,inMaintenance=true,isClosedLoopDisabled=true,resourceVersion=resourceVersion,modelInvariantId=modelInvariantId,modelVersionId=modelVersionId,modelCustomizationId=modelCustomizationId,nfType=nfType,nfFunction=nfFunction,nfRole=nfRole,nfNamingCode=nfNamingCode,"));
+ }
+
+ @Test
+ public void testVnfInstanceEquals() {
+ VnfInstance vnfInstance1 = new VnfInstance("vnfId1", "vnfName1", "vnfName2-1", "vnfType1", "serviceId1", "provisionStatus1", "licenseKey1", "equipmentRole1", "orchestrationStatus1", "heatStackId1", "msoCatalogKey1", "ipv4OamAddress1", "ipv4Loopback0Address1", "nmLanV6Address1", "managementV6Address1", true, true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", "nfType1", "nfFunction1", "nfRole1", "nfNamingCode1", new RelationshipList(), new VfModules());
+ VnfInstance vnfInstance2 = new VnfInstance("vnfId2", "vnfName2", "vnfName2-2", "vnfType2", "serviceId2", "provisionStatus2", "licenseKey2", "equipmentRole2", "orchestrationStatus2", "heatStackId2", "msoCatalogKey2", "ipv4OamAddress2", "ipv4Loopback0Address2", "nmLanV6Address2", "managementV6Address2", true, true, "resourceVersion2", "modelInvariantId2", "modelVersionId2", "modelCustomizationId2", "nfType2", "nfFunction2", "nfRole2", "nfNamingCode2", new RelationshipList(), new VfModules());
+ VnfInstance vnfInstance3 = new VnfInstance("vnfId1", "vnfName1", "vnfName2-1", "vnfType1", "serviceId1", "provisionStatus1", "licenseKey1", "equipmentRole1", "orchestrationStatus1", "heatStackId1", "msoCatalogKey1", "ipv4OamAddress1", "ipv4Loopback0Address1", "nmLanV6Address1", "managementV6Address1", true, true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", "nfType1", "nfFunction1", "nfRole1", "nfNamingCode1", new RelationshipList(), new VfModules());
+
+ assertTrue(vnfInstance1.equals(vnfInstance1));
+ assertTrue(!vnfInstance1.equals(vnfInstance2));
+ assertTrue(vnfInstance1.equals(vnfInstance3));
+
+ }
+}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfcInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfcInstanceTest.java
new file mode 100644
index 0000000..29c55a9
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfcInstanceTest.java
@@ -0,0 +1,87 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
+import org.onap.pomba.contextbuilder.aai.datatype.VnfcInstance;
+
+public class VnfcInstanceTest {
+ @Test
+ public void testVnfcInstance() {
+ VnfcInstance vnfcInstance = new VnfcInstance();
+ vnfcInstance.setVnfcName("vnfcName");
+ vnfcInstance.setNfcNamingCode("nfcNamingCode");
+ vnfcInstance.setNfcFunction("nfcFunction");
+ vnfcInstance.setProvisionStatus("provisionStatus");
+ vnfcInstance.setOrchestrationStatus("orchestrationStatus");
+ vnfcInstance.setInMaintenance(true);
+ vnfcInstance.setIsClosedLoopDisabled(true);
+ vnfcInstance.setResourceVersion("resourceVersion");
+ vnfcInstance.setModelInvariantId("modelInvariantId");
+ vnfcInstance.setModelVersionId("modelVersionId");
+ vnfcInstance.setRelationshipList(new RelationshipList());
+
+ assertEquals("vnfcName", vnfcInstance.getVnfcName());
+ assertEquals("nfcNamingCode", vnfcInstance.getNfcNamingCode());
+ assertEquals("nfcFunction", vnfcInstance.getNfcFunction());
+ assertEquals("provisionStatus", vnfcInstance.getProvisionStatus());
+ assertEquals("orchestrationStatus", vnfcInstance.getOrchestrationStatus());
+ assertTrue(vnfcInstance.getInMaintenance());
+ assertTrue(vnfcInstance.getIsClosedLoopDisabled());
+ assertEquals("resourceVersion", vnfcInstance.getResourceVersion());
+ assertEquals("modelInvariantId", vnfcInstance.getModelInvariantId());
+ assertEquals("modelVersionId", vnfcInstance.getModelVersionId());
+ assertTrue(vnfcInstance.getRelationshipList() instanceof RelationshipList);
+
+ }
+
+ @Test
+ public void testVnfcInstanceWithParameters() {
+ VnfcInstance vnfcInstance = new VnfcInstance("vnfcName", "nfcNamingCode", "nfcFunction", "provisionStatus", "orchestrationStatus", true, true, "resourceVersion", "modelInvariantId", "modelVersionId", new RelationshipList());
+
+ assertEquals("vnfcName", vnfcInstance.getVnfcName());
+ assertEquals("nfcNamingCode", vnfcInstance.getNfcNamingCode());
+ assertEquals("nfcFunction", vnfcInstance.getNfcFunction());
+ assertEquals("provisionStatus", vnfcInstance.getProvisionStatus());
+ assertEquals("orchestrationStatus", vnfcInstance.getOrchestrationStatus());
+ assertTrue(vnfcInstance.getInMaintenance());
+ assertTrue(vnfcInstance.getIsClosedLoopDisabled());
+ assertEquals("resourceVersion", vnfcInstance.getResourceVersion());
+ assertEquals("modelInvariantId", vnfcInstance.getModelInvariantId());
+ assertEquals("modelVersionId", vnfcInstance.getModelVersionId());
+ assertTrue(vnfcInstance.getRelationshipList() instanceof RelationshipList);
+
+ String vnfcInstanceString = vnfcInstance.toString();
+ assertTrue(vnfcInstanceString.contains("[vnfcName=vnfcName,nfcNamingCode=nfcNamingCode,nfcFunction=nfcFunction,provisionStatus=provisionStatus,orchestration_status=orchestrationStatus,inMaintenance=true,isClosedLoopDisabled=true,resourceVersion=resourceVersion,modelInvariantId=modelInvariantId,modelVersionId=modelVersionId,"));
+ }
+
+ @Test
+ public void testVnfcInstanceEquals() {
+ VnfcInstance vnfcInstance1 = new VnfcInstance("vnfcName1", "nfcNamingCode1", "nfcFunction1", "provisionStatus1", "orchestrationStatus1", true, true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", new RelationshipList());
+ VnfcInstance vnfcInstance2 = new VnfcInstance("vnfcName2", "nfcNamingCode2", "nfcFunction2", "provisionStatus2", "orchestrationStatus2", true, true, "resourceVersion2", "modelInvariantId2", "modelVersionId2", new RelationshipList());
+ VnfcInstance vnfcInstance3 = new VnfcInstance("vnfcName1", "nfcNamingCode1", "nfcFunction1", "provisionStatus1", "orchestrationStatus1", true, true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", new RelationshipList());
+
+ assertTrue(vnfcInstance1.equals(vnfcInstance1));
+ assertTrue(!vnfcInstance1.equals(vnfcInstance2));
+ assertTrue(vnfcInstance1.equals(vnfcInstance3));
+ }
+}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/WebConfigurationTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/WebConfigurationTest.java
new file mode 100644
index 0000000..a07524d
--- /dev/null
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/WebConfigurationTest.java
@@ -0,0 +1,38 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.WebConfiguration;
+import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+public class WebConfigurationTest {
+ @Test
+ public void runTest() {
+ WebConfiguration webConfiguration = new WebConfiguration();
+ WebMvcConfigurerAdapter webMvConfigurationAdapter = webConfiguration.forwardToIndex();
+ ViewResolverRegistry registry = mock(ViewResolverRegistry.class);
+ webMvConfigurationAdapter.configureViewResolvers(registry);
+ assertEquals(false, registry.hasRegistrations());
+ }
+
+}