aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PserverInstance.java3
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/datatype/Vserver.java4
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringService.java3
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringServiceImpl.java5
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestService.java6
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestServiceImpl.java18
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java181
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LInterfaceInstanceTest.java51
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LogicalLinkInstanceTest.java59
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PInterfaceInstanceTest.java55
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PnfInstanceTest.java59
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PserverInstanceTest.java58
-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/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.java100
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java139
-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/pomba/contextbuilder/aai/test/RestServiceTest.java (renamed from src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java)434
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/RestUtilTest.java (renamed from src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java)134
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/AppTest.java (renamed from src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/AppTest.java)16
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/GenericResponseTest.java (renamed from src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/GenericResponseTest.java)5
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/JerseyConfigurationTest.java (renamed from src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JerseyConfigurationTest.java)18
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/JsonReaderTest.java (renamed from src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JsonReaderTest.java)8
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/L3networkInstanceTest.java (renamed from src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/L3networkInstanceTest.java)25
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LInterfaceInstanceTest.java49
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LogicalLinkInstanceTest.java57
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PInterfaceInstanceTest.java55
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PnfInstanceTest.java58
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PserverInstanceTest.java58
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelatedToPropertyTest.java56
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipDatumTest.java60
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipListTest.java101
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipTest.java89
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/ServiceInstanceTest.java145
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VfModuleTest.java152
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VfModulesTest.java (renamed from src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModulesTest.java)45
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfInstanceTest.java259
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfcInstanceTest.java132
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VserverTest.java (renamed from src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VserverTest.java)54
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/WebConfigurationTest.java (renamed from src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/WebConfigurationTest.java)19
44 files changed, 1887 insertions, 1365 deletions
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PserverInstance.java b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PserverInstance.java
index 5ca73c5..8ec0f6b 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PserverInstance.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PserverInstance.java
@@ -23,9 +23,6 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
-
-import javax.validation.Valid;
-
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/Vserver.java b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/Vserver.java
index 948aaa7..9bf67d9 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/Vserver.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/Vserver.java
@@ -21,11 +21,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
-
import java.util.List;
-
-import javax.validation.Valid;
-
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringService.java b/src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringService.java
index c59a24e..77f9145 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringService.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringService.java
@@ -18,10 +18,11 @@
package org.onap.pomba.contextbuilder.aai.service;
+import javax.servlet.http.HttpServletRequest;
import org.onap.pomba.common.datatypes.ModelContext;
import org.onap.pomba.contextbuilder.aai.exception.AuditException;
public interface SpringService {
- public ModelContext getContext(String serviceInstanceId, String transactionId) throws AuditException;
+ public ModelContext getContext(HttpServletRequest req, String serviceInstanceId, String requestId, String partnerName) throws AuditException;
}
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 216ee3e..cba4aa9 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
@@ -17,6 +17,7 @@
*/
package org.onap.pomba.contextbuilder.aai.service;
+import javax.servlet.http.HttpServletRequest;
import org.onap.aai.restclient.client.RestClient;
import org.onap.pomba.common.datatypes.ModelContext;
import org.onap.pomba.contextbuilder.aai.common.LogMessages;
@@ -45,7 +46,7 @@ public class SpringServiceImpl implements SpringService {
// needed for instantiation
}
- public ModelContext getContext(String serviceInstanceId, String tranId) throws AuditException {
+ public ModelContext getContext(HttpServletRequest req, String serviceInstanceId, String requestId, String partnerName) throws AuditException {
String url = "serviceInstanceId=" + serviceInstanceId;
log.info(LogMessages.AAI_CONTEXT_BUILDER_URL, url);
@@ -54,7 +55,7 @@ public class SpringServiceImpl implements SpringService {
// Retrieve the service instance information from AAI
try {
- context= RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, tranId, serviceInstanceId, aaiBasicAuthorization);
+ context= RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, req, requestId, partnerName, serviceInstanceId, aaiBasicAuthorization);
} catch (AuditException ae) {
throw ae;
} catch (Exception e) {
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestService.java b/src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestService.java
index b30b76d..6d28c90 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestService.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestService.java
@@ -22,6 +22,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.Path;
@@ -54,9 +55,10 @@ public interface RestService {
@ApiResponse(code = 500, message = "Unexpected Runtime error")
})
public Response getContext(@Context HttpHeaders headers,
+ @Context HttpServletRequest req,
@HeaderParam(HttpHeaders.AUTHORIZATION) @ApiParam(hidden=true) String authorization,
- @HeaderParam(org.onap.pomba.contextbuilder.aai.util.RestUtil.FROM_APP_ID) @ApiParam(required=true) String xFromAppId,
- @HeaderParam(org.onap.pomba.contextbuilder.aai.util.RestUtil.TRANSACTION_ID) String xTransactionId,
+ @HeaderParam(org.onap.pomba.contextbuilder.aai.util.RestUtil.FROM_APP_ID) @ApiParam(required=true) String xPartnerName,
+ @HeaderParam(org.onap.pomba.contextbuilder.aai.util.RestUtil.TRANSACTION_ID) String xRequestId,
@QueryParam("serviceInstanceId") @ApiParam(required=true) String serviceInstanceId
);
} \ No newline at end of file
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestServiceImpl.java
index 19e81df..f5653f2 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestServiceImpl.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestServiceImpl.java
@@ -20,6 +20,8 @@ package org.onap.pomba.contextbuilder.aai.service.rs;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import java.util.UUID;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
@@ -31,7 +33,6 @@ import org.onap.pomba.contextbuilder.aai.util.RestUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.UUID;
import org.springframework.stereotype.Component;
@Component
@@ -47,9 +48,10 @@ public class RestServiceImpl implements RestService {
@Override
public Response getContext(HttpHeaders headers,
+ HttpServletRequest req,
String authorization,
- String fromAppId,
- String transactionId,
+ String partnerName,
+ String requestId,
String serviceInstanceId) {
String url = "serviceInstanceId=" + serviceInstanceId;
@@ -57,9 +59,9 @@ public class RestServiceImpl implements RestService {
log.debug(LogMessages.AAI_CONTEXT_BUILDER_URL, url);
}
- if (transactionId == null || transactionId.isEmpty()) {
- transactionId = UUID.randomUUID().toString();
- log.info(String.format("%s is missing; using newly generated value: %s", org.onap.pomba.contextbuilder.aai.util.RestUtil.TRANSACTION_ID, transactionId));
+ if (requestId == null || requestId.isEmpty()) {
+ requestId = UUID.randomUUID().toString();
+ log.info(String.format("%s is missing; using newly generated value: %s", org.onap.pomba.contextbuilder.aai.util.RestUtil.TRANSACTION_ID, requestId));
}
Response response = null;
@@ -74,9 +76,9 @@ public class RestServiceImpl implements RestService {
RestUtil.validateServiceInstanceId(serviceInstanceId);
// Keep the same transaction id for logging purpose
- transactionId= RestUtil.extractTranIdHeader(headers);
+ requestId= RestUtil.extractRequestIdHeader(headers);
- aaiContext = service.getContext(serviceInstanceId,transactionId);
+ aaiContext = service.getContext(req, serviceInstanceId, requestId, partnerName);
if (aaiContext==null) {
// Return empty JSON
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 581ef32..928153b 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
@@ -15,8 +15,13 @@ package org.onap.pomba.contextbuilder.aai.util;
+import com.bazaarvoice.jolt.JsonUtils;
+import java.net.InetAddress;
+import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -24,6 +29,7 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedHashMap;
@@ -35,14 +41,26 @@ import org.onap.aai.restclient.client.OperationResult;
import org.onap.aai.restclient.client.RestClient;
import org.onap.pomba.common.datatypes.Attribute;
import org.onap.pomba.common.datatypes.DataQuality;
+import org.onap.pomba.common.datatypes.LInterface;
+import org.onap.pomba.common.datatypes.LogicalLink;
import org.onap.pomba.common.datatypes.ModelContext;
+import org.onap.pomba.common.datatypes.Network;
+import org.onap.pomba.common.datatypes.PInterface;
+import org.onap.pomba.common.datatypes.PNF;
+import org.onap.pomba.common.datatypes.Pserver;
import org.onap.pomba.common.datatypes.Service;
-import org.onap.pomba.common.datatypes.VNF;
import org.onap.pomba.common.datatypes.VFModule;
import org.onap.pomba.common.datatypes.VM;
+import org.onap.pomba.common.datatypes.VNF;
import org.onap.pomba.common.datatypes.VNFC;
-import org.onap.pomba.common.datatypes.Network;
import org.onap.pomba.contextbuilder.aai.common.LogMessages;
+import org.onap.pomba.contextbuilder.aai.datatype.L3networkInstance;
+import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstance;
+import org.onap.pomba.contextbuilder.aai.datatype.LogicalLinkInstance;
+import org.onap.pomba.contextbuilder.aai.datatype.PInterfaceInstance;
+import org.onap.pomba.contextbuilder.aai.datatype.PInterfaceInstanceList;
+import org.onap.pomba.contextbuilder.aai.datatype.PnfInstance;
+import org.onap.pomba.contextbuilder.aai.datatype.PserverInstance;
import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
import org.onap.pomba.contextbuilder.aai.datatype.ServiceInstance;
@@ -50,24 +68,11 @@ import org.onap.pomba.contextbuilder.aai.datatype.VfModule;
import org.onap.pomba.contextbuilder.aai.datatype.VnfInstance;
import org.onap.pomba.contextbuilder.aai.datatype.VnfcInstance;
import org.onap.pomba.contextbuilder.aai.datatype.Vserver;
-import org.onap.pomba.contextbuilder.aai.datatype.PserverInstance;
-import org.onap.pomba.contextbuilder.aai.datatype.PInterfaceInstance;
-import org.onap.pomba.contextbuilder.aai.datatype.L3networkInstance;
-import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstance;
-import org.onap.pomba.contextbuilder.aai.datatype.LogicalLinkInstance;
import org.onap.pomba.contextbuilder.aai.exception.AuditError;
import org.onap.pomba.contextbuilder.aai.exception.AuditException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.onap.pomba.contextbuilder.aai.datatype.PnfInstance;
-import org.onap.pomba.contextbuilder.aai.datatype.PInterfaceInstanceList;
-import org.onap.pomba.common.datatypes.PNF;
-import org.onap.pomba.common.datatypes.PInterface;
-import com.bazaarvoice.jolt.JsonUtils;
-import org.onap.pomba.common.datatypes.Pserver;
-import org.onap.pomba.common.datatypes.LInterface;
-import org.onap.pomba.common.datatypes.LogicalLink;
-import java.text.MessageFormat;
+import org.slf4j.MDC;
public class RestUtil {
@@ -85,6 +90,20 @@ public class RestUtil {
private static final String APP_NAME = "aaiCtxBuilder";
+ private static final String MDC_REQUEST_ID = "RequestId";
+ private static final String MDC_SERVER_FQDN = "ServerFQDN";
+ private static final String MDC_SERVICE_NAME = "ServiceName";
+ private static final String MDC_PARTNER_NAME = "PartnerName";
+ private static final String MDC_START_TIME = "StartTime";
+ private static final String MDC_SERVICE_INSTANCE_ID = "ServiceInstanceId";
+ private static final String MDC_INVOCATION_ID = "InvocationID";
+ private static final String MDC_CLIENT_ADDRESS = "ClientAddress";
+ private static final String MDC_STATUS_CODE = "StatusCode";
+ private static final String MDC_RESPONSE_CODE = "ResponseCode";
+ private static final String MDC_INSTANCE_ID = "InstanceId";
+
+ private static UUID instanceId = UUID.randomUUID();
+
// Service Catalog - "related-to"
private static final String CATALOG_GENERIC_VNF = "generic-vnf";
private static final String CATALOG_VNFC = "vnfc";
@@ -97,8 +116,6 @@ public class RestUtil {
private static final String VF_MODULES = "vf-modules";
private static final String VF_MODULE = "vf-module";
-
-
// Relationship Json Path
private static final String RELATIONSHIP_LIST = "relationship-list";
private static final String RELATIONSHIP = "relationship";
@@ -187,7 +204,7 @@ public class RestUtil {
public static void validateHeader(HttpHeaders headers) throws AuditException {
String fromAppId = null;
- String transactionId = null;
+ String requestId = null;
fromAppId = headers.getRequestHeaders().getFirst(FROM_APP_ID);
if ((fromAppId == null) || fromAppId.trim().isEmpty()) {
@@ -195,24 +212,24 @@ public class RestUtil {
throw new AuditException(AuditError.MISSING_HEADER_PARAMETER + FROM_APP_ID, Status.BAD_REQUEST);
}
- transactionId = headers.getRequestHeaders().getFirst(TRANSACTION_ID);
- if ((transactionId == null) || transactionId.trim().isEmpty()) {
- transactionId = UUID.randomUUID().toString();
- log.info(LogMessages.HEADER_MESSAGE, TRANSACTION_ID, transactionId);
+ requestId = headers.getRequestHeaders().getFirst(TRANSACTION_ID);
+ if ((requestId == null) || requestId.trim().isEmpty()) {
+ requestId = UUID.randomUUID().toString();
+ log.info(LogMessages.HEADER_MESSAGE, TRANSACTION_ID, requestId);
}
}
/*
* The purpose is to keep same transaction Id from north bound interface to south bound interface
*/
- public static String extractTranIdHeader(HttpHeaders headers) {
- String transactionId = null;
- transactionId = headers.getRequestHeaders().getFirst(TRANSACTION_ID);
- if ((transactionId == null) || transactionId.trim().isEmpty()) {
- transactionId = UUID.randomUUID().toString();
- log.info(LogMessages.HEADER_MESSAGE, TRANSACTION_ID, transactionId);
+ public static String extractRequestIdHeader(HttpHeaders headers) {
+ String requestId = null;
+ requestId = headers.getRequestHeaders().getFirst(TRANSACTION_ID);
+ if ((requestId == null) || requestId.trim().isEmpty()) {
+ requestId = UUID.randomUUID().toString();
+ log.info(LogMessages.HEADER_MESSAGE, TRANSACTION_ID, requestId);
}
- return transactionId;
+ return requestId;
}
/*
@@ -220,7 +237,8 @@ public class RestUtil {
*
*/
public static ModelContext retrieveAAIModelData(RestClient aaiClient, String baseURL, String aaiPathToSearchNodeQuery,
- String transactionId, String serviceInstanceId, String aaiBasicAuthorization) throws AuditException {
+ HttpServletRequest req, String requestId, String partnerName, String serviceInstanceId, String aaiBasicAuthorization) throws AuditException {
+ initMdc(requestId, partnerName, serviceInstanceId, req.getRemoteAddr());
String serviceInstancePayload = null;
String genericVNFPayload = null;
@@ -238,7 +256,7 @@ public class RestUtil {
// Response from service instance API call
serviceInstancePayload =
- getResource(aaiClient, url, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+ getResource(aaiClient, url, aaiBasicAuthorization, requestId, MediaType.valueOf(MediaType.APPLICATION_JSON));
// Handle the case if the service instance is not found in AAI
if (isEmptyJson(serviceInstancePayload)) {
@@ -259,7 +277,7 @@ public class RestUtil {
String genericVNFURL = baseURL + genericVNFLink + DEPTH;
// Response from generic VNF API call
genericVNFPayload =
- getResource(aaiClient, genericVNFURL, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+ getResource(aaiClient, genericVNFURL, aaiBasicAuthorization, requestId, MediaType.valueOf(MediaType.APPLICATION_JSON));
if (isEmptyJson(genericVNFPayload)) {
log.info(LogMessages.NOT_FOUND, "GenericVNF with url ", genericVNFLink);
@@ -274,34 +292,34 @@ public class RestUtil {
List<LInterfaceInstance> lInterfaceInstList_aai = vnfInstance.getLInterfaceInstanceList().getLInterfaceList();
for (LInterfaceInstance lInterfaceInst_aai : lInterfaceInstList_aai) {
lInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
- transactionId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList()));
+ requestId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList()));
}
}
vnfLst.add(vnfInstance);
// Update VModule with l3-network list from aai, if any.
- buildVModuleWithL3NetworkInfo (vnfInstance, aaiClient, baseURL, transactionId, aaiBasicAuthorization);
+ buildVModuleWithL3NetworkInfo (vnfInstance, aaiClient, baseURL, requestId, aaiBasicAuthorization);
// Build the vnf_vnfc relationship map
- buildVnfcMap(vnfcMap, genericVNFPayload, aaiClient, baseURL, transactionId, aaiBasicAuthorization );
+ buildVnfcMap(vnfcMap, genericVNFPayload, aaiClient, baseURL, requestId, aaiBasicAuthorization );
// Build vnf_vfmodule_vserver relationship map
- buildVfmoduleVserverMap(vnfVfmoduleVserverMap, genericVNFPayload, aaiClient, baseURL, transactionId, aaiBasicAuthorization);
+ buildVfmoduleVserverMap(vnfVfmoduleVserverMap, genericVNFPayload, aaiClient, baseURL, requestId, aaiBasicAuthorization);
// Build the vnf_l3_network relationship map
- buildVnfWithL3networkInfo(l3networkMapInVnf, genericVNFPayload, aaiClient, baseURL, transactionId, aaiBasicAuthorization );
+ buildVnfWithL3networkInfo(l3networkMapInVnf, genericVNFPayload, aaiClient, baseURL, requestId, aaiBasicAuthorization );
}
}
//Obtain PNF (Physical Network Function)
- List<PnfInstance> pnfLst = retrieveAAIModelData_PNF (aaiClient, baseURL, transactionId, serviceInstanceId, aaiBasicAuthorization, serviceInstancePayload) ;
+ List<PnfInstance> pnfLst = retrieveAAIModelData_PNF (aaiClient, baseURL, requestId, serviceInstanceId, aaiBasicAuthorization, serviceInstancePayload) ;
//Obtain l3-network on service level
- List<L3networkInstance> l3networkLstInService = retrieveAaiModelDataL3NetworkInServiceLevel (aaiClient, baseURL, transactionId, aaiBasicAuthorization, serviceInstancePayload) ;
+ List<L3networkInstance> l3networkLstInService = retrieveAaiModelDataL3NetworkInServiceLevel (aaiClient, baseURL, requestId, aaiBasicAuthorization, serviceInstancePayload) ;
//Obtain logical-link on service level
List<LogicalLinkInstance> logicalLinkInstanceLstInService = obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
- transactionId, aaiBasicAuthorization, ServiceInstance.fromJson(serviceInstancePayload).getRelationshipList());
+ requestId, aaiBasicAuthorization, ServiceInstance.fromJson(serviceInstancePayload).getRelationshipList());
// Transform to common model and return
return transform(ServiceInstance.fromJson(serviceInstancePayload), vnfLst, vnfcMap, l3networkMapInVnf, vnfVfmoduleVserverMap, pnfLst, l3networkLstInService, logicalLinkInstanceLstInService);
@@ -309,7 +327,7 @@ public class RestUtil {
private static void buildVModuleWithL3NetworkInfo (VnfInstance vnfInstance,
RestClient aaiClient, String baseURL,
- String transactionId, String aaiBasicAuthorization
+ String requestId, String aaiBasicAuthorization
) throws AuditException {
if ((vnfInstance != null ) && (vnfInstance.getVfModules()) != null) {
@@ -329,7 +347,7 @@ public class RestUtil {
}
if (!(relatedLinkList.isEmpty())) {
- List<L3networkInstance> l3nwInsLst = queryAaiForL3networkInfo (aaiClient,baseURL,transactionId,aaiBasicAuthorization,relatedLinkList);
+ List<L3networkInstance> l3nwInsLst = queryAaiForL3networkInfo (aaiClient,baseURL,requestId,aaiBasicAuthorization,relatedLinkList);
if ((l3nwInsLst != null) && (!l3nwInsLst.isEmpty())) {
t_vfModule.setL3NetworkList(l3nwInsLst);
@@ -342,7 +360,7 @@ public class RestUtil {
}
private static List<PnfInstance> retrieveAAIModelData_PNF(RestClient aaiClient, String baseURL,
- String transactionId, String serviceInstanceId, String aaiBasicAuthorization, String serviceInstancePayload) throws AuditException {
+ String requestId, String serviceInstanceId, String aaiBasicAuthorization, String serviceInstancePayload) throws AuditException {
List<String> genericPNFLinkLst = extractRelatedLink(serviceInstancePayload, CATALOG_PNF);
log.info(LogMessages.NUMBER_OF_API_CALLS, "PNF", genericPNFLinkLst.size());
@@ -360,7 +378,7 @@ public class RestUtil {
String genericPNFURL = baseURL + genericPNFLink + DEPTH;
// Response from generic PNF API call
genericPNFPayload =
- getResource(aaiClient, genericPNFURL, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+ getResource(aaiClient, genericPNFURL, aaiBasicAuthorization, requestId, MediaType.valueOf(MediaType.APPLICATION_JSON));
if (isEmptyJson(genericPNFPayload)) {
log.info(LogMessages.NOT_FOUND, "GenericPNF with url ", genericPNFLink);
@@ -376,7 +394,7 @@ public class RestUtil {
List<PInterfaceInstance> pInterfaceInstList_aai = pnfInstance.getPInterfaceInstanceList().getPInterfaceList();
for (PInterfaceInstance pInterfaceInst_aai : pInterfaceInstList_aai) {
pInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
- transactionId, aaiBasicAuthorization, pInterfaceInst_aai.getRelationshipList()));
+ requestId, aaiBasicAuthorization, pInterfaceInst_aai.getRelationshipList()));
//Obtain L-Interface level logical-link
if ((pInterfaceInst_aai.getLInterfaceInstanceList() != null)
@@ -384,7 +402,7 @@ public class RestUtil {
List<LInterfaceInstance> lInterfaceInstList_aai = pInterfaceInst_aai.getLInterfaceInstanceList().getLInterfaceList();
for (LInterfaceInstance lInterfaceInst_aai : lInterfaceInstList_aai) {
lInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
- transactionId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList()));
+ requestId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList()));
}
}
}
@@ -396,7 +414,7 @@ public class RestUtil {
}
private static List<LogicalLinkInstance> obtainLogicalLinkInfoFromAai(RestClient aaiClient, String baseURL,
- String transactionId, String aaiBasicAuthorization, RelationshipList logicalLinkRelateionShipList) throws AuditException {
+ String requestId, String aaiBasicAuthorization, RelationshipList logicalLinkRelateionShipList) throws AuditException {
if (logicalLinkRelateionShipList == null) {
return null;
}
@@ -416,7 +434,7 @@ public class RestUtil {
}
if (!(relatedLinkList.isEmpty())) {
- List<LogicalLinkInstance> logicalLinkInsLst = queryAaiForLogicalLinkData (aaiClient,baseURL,transactionId,aaiBasicAuthorization,relatedLinkList);
+ List<LogicalLinkInstance> logicalLinkInsLst = queryAaiForLogicalLinkData (aaiClient,baseURL,requestId,aaiBasicAuthorization,relatedLinkList);
if ((logicalLinkInsLst != null) && (!logicalLinkInsLst.isEmpty())) {
@@ -428,7 +446,7 @@ public class RestUtil {
}
private static List<LogicalLinkInstance> queryAaiForLogicalLinkData(RestClient aaiClient, String baseURL,
- String transactionId, String aaiBasicAuthorization, List<String> genericRelatedLinkLst) throws AuditException {
+ String requestId, String aaiBasicAuthorization, List<String> genericRelatedLinkLst) throws AuditException {
if ( genericRelatedLinkLst.isEmpty()) {
return null;
}
@@ -443,7 +461,7 @@ public class RestUtil {
String genericURL = baseURL + genericRelatedLink;
// Response from generic l3-network API call
genericDataPayload =
- getResource(aaiClient, genericURL, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+ getResource(aaiClient, genericURL, aaiBasicAuthorization, requestId, MediaType.valueOf(MediaType.APPLICATION_JSON));
if (isEmptyJson(genericDataPayload)) {
log.info(LogMessages.NOT_FOUND, " url ", genericRelatedLink);
@@ -460,7 +478,7 @@ public class RestUtil {
}
private static List<L3networkInstance> queryAaiForL3networkInfo(RestClient aaiClient, String baseURL,
- String transactionId, String aaiBasicAuthorization, List<String> genericL3networkLinkLst) throws AuditException {
+ String requestId, String aaiBasicAuthorization, List<String> genericL3networkLinkLst) throws AuditException {
if ( genericL3networkLinkLst.isEmpty()) {
return null;
}
@@ -475,7 +493,7 @@ public class RestUtil {
String genericL3NetworkURL = baseURL + genericNetworkLink + DEPTH;
// Response from generic l3-network API call
genericL3networkPayload =
- getResource(aaiClient, genericL3NetworkURL, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+ getResource(aaiClient, genericL3NetworkURL, aaiBasicAuthorization, requestId, MediaType.valueOf(MediaType.APPLICATION_JSON));
if (isEmptyJson(genericL3networkPayload)) {
log.info(LogMessages.NOT_FOUND, "GenericPNF with url ", genericNetworkLink);
@@ -491,18 +509,18 @@ public class RestUtil {
}
private static List<L3networkInstance> retrieveAaiModelDataL3NetworkInServiceLevel(RestClient aaiClient, String baseURL,
- String transactionId, String aaiBasicAuthorization, String relationShipPayload) throws AuditException {
+ String requestId, String aaiBasicAuthorization, String relationShipPayload) throws AuditException {
List<String> genericL3networkLinkLst = extractRelatedLink(relationShipPayload, CATALOG_L3_NETWORK);
- return (queryAaiForL3networkInfo (aaiClient,baseURL,transactionId,aaiBasicAuthorization,genericL3networkLinkLst) ) ;
+ return (queryAaiForL3networkInfo (aaiClient,baseURL,requestId,aaiBasicAuthorization,genericL3networkLinkLst) ) ;
}
/*
* The map is to track the relationship of vnf-id with multiple vnfc relationship
*/
private static Map<String, List<VnfcInstance>> buildVnfcMap(Map<String, List<VnfcInstance>> vnfcMap, String genericVNFPayload, RestClient aaiClient, String baseURL,
- String transactionId, String aaiBasicAuthorization) throws AuditException {
+ String requestId, String aaiBasicAuthorization) throws AuditException {
String vnfcPayload = null;
@@ -513,7 +531,7 @@ public class RestUtil {
List<VnfcInstance> vnfcLst = new ArrayList<>();
for (String vnfcLink : vnfcLinkLst) {
String vnfcURL = baseURL + vnfcLink;
- vnfcPayload = getResource(aaiClient, vnfcURL, aaiBasicAuthorization, transactionId,
+ vnfcPayload = getResource(aaiClient, vnfcURL, aaiBasicAuthorization, requestId,
MediaType.valueOf(MediaType.APPLICATION_JSON));
if (isEmptyJson(vnfcPayload)) {
@@ -538,9 +556,9 @@ public class RestUtil {
* The map is to track the relationship of vnf-id with multiple l3-network relationship at vnf level
*/
private static Map<String, List<L3networkInstance>> buildVnfWithL3networkInfo(Map<String, List<L3networkInstance>> l3networkMap_in_vnf, String genericVNFPayload, RestClient aaiClient, String baseURL,
- String transactionId, String aaiBasicAuthorization) throws AuditException {
+ String requestId, String aaiBasicAuthorization) throws AuditException {
- List<L3networkInstance> l3NwLst = retrieveAaiModelDataL3NetworkInServiceLevel (aaiClient, baseURL, transactionId, aaiBasicAuthorization, genericVNFPayload) ;
+ List<L3networkInstance> l3NwLst = retrieveAaiModelDataL3NetworkInServiceLevel (aaiClient, baseURL, requestId, aaiBasicAuthorization, genericVNFPayload) ;
if ((l3NwLst != null ) && (!l3NwLst.isEmpty())) {
// Assume the vnf-id is unique as a key
@@ -558,7 +576,7 @@ public class RestUtil {
*
* The Map<String, Map<String, List<Vserver>>> key: vnf-id
*/
- private static Map<String, Map<String, List<Vserver>>> buildVfmoduleVserverMap(Map<String, Map<String, List<Vserver>>> vnf_vfmodule_vserver_Map, String genericVNFPayload, RestClient aaiClient, String baseURL, String transactionId, String aaiBasicAuthorization) throws AuditException {
+ private static Map<String, Map<String, List<Vserver>>> buildVfmoduleVserverMap(Map<String, Map<String, List<Vserver>>> vnf_vfmodule_vserver_Map, String genericVNFPayload, RestClient aaiClient, String baseURL, String requestId, String aaiBasicAuthorization) throws AuditException {
Map<String, List<Vserver>> vServerMap = new HashMap<>();
@@ -577,7 +595,7 @@ public class RestUtil {
List<Vserver> vserverLst = new ArrayList<>();
for (String vserverLink : vserverLinkLst) {
String vserverURL = baseURL + vserverLink + DEPTH;
- vserverPayload = getResource(aaiClient, vserverURL, aaiBasicAuthorization, transactionId,
+ vserverPayload = getResource(aaiClient, vserverURL, aaiBasicAuthorization, requestId,
MediaType.valueOf(MediaType.APPLICATION_XML));
if (isEmptyJson(vserverPayload)) {
@@ -587,7 +605,7 @@ public class RestUtil {
Vserver vserver = Vserver.fromJson(vserverPayload);
// add pserver if any
- List<PserverInstance> pserverInstanceLst = getPserverInfoFromAai(vserverPayload, aaiClient, baseURL, transactionId, aaiBasicAuthorization);
+ List<PserverInstance> pserverInstanceLst = getPserverInfoFromAai(vserverPayload, aaiClient, baseURL, requestId, aaiBasicAuthorization);
if ((pserverInstanceLst != null) && (!pserverInstanceLst.isEmpty())) {
vserver.setPserverInstanceList(pserverInstanceLst);
}
@@ -598,7 +616,7 @@ public class RestUtil {
List<LInterfaceInstance> lInterfaceInstList_aai = vserver.getLInterfaceInstanceList().getLInterfaceList();
for (LInterfaceInstance lInterfaceInst_aai : lInterfaceInstList_aai) {
lInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
- transactionId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList()));
+ requestId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList()));
}
}
@@ -618,7 +636,7 @@ public class RestUtil {
return vnf_vfmodule_vserver_Map;
}
- private static List<PserverInstance> getPserverInfoFromAai (String vserverPayload, RestClient aaiClient, String baseURL, String transactionId, String aaiBasicAuthorization) throws AuditException {
+ private static List<PserverInstance> getPserverInfoFromAai (String vserverPayload, RestClient aaiClient, String baseURL, String requestId, String aaiBasicAuthorization) throws AuditException {
if (vserverPayload == null) {
//already reported.
return null;
@@ -634,7 +652,7 @@ public class RestUtil {
pserverLst = new ArrayList<>();
for (String pserverRelatedLink : pserverRelatedLinkList) {
String pserverURL = baseURL + pserverRelatedLink + DEPTH;;
- String pserverPayload = getResource(aaiClient, pserverURL, aaiBasicAuthorization, transactionId,
+ String pserverPayload = getResource(aaiClient, pserverURL, aaiBasicAuthorization, requestId,
MediaType.valueOf(MediaType.APPLICATION_XML));
if (isEmptyJson(pserverPayload)) {
@@ -651,13 +669,13 @@ public class RestUtil {
for (PInterfaceInstance pInterfaceInst_aai : pInterfaceInstList_aai) {
//Obtain P-Interface level logical-link
pInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
- transactionId, aaiBasicAuthorization, pInterfaceInst_aai.getRelationshipList()));
+ requestId, aaiBasicAuthorization, pInterfaceInst_aai.getRelationshipList()));
List<LInterfaceInstance> lInterfaceInstList_aai = pInterfaceInst_aai.getLInterfaceInstanceList().getLInterfaceList();
for (LInterfaceInstance lInterfaceInst_aai : lInterfaceInstList_aai) {
//Obtain L-Interface level logical-link
lInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
- transactionId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList()));
+ requestId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList()));
}
}
@@ -1913,9 +1931,9 @@ public class RestUtil {
return vServerRelatedLinkMap;
}
- private static Map<String, List<String>> buildHeaders(String aaiBasicAuthorization, String transactionId) {
+ private static Map<String, List<String>> buildHeaders(String aaiBasicAuthorization, String requestId) {
MultivaluedHashMap<String, String> headers = new MultivaluedHashMap<>();
- headers.put(TRANSACTION_ID, Collections.singletonList(transactionId));
+ headers.put(TRANSACTION_ID, Collections.singletonList(requestId));
headers.put(FROM_APP_ID, Collections.singletonList(APP_NAME));
headers.put(AUTHORIZATION, Collections.singletonList(aaiBasicAuthorization));
return headers;
@@ -1926,14 +1944,18 @@ public class RestUtil {
throws AuditException {
OperationResult result = client.get(url, buildHeaders(aaiBasicAuthorization, transId), MediaType.valueOf(MediaType.APPLICATION_JSON));
+ MDC.put(MDC_RESPONSE_CODE, String.valueOf(result.getResultCode()));
if (result.getResultCode() == 200) {
+ MDC.put(MDC_STATUS_CODE, "COMPLETE");
return result.getResult();
} else if (result.getResultCode() == 404) {
// Resource not found, generate empty JSON format
+ MDC.put(MDC_STATUS_CODE, "ERROR");
log.info(LogMessages.RESOURCE_NOT_FOUND, url, "return empty Json format");
return new JSONObject().toString();
} else {
+ MDC.put(MDC_STATUS_CODE, "ERROR");
throw new AuditException(AuditError.INTERNAL_SERVER_ERROR + " with " + result.getFailureCause());
}
}
@@ -1950,4 +1972,25 @@ public class RestUtil {
return true;
}
+
+ private static void initMdc(String requestId, String partnerName, String serviceInstanceId, String remoteAddress) {
+ MDC.clear();
+ MDC.put(MDC_REQUEST_ID, requestId);
+ MDC.put(MDC_SERVICE_NAME, APP_NAME);
+ MDC.put(MDC_SERVICE_INSTANCE_ID, serviceInstanceId);
+ MDC.put(MDC_PARTNER_NAME, partnerName);
+ MDC.put(MDC_CLIENT_ADDRESS, remoteAddress);
+ MDC.put(MDC_START_TIME, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").format(new Date()));
+ MDC.put(MDC_INVOCATION_ID, UUID.randomUUID().toString());
+ MDC.put(MDC_INSTANCE_ID, instanceId.toString());
+
+ try {
+ MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getCanonicalHostName());
+ } catch (Exception e) {
+ // If, for some reason we are unable to get the canonical host name,
+ // we
+ // just want to leave the field null.
+ log.info("Could not get canonical host name for " + MDC_SERVER_FQDN + ", leaving field null");
+ }
+ }
}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LInterfaceInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LInterfaceInstanceTest.java
deleted file mode 100644
index 1dde19d..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LInterfaceInstanceTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * ============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.LInterfaceInstance;
-
-public class LInterfaceInstanceTest {
- @Test
- public void testLInterfaceInstanceEquals() {
- LInterfaceInstance lInterfaceInstance1 = new LInterfaceInstance
- ( "interfaceId1", "interfaceName1", "interfaceRole1",
- "isPortMirrored1", "adminStatus1", "networkName1",
- "macAddr1", "inMaint1", null);
-
- LInterfaceInstance lInterfaceInstance2 = new LInterfaceInstance ();
- lInterfaceInstance2.setInterfaceId("interfaceId1");
- lInterfaceInstance2.setInterfaceName("interfaceName1");
- lInterfaceInstance2.setInterfaceRole("interfaceRole1");
- lInterfaceInstance2.setIsPortMirrored("isPortMirrored1");
- lInterfaceInstance2.setAdminStatus("adminStatus1");
- lInterfaceInstance2.setNetworkName("networkName1");
- lInterfaceInstance2.setMacAddr("macAddr1");
- lInterfaceInstance2.setInMaint("inMaint1");
-
- lInterfaceInstance1.toJson();
- lInterfaceInstance1.toString();
- assertEquals("interfaceName1", lInterfaceInstance2.getInterfaceName());
- assertTrue(lInterfaceInstance1.equals(lInterfaceInstance1));
- assertTrue(lInterfaceInstance1.equals(lInterfaceInstance2));
- }
-
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LogicalLinkInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LogicalLinkInstanceTest.java
deleted file mode 100644
index b0c4ea8..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LogicalLinkInstanceTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * ============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.LogicalLinkInstance;
-
-public class LogicalLinkInstanceTest {
- @Test
- public void testLogicalLinkInstanceEquals() {
- LogicalLinkInstance logicalLinkInstance1 = new LogicalLinkInstance
- ( "linkName1", "linkId1", "modelVersionId1",
- "modelInvariantId1", "linkType1", "routingProtocol1",
- "speedValue1", "speedUnits1", "provStatus1",
- "inMaint1", "linkRole1", "ipVersion1",
- "linkName21","circuitId1","purpose1");
-
- LogicalLinkInstance logicalLinkInstance2 = new LogicalLinkInstance ();
- logicalLinkInstance2.setLinkName("linkName1");
- logicalLinkInstance2.setLinkId("linkId1");
- logicalLinkInstance2.setModelVersionId("modelVersionId1");
- logicalLinkInstance2.setModelInvariantId("modelInvariantId1");
- logicalLinkInstance2.setLinkType("linkType1");
- logicalLinkInstance2.setRoutingProtocol("routingProtocol1");
- logicalLinkInstance2.setSpeedValue("speedValue1");
- logicalLinkInstance2.setSpeedUnits("speedUnits1");
- logicalLinkInstance2.setProvStatus("provStatus1");
- logicalLinkInstance2.setInMaint("inMaint1");
- logicalLinkInstance2.setLinkRole("linkRole1");
- logicalLinkInstance2.setIpVersion("ipVersion1");
- logicalLinkInstance2.setLinkName2("linkName21");
- logicalLinkInstance2.setCircuitId("circuitId1");
- logicalLinkInstance2.setPurpose("purpose1");
-
- logicalLinkInstance1.toJson();
- logicalLinkInstance1.toString();
- assertEquals("linkName1", logicalLinkInstance2.getLinkName());
- assertTrue(logicalLinkInstance1.equals(logicalLinkInstance1));
- assertTrue(logicalLinkInstance1.equals(logicalLinkInstance2));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PInterfaceInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PInterfaceInstanceTest.java
deleted file mode 100644
index 33bba56..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PInterfaceInstanceTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * ============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.PInterfaceInstance;
-import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList;
-
-public class PInterfaceInstanceTest {
-
- @Test
- public void testPInterfaceInstanceEquals() {
- PInterfaceInstance pInterfaceInstance1 = new PInterfaceInstance
- ( "interfaceName1", "speedValue1", "speedUnits1",
- "portDescription1", "equipmentIdentifier1", "interfaceRole1", "interfaceType1",
- "provStatus1", "resourceVersion1", "inMaint1", "invStatus1" , new LInterfaceInstanceList(), null);
-
- PInterfaceInstance pInterfaceInstance2 = new PInterfaceInstance ();
- pInterfaceInstance2.setInterfaceName("interfaceName1");
- pInterfaceInstance2.setSpeedValue("speedValue1");
- pInterfaceInstance2.setSpeedUnits("speedUnits1");
- pInterfaceInstance2.setPortDescription("portDescription1");
- pInterfaceInstance2.setEquipmentIdentifier("equipmentIdentifier1");
- pInterfaceInstance2.setInterfaceRole("interfaceRole1");
- pInterfaceInstance2.setInterfaceType("interfaceType1");
- pInterfaceInstance2.setProvStatus("provStatus1");
- pInterfaceInstance2.setResourceVersion("resourceVersion1");
- pInterfaceInstance2.setInMaint("inMaint1");
- pInterfaceInstance2.setInvStatus("invStatus1");
-
- pInterfaceInstance1.toJson();
- pInterfaceInstance1.toString();
- assertEquals("interfaceName1", pInterfaceInstance2.getInterfaceName());
- assertTrue(pInterfaceInstance1.equals(pInterfaceInstance1));
- assertTrue(pInterfaceInstance1.equals(pInterfaceInstance2));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PnfInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PnfInstanceTest.java
deleted file mode 100644
index e7748c5..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PnfInstanceTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * ============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.PnfInstance;
-
-public class PnfInstanceTest {
- @Test
- public void testPnfInstanceEquals() {
- PnfInstance pnfInstance1 = new PnfInstance
- ( "uuid1", "name1", "networkRole1",
- "name21", "name2Source1", "equipmentType1",
- "equipmentVendor1", "equipmentModel1", "managementOptions1",
- "swVersion1", "frameId1", "serialNumber1",
- "modelInvariantId1", "modelVersionId1", null);
-
- PnfInstance pnfInstance2 = new PnfInstance ();
- pnfInstance2.setPnfId("uuid1");
- pnfInstance2.setPnfName("name1");
- pnfInstance2.setNfRole("networkRole1");
- pnfInstance2.setPnfName2("name21");
- pnfInstance2.setPnfName2Source("name2Source1");
- pnfInstance2.setEquipmentType("equipmentType1");
- pnfInstance2.setEquipmentVendor("equipmentVendor1");
- pnfInstance2.setEquipmentModel("equipmentModel1");
- pnfInstance2.setManagementOptions("managementOptions1");
- pnfInstance2.setSwVersion("swVersion1");
- pnfInstance2.setFrameId("frameId1");
- pnfInstance2.setSerialNumber("serialNumber1");
- pnfInstance2.setModelInvariantId("modelInvariantId1");
- pnfInstance2.setModelVersionId("modelVersionId1");
- pnfInstance2.setPInterfaceInstanceList(null);
-
- pnfInstance1.toJson();
- pnfInstance1.toString();
- assertEquals("name1", pnfInstance2.getPnfName());
- assertTrue(pnfInstance1.equals(pnfInstance1));
- assertTrue(pnfInstance1.equals(pnfInstance2));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PserverInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PserverInstanceTest.java
deleted file mode 100644
index 93afb91..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PserverInstanceTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * ============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.PserverInstance;
-
-public class PserverInstanceTest {
- @Test
- public void testPserverInstanceEquals() {
- PserverInstance pserverInstance1 = new PserverInstance
- ( "pserverId1", "hostname1", "pserverName2a",
- "ptniiEquipName1", "equipType1", "equipVendor1",
- "equipModel1", "fqdn1", "internetTopology1",
- "inMaint1", "resourceVersion1", "serialNumber1",
- "purpose1",null);
-
- PserverInstance pserverInstance2 = new PserverInstance ();
- pserverInstance2.setPserverId("pserverId1");
- pserverInstance2.setHostname("hostname1");
- pserverInstance2.setPserverName2("pserverName2a");
- pserverInstance2.setPtniiEquipName("ptniiEquipName1");
- pserverInstance2.setEquipType("equipType1");
- pserverInstance2.setEquipVendor("equipVendor1");
- pserverInstance2.setEquipModel("equipModel1");
- pserverInstance2.setFqdn("fqdn1");
- pserverInstance2.setInternetTopology("internetTopology1");
- pserverInstance2.setInMaint("inMaint1");
- pserverInstance2.setResourceVersion("resourceVersion1");
- pserverInstance2.setSerialNumber("serialNumber1");
- pserverInstance2.setPurpose("purpose1");
- pserverInstance2.setPInterfaceInstanceList(null);
-
- pserverInstance1.toJson();
- pserverInstance1.toString();
- assertEquals("hostname1", pserverInstance2.getHostname());
- assertTrue(pserverInstance1.equals(pserverInstance1));
- assertTrue(pserverInstance1.equals(pserverInstance2));
- }
-}
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
deleted file mode 100644
index 6a3c0ac..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelatedToPropertyTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * ============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
deleted file mode 100644
index 490e3d3..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipDatumTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * ============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
deleted file mode 100644
index f904f25..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipListTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * ============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
deleted file mode 100644
index 786ea13..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * ============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/ServiceInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/ServiceInstanceTest.java
deleted file mode 100644
index 74e5994..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/ServiceInstanceTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * ============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
deleted file mode 100644
index 13d52f9..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/TestSrpingServiceImpl.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * ============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
deleted file mode 100644
index 77da591..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * ============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.L3networkInstance;
-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.getVfModuleName());
- 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() , new ArrayList<L3networkInstance>());
-
- assertEquals("vfModuleId", vfModule.getVfModuleId());
- assertEquals("vfModuleName", vfModule.getVfModuleName());
- 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() , new ArrayList<L3networkInstance>());
- VfModule vfModule2 = new VfModule("vfModuleId2", "vfModuleName2", "heatStackId2", "orchestrationStatus2", true, "resourceVersion2", "modelInvariantId2", "modelVersionId2", "modelCustomizationId2", 1, new RelationshipList() , new ArrayList<L3networkInstance>());
- VfModule vfModule3 = new VfModule("vfModuleId1", "vfModuleName1", "heatStackId1", "orchestrationStatus1", true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", 1, new RelationshipList() , new ArrayList<L3networkInstance>());
-
- 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/VnfInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java
deleted file mode 100644
index b9d9329..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * ============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;
-import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList;
-
-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(), new LInterfaceInstanceList());
-
- 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(), new LInterfaceInstanceList());
- 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(), new LInterfaceInstanceList());
- 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(), new LInterfaceInstanceList());
-
- 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
deleted file mode 100644
index 29c55a9..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfcInstanceTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * ============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/test/RestServiceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/RestServiceTest.java
index c97ea1a..7e1248e 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/RestServiceTest.java
@@ -15,13 +15,18 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
-package org.onap.logging_analytics.pomba.pomba_aai_context_builder.test;
+
+package org.onap.pomba.contextbuilder.aai.test;
+
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+import com.google.gson.Gson;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -29,6 +34,7 @@ import java.text.MessageFormat;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
@@ -37,6 +43,11 @@ import javax.ws.rs.core.Response.Status;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.pomba.common.datatypes.ModelContext;
+import org.onap.pomba.common.datatypes.VFModule;
+import org.onap.pomba.common.datatypes.VM;
+import org.onap.pomba.common.datatypes.VNF;
+import org.onap.pomba.common.datatypes.VNFC;
import org.onap.pomba.contextbuilder.aai.Application;
import org.onap.pomba.contextbuilder.aai.service.rs.RestService;
import org.onap.pomba.contextbuilder.aai.util.RestUtil;
@@ -48,14 +59,6 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
-import org.onap.pomba.common.datatypes.ModelContext;
-import org.onap.pomba.common.datatypes.VFModule;
-import org.onap.pomba.common.datatypes.VM;
-import org.onap.pomba.common.datatypes.VNF;
-import org.onap.pomba.common.datatypes.VNFC;
-import org.json.JSONObject;
-import com.google.gson.Gson;
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
@RunWith(SpringJUnit4ClassRunner.class)
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
@@ -78,6 +81,8 @@ public class RestServiceTest {
HttpHeaders mockHttpHeaders = mock(HttpHeaders.class);
+ HttpServletRequest mockHttpServletRequest = mock(HttpServletRequest.class);
+
private static final String DEPTH = "?depth=2";
@Rule
@@ -101,11 +106,11 @@ public class RestServiceTest {
}
private static MultivaluedMap<String, String> buildHeaders(
- String partnerName, String transactionId, String authorization) {
+ String partnerName, String requestId, String authorization) {
MultivaluedMap<String, String> headers = new MultivaluedHashMap<>();
headers.put(RestUtil.FROM_APP_ID, Collections.singletonList(partnerName));
- headers.put(RestUtil.TRANSACTION_ID, Collections.singletonList(transactionId));
+ headers.put(RestUtil.TRANSACTION_ID, Collections.singletonList(requestId));
if (null != authorization) {
headers.put(RestUtil.AUTHORIZATION, Collections.singletonList(authorization));
}
@@ -118,43 +123,52 @@ public class RestServiceTest {
///Verify the relationship serviceInstanceId -> vnf -> vserver -> pserver
@Test
- public void testGetContext_VSERVER_PSERVER() throws Exception {
+ public void testGetContextVserverPserver() throws Exception {
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
+ String requestId = UUID.randomUUID().toString();
+ String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb";
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
+ requestId, testRestHeaders, httpBasicAuthorization);
// 2. simulate the response of AAI (1 vnf)
// note: match serviceInstanceId in (1)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
+ addResponse(queryNodeUrl, "junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
// note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set2.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39"
+ + DEPTH,
+ "junit/genericVnfInput_set2.json",
+ aaiEnricherRule);
// 4. simulate the rsp of vserer
// note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver.json", aaiEnricherRule);
+ addResponse("/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
+ + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"
+ + DEPTH,
+ "junit/aai-vserver.json",
+ aaiEnricherRule);
// 5. simulate the rsp of pserver
// note: match pserver hostname to the path of "pserver" in (4)
- addResponse(
- "/aai/v13/cloud-infrastructure/pservers/pserver/mtn96compute.cci.att.com" + DEPTH,
- "junit/pserverInput_set2.json", aaiEnricherRule);
+ addResponse("/aai/v13/cloud-infrastructure/pservers/pserver/mtn96compute.cci.att.com"
+ + DEPTH,
+ "junit/pserverInput_set2.json",
+ aaiEnricherRule);
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
+ when(mockHttpServletRequest.getRemoteAddr()).thenReturn("testGetContextVserverPserver");
+
+ Response response = this.dummyRestSvc.getContext(mockHttpHeaders,
+ mockHttpServletRequest,
+ httpBasicAuthorization,
+ testRestHeaders,
+ requestId,
+ serviceInstanceId);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
Gson gson = new Gson();
@@ -171,55 +185,65 @@ public class RestServiceTest {
}
- ///Verify the relationship serviceInstanceId -> vnf (containing L-Interface) -> vserver (containing - LInterfaceList)
+ // Verify the relationship
+ // serviceInstanceId -> vnf (containing L-Interface) -> vserver (containing - LInterfaceList)
@Test
- public void testGetContext_VSERVER_L_interface_And_Logical_link() throws Exception {
+ public void testGetContextVserverLinterfaceAndLogicalLink() throws Exception {
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
+ String requestId = UUID.randomUUID().toString();
+ String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb";
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
+ requestId, testRestHeaders, httpBasicAuthorization);
// 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
+ addResponse(queryNodeUrl, "junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
// note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set6.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39"
+ + DEPTH,
+ "junit/genericVnfInput_set6.json",
+ aaiEnricherRule);
// 4. simulate the rsp of vserer
// note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver-set3.json", aaiEnricherRule);
+ addResponse("/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
+ + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"
+ + DEPTH,
+ "junit/aai-vserver-set3.json",
+ aaiEnricherRule);
// 5. simulate the rsp of logical-link
// note: match to link-name to the path of "relationship-list" in (3: genericVnfInput_set6)
// and match the link-name to (4 aai-vserver-set3.json)
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1",
- "junit/logical-link-input1.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2",
- "junit/logical-link-input2.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-3",
- "junit/logical-link-input3.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-4",
- "junit/logical-link-input4.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1",
+ "junit/logical-link-input1.json",
+ aaiEnricherRule);
+ addResponse("/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2",
+ "junit/logical-link-input2.json",
+ aaiEnricherRule);
+ addResponse("/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-3",
+ "junit/logical-link-input3.json",
+ aaiEnricherRule);
+ addResponse("/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-4",
+ "junit/logical-link-input4.json",
+ aaiEnricherRule);
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
+ when(mockHttpServletRequest.getRemoteAddr()).thenReturn("testGetContextVserverLinterfaceAndLogicalLink");
+
+
+ Response response = this.dummyRestSvc.getContext(mockHttpHeaders,
+ mockHttpServletRequest,
+ httpBasicAuthorization,
+ testRestHeaders,
+ requestId,
+ serviceInstanceId);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
Gson gson = new Gson();
@@ -228,65 +252,81 @@ public class RestServiceTest {
List<VNF> vnfList = modelCtx.getVnfs();
assertEquals(vnfList.size(), 1);
assertEquals(vnfList.get(0).getLInterfaceList().size(), 2);
- assertEquals(vnfList.get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name3"); //l-interface-name
- assertEquals(vnfList.get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name4"); //l-interface-name
+ assertEquals(vnfList.get(0).getLInterfaceList().get(0).getName(),
+ "junit-l-interface-name3"); //l-interface-name
+ assertEquals(vnfList.get(0).getLInterfaceList().get(1).getName(),
+ "junit-l-interface-name4"); //l-interface-name
assertEquals(vnfList.get(0).getLInterfaceList().get(0).getLogicalLinkList().size(), 1);
- assertEquals(vnfList.get(0).getLInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-3"); //Logical-link at vnf->l-interface -> Logical-link
+ assertEquals(vnfList.get(0).getLInterfaceList().get(0).getLogicalLinkList().get(0).getName(),
+ "01e8d84a-logical-link-3"); //Logical-link at vnf->l-interface -> Logical-link
assertEquals(vnfList.get(0).getLInterfaceList().get(1).getLogicalLinkList().size(), 1);
- assertEquals(vnfList.get(0).getLInterfaceList().get(1).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-4");
+ assertEquals(vnfList.get(0).getLInterfaceList().get(1).getLogicalLinkList().get(0).getName(),
+ "01e8d84a-logical-link-4");
List<VFModule> vfModuleList = vnfList.get(0).getVfModules();
assertEquals(vfModuleList.size(), 1);
List<VM> vmList = vfModuleList.get(0).getVms();
assertEquals(vmList.size(), 1);
assertEquals(vmList.get(0).getUuid(), "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"); //vserver-id
assertEquals(vmList.get(0).getLInterfaceList().size(), 2);
- assertEquals(vmList.get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name1"); //l-interface-name
- assertEquals(vmList.get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name2"); //l-interface-name
+ assertEquals(vmList.get(0).getLInterfaceList().get(0).getName(),
+ "junit-l-interface-name1"); //l-interface-name
+ assertEquals(vmList.get(0).getLInterfaceList().get(1).getName(),
+ "junit-l-interface-name2"); //l-interface-name
assertEquals(vmList.get(0).getLInterfaceList().get(0).getLogicalLinkList().size(), 1);
- assertEquals(vmList.get(0).getLInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-1"); //Logical-link at vserver->l-interface -> Logical-link
+ assertEquals(vmList.get(0).getLInterfaceList().get(0).getLogicalLinkList().get(0).getName(),
+ "01e8d84a-logical-link-1"); //Logical-link at vserver->l-interface -> Logical-link
assertEquals(vmList.get(0).getLInterfaceList().get(1).getLogicalLinkList().size(), 1);
- assertEquals(vmList.get(0).getLInterfaceList().get(1).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-2");
+ assertEquals(vmList.get(0).getLInterfaceList().get(1).getLogicalLinkList().get(0).getName(),
+ "01e8d84a-logical-link-2");
}
///Verify the relationship serviceInstanceId -> vnf + vnfc
@Test
- public void testGetContext_VNFC() throws Exception {
+ public void testGetContextVnfc() throws Exception {
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
+ String requestId = UUID.randomUUID().toString();
+ String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb";
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
+ requestId, testRestHeaders, httpBasicAuthorization);
// 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
+ addResponse(queryNodeUrl, "junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
// note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set5.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39"
+ + DEPTH,
+ "junit/genericVnfInput_set5.json",
+ aaiEnricherRule);
// 4. simulate the rsp of vserer
// note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver-set2.json", aaiEnricherRule);
+ addResponse("/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
+ + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"
+ + DEPTH,
+ "junit/aai-vserver-set2.json",
+ aaiEnricherRule);
// 5. simulate the rsp of vnfc
// note: match to vnfc-name to the path of "vnfc" in (3)
- addResponse(
- "/aai/v13/network/vnfcs/vnfc/junit-vnfc-name1212",
- "junit/vnfc-input1.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/vnfcs/vnfc/junit-vnfc-name1212",
+ "junit/vnfc-input1.json",
+ aaiEnricherRule);
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
+ when(mockHttpServletRequest.getRemoteAddr()).thenReturn("testGetContextVnfc");
+
+ Response response = this.dummyRestSvc.getContext(mockHttpHeaders,
+ mockHttpServletRequest,
+ httpBasicAuthorization,
+ testRestHeaders,
+ requestId,
+ serviceInstanceId);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
Gson gson = new Gson();
@@ -307,42 +347,50 @@ public class RestServiceTest {
///Verify the relationship serviceInstanceId -> vnf + vnfc
@Test
- public void testGetContext_VNFC2() throws Exception {
+ public void testGetContextVnfc2() throws Exception {
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
+ String requestId = UUID.randomUUID().toString();
+ String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb";
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
+ requestId, testRestHeaders, httpBasicAuthorization);
// 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
+ addResponse(queryNodeUrl, "junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
// note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set5.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39"
+ + DEPTH,
+ "junit/genericVnfInput_set5.json",
+ aaiEnricherRule);
// 4. simulate the rsp of vserer
// note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver-set2.json", aaiEnricherRule);
+ addResponse("/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
+ + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"
+ + DEPTH,
+ "junit/aai-vserver-set2.json",
+ aaiEnricherRule);
// 5. simulate the rsp of vnfc
// note: match to vnfc-name to the path of "vnfc" in (3)
- addResponse(
- "/aai/v13/network/vnfcs/vnfc/junit-vnfc-name1212",
- "junit/vnfc-input1.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/vnfcs/vnfc/junit-vnfc-name1212",
+ "junit/vnfc-input1.json",
+ aaiEnricherRule);
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
+ when(mockHttpServletRequest.getRemoteAddr()).thenReturn("testGetContextVnfc2");
+
+ Response response = this.dummyRestSvc.getContext(mockHttpHeaders,
+ mockHttpServletRequest,
+ httpBasicAuthorization,
+ testRestHeaders,
+ requestId,
+ serviceInstanceId);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
Gson gson = new Gson();
@@ -363,31 +411,35 @@ public class RestServiceTest {
///Verify the relationship serviceInstanceId -> vnf + vnfc
@Test
- public void testGetContext_LogicalLink_in_service_level() throws Exception {
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
+ public void testGetContextLogicalLinkInServiceLevel() throws Exception {
+ String requestId = UUID.randomUUID().toString();
+ String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb";
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
+ requestId, testRestHeaders, httpBasicAuthorization);
// 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set4.json", aaiEnricherRule);
+ addResponse(queryNodeUrl, "junit/aai-service-instance_set4.json", aaiEnricherRule);
// 3. simulate the rsp of logical-link
// note: match to link-name to the path of "relationship-list" in (2: aai-service-instance_set4)
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1",
- "junit/logical-link-input1.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2",
- "junit/logical-link-input2.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1",
+ "junit/logical-link-input1.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2",
+ "junit/logical-link-input2.json", aaiEnricherRule);
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
+
+ when(mockHttpServletRequest.getRemoteAddr()).thenReturn("testGetContextLogicalLinkInServiceLevel");
+
+ Response response = this.dummyRestSvc.getContext(mockHttpHeaders,
+ mockHttpServletRequest,
+ httpBasicAuthorization,
+ testRestHeaders,
+ requestId,
+ serviceInstanceId);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
Gson gson = new Gson();
@@ -399,40 +451,50 @@ public class RestServiceTest {
///Verify the relationship P-interface, L-interaface, Logical-link
@Test
- public void testGetContext_LogicalLink_in_PInterface_level_with_PNF() throws Exception {
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
+ public void testGetContextLogicalLinkInPInterfaceLevelWithPnf() throws Exception {
+ String requestId = UUID.randomUUID().toString();
+ String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb";
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
+ requestId, testRestHeaders, httpBasicAuthorization);
// 2. simulate the response of AAI (1 vnf and 1 pnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance.json", aaiEnricherRule);
+ addResponse(queryNodeUrl, "junit/aai-service-instance.json", aaiEnricherRule);
// 3. simulate the rsp of VNF
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39"
+ + DEPTH,
+ "junit/genericVnfInput.json",
+ aaiEnricherRule);
// 4. simulate the response of PNF based on the resourceLink in (2)
//note: match pnf_id in junit/aai-service-instance.json
- addResponse( "/aai/v13/network/pnfs/pnf/amdocsPnfName" + DEPTH,
- "junit/pnfInput_w_pInterface_LInterface_set2.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/pnfs/pnf/amdocsPnfName"
+ + DEPTH,
+ "junit/pnfInput_w_pInterface_LInterface_set2.json",
+ aaiEnricherRule);
// 5. simulate the rsp of logical-link
// note: match to link-name to the path of "relationship-list" in (4: pnfInput_w_pInterface_LInterface_set2)
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1",
- "junit/logical-link-input1.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2",
- "junit/logical-link-input2.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1",
+ "junit/logical-link-input1.json",
+ aaiEnricherRule);
+ addResponse("/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2",
+ "junit/logical-link-input2.json",
+ aaiEnricherRule);
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
+
+ when(mockHttpServletRequest.getRemoteAddr()).thenReturn("testGetContextLogicalLinkInPInterfaceLevelWithPnf");
+
+ Response response = this.dummyRestSvc.getContext(mockHttpHeaders,
+ mockHttpServletRequest,
+ httpBasicAuthorization,
+ testRestHeaders,
+ requestId,
+ serviceInstanceId);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
Gson gson = new Gson();
@@ -441,64 +503,81 @@ public class RestServiceTest {
assertEquals(modelCtx.getPnfs().size(), 1);
assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().size(), 1);
assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().size(), 2);
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name5"); //l-interface-name
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name6"); //l-interface-name
+ assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().get(0).getName(),
+ "junit-l-interface-name5"); //l-interface-name
+ assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().get(1).getName(),
+ "junit-l-interface-name6"); //l-interface-name
assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLogicalLinkList().size(), 2);
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-1");
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLogicalLinkList().get(1).getName(), "01e8d84a-logical-link-2");
+ assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLogicalLinkList().get(0).getName(),
+ "01e8d84a-logical-link-1");
+ assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLogicalLinkList().get(1).getName(),
+ "01e8d84a-logical-link-2");
}
///Verify the relationship P-interface, L-interaface, Logical-link
@Test
- public void testGetContext_LogicalLink_in_PInterface_level_with_PSERVER() throws Exception {
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
+ public void testGetContextLogicalLinkInPInterfaceLevelWithPserver() throws Exception {
+ String requestId = UUID.randomUUID().toString();
+ String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb";
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// Test with No Partner Name
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
+ requestId, testRestHeaders, httpBasicAuthorization);
// 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
+ addResponse(queryNodeUrl, "junit/aai-service-instance_set2.json", aaiEnricherRule);
// 3. simulate the rsp of VNF (with 1 vserver)
// note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set2.json", aaiEnricherRule);
+ addResponse("/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39"
+ + DEPTH,
+ "junit/genericVnfInput_set2.json",
+ aaiEnricherRule);
// 4. simulate the rsp of vserer
// note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver.json", aaiEnricherRule);
+ addResponse("/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
+ + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"
+ + DEPTH,
+ "junit/aai-vserver.json",
+ aaiEnricherRule);
// 5. simulate the rsp of pserver with P-interface which also contains L-interface.
// note: match pserver hostname to the path of "pserver" in (4)
- addResponse(
- "/aai/v13/cloud-infrastructure/pservers/pserver/mtn96compute.cci.att.com" + DEPTH,
- "junit/pserverInput_with_pInterface_LInterface_set2.json", aaiEnricherRule);
+ addResponse("/aai/v13/cloud-infrastructure/pservers/pserver/mtn96compute.cci.att.com"
+ + DEPTH,
+ "junit/pserverInput_with_pInterface_LInterface_set2.json",
+ aaiEnricherRule);
// 6. simulate the rsp of logical-link
- // note: match to link-name to the path of "relationship-list" in (5: pserverInput_with_pInterface_LInterface_set2)
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1",
- "junit/logical-link-input1.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2",
- "junit/logical-link-input2.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-3",
- "junit/logical-link-input3.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-4",
- "junit/logical-link-input4.json", aaiEnricherRule);
+ // note: match to link-name to the path of "relationship-list" in
+ // (5: pserverInput_with_pInterface_LInterface_set2)
+ addResponse("/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1",
+ "junit/logical-link-input1.json",
+ aaiEnricherRule);
+ addResponse("/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2",
+ "junit/logical-link-input2.json",
+ aaiEnricherRule);
+ addResponse("/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-3",
+ "junit/logical-link-input3.json",
+ aaiEnricherRule);
+ addResponse("/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-4",
+ "junit/logical-link-input4.json",
+ aaiEnricherRule);
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
+
+ when(mockHttpServletRequest
+ .getRemoteAddr())
+ .thenReturn("testGetContextLogicalLinkInPInterfaceLevelWithPserver");
+
+ Response response = this.dummyRestSvc.getContext(mockHttpHeaders,
+ mockHttpServletRequest,
+ httpBasicAuthorization,
+ testRestHeaders,
+ requestId,
+ serviceInstanceId);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
Gson gson = new Gson();
@@ -511,16 +590,27 @@ public class RestServiceTest {
List<VM> vmList = vfModuleList.get(0).getVms();
assertEquals(vmList.size(), 1);
assertEquals(vmList.get(0).getPServer().getPInterfaceList().size(), 1);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getName(), "bdc3cc2a-c73e-414f-7ddb-367de92801cb"); //interface-name
+ assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getName(),
+ "bdc3cc2a-c73e-414f-7ddb-367de92801cb"); //interface-name
assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().size(), 2);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name7"); //Vserver-> Pserver-> P-interface -> l-interface
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name8");
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0).getLogicalLinkList().size(), 1);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-3"); //Vserver-> Pserver-> P-interface -> l-interface -> logical-link
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1).getLogicalLinkList().size(), 1);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-4");
+ assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0).getName(),
+ "junit-l-interface-name7"); //Vserver-> Pserver-> P-interface -> l-interface
+ assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1).getName(),
+ "junit-l-interface-name8");
+ assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0)
+ .getLogicalLinkList().size(), 1);
+ assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0)
+ .getLogicalLinkList().get(0).getName(),
+ "01e8d84a-logical-link-3"); //Vserver-> Pserver-> P-interface -> l-interface -> logical-link
+ assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1)
+ .getLogicalLinkList().size(), 1);
+ assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1)
+ .getLogicalLinkList().get(0).getName(),
+ "01e8d84a-logical-link-4");
assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLogicalLinkList().size(), 2);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-1"); //Vserver-> Pserver-> P-interface -> Logical-link
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLogicalLinkList().get(1).getName(), "01e8d84a-logical-link-2");
+ assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLogicalLinkList().get(0).getName(),
+ "01e8d84a-logical-link-1"); //Vserver-> Pserver-> P-interface -> Logical-link
+ assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLogicalLinkList().get(1).getName(),
+ "01e8d84a-logical-link-2");
}
}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/RestUtilTest.java
index 8c445c1..bbf4c8f 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/RestUtilTest.java
@@ -15,23 +15,33 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
-package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+package org.onap.pomba.contextbuilder.aai.test;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.MessageFormat;
import java.util.List;
import java.util.UUID;
+import javax.servlet.http.HttpServletRequest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.restclient.client.RestClient;
+import org.onap.pomba.common.datatypes.ModelContext;
+import org.onap.pomba.common.datatypes.Network;
+import org.onap.pomba.common.datatypes.VFModule;
+import org.onap.pomba.common.datatypes.VM;
+import org.onap.pomba.common.datatypes.VNF;
import org.onap.pomba.contextbuilder.aai.Application;
import org.onap.pomba.contextbuilder.aai.exception.AuditException;
import org.onap.pomba.contextbuilder.aai.util.RestUtil;
@@ -43,12 +53,6 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-import org.onap.pomba.common.datatypes.ModelContext;
-import org.onap.pomba.common.datatypes.VNF;
-import org.onap.pomba.common.datatypes.VFModule;
-import org.onap.pomba.common.datatypes.VM;
-import org.onap.pomba.common.datatypes.Network;
@RunWith(SpringJUnit4ClassRunner.class)
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class })
@@ -65,6 +69,10 @@ public class RestUtilTest {
@Autowired
private String aaiBasicAuthorization;
+ HttpServletRequest mockHttpServletRequest = mock(HttpServletRequest.class);
+
+ private String partnerName = "RestUtilTest";
+
private static final String DEPTH = "?depth=2";
@Rule
@@ -116,9 +124,9 @@ public class RestUtilTest {
////
@Test
- public void testretrieveAAIModelDataFromAAI_PNF() throws Exception {
+ public void testretrieveAaiModelDataFromAaiPnf() throws Exception {
- String transactionId = UUID.randomUUID().toString();
+ String requestId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
@@ -136,17 +144,25 @@ public class RestUtilTest {
addResponse( "/aai/v13/network/pnfs/pnf/amdocsPnfName" + DEPTH,
"junit/pnfSampleInput.json", aaiEnricherRule);
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
+ when(mockHttpServletRequest.getRemoteAddr()).thenReturn("testretrieveAaiModelDataFromAaiPnf");
+ ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient,
+ aaiBaseUrl,
+ aaiPathToSearchNodeQuery,
+ mockHttpServletRequest,
+ requestId,
+ partnerName,
+ serviceInstanceId,
+ aaiBasicAuthorization);
assertEquals(modelCtx.getVnfs().size(), 1);
assertEquals(modelCtx.getPnfs().size(), 1);
}
///Verify the relationship serviceInstanceId -> vnf -> vserver
@Test
- public void testretrieveAAIModelDataFromAAI_VSERVER_PSERVER() throws Exception {
+ public void testretrieveAaiModelDataFromAaiVserverPserver() throws Exception {
- String transactionId = UUID.randomUUID().toString();
+ String requestId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
@@ -173,8 +189,16 @@ public class RestUtilTest {
"/aai/v13/cloud-infrastructure/pservers/pserver/mtn96compute.cci.att.com" + DEPTH,
"junit/pserverInput_set2.json", aaiEnricherRule);
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
+ when(mockHttpServletRequest.getRemoteAddr()).thenReturn("testretrieveAaiModelDataFromAaiVserverPserver");
+ ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient,
+ aaiBaseUrl,
+ aaiPathToSearchNodeQuery,
+ mockHttpServletRequest,
+ requestId,
+ partnerName,
+ serviceInstanceId,
+ aaiBasicAuthorization);
// verify results
List<VNF> vnfList = modelCtx.getVnfs();
assertEquals(vnfList.size(), 1);
@@ -188,9 +212,9 @@ public class RestUtilTest {
////
@Test
- public void testretrieveAAIModelDataFromAAI_PInterface_LInterface_with_PNF() throws Exception {
+ public void testretrieveAaiModelDataFromAaiPinterfaceLinterfaceWithPnf() throws Exception {
- String transactionId = UUID.randomUUID().toString();
+ String requestId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// 2. simulate the response of AAI (1 vnf and 1 pnf)
@@ -206,7 +230,18 @@ public class RestUtilTest {
addResponse( "/aai/v13/network/pnfs/pnf/amdocsPnfName" + DEPTH,
"junit/pnfInput_w_pInterface_LInterface.json", aaiEnricherRule);
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
+ when(mockHttpServletRequest
+ .getRemoteAddr())
+ .thenReturn("testretrieveAaiModelDataFromAaiPinterfaceLinterfaceWithPnf");
+
+ ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient,
+ aaiBaseUrl,
+ aaiPathToSearchNodeQuery,
+ mockHttpServletRequest,
+ requestId,
+ partnerName,
+ serviceInstanceId,
+ aaiBasicAuthorization);
assertEquals(modelCtx.getVnfs().size(), 1);
assertEquals(modelCtx.getPnfs().size(), 1);
@@ -217,9 +252,9 @@ public class RestUtilTest {
}
@Test
- public void testretrieveAAIModelDataFromAAI_PInterface_LInterface_with_PSERVER() throws Exception {
+ public void testretrieveAaiModelDataFromAaiPinterfaceLinterfaceWithPserver() throws Exception {
- String transactionId = UUID.randomUUID().toString();
+ String requestId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// 2. simulate the response of AAI (1 vnf)
@@ -244,7 +279,18 @@ public class RestUtilTest {
"/aai/v13/cloud-infrastructure/pservers/pserver/mtn96compute.cci.att.com" + DEPTH,
"junit/pserverInput_with_pInterface_LInterface.json", aaiEnricherRule);
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
+ when(mockHttpServletRequest
+ .getRemoteAddr())
+ .thenReturn("testretrieveAaiModelDataFromAaiPinterfaceLinterfaceWithPserver");
+
+ ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient,
+ aaiBaseUrl,
+ aaiPathToSearchNodeQuery,
+ mockHttpServletRequest,
+ requestId,
+ partnerName,
+ serviceInstanceId,
+ aaiBasicAuthorization);
// verify results
List<VNF> vnfList = modelCtx.getVnfs();
@@ -262,9 +308,9 @@ public class RestUtilTest {
///Verify the relationship serviceInstanceId -> l3network
@Test
- public void testretrieveAAIModelDataFromAAI_L3_network_in_service_level () throws Exception {
+ public void testretrieveAaiModelDataFromAaiL3NetworkInServiceLevel () throws Exception {
- String transactionId = UUID.randomUUID().toString();
+ String requestId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// 2. simulate the response of AAI (1 vnf)
@@ -281,7 +327,18 @@ public class RestUtilTest {
"junit/l3-network-2.json", aaiEnricherRule);
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
+ when(mockHttpServletRequest
+ .getRemoteAddr())
+ .thenReturn("testretrieveAaiModelDataFromAaiL3NetworkInServiceLevel");
+
+ ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient,
+ aaiBaseUrl,
+ aaiPathToSearchNodeQuery,
+ mockHttpServletRequest,
+ requestId,
+ partnerName,
+ serviceInstanceId,
+ aaiBasicAuthorization);
// verify results
List<Network> networkList = modelCtx.getNetworkList();
@@ -292,9 +349,9 @@ public class RestUtilTest {
///Verify the relationship serviceInstanceId -> vnf -> l3network
@Test
- public void testretrieveAAIModelDataFromAAI_L3_network_in_VNF_level() throws Exception {
+ public void testretrieveAaiModelDataFromAaiL3NetworkInVnfLevel() throws Exception {
- String transactionId = UUID.randomUUID().toString();
+ String requestId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// 2. simulate the response of AAI (1 vnf)
@@ -319,7 +376,18 @@ public class RestUtilTest {
"/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-1" + DEPTH,
"junit/l3-network-1.json", aaiEnricherRule);
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
+ when(mockHttpServletRequest
+ .getRemoteAddr())
+ .thenReturn("testretrieveAaiModelDataFromAaiL3NetworkInVnfLevel");
+
+ ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient,
+ aaiBaseUrl,
+ aaiPathToSearchNodeQuery,
+ mockHttpServletRequest,
+ requestId,
+ partnerName,
+ serviceInstanceId,
+ aaiBasicAuthorization);
// verify results
List<VNF> vnfList = modelCtx.getVnfs();
@@ -330,9 +398,9 @@ public class RestUtilTest {
}
@Test
- public void testretrieveAAIModelDataFromAAI_L3_network_in_vModule_level() throws Exception {
+ public void testretrieveAaiModelDataFromAaiL3NetworkInvModuleLevel() throws Exception {
- String transactionId = UUID.randomUUID().toString();
+ String requestId = UUID.randomUUID().toString();
String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
// 2. simulate the response of AAI (1 vnf)
@@ -361,8 +429,18 @@ public class RestUtilTest {
"junit/l3-network-2.json", aaiEnricherRule);
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
+ when(mockHttpServletRequest
+ .getRemoteAddr())
+ .thenReturn("testretrieveAaiModelDataFromAaiL3NetworkInvModuleLevel");
+ ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient,
+ aaiBaseUrl,
+ aaiPathToSearchNodeQuery,
+ mockHttpServletRequest,
+ requestId,
+ partnerName,
+ serviceInstanceId,
+ aaiBasicAuthorization);
// verify results
List<VNF> vnfList = modelCtx.getVnfs();
assertEquals(vnfList.size(), 1);
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/AppTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/AppTest.java
index cb631cc..9e274b2 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/AppTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/AppTest.java
@@ -15,7 +15,8 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
-package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+package org.onap.pomba.contextbuilder.aai.test.datatype;
import junit.framework.Test;
import junit.framework.TestCase;
@@ -24,32 +25,27 @@ import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
+public class AppTest extends TestCase {
/**
* Create the test case
*
* @param testName name of the test case
*/
- public AppTest( String testName )
- {
+ public AppTest( String testName ) {
super( testName );
}
/**
* @return the suite of tests being tested
*/
- public static Test suite()
- {
+ public static Test suite() {
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
+ public void testApp() {
assertTrue( true );
}
}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/GenericResponseTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/GenericResponseTest.java
index ce11d61..d64b2e8 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/GenericResponseTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/GenericResponseTest.java
@@ -14,11 +14,14 @@
* 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;
+
+package org.onap.pomba.contextbuilder.aai.test.datatype;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import org.onap.pomba.contextbuilder.aai.model.GenericResponse;
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JerseyConfigurationTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/JerseyConfigurationTest.java
index a0570c3..dde6f8d 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JerseyConfigurationTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/JerseyConfigurationTest.java
@@ -14,8 +14,10 @@
* 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;
+
+package org.onap.pomba.contextbuilder.aai.test.datatype;
import static org.junit.Assert.assertEquals;
@@ -24,11 +26,11 @@ 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);
- }
+ @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/JsonReaderTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/JsonReaderTest.java
index b827fbc..f4e26ac 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JsonReaderTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/JsonReaderTest.java
@@ -15,9 +15,11 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
-package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+package org.onap.pomba.contextbuilder.aai.test.datatype;
import static org.junit.Assert.fail;
+
import org.junit.Test;
import org.onap.pomba.contextbuilder.aai.exception.AuditException;
import org.onap.pomba.contextbuilder.aai.reader.JsonReader;
@@ -29,7 +31,7 @@ public class JsonReaderTest {
JsonReader reader = new JsonReader();
try {
reader.parse("{test:test}");
- } catch(AuditException e) {
+ } catch (AuditException e) {
fail("This should not throw an exception.");
}
}
@@ -40,7 +42,7 @@ public class JsonReaderTest {
try {
reader.parse("{test}");
fail("This should throw an exception.");
- } catch(AuditException e) {
+ } catch (AuditException e) {
//Just a test, no need to log the exception here.
}
}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/L3networkInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/L3networkInstanceTest.java
index d08d696..8432f87 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/L3networkInstanceTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/L3networkInstanceTest.java
@@ -15,7 +15,8 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
-package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+package org.onap.pomba.contextbuilder.aai.test.datatype;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -24,16 +25,14 @@ import org.junit.Test;
import org.onap.pomba.contextbuilder.aai.datatype.L3networkInstance;
public class L3networkInstanceTest {
- @Test
- public void testL3networkInstanceEquals() {
- L3networkInstance l3networkInstance1 = new L3networkInstance
- ( "networkId1", "networkName1", "networkType1",
- "networkRole1", "networkTechnology1", "resourceVersion1",
- "modelInvariantId1", "modelVersionId1", "physicalNetworkName1", "true",
- null);
+ @Test
+ public void testL3networkInstanceEquals() {
+ L3networkInstance l3networkInstance1 = new L3networkInstance("networkId1", "networkName1", "networkType1",
+ "networkRole1", "networkTechnology1", "resourceVersion1", "modelInvariantId1", "modelVersionId1",
+ "physicalNetworkName1", "true", null);
- L3networkInstance l3networkInstance2 = new L3networkInstance ();
- l3networkInstance2.setNetworkId("networkId1");
+ L3networkInstance l3networkInstance2 = new L3networkInstance();
+ l3networkInstance2.setNetworkId("networkId1");
l3networkInstance2.setNetworkName("networkName1");
l3networkInstance2.setNetworkType("networkType1");
l3networkInstance2.setNetworkRole("networkRole1");
@@ -48,7 +47,7 @@ public class L3networkInstanceTest {
l3networkInstance1.toJson();
l3networkInstance1.toString();
assertEquals("physicalNetworkName1", l3networkInstance2.getPhysicalNetworkName());
- assertTrue(l3networkInstance1.equals(l3networkInstance1));
- assertTrue(l3networkInstance1.equals(l3networkInstance2));
- }
+ assertTrue(l3networkInstance1.equals(l3networkInstance1));
+ assertTrue(l3networkInstance1.equals(l3networkInstance2));
+ }
}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LInterfaceInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LInterfaceInstanceTest.java
new file mode 100644
index 0000000..5ec2420
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LInterfaceInstanceTest.java
@@ -0,0 +1,49 @@
+/*
+ * ============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.pomba.contextbuilder.aai.test.datatype;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstance;
+
+public class LInterfaceInstanceTest {
+ @Test
+ public void testLInterfaceInstanceEquals() {
+ LInterfaceInstance lInterfaceInstance1 = new LInterfaceInstance("interfaceId1", "interfaceName1",
+ "interfaceRole1", "isPortMirrored1", "adminStatus1", "networkName1", "macAddr1", "inMaint1", null);
+
+ LInterfaceInstance lInterfaceInstance2 = new LInterfaceInstance();
+ lInterfaceInstance2.setInterfaceId("interfaceId1");
+ lInterfaceInstance2.setInterfaceName("interfaceName1");
+ lInterfaceInstance2.setInterfaceRole("interfaceRole1");
+ lInterfaceInstance2.setIsPortMirrored("isPortMirrored1");
+ lInterfaceInstance2.setAdminStatus("adminStatus1");
+ lInterfaceInstance2.setNetworkName("networkName1");
+ lInterfaceInstance2.setMacAddr("macAddr1");
+ lInterfaceInstance2.setInMaint("inMaint1");
+
+ lInterfaceInstance1.toJson();
+ lInterfaceInstance1.toString();
+ assertEquals("interfaceName1", lInterfaceInstance2.getInterfaceName());
+ assertTrue(lInterfaceInstance1.equals(lInterfaceInstance1));
+ assertTrue(lInterfaceInstance1.equals(lInterfaceInstance2));
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LogicalLinkInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LogicalLinkInstanceTest.java
new file mode 100644
index 0000000..9ee3c3e
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LogicalLinkInstanceTest.java
@@ -0,0 +1,57 @@
+/*
+ * ============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.pomba.contextbuilder.aai.test.datatype;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.LogicalLinkInstance;
+
+public class LogicalLinkInstanceTest {
+ @Test
+ public void testLogicalLinkInstanceEquals() {
+ LogicalLinkInstance logicalLinkInstance1 = new LogicalLinkInstance("linkName1", "linkId1",
+ "modelVersionId1", "modelInvariantId1", "linkType1", "routingProtocol1", "speedValue1", "speedUnits1",
+ "provStatus1", "inMaint1", "linkRole1", "ipVersion1", "linkName21","circuitId1","purpose1");
+
+ LogicalLinkInstance logicalLinkInstance2 = new LogicalLinkInstance();
+ logicalLinkInstance2.setLinkName("linkName1");
+ logicalLinkInstance2.setLinkId("linkId1");
+ logicalLinkInstance2.setModelVersionId("modelVersionId1");
+ logicalLinkInstance2.setModelInvariantId("modelInvariantId1");
+ logicalLinkInstance2.setLinkType("linkType1");
+ logicalLinkInstance2.setRoutingProtocol("routingProtocol1");
+ logicalLinkInstance2.setSpeedValue("speedValue1");
+ logicalLinkInstance2.setSpeedUnits("speedUnits1");
+ logicalLinkInstance2.setProvStatus("provStatus1");
+ logicalLinkInstance2.setInMaint("inMaint1");
+ logicalLinkInstance2.setLinkRole("linkRole1");
+ logicalLinkInstance2.setIpVersion("ipVersion1");
+ logicalLinkInstance2.setLinkName2("linkName21");
+ logicalLinkInstance2.setCircuitId("circuitId1");
+ logicalLinkInstance2.setPurpose("purpose1");
+
+ logicalLinkInstance1.toJson();
+ logicalLinkInstance1.toString();
+ assertEquals("linkName1", logicalLinkInstance2.getLinkName());
+ assertTrue(logicalLinkInstance1.equals(logicalLinkInstance1));
+ assertTrue(logicalLinkInstance1.equals(logicalLinkInstance2));
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PInterfaceInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PInterfaceInstanceTest.java
new file mode 100644
index 0000000..60c0e92
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PInterfaceInstanceTest.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.pomba.contextbuilder.aai.test.datatype;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList;
+import org.onap.pomba.contextbuilder.aai.datatype.PInterfaceInstance;
+
+public class PInterfaceInstanceTest {
+
+ @Test
+ public void testPInterfaceInstanceEquals() {
+ PInterfaceInstance pInterfaceInstance1 = new PInterfaceInstance("interfaceName1", "speedValue1",
+ "speedUnits1", "portDescription1", "equipmentIdentifier1", "interfaceRole1", "interfaceType1",
+ "provStatus1", "resourceVersion1", "inMaint1", "invStatus1" , new LInterfaceInstanceList(), null);
+
+ PInterfaceInstance pInterfaceInstance2 = new PInterfaceInstance();
+ pInterfaceInstance2.setInterfaceName("interfaceName1");
+ pInterfaceInstance2.setSpeedValue("speedValue1");
+ pInterfaceInstance2.setSpeedUnits("speedUnits1");
+ pInterfaceInstance2.setPortDescription("portDescription1");
+ pInterfaceInstance2.setEquipmentIdentifier("equipmentIdentifier1");
+ pInterfaceInstance2.setInterfaceRole("interfaceRole1");
+ pInterfaceInstance2.setInterfaceType("interfaceType1");
+ pInterfaceInstance2.setProvStatus("provStatus1");
+ pInterfaceInstance2.setResourceVersion("resourceVersion1");
+ pInterfaceInstance2.setInMaint("inMaint1");
+ pInterfaceInstance2.setInvStatus("invStatus1");
+
+ pInterfaceInstance1.toJson();
+ pInterfaceInstance1.toString();
+ assertEquals("interfaceName1", pInterfaceInstance2.getInterfaceName());
+ assertTrue(pInterfaceInstance1.equals(pInterfaceInstance1));
+ assertTrue(pInterfaceInstance1.equals(pInterfaceInstance2));
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PnfInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PnfInstanceTest.java
new file mode 100644
index 0000000..a623912
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PnfInstanceTest.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.pomba.contextbuilder.aai.test.datatype;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.PnfInstance;
+
+public class PnfInstanceTest {
+
+ @Test
+ public void testPnfInstanceEquals() {
+ PnfInstance pnfInstance1 = new PnfInstance("uuid1", "name1", "networkRole1", "name21", "name2Source1",
+ "equipmentType1", "equipmentVendor1", "equipmentModel1", "managementOptions1", "swVersion1",
+ "frameId1", "serialNumber1", "modelInvariantId1", "modelVersionId1", null);
+
+ PnfInstance pnfInstance2 = new PnfInstance();
+ pnfInstance2.setPnfId("uuid1");
+ pnfInstance2.setPnfName("name1");
+ pnfInstance2.setNfRole("networkRole1");
+ pnfInstance2.setPnfName2("name21");
+ pnfInstance2.setPnfName2Source("name2Source1");
+ pnfInstance2.setEquipmentType("equipmentType1");
+ pnfInstance2.setEquipmentVendor("equipmentVendor1");
+ pnfInstance2.setEquipmentModel("equipmentModel1");
+ pnfInstance2.setManagementOptions("managementOptions1");
+ pnfInstance2.setSwVersion("swVersion1");
+ pnfInstance2.setFrameId("frameId1");
+ pnfInstance2.setSerialNumber("serialNumber1");
+ pnfInstance2.setModelInvariantId("modelInvariantId1");
+ pnfInstance2.setModelVersionId("modelVersionId1");
+ pnfInstance2.setPInterfaceInstanceList(null);
+
+ pnfInstance1.toJson();
+ pnfInstance1.toString();
+ assertEquals("name1", pnfInstance2.getPnfName());
+ assertTrue(pnfInstance1.equals(pnfInstance1));
+ assertTrue(pnfInstance1.equals(pnfInstance2));
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PserverInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PserverInstanceTest.java
new file mode 100644
index 0000000..b20cfc2
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PserverInstanceTest.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.pomba.contextbuilder.aai.test.datatype;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.PserverInstance;
+
+public class PserverInstanceTest {
+
+ @Test
+ public void testPserverInstanceEquals() {
+ PserverInstance pserverInstance1 = new PserverInstance("pserverId1", "hostname1", "pserverName2a",
+ "ptniiEquipName1", "equipType1", "equipVendor1", "equipModel1", "fqdn1", "internetTopology1",
+ "inMaint1", "resourceVersion1", "serialNumber1",
+ "purpose1",null);
+
+ PserverInstance pserverInstance2 = new PserverInstance();
+ pserverInstance2.setPserverId("pserverId1");
+ pserverInstance2.setHostname("hostname1");
+ pserverInstance2.setPserverName2("pserverName2a");
+ pserverInstance2.setPtniiEquipName("ptniiEquipName1");
+ pserverInstance2.setEquipType("equipType1");
+ pserverInstance2.setEquipVendor("equipVendor1");
+ pserverInstance2.setEquipModel("equipModel1");
+ pserverInstance2.setFqdn("fqdn1");
+ pserverInstance2.setInternetTopology("internetTopology1");
+ pserverInstance2.setInMaint("inMaint1");
+ pserverInstance2.setResourceVersion("resourceVersion1");
+ pserverInstance2.setSerialNumber("serialNumber1");
+ pserverInstance2.setPurpose("purpose1");
+ pserverInstance2.setPInterfaceInstanceList(null);
+
+ pserverInstance1.toJson();
+ pserverInstance1.toString();
+ assertEquals("hostname1", pserverInstance2.getHostname());
+ assertTrue(pserverInstance1.equals(pserverInstance1));
+ assertTrue(pserverInstance1.equals(pserverInstance2));
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelatedToPropertyTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelatedToPropertyTest.java
new file mode 100644
index 0000000..e64a63a
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelatedToPropertyTest.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.pomba.contextbuilder.aai.test.datatype;
+
+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/pomba/contextbuilder/aai/test/datatype/RelationshipDatumTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipDatumTest.java
new file mode 100644
index 0000000..4fdf979
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipDatumTest.java
@@ -0,0 +1,60 @@
+/*
+ * ============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.pomba.contextbuilder.aai.test.datatype;
+
+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/pomba/contextbuilder/aai/test/datatype/RelationshipListTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipListTest.java
new file mode 100644
index 0000000..59cc0c5
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipListTest.java
@@ -0,0 +1,101 @@
+/*
+ * ============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.pomba.contextbuilder.aai.test.datatype;
+
+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/pomba/contextbuilder/aai/test/datatype/RelationshipTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipTest.java
new file mode 100644
index 0000000..14195d9
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipTest.java
@@ -0,0 +1,89 @@
+/*
+ * ============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.pomba.contextbuilder.aai.test.datatype;
+
+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/pomba/contextbuilder/aai/test/datatype/ServiceInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/ServiceInstanceTest.java
new file mode 100644
index 0000000..f852d76
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/ServiceInstanceTest.java
@@ -0,0 +1,145 @@
+/*
+ * ============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.pomba.contextbuilder.aai.test.datatype;
+
+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/pomba/contextbuilder/aai/test/datatype/VfModuleTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VfModuleTest.java
new file mode 100644
index 0000000..3be2346
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VfModuleTest.java
@@ -0,0 +1,152 @@
+/*
+ * ============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.pomba.contextbuilder.aai.test.datatype;
+
+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.L3networkInstance;
+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.getVfModuleName());
+ 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() ,
+ new ArrayList<L3networkInstance>());
+
+ assertEquals("vfModuleId", vfModule.getVfModuleId());
+ assertEquals("vfModuleName", vfModule.getVfModuleName());
+ 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() ,
+ new ArrayList<L3networkInstance>());
+ VfModule vfModule2 = new VfModule("vfModuleId2",
+ "vfModuleName2",
+ "heatStackId2",
+ "orchestrationStatus2",
+ true,
+ "resourceVersion2",
+ "modelInvariantId2",
+ "modelVersionId2",
+ "modelCustomizationId2",
+ 1,
+ new RelationshipList() ,
+ new ArrayList<L3networkInstance>());
+ VfModule vfModule3 = new VfModule("vfModuleId1",
+ "vfModuleName1",
+ "heatStackId1",
+ "orchestrationStatus1",
+ true,
+ "resourceVersion1",
+ "modelInvariantId1",
+ "modelVersionId1",
+ "modelCustomizationId1",
+ 1,
+ new RelationshipList() ,
+ new ArrayList<L3networkInstance>());
+
+ 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/pomba/contextbuilder/aai/test/datatype/VfModulesTest.java
index 3e1588c..0202359 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModulesTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VfModulesTest.java
@@ -15,7 +15,8 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
-package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+package org.onap.pomba.contextbuilder.aai.test.datatype;
import static org.junit.Assert.assertTrue;
@@ -26,31 +27,31 @@ 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();
+ @Test
+ public void testVfModules() {
+ VfModules vfModules = new VfModules();
- List<VfModule> vfModuleList = new ArrayList<VfModule>();
- vfModuleList.add(new VfModule());
- vfModules.setVfModule(vfModuleList);
+ List<VfModule> vfModuleList = new ArrayList<VfModule>();
+ vfModuleList.add(new VfModule());
+ vfModules.setVfModule(vfModuleList);
- assertTrue(vfModules.getVfModule().get(0) instanceof VfModule);
- }
+ assertTrue(vfModules.getVfModule().get(0) instanceof VfModule);
+ }
- @Test
- public void testVfModulesWithParameters() {
- VfModules vfModules = new VfModules(new ArrayList<VfModule>());
+ @Test
+ public void testVfModulesWithParameters() {
+ VfModules vfModules = new VfModules(new ArrayList<VfModule>());
- String vfModulesString = vfModules.toString();
- assertTrue(vfModulesString.contains("[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>());
+ @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));
- }
+ assertTrue(vfModules1.equals(vfModules1));
+ assertTrue(vfModules1.equals(vfModules2));
+ }
}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfInstanceTest.java
new file mode 100644
index 0000000..7e022f5
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfInstanceTest.java
@@ -0,0 +1,259 @@
+/*
+ * ============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.pomba.contextbuilder.aai.test.datatype;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList;
+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(),
+ new LInterfaceInstanceList());
+
+ 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(),
+ new LInterfaceInstanceList());
+ 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(),
+ new LInterfaceInstanceList());
+ 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(),
+ new LInterfaceInstanceList());
+
+ assertTrue(vnfInstance1.equals(vnfInstance1));
+ assertTrue(!vnfInstance1.equals(vnfInstance2));
+ assertTrue(vnfInstance1.equals(vnfInstance3));
+
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfcInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfcInstanceTest.java
new file mode 100644
index 0000000..d9f6509
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfcInstanceTest.java
@@ -0,0 +1,132 @@
+/*
+ * ============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.pomba.contextbuilder.aai.test.datatype;
+
+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/VserverTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VserverTest.java
index 509db34..34c81bd 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VserverTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VserverTest.java
@@ -15,18 +15,20 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
-package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+package org.onap.pomba.contextbuilder.aai.test.datatype;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
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.LInterfaceInstanceList;
import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
import org.onap.pomba.contextbuilder.aai.datatype.Vserver;
-import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList;
public class VserverTest {
@@ -58,12 +60,23 @@ public class VserverTest {
assertEquals("resourceVersion", aVServer.getResourceVersion());
String vserverToString = aVServer.toString();
- assertTrue(vserverToString.contains("[vserverId=vserverId,vserverName=vserverName,vserverName2=vserverName2,provStatus=provStatus,vserverSelflink=vserverSelflink,inMaint=true,isClosedLoopDisabled=true,resourceVersion=resourceVersion"));
+ assertTrue(vserverToString.contains("[vserverId=vserverId,vserverName=vserverName,vserverName2=vserverName2"
+ + ",provStatus=provStatus,vserverSelflink=vserverSelflink,inMaint=true,"
+ + "isClosedLoopDisabled=true,resourceVersion=resourceVersion"));
}
@Test
public void testVserverWithParameters() {
- Vserver aVServer = new Vserver("vserverId", "vserverName", "vserverName2", "provStatus", "vserverSelflink", true, true, "resourceVersion", new RelationshipList(), new LInterfaceInstanceList());
+ Vserver aVServer = new Vserver("vserverId",
+ "vserverName",
+ "vserverName2",
+ "provStatus",
+ "vserverSelflink",
+ true,
+ true,
+ "resourceVersion",
+ new RelationshipList(),
+ new LInterfaceInstanceList());
assertEquals("vserverId", aVServer.getVserverId());
assertEquals("vserverName", aVServer.getVserverName());
@@ -77,9 +90,36 @@ public class VserverTest {
@Test
public void testVserverEquals() {
- Vserver aVServer1 = new Vserver("vserverId1", "vserverName1", "vserverName2", "provStatus1", "vserverSelflink1", true, true, "resourceVersion1", new RelationshipList(), new LInterfaceInstanceList());
- Vserver aVServer2 = new Vserver("vserverId2", "vserverName2", "vserverName2", "provStatus2", "vserverSelflink2", false, false, "resourceVersion2", new RelationshipList(), new LInterfaceInstanceList());
- Vserver aVServer3 = new Vserver("vserverId1", "vserverName1", "vserverName2", "provStatus1", "vserverSelflink1", true, true, "resourceVersion1", new RelationshipList(), new LInterfaceInstanceList());
+ Vserver aVServer1 = new Vserver("vserverId1",
+ "vserverName1",
+ "vserverName2",
+ "provStatus1",
+ "vserverSelflink1",
+ true,
+ true,
+ "resourceVersion1",
+ new RelationshipList(),
+ new LInterfaceInstanceList());
+ Vserver aVServer2 = new Vserver("vserverId2",
+ "vserverName2",
+ "vserverName2",
+ "provStatus2",
+ "vserverSelflink2",
+ false,
+ false,
+ "resourceVersion2",
+ new RelationshipList(),
+ new LInterfaceInstanceList());
+ Vserver aVServer3 = new Vserver("vserverId1",
+ "vserverName1",
+ "vserverName2",
+ "provStatus1",
+ "vserverSelflink1",
+ true,
+ true,
+ "resourceVersion1",
+ new RelationshipList(),
+ new LInterfaceInstanceList());
assertTrue(aVServer1.equals(aVServer1));
assertFalse(aVServer1.equals(aVServer2));
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/WebConfigurationTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/WebConfigurationTest.java
index a07524d..65c0ede 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/WebConfigurationTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/WebConfigurationTest.java
@@ -15,7 +15,8 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
-package org.onap.logging_analytics.pomba.pomba_aai_context_builder;
+
+package org.onap.pomba.contextbuilder.aai.test.datatype;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
@@ -26,13 +27,13 @@ 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());
- }
+ @Test
+ public void runTest() {
+ WebConfiguration webConfiguration = new WebConfiguration();
+ WebMvcConfigurerAdapter webMvConfigurationAdapter = webConfiguration.forwardToIndex();
+ ViewResolverRegistry registry = mock(ViewResolverRegistry.class);
+ webMvConfigurationAdapter.configureViewResolvers(registry);
+ assertEquals(false, registry.hasRegistrations());
+ }
}