diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/onap/aai/datarouter/entity/POAServiceInstanceEntity.java | 34 | ||||
-rw-r--r-- | src/test/java/org/onap/aai/datarouter/entity/POAServiceInstanceEntityTest.java | 121 |
2 files changed, 2 insertions, 153 deletions
diff --git a/src/main/java/org/onap/aai/datarouter/entity/POAServiceInstanceEntity.java b/src/main/java/org/onap/aai/datarouter/entity/POAServiceInstanceEntity.java index 419db87..810255c 100644 --- a/src/main/java/org/onap/aai/datarouter/entity/POAServiceInstanceEntity.java +++ b/src/main/java/org/onap/aai/datarouter/entity/POAServiceInstanceEntity.java @@ -36,20 +36,16 @@ import org.onap.aai.datarouter.service.AuditService; public class POAServiceInstanceEntity
{
private static final String ATTR_SERVICE_INST_ID = "serviceInstanceId";
- private static final String ATTR_SERVICE_TYPE = "serviceType";
private static final String ATTR_MODEL_VERSION_ID = "modelVersionId";
private static final String ATTR_MODEL_INVARIANT_ID = "modelInvariantId";
- private static final String ATTR_CUSTOMER_ID = "customerId";
private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
private String xFromAppId;
private String xTransactionId;
private String serviceInstanceId;
- private String serviceType;
private String modelVersionId;
private String modelInvariantId;
- private String customerId;
private static Logger logger = LoggerFactory.getInstance().getLogger(POAServiceInstanceEntity.class.getName());
@@ -78,14 +74,6 @@ public class POAServiceInstanceEntity this.serviceInstanceId = serviceInstanceId;
}
- public String getServiceType() {
- return serviceType;
- }
-
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
public String getModelVersionId() {
return modelVersionId;
}
@@ -102,15 +90,6 @@ public class POAServiceInstanceEntity this.modelInvariantId = modelInvariantId;
}
- public String getCustomerId() {
- return customerId;
- }
-
- public void setCustomerId(String customerId) {
- this.customerId = customerId;
- }
-
-
public String toJson() {
return gson.toJson(this);
}
@@ -142,11 +121,6 @@ public class POAServiceInstanceEntity throw new POAAuditException(error, Status.BAD_REQUEST, DataRouterMsgs.BAD_REST_REQUEST, error);
}
- if(serviceType == null || serviceType.isEmpty()) {
- String error = "Missing attribute: " + ATTR_SERVICE_TYPE;
- throw new POAAuditException(error, Status.BAD_REQUEST, DataRouterMsgs.BAD_REST_REQUEST, error);
- }
-
if(modelVersionId == null || modelVersionId.isEmpty()) {
String error = "Missing attribute: " + ATTR_MODEL_VERSION_ID;
throw new POAAuditException(error, Status.BAD_REQUEST, DataRouterMsgs.BAD_REST_REQUEST, error);
@@ -157,17 +131,13 @@ public class POAServiceInstanceEntity throw new POAAuditException(error, Status.BAD_REQUEST, DataRouterMsgs.BAD_REST_REQUEST, error);
}
- if(customerId == null || customerId.isEmpty()) {
- String error = "Missing attribute: " + ATTR_CUSTOMER_ID;
- throw new POAAuditException(error, Status.BAD_REQUEST, DataRouterMsgs.BAD_REST_REQUEST, error);
- }
}
@Override
public String toString() {
return "ServiceInstance [xFromAppId=" + xFromAppId + ", xTransactionId=" + xTransactionId
- + ", serviceInstanceId=" + serviceInstanceId + ", serviceType=" + serviceType + ", modelVersionId="
- + modelVersionId + ", modelInvariantId=" + modelInvariantId + ", customerId=" + customerId + "]";
+ + ", serviceInstanceId=" + serviceInstanceId + ", modelVersionId="
+ + modelVersionId + ", modelInvariantId=" + modelInvariantId + "]";
}
}
diff --git a/src/test/java/org/onap/aai/datarouter/entity/POAServiceInstanceEntityTest.java b/src/test/java/org/onap/aai/datarouter/entity/POAServiceInstanceEntityTest.java index 1f3db97..4f9142c 100644 --- a/src/test/java/org/onap/aai/datarouter/entity/POAServiceInstanceEntityTest.java +++ b/src/test/java/org/onap/aai/datarouter/entity/POAServiceInstanceEntityTest.java @@ -34,8 +34,6 @@ public class POAServiceInstanceEntityTest { String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";
String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";
String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";
- String customerId = "global-customer-01";
- String serviceType = "vFW";
String xFromAppId ="REST-client";
String xTransactionId = "aaa111cccc4444";
@@ -43,8 +41,6 @@ public class POAServiceInstanceEntityTest { svcEntity.setServiceInstanceId(svcInstanceId);
svcEntity.setModelVersionId(modelVersionId);
svcEntity.setModelInvariantId(modelInvariantId);
- svcEntity.setCustomerId(customerId);
- svcEntity.setServiceType(serviceType);
svcEntity.setxFromAppId(xFromAppId);
svcEntity.setxTransactionId(xTransactionId);
@@ -52,8 +48,6 @@ public class POAServiceInstanceEntityTest { Assert.assertEquals(modelVersionId, svcEntity.getModelVersionId());
Assert.assertEquals(modelInvariantId, svcEntity.getModelInvariantId());
- Assert.assertEquals(customerId, svcEntity.getCustomerId());
- Assert.assertEquals(serviceType, svcEntity.getServiceType());
Assert.assertEquals(xFromAppId, svcEntity.getxFromAppId());
Assert.assertEquals(xTransactionId, svcEntity.getxTransactionId());
@@ -63,15 +57,11 @@ public class POAServiceInstanceEntityTest { public void testNullServiceInstanceId() throws POAAuditException {
String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";
String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";
- String customerId = "global-customer-01";
- String serviceType = "vFW";
POAServiceInstanceEntity svcEntity= new POAServiceInstanceEntity();
svcEntity.setServiceInstanceId(null);
svcEntity.setModelVersionId(modelVersionId);
svcEntity.setModelInvariantId(modelInvariantId);
- svcEntity.setCustomerId(customerId);
- svcEntity.setServiceType(serviceType);
try {
svcEntity.validate();
@@ -85,15 +75,11 @@ public class POAServiceInstanceEntityTest { public void testEmptyServiceInstanceId() throws POAAuditException {
String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";
String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";
- String customerId = "global-customer-01";
- String serviceType = "vFW";
POAServiceInstanceEntity svcEntity= new POAServiceInstanceEntity();
svcEntity.setServiceInstanceId("");
svcEntity.setModelVersionId(modelVersionId);
svcEntity.setModelInvariantId(modelInvariantId);
- svcEntity.setCustomerId(customerId);
- svcEntity.setServiceType(serviceType);
try {
svcEntity.validate();
@@ -107,16 +93,11 @@ public class POAServiceInstanceEntityTest { public void testNullModelVersionId() throws POAAuditException {
String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";
String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";
- String customerId = "global-customer-01";
- String serviceType = "vFW";
POAServiceInstanceEntity svcEntity= new POAServiceInstanceEntity();
svcEntity.setServiceInstanceId(svcInstanceId);
svcEntity.setModelVersionId(null);
svcEntity.setModelInvariantId(modelInvariantId);
- svcEntity.setCustomerId(customerId);
- svcEntity.setServiceType(serviceType);
-
try {
svcEntity.validate();
} catch (POAAuditException e) {
@@ -128,15 +109,11 @@ public class POAServiceInstanceEntityTest { public void testEmptyModelVersionId() throws POAAuditException {
String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";
String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";
- String customerId = "global-customer-01";
- String serviceType = "vFW";
POAServiceInstanceEntity svcEntity= new POAServiceInstanceEntity();
svcEntity.setServiceInstanceId(svcInstanceId);
svcEntity.setModelVersionId("");
svcEntity.setModelInvariantId(modelInvariantId);
- svcEntity.setCustomerId(customerId);
- svcEntity.setServiceType(serviceType);
try {
svcEntity.validate();
@@ -150,15 +127,11 @@ public class POAServiceInstanceEntityTest { public void testNullModelInvariantId() throws POAAuditException {
String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";
String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";
- String customerId = "global-customer-01";
- String serviceType = "vFW";
POAServiceInstanceEntity svcEntity= new POAServiceInstanceEntity();
svcEntity.setServiceInstanceId(svcInstanceId);
svcEntity.setModelVersionId(modelVersionId);
svcEntity.setModelInvariantId(null);
- svcEntity.setCustomerId(customerId);
- svcEntity.setServiceType(serviceType);
try {
svcEntity.validate();
@@ -172,105 +145,11 @@ public class POAServiceInstanceEntityTest { public void testEmptyModelInvariantId() throws POAAuditException {
String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";
String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";
- String customerId = "global-customer-01";
- String serviceType = "vFW";
POAServiceInstanceEntity svcEntity= new POAServiceInstanceEntity();
svcEntity.setServiceInstanceId(svcInstanceId);
svcEntity.setModelVersionId(modelVersionId);
svcEntity.setModelInvariantId("");
- svcEntity.setCustomerId(customerId);
- svcEntity.setServiceType(serviceType);
-
- try {
- svcEntity.validate();
- } catch (POAAuditException e) {
- assertEquals(Status.BAD_REQUEST, e.getHttpStatus());
- }
- }
-
- @Test
- public void testNullServiceType() throws POAAuditException {
- String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";
- String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";
- String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";
- String customerId = "global-customer-01";
-
-
- POAServiceInstanceEntity svcEntity= new POAServiceInstanceEntity();
- svcEntity.setServiceInstanceId(svcInstanceId);
- svcEntity.setModelVersionId(modelVersionId);
- svcEntity.setModelInvariantId(modelInvariantId);
- svcEntity.setCustomerId(customerId);
- svcEntity.setServiceType(null);
-
- try {
- svcEntity.validate();
- } catch (POAAuditException e) {
- assertEquals(Status.BAD_REQUEST, e.getHttpStatus());
- }
- }
-
-
- @Test
- public void testEmptyServiceType() throws POAAuditException {
- String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";
- String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";
- String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";
- String customerId = "global-customer-01";
-
-
- POAServiceInstanceEntity svcEntity= new POAServiceInstanceEntity();
- svcEntity.setServiceInstanceId(svcInstanceId);
- svcEntity.setModelVersionId(modelVersionId);
- svcEntity.setModelInvariantId(modelInvariantId);
- svcEntity.setCustomerId(customerId);
- svcEntity.setServiceType("");
-
- try {
- svcEntity.validate();
- } catch (POAAuditException e) {
- assertEquals(Status.BAD_REQUEST, e.getHttpStatus());
- }
- }
-
-
- @Test
- public void testNullCustomerId() throws POAAuditException {
- String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";
- String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";
- String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";
- String serviceType = "vFW";
-
- POAServiceInstanceEntity svcEntity= new POAServiceInstanceEntity();
- svcEntity.setServiceInstanceId(svcInstanceId);
- svcEntity.setModelVersionId(modelVersionId);
- svcEntity.setModelInvariantId(modelInvariantId);
- svcEntity.setCustomerId(null);
- svcEntity.setServiceType(serviceType);
-
- try {
- svcEntity.validate();
- } catch (POAAuditException e) {
- assertEquals(Status.BAD_REQUEST, e.getHttpStatus());
- }
- }
-
-
- @Test
- public void testEmptyCustomerId() throws POAAuditException {
- String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";
- String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";
- String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";
- String serviceType = "vFW";
-
- POAServiceInstanceEntity svcEntity= new POAServiceInstanceEntity();
- svcEntity.setServiceInstanceId(svcInstanceId);
- svcEntity.setModelVersionId(modelVersionId);
- svcEntity.setModelInvariantId(modelInvariantId);
- svcEntity.setCustomerId("");
- svcEntity.setServiceType(serviceType);
-
try {
svcEntity.validate();
} catch (POAAuditException e) {
|