From 727fe0c762947874d21128f21db71b33f75407c3 Mon Sep 17 00:00:00 2001 From: Seshu-Kumar-M Date: Tue, 26 Sep 2017 13:43:21 +0530 Subject: Add test cases for E2E service IssueId : SO-50 Change-Id: Idbace244134aea60eab0cbce553355d6e2a69f25 Signed-off-by: Seshu-Kumar-M --- .../apihandlerinfra/E2EServiceInstancesTest.java | 105 +++++++++++---------- 1 file changed, 53 insertions(+), 52 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-infra') diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java index 325d2f8bdd..ae6ffd3470 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java @@ -110,12 +110,13 @@ public class E2EServiceInstancesTest { } }; - /*E2EServiceInstances instance = new E2EServiceInstances(); - String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}"; - Response resp = instance.createE2EServiceInstance(request, "v2"); - assertTrue(resp.getStatus() == 202);*/ + E2EServiceInstances instance = new E2EServiceInstances(); + System.out.println(instance); + String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}"; + Response resp = instance.createE2EServiceInstance(request, "v3"); + assertTrue(resp.getStatus() == 202); } - + @Test public void createE2EServiceInstanceTestBpelHTTPException(){ new MockUp() { @@ -173,11 +174,11 @@ public class E2EServiceInstancesTest { } }; - /*E2EServiceInstances instance = new E2EServiceInstances(); - String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}"; - Response resp = instance.createE2EServiceInstance(request, "v2"); + E2EServiceInstances instance = new E2EServiceInstances(); + String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}"; + Response resp = instance.createE2EServiceInstance(request, "v3"); String respStr = resp.getEntity().toString(); - assertTrue(respStr.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);*/ + assertTrue(respStr.indexOf("Request Failed due to BPEL error with HTTP Status") != -1); } @Test @@ -237,11 +238,11 @@ public class E2EServiceInstancesTest { } }; - /*E2EServiceInstances instance = new E2EServiceInstances(); - String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}"; - Response resp = instance.createE2EServiceInstance(request, "v2"); + E2EServiceInstances instance = new E2EServiceInstances(); + String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}"; + Response resp = instance.createE2EServiceInstance(request, "v3"); String respStr = resp.getEntity().toString(); - assertTrue(respStr.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);*/ + assertTrue(respStr.indexOf("Request Failed due to BPEL error with HTTP Status") != -1); } @Test @@ -289,11 +290,11 @@ public class E2EServiceInstancesTest { } }; - /*E2EServiceInstances instance = new E2EServiceInstances(); - String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}"; - Response resp = instance.createE2EServiceInstance(request, "v2"); + E2EServiceInstances instance = new E2EServiceInstances(); + String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}"; + Response resp = instance.createE2EServiceInstance(request, "v3"); String respStr = resp.getEntity().toString(); - assertTrue(respStr.indexOf("bpelResponse is null") != -1);*/ + assertTrue(respStr.indexOf("bpelResponse is null") != -1); } @Test @@ -338,11 +339,11 @@ public class E2EServiceInstancesTest { } }; - /* E2EServiceInstances instance = new E2EServiceInstances(); - String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}"; - Response resp = instance.createE2EServiceInstance(request, "v2"); + E2EServiceInstances instance = new E2EServiceInstances(); + String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}"; + Response resp = instance.createE2EServiceInstance(request, "v3"); String respStr = resp.getEntity().toString(); - assertTrue(respStr.indexOf("Failed calling bpmn null") != -1);*/ + assertTrue(respStr.indexOf("Failed calling bpmn null") != -1); } @Test @@ -368,11 +369,11 @@ public class E2EServiceInstancesTest { return rec; } }; - /*E2EServiceInstances instance = new E2EServiceInstances(); - String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}"; - Response resp = instance.createE2EServiceInstance(request, "v2"); + E2EServiceInstances instance = new E2EServiceInstances(); + String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}"; + Response resp = instance.createE2EServiceInstance(request, "v3"); String respStr = resp.getEntity().toString(); - assertTrue(respStr.indexOf("Failed calling bpmn properties is null") != -1);*/ + assertTrue(respStr.indexOf("Failed calling bpmn properties is null") != -1); } @Test @@ -383,11 +384,11 @@ public class E2EServiceInstancesTest { return null; } }; - /*E2EServiceInstances instance = new E2EServiceInstances(); - String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}"; - Response resp = instance.createE2EServiceInstance(request, "v2"); + E2EServiceInstances instance = new E2EServiceInstances(); + String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}"; + Response resp = instance.createE2EServiceInstance(request, "v3"); String respStr = resp.getEntity().toString(); - assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB null") != -1);*/ + assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB null") != -1); } @Test @@ -398,11 +399,11 @@ public class E2EServiceInstancesTest { return null; } }; - /*E2EServiceInstances instance = new E2EServiceInstances(); - String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}"; - Response resp = instance.createE2EServiceInstance(request, "v2"); + E2EServiceInstances instance = new E2EServiceInstances(); + String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}"; + Response resp = instance.createE2EServiceInstance(request, "v3"); String respStr = resp.getEntity().toString(); - assertTrue(respStr.indexOf("Recipe does not exist in catalog DB") != -1);*/ + assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB ") != -1); } @Test @@ -418,11 +419,11 @@ public class E2EServiceInstancesTest { return activeReqlist; } }; - /* E2EServiceInstances instance = new E2EServiceInstances(); - String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}"; - Response resp = instance.createE2EServiceInstance(request, "v2"); + E2EServiceInstances instance = new E2EServiceInstances(); + String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}"; + Response resp = instance.createE2EServiceInstance(request, "v3"); String respStr = resp.getEntity().toString(); - assertTrue(respStr.indexOf("The existing request must finish or be cleaned up before proceeding.") != -1);*/ + assertTrue(respStr.indexOf("The existing request must finish or be cleaned up before proceeding.") != -1); } @Test @@ -433,37 +434,37 @@ public class E2EServiceInstancesTest { return Collections.EMPTY_LIST; } }; - /* E2EServiceInstances instance = new E2EServiceInstances(); - String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}"; - Response resp = instance.createE2EServiceInstance(request, "v2"); + E2EServiceInstances instance = new E2EServiceInstances(); + String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}"; + Response resp = instance.createE2EServiceInstance(request, "v3"); String respStr = resp.getEntity().toString(); - assertTrue(respStr.indexOf("Recipe does not exist in catalog DB") != -1);*/ + assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB ") != -1); } @Test public void createE2EServiceInstanceTestDBQueryFail(){ - /* E2EServiceInstances instance = new E2EServiceInstances(); - String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}"; - Response resp = instance.createE2EServiceInstance(request, "v2"); + E2EServiceInstances instance = new E2EServiceInstances(); + String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}"; + Response resp = instance.createE2EServiceInstance(request, "v3"); String respStr = resp.getEntity().toString(); - assertTrue(respStr.indexOf("SVC2000") != -1);*/ + assertTrue(respStr.indexOf("SVC2000") != -1); } @Test public void createE2EServiceInstanceTestForEmptyRequest(){ - /*E2EServiceInstances instance = new E2EServiceInstances(); + E2EServiceInstances instance = new E2EServiceInstances(); String request = ""; - Response resp = instance.createE2EServiceInstance(request, "v2"); + Response resp = instance.createE2EServiceInstance(request, "v3"); String respStr = resp.getEntity().toString(); - assertTrue(respStr.indexOf("Mapping of request to JSON object failed. No content to map to Object due to end of input") != -1);*/ + assertTrue(respStr.indexOf("Mapping of request to JSON object failed. No content to map to Object due to end of input") != -1); } @Test public void deleteE2EServiceInstanceTestNormal(){ - /* E2EServiceInstances instance = new E2EServiceInstances(); - String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}"; - Response resp = instance.deleteE2EServiceInstance(request, "v2"); + E2EServiceInstances instance = new E2EServiceInstances(); + String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}"; + Response resp = instance.deleteE2EServiceInstance(request, "v3", "12345678"); String respStr = resp.getEntity().toString(); - assertTrue(respStr.indexOf("SVC2000") != -1);*/ + assertTrue(respStr.indexOf("SVC2000") != -1); } } -- cgit 1.2.3-korg