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
351 }catch(Exception e){
\r
352 //TODO: need to catch
\r
357 public void createE2EServiceInstanceTestNullBpmn(){
\r
358 new MockUp<RequestsDatabase>() {
\r
360 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
364 new MockUp<CatalogDatabase>() {
\r
366 public Service getServiceByModelName (String modelName) {
\r
367 Service svc = new Service();
\r
372 new MockUp<CatalogDatabase>() {
\r
374 public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
\r
375 ServiceRecipe rec = new ServiceRecipe();
\r
380 E2EServiceInstances instance = new E2EServiceInstances();
\r
381 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
382 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
383 String respStr = resp.getEntity().toString();
\r
384 assertTrue(respStr.indexOf("SVC1000") != -1);
\r
385 }catch(Exception e){
\r
386 //TODO: need to catch
\r
391 public void createE2EServiceInstanceTestNullReceipe(){
\r
392 new MockUp<RequestsDatabase>() {
\r
394 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
399 E2EServiceInstances instance = new E2EServiceInstances();
\r
400 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
401 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
402 String respStr = resp.getEntity().toString();
\r
403 //assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB null") != -1);
\r
405 }catch(Exception e){
\r
406 //TODO: need to catch
\r
411 public void createE2EServiceInstanceTestNullDBResponse(){
\r
412 new MockUp<RequestsDatabase>() {
\r
414 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
419 E2EServiceInstances instance = new E2EServiceInstances();
\r
420 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
421 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
422 String respStr = resp.getEntity().toString();
\r
423 //assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB ") !=-1);
\r
425 }catch(Exception e){
\r
426 //TODO: need to catch
\r
431 public void createE2EServiceInstanceTestInvalidRequest(){
\r
433 new MockUp<RequestsDatabase>() {
\r
435 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
436 List<InfraActiveRequests> activeReqlist = new ArrayList<>();
\r
437 InfraActiveRequests req = new InfraActiveRequests();
\r
438 req.setAaiServiceId("39493992");
\r
440 activeReqlist.add(req);
\r
441 return activeReqlist;
\r
444 E2EServiceInstances instance = new E2EServiceInstances();
\r
445 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
446 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
447 String respStr = resp.getEntity().toString();
\r
448 assertTrue(respStr.indexOf("SVC1000") != -1);
\r
449 }catch(Exception e){
\r
450 //TODO: need to catch
\r
455 public void createE2EServiceInstanceTestEmptyDBQuery(){
\r
457 new MockUp<RequestsDatabase>() {
\r
459 private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
\r
460 return Collections.EMPTY_LIST;
\r
464 E2EServiceInstances instance = new E2EServiceInstances();
\r
465 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
466 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
467 String respStr = resp.getEntity().toString();
\r
468 //assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB ") != -1);
\r
470 }catch(Exception e){
\r
471 //TODO: need to catch
\r
476 public void createE2EServiceInstanceTestDBQueryFail(){
\r
478 E2EServiceInstances instance = new E2EServiceInstances();
\r
479 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
480 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
481 String respStr = resp.getEntity().toString();
\r
482 assertTrue(respStr.indexOf("SVC1000") != -1);
\r
483 }catch(Exception e){
\r
484 //TODO: need to catch
\r
489 public void createE2EServiceInstanceTestForEmptyRequest(){
\r
491 E2EServiceInstances instance = new E2EServiceInstances();
\r
492 String request = "";
\r
493 Response resp = instance.createE2EServiceInstance(request, "v3");
\r
494 String respStr = resp.getEntity().toString();
\r
495 assertTrue(respStr.indexOf("Mapping of request to JSON object failed. No content to map to Object due to end of input") != -1);
\r
496 }catch(Exception e){
\r
497 //TODO: need to catch
\r
502 public void deleteE2EServiceInstanceTestNormal(){
\r
503 E2EServiceInstances instance = new E2EServiceInstances();
\r
504 String request = "{\"globalSubscriberId\":\"299392392\",\"serviceType\":\"VoLTE\"}";
\r
505 Response resp = instance.deleteE2EServiceInstance(request, "v3", "12345678");
\r
506 String respStr = resp.getEntity().toString();
\r
507 assertTrue(respStr.indexOf("SVC1000") != -1);
\r