2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package org.openecomp.mso.apihandlerinfra;
\r
23 import static org.junit.Assert.assertTrue;
\r
25 import java.io.ByteArrayInputStream;
\r
26 import java.io.InputStream;
\r
27 import java.util.ArrayList;
\r
28 import java.util.Collections;
\r
29 import java.util.List;
\r
31 import javax.ws.rs.core.Response;
\r
33 import org.apache.http.HttpResponse;
\r
34 import org.apache.http.ProtocolVersion;
\r
35 import org.apache.http.entity.BasicHttpEntity;
\r
36 import org.apache.http.message.BasicHttpResponse;
\r
37 import org.hibernate.HibernateException;
\r
38 import org.hibernate.Session;
\r
39 import org.hibernate.criterion.Criterion;
\r
40 import org.hibernate.criterion.Order;
\r
41 import org.hibernate.internal.SessionFactoryImpl;
\r
42 import org.junit.Test;
\r
43 import org.mockito.Mockito;
\r
44 import org.openecomp.mso.apihandler.common.CamundaClient;
\r
45 import org.openecomp.mso.apihandler.common.RequestClient;
\r
46 import org.openecomp.mso.apihandler.common.RequestClientFactory;
\r
47 import org.openecomp.mso.db.catalog.CatalogDatabase;
\r
48 import org.openecomp.mso.db.catalog.beans.Service;
\r
49 import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
\r
50 import org.openecomp.mso.properties.MsoJavaProperties;
\r
51 import org.openecomp.mso.requestsdb.InfraActiveRequests;
\r
52 import org.openecomp.mso.requestsdb.RequestsDatabase;
\r
55 import mockit.MockUp;
\r
57 public class E2EServiceInstancesTest {
\r
61 public void createE2EServiceInstanceTestSuccess(){
\r
62 new MockUp<RequestsDatabase>() {
\r
64 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
68 new MockUp<RequestsDatabase>() {
\r
70 public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
\r
74 new MockUp<CatalogDatabase>() {
\r
76 public Service getServiceByModelName (String modelName) {
\r
77 Service svc = new Service();
\r
82 new MockUp<CatalogDatabase>() {
\r
84 public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
\r
85 ServiceRecipe rec = new ServiceRecipe();
\r
90 new MockUp<RequestClientFactory>() {
\r
92 public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
\r
93 RequestClient client = new CamundaClient();
\r
94 client.setUrl("/test/url");
\r
99 new MockUp<CamundaClient>() {
\r
101 public HttpResponse post(String requestId, boolean isBaseVfModule,
\r
102 int recipeTimeout, String requestAction, String serviceInstanceId,
\r
103 String vnfId, String vfModuleId, String volumeGroupId, String networkId,
\r
104 String serviceType, String vnfType, String vfModuleType, String networkType,
\r
105 String requestDetails){
\r
106 ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
\r
107 HttpResponse resp = new BasicHttpResponse(pv,202, "test response");
\r
108 BasicHttpEntity entity = new BasicHttpEntity();
\r
109 String body = "{\"response\":\"success\",\"message\":\"success\"}";
\r
110 InputStream instream = new ByteArrayInputStream(body.getBytes());
\r
111 entity.setContent(instream);
\r
112 resp.setEntity(entity);
\r
117 E2EServiceInstances instance = new E2EServiceInstances();
\r
118 String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
\r
119 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
120 String respStr = resp.getEntity().toString();
\r
121 assertTrue(respStr.indexOf("success") != -1);
\r
125 public void createE2EServiceInstanceTestBpelHTTPException(){
\r
126 new MockUp<RequestsDatabase>() {
\r
128 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
132 new MockUp<RequestsDatabase>() {
\r
134 public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
\r
138 new MockUp<CatalogDatabase>() {
\r
140 public Service getServiceByModelName (String modelName) {
\r
141 Service svc = new Service();
\r
146 new MockUp<CatalogDatabase>() {
\r
148 public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
\r
149 ServiceRecipe rec = new ServiceRecipe();
\r
154 new MockUp<RequestClientFactory>() {
\r
156 public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
\r
157 RequestClient client = new CamundaClient();
\r
158 client.setUrl("/test/url");
\r
163 new MockUp<CamundaClient>() {
\r
165 public HttpResponse post(String requestId, boolean isBaseVfModule,
\r
166 int recipeTimeout, String requestAction, String serviceInstanceId,
\r
167 String vnfId, String vfModuleId, String volumeGroupId, String networkId,
\r
168 String serviceType, String vnfType, String vfModuleType, String networkType,
\r
169 String requestDetails){
\r
170 ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
\r
171 HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
\r
172 BasicHttpEntity entity = new BasicHttpEntity();
\r
173 String body = "{\"response\":\"success\",\"message\":\"success\"}";
\r
174 InputStream instream = new ByteArrayInputStream(body.getBytes());
\r
175 entity.setContent(instream);
\r
176 resp.setEntity(entity);
\r
181 E2EServiceInstances instance = new E2EServiceInstances();
\r
182 String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
\r
183 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
184 String respStr = resp.getEntity().toString();
\r
185 assertTrue(respStr.indexOf("SVC2000") != -1);
\r
189 public void createE2EServiceInstanceTestBpelHTTPExceptionWithNullREsponseBody(){
\r
190 new MockUp<RequestsDatabase>() {
\r
192 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
196 new MockUp<RequestsDatabase>() {
\r
198 public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
\r
202 new MockUp<CatalogDatabase>() {
\r
204 public Service getServiceByModelName (String modelName) {
\r
205 Service svc = new Service();
\r
210 new MockUp<CatalogDatabase>() {
\r
212 public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
\r
213 ServiceRecipe rec = new ServiceRecipe();
\r
218 new MockUp<RequestClientFactory>() {
\r
220 public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
\r
221 RequestClient client = new CamundaClient();
\r
222 client.setUrl("/test/url");
\r
227 new MockUp<CamundaClient>() {
\r
229 public HttpResponse post(String requestId, boolean isBaseVfModule,
\r
230 int recipeTimeout, String requestAction, String serviceInstanceId,
\r
231 String vnfId, String vfModuleId, String volumeGroupId, String networkId,
\r
232 String serviceType, String vnfType, String vfModuleType, String networkType,
\r
233 String requestDetails){
\r
234 ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
\r
235 HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
\r
236 BasicHttpEntity entity = new BasicHttpEntity();
\r
237 String body = "{\"response\":\"\",\"message\":\"success\"}";
\r
238 InputStream instream = new ByteArrayInputStream(body.getBytes());
\r
239 entity.setContent(instream);
\r
240 resp.setEntity(entity);
\r
245 E2EServiceInstances instance = new E2EServiceInstances();
\r
246 String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
\r
247 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
248 String respStr = resp.getEntity().toString();
\r
249 assertTrue(respStr.indexOf("SVC2000") != -1);
\r
253 public void createE2EServiceInstanceTestNullBPELResponse(){
\r
254 new MockUp<RequestsDatabase>() {
\r
256 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
260 new MockUp<CatalogDatabase>() {
\r
262 public Service getServiceByModelName (String modelName) {
\r
263 Service svc = new Service();
\r
268 new MockUp<CatalogDatabase>() {
\r
270 public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
\r
271 ServiceRecipe rec = new ServiceRecipe();
\r
276 new MockUp<RequestClientFactory>() {
\r
278 public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
\r
279 RequestClient client = new CamundaClient();
\r
280 client.setUrl("/test/url");
\r
285 new MockUp<CamundaClient>() {
\r
287 public HttpResponse post(String requestId, boolean isBaseVfModule,
\r
288 int recipeTimeout, String requestAction, String serviceInstanceId,
\r
289 String vnfId, String vfModuleId, String volumeGroupId, String networkId,
\r
290 String serviceType, String vnfType, String vfModuleType, String networkType,
\r
291 String requestDetails){
\r
292 HttpResponse resp = null;
\r
297 E2EServiceInstances instance = new E2EServiceInstances();
\r
298 String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
\r
299 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
300 String respStr = resp.getEntity().toString();
\r
301 assertTrue(respStr.indexOf("SVC1000") != -1);
\r
305 public void createE2EServiceInstanceTestBPMNNullREsponse(){
\r
306 new MockUp<RequestsDatabase>() {
\r
308 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
312 new MockUp<CatalogDatabase>() {
\r
314 public Service getServiceByModelName (String modelName) {
\r
315 Service svc = new Service();
\r
320 new MockUp<CatalogDatabase>() {
\r
322 public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
\r
323 ServiceRecipe rec = new ServiceRecipe();
\r
328 new MockUp<RequestClientFactory>() {
\r
330 public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
\r
331 RequestClient client = new CamundaClient();
\r
332 client.setUrl("/test/url");
\r
337 new MockUp<CamundaClient>() {
\r
339 public HttpResponse post(String camundaReqXML, String requestId,
\r
340 String requestTimeout, String schemaVersion, String serviceInstanceId, String action){
\r
341 HttpResponse resp = null;
\r
346 E2EServiceInstances instance = new E2EServiceInstances();
\r
347 String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
\r
348 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
349 String respStr = resp.getEntity().toString();
\r
350 assertTrue(respStr.indexOf("SVC1000") != -1);
\r
354 public void createE2EServiceInstanceTestNullBpmn(){
\r
355 new MockUp<RequestsDatabase>() {
\r
357 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
361 new MockUp<CatalogDatabase>() {
\r
363 public Service getServiceByModelName (String modelName) {
\r
364 Service svc = new Service();
\r
369 new MockUp<CatalogDatabase>() {
\r
371 public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
\r
372 ServiceRecipe rec = new ServiceRecipe();
\r
376 E2EServiceInstances instance = new E2EServiceInstances();
\r
377 String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
\r
378 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
379 String respStr = resp.getEntity().toString();
\r
380 assertTrue(respStr.indexOf("SVC1000") != -1);
\r
384 public void createE2EServiceInstanceTestNullReceipe(){
\r
385 new MockUp<RequestsDatabase>() {
\r
387 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
391 E2EServiceInstances instance = new E2EServiceInstances();
\r
392 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\"}]}}}}";
\r
393 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
394 String respStr = resp.getEntity().toString();
\r
395 //assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB null") != -1);
\r
400 public void createE2EServiceInstanceTestNullDBResponse(){
\r
401 new MockUp<RequestsDatabase>() {
\r
403 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
407 E2EServiceInstances instance = new E2EServiceInstances();
\r
408 String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
\r
409 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
410 String respStr = resp.getEntity().toString();
\r
411 //assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB ") !=-1);
\r
416 public void createE2EServiceInstanceTestInvalidRequest(){
\r
417 new MockUp<RequestsDatabase>() {
\r
419 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
420 List<InfraActiveRequests> activeReqlist = new ArrayList<>();
\r
421 InfraActiveRequests req = new InfraActiveRequests();
\r
422 req.setAaiServiceId("39493992");
\r
424 activeReqlist.add(req);
\r
425 return activeReqlist;
\r
428 E2EServiceInstances instance = new E2EServiceInstances();
\r
429 String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
\r
430 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
431 String respStr = resp.getEntity().toString();
\r
432 assertTrue(respStr.indexOf("SVC1000") != -1);
\r
436 public void createE2EServiceInstanceTestEmptyDBQuery(){
\r
437 new MockUp<RequestsDatabase>() {
\r
439 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
440 return Collections.EMPTY_LIST;
\r
443 E2EServiceInstances instance = new E2EServiceInstances();
\r
444 String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
\r
445 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
446 String respStr = resp.getEntity().toString();
\r
447 //assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB ") != -1);
\r
452 public void createE2EServiceInstanceTestDBQueryFail(){
\r
453 E2EServiceInstances instance = new E2EServiceInstances();
\r
454 String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
\r
455 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
456 String respStr = resp.getEntity().toString();
\r
457 assertTrue(respStr.indexOf("SVC1000") != -1);
\r
461 public void createE2EServiceInstanceTestForEmptyRequest(){
\r
462 E2EServiceInstances instance = new E2EServiceInstances();
\r
463 String request = "";
\r
464 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
465 String respStr = resp.getEntity().toString();
\r
466 assertTrue(respStr.indexOf("Mapping of request to JSON object failed. No content to map to Object due to end of input") != -1);
\r
470 public void deleteE2EServiceInstanceTestNormal(){
\r
471 E2EServiceInstances instance = new E2EServiceInstances();
\r
472 String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
\r
473 Response resp = instance.deleteE2EServiceInstance(request, "v3", "12345678");
\r
474 String respStr = resp.getEntity().toString();
\r
475 assertTrue(respStr.indexOf("SVC1000") != -1);
\r