Aharoni, Pavel (pa0916) | ca3cb01 | 2018-10-22 15:29:57 +0300 | [diff] [blame] | 1 | /*-
|
| 2 | * ============LICENSE_START=======================================================
|
| 3 | * OSAM
|
| 4 | * ================================================================================
|
| 5 | * Copyright (C) 2018 AT&T
|
| 6 | * ================================================================================
|
| 7 | * Licensed under the Apache License, Version 2.0 (the "License");
|
| 8 | * you may not use this file except in compliance with the License.
|
| 9 | * You may obtain a copy of the License at
|
| 10 | *
|
| 11 | * http://www.apache.org/licenses/LICENSE-2.0
|
| 12 | *
|
| 13 | * Unless required by applicable law or agreed to in writing, software
|
| 14 | * distributed under the License is distributed on an "AS IS" BASIS,
|
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 16 | * See the License for the specific language governing permissions and
|
| 17 | * limitations under the License.
|
| 18 | * ============LICENSE_END=========================================================
|
| 19 | */
|
| 20 |
|
| 21 |
|
| 22 | package org.onap.osam.mso.rest;
|
| 23 |
|
| 24 | import com.xebialabs.restito.server.StubServer;
|
| 25 | import org.glassfish.grizzly.http.util.HttpStatus;
|
| 26 | import org.junit.AfterClass;
|
| 27 | import org.junit.BeforeClass;
|
| 28 | import org.junit.Test;
|
| 29 | import org.onap.portalsdk.core.util.SystemProperties;
|
| 30 | import org.onap.osam.client.SyncRestClient;
|
| 31 | import org.onap.osam.controllers.MsoController;
|
| 32 | import org.onap.osam.mso.MsoInterface;
|
| 33 | import org.onap.osam.mso.MsoProperties;
|
| 34 | import org.onap.osam.mso.MsoResponseWrapper;
|
| 35 | import org.onap.osam.mso.MsoResponseWrapperInterface;
|
| 36 | import org.onap.osam.mso.RestObject;
|
| 37 | import org.springframework.test.context.ContextConfiguration;
|
| 38 |
|
| 39 | import java.io.IOException;
|
| 40 | import java.io.InputStream;
|
| 41 | import java.nio.file.Files;
|
| 42 | import java.nio.file.Path;
|
| 43 | import java.nio.file.Paths;
|
| 44 | import java.util.Properties;
|
| 45 | import java.util.UUID;
|
| 46 |
|
| 47 | import static org.onap.osam.controllers.MsoController.SVC_INSTANCE_ID;
|
| 48 | import static org.onap.osam.controllers.MsoController.VNF_INSTANCE_ID;
|
| 49 |
|
| 50 | @ContextConfiguration(classes = {SystemProperties.class})
|
| 51 | public class MsoRestClientNewTest {
|
| 52 |
|
| 53 | private static StubServer server;
|
| 54 | private static StubServer securedServer;
|
| 55 | private static Properties props = new Properties();
|
| 56 | private static String msoCreateServiceInstanceJson;
|
| 57 | private static String msoScaleOutVfModule;
|
| 58 | private final static String CREATE_INSTANCE_RESPONSE_STR =
|
| 59 | "{\"requestReferences\":{\"instanceId\":\"baa13544-0e95-4644-9565-9a198a29a294\","
|
| 60 | + "\"requestId\":\"a42a1a35-3d63-4629-bbe0-4989fa7414cb\"}}";
|
| 61 | private final static String SERVICE_INSTANCE_ID = "12345";
|
| 62 | private static final String SAMPLE_VNF_INSTANCE_ID = "111";
|
| 63 | private static final String SAMPLE_VNF_MODULE_ID = "987";
|
| 64 | private static final String SAMPLE_NETWORK_INSTANCE_ID = "666";
|
| 65 | private static final String SAMPLE_CONFIGURATION_ID = "997";
|
| 66 | private static final String SAMPLE_REQUEST_ID = "7777";
|
| 67 |
|
| 68 |
|
| 69 | @BeforeClass
|
| 70 | public static void start() throws IOException {
|
| 71 | server = new StubServer().run();
|
| 72 | securedServer = new StubServer().secured().run();
|
| 73 |
|
| 74 | Path resourceDirectory =
|
| 75 | Paths.get("src", "test", "resources", "WEB-INF", "conf", "system.properties");
|
| 76 | try (InputStream is = Files.newInputStream(resourceDirectory)) {
|
| 77 | props.load(is);
|
| 78 | }
|
| 79 |
|
| 80 | Path msoServiceInstantiationJsonFilePath =
|
| 81 | Paths.get("src", "test", "resources", "payload_jsons", "mso_service_instantiation.json");
|
| 82 |
|
| 83 | Path scaleOutJsonFilePath = Paths.get("src", "test", "resources", "payload_jsons", "scaleOutVfModulePayloadToMso.json");
|
| 84 | msoCreateServiceInstanceJson =
|
| 85 | String.join("\n", Files.readAllLines(msoServiceInstantiationJsonFilePath));
|
| 86 | msoScaleOutVfModule = String.join("\n", Files.readAllLines(scaleOutJsonFilePath));
|
| 87 |
|
| 88 | }
|
| 89 |
|
| 90 | @AfterClass
|
| 91 | public static void stop() {
|
| 92 | server.stop();
|
| 93 | securedServer.stop();
|
| 94 | }
|
| 95 |
|
| 96 |
|
| 97 | private String baseUrl() {
|
| 98 | return String.format("http://localhost:%d", server.getPort());
|
| 99 | }
|
| 100 |
|
| 101 | @Test
|
| 102 | public void testCreateSvcInstance() throws Exception {
|
| 103 | String endpoint = props.getProperty(MsoProperties.MSO_REST_API_CONFIGURATIONS);
|
| 104 | endpoint = endpoint.replace(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
|
| 105 | try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 106 | server,
|
| 107 | endpoint,
|
| 108 | HttpStatus.ACCEPTED_202,
|
| 109 | CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) {
|
| 110 | closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::createSvcInstance);
|
| 111 | }
|
| 112 | }
|
| 113 |
|
| 114 | @Test
|
| 115 | public void testCreateVnf() throws Exception {
|
| 116 | String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VNF_INSTANCE);
|
| 117 | endpoint = endpoint.replace(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
|
| 118 | try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 119 | server,
|
| 120 | endpoint,
|
| 121 | HttpStatus.ACCEPTED_202,
|
| 122 | CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) {
|
| 123 |
|
| 124 | closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::createVnf);
|
| 125 | }
|
| 126 | }
|
| 127 |
|
| 128 | @Test
|
| 129 | public void testCreateNwInstance() throws Exception {
|
| 130 | String endpoint = props.getProperty(MsoProperties.MSO_REST_API_NETWORK_INSTANCE);
|
| 131 | String nw_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
|
| 132 | try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 133 | server,
|
| 134 | nw_endpoint,
|
| 135 | HttpStatus.ACCEPTED_202,
|
| 136 | CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) {
|
| 137 | closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::createNwInstance);
|
| 138 | }
|
| 139 | }
|
| 140 |
|
| 141 | @Test
|
| 142 | public void testCreateVolumeGroupInstance() throws Exception {
|
| 143 | String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);
|
| 144 | String vnf_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
|
| 145 | vnf_endpoint = vnf_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID);
|
| 146 | try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 147 | server,
|
| 148 | vnf_endpoint,
|
| 149 | HttpStatus.ACCEPTED_202,
|
| 150 | CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) {
|
| 151 | closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::createVolumeGroupInstance);
|
| 152 | }
|
| 153 | }
|
| 154 |
|
| 155 | @Test
|
| 156 | public void testCreateVfModuleInstance() throws Exception {
|
| 157 | String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);
|
| 158 | String partial_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
|
| 159 | String vf_module_endpoint =
|
| 160 | partial_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID);
|
| 161 |
|
| 162 |
|
| 163 | try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 164 | server,
|
| 165 | vf_module_endpoint,
|
| 166 | HttpStatus.ACCEPTED_202,
|
| 167 | CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) {
|
| 168 | closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::createVfModuleInstance);
|
| 169 | }
|
| 170 | }
|
| 171 |
|
| 172 | @Test
|
| 173 | public void testCreateConfigurationInstance() throws Exception {
|
| 174 | MsoRestClientNew testSubject;
|
| 175 | RequestDetailsWrapper requestDetails = null;
|
| 176 | String endpoint = "";
|
| 177 | MsoResponseWrapper result;
|
| 178 |
|
| 179 | // default test
|
| 180 | try {
|
| 181 | testSubject = createTestSubject();
|
| 182 | result = testSubject.createConfigurationInstance(requestDetails, endpoint);
|
| 183 | } catch (Exception e) {
|
| 184 | }
|
| 185 | }
|
| 186 |
|
| 187 | @Test
|
| 188 | public void testDeleteSvcInstance() throws Exception {
|
| 189 | String endpoint = props.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
|
| 190 | endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
|
| 191 |
|
| 192 |
|
| 193 | try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 194 | server,
|
| 195 | endpoint,
|
| 196 | HttpStatus.NO_CONTENT_204,
|
| 197 | CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) {
|
| 198 | closure.executeDelete(msoCreateServiceInstanceJson, msoRestClient()::deleteSvcInstance);
|
| 199 | }
|
| 200 | }
|
| 201 |
|
| 202 | @Test
|
| 203 | public void testDeleteVnf() throws Exception {
|
| 204 | String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VNF_INSTANCE);
|
| 205 | endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
|
| 206 |
|
| 207 | try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 208 | server,
|
| 209 | endpoint,
|
| 210 | HttpStatus.NO_CONTENT_204,
|
| 211 | CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) {
|
| 212 | closure.executeDelete(msoCreateServiceInstanceJson, msoRestClient()::deleteVnf);
|
| 213 | }
|
| 214 | }
|
| 215 |
|
| 216 | @Test
|
| 217 | public void testDeleteVfModule() throws Exception {
|
| 218 | String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);
|
| 219 | String part_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
|
| 220 | String vf_modules_endpoint = part_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID);
|
| 221 | String delete_vf_endpoint = vf_modules_endpoint + '/' + SAMPLE_VNF_MODULE_ID;
|
| 222 |
|
| 223 | try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 224 | server,
|
| 225 | delete_vf_endpoint,
|
| 226 | HttpStatus.NO_CONTENT_204,
|
| 227 | CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) {
|
| 228 | closure.executeDelete(msoCreateServiceInstanceJson, msoRestClient()::deleteVfModule);
|
| 229 | }
|
| 230 | }
|
| 231 |
|
| 232 | @Test
|
| 233 | public void testDeleteVolumeGroupInstance() throws Exception {
|
| 234 | String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);
|
| 235 | String svc_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
|
| 236 | String vnf_endpoint = svc_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID);
|
| 237 | String delete_volume_group_endpoint = vnf_endpoint + "/" + SAMPLE_VNF_MODULE_ID;
|
| 238 |
|
| 239 | try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 240 | server,
|
| 241 | delete_volume_group_endpoint,
|
| 242 | HttpStatus.NO_CONTENT_204,
|
| 243 | CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) {
|
| 244 | closure.executeDelete(msoCreateServiceInstanceJson, msoRestClient()::deleteVolumeGroupInstance);
|
| 245 | }
|
| 246 | }
|
| 247 |
|
| 248 | @Test
|
| 249 | public void testDeleteNwInstance() throws Exception {
|
| 250 | String endpoint = props.getProperty(MsoProperties.MSO_REST_API_NETWORK_INSTANCE);
|
| 251 | String svc_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
|
| 252 | String delete_nw_endpoint = svc_endpoint + "/" + SAMPLE_NETWORK_INSTANCE_ID;
|
| 253 |
|
| 254 | try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 255 | server,
|
| 256 | delete_nw_endpoint,
|
| 257 | HttpStatus.NO_CONTENT_204,
|
| 258 | CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) {
|
| 259 | closure.executeDelete(msoCreateServiceInstanceJson, msoRestClient()::deleteNwInstance);
|
| 260 | }
|
| 261 | }
|
| 262 |
|
| 263 | @Test
|
| 264 | public void testGetOrchestrationRequest() {
|
| 265 | String p = props.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQ);
|
| 266 | String path = p + "/" + SAMPLE_REQUEST_ID;
|
| 267 |
|
| 268 | try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 269 | server,
|
| 270 | path,
|
| 271 | HttpStatus.OK_200,
|
| 272 | CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) {
|
| 273 | closure.executeGet(msoRestClient()::getOrchestrationRequest);
|
| 274 | }
|
| 275 | }
|
| 276 |
|
| 277 | @Test
|
| 278 | public void testGetManualTasks() {
|
| 279 | String p = props.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQ);
|
| 280 | String path = p + "/" + UUID.randomUUID();
|
| 281 |
|
| 282 | try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 283 | server,
|
| 284 | path,
|
| 285 | HttpStatus.OK_200,
|
| 286 | CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) {
|
| 287 | closure.executeGet(msoRestClient()::getManualTasks);
|
| 288 | }
|
| 289 | }
|
| 290 |
|
| 291 | @Test
|
| 292 | public void testGetOrchestrationRequestsForDashboard() throws Exception {
|
| 293 | MsoRestClientNew testSubject;
|
| 294 | String t = "";
|
| 295 | String sourceId = "";
|
| 296 | String endpoint = "";
|
| 297 | RestObject restObject = null;
|
| 298 | MsoResponseWrapper result;
|
| 299 |
|
| 300 | // default test
|
| 301 | try {
|
| 302 | testSubject = createTestSubject();
|
| 303 | result = testSubject.getOrchestrationRequestsForDashboard(t, sourceId, endpoint, restObject);
|
| 304 | } catch (Exception e) {
|
| 305 | }
|
| 306 | }
|
| 307 |
|
| 308 | @Test
|
| 309 | public void testGetManualTasksByRequestId() throws Exception {
|
| 310 | MsoRestClientNew testSubject;
|
| 311 | String t = "";
|
| 312 | String sourceId = "";
|
| 313 | String endpoint = "";
|
| 314 | RestObject restObject = null;
|
| 315 | MsoResponseWrapper result;
|
| 316 |
|
| 317 | // default test
|
| 318 | try {
|
| 319 | testSubject = createTestSubject();
|
| 320 | result = testSubject.getManualTasksByRequestId(t, sourceId, endpoint, restObject);
|
| 321 | } catch (Exception e) {
|
| 322 | }
|
| 323 | }
|
| 324 |
|
| 325 | @Test
|
| 326 | public void testCompleteManualTask() throws Exception {
|
| 327 | MsoRestClientNew testSubject;
|
| 328 | RequestDetails requestDetails = null;
|
| 329 | String t = "";
|
| 330 | String sourceId = "";
|
| 331 | String endpoint = "";
|
| 332 | RestObject restObject = null;
|
| 333 | MsoResponseWrapper result;
|
| 334 |
|
| 335 | // default test
|
| 336 | try {
|
| 337 | testSubject = createTestSubject();
|
| 338 | result = testSubject.completeManualTask(requestDetails, t, sourceId, endpoint, restObject);
|
| 339 | } catch (Exception e) {
|
| 340 | }
|
| 341 | }
|
| 342 |
|
| 343 | @Test
|
| 344 | public void testDeleteConfiguration() throws Exception {
|
| 345 | MsoRestClientNew testSubject;
|
| 346 | RequestDetailsWrapper requestDetails = null;
|
| 347 | String pmc_endpoint = "";
|
| 348 | MsoResponseWrapper result;
|
| 349 |
|
| 350 | // default test
|
| 351 | try {
|
| 352 | testSubject = createTestSubject();
|
| 353 | result = testSubject.deleteConfiguration(requestDetails, pmc_endpoint);
|
| 354 | } catch (Exception e) {
|
| 355 | }
|
| 356 | }
|
| 357 |
|
| 358 | @Test
|
| 359 | public void testSetConfigurationActiveStatus() throws Exception {
|
| 360 | String endpoint = "/serviceInstances/v5/<service_instance_id>/configurations/<configuration_id>";
|
| 361 | endpoint = endpoint.replace(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
|
| 362 | endpoint = endpoint.replace(MsoController.CONFIGURATION_ID, SAMPLE_CONFIGURATION_ID);
|
| 363 | endpoint = endpoint + "/activate";
|
| 364 |
|
| 365 | try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 366 | server,
|
| 367 | endpoint,
|
| 368 | HttpStatus.ACCEPTED_202,
|
| 369 | CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) {
|
| 370 | closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::setConfigurationActiveStatus);
|
| 371 | }
|
| 372 | }
|
| 373 |
|
| 374 | @Test
|
| 375 | public void testSetPortOnConfigurationStatus() throws Exception {
|
| 376 | MsoRestClientNew testSubject;
|
| 377 | RequestDetails request = null;
|
| 378 | String path = "";
|
| 379 | MsoResponseWrapper result;
|
| 380 |
|
| 381 | // default test
|
| 382 | try {
|
| 383 | testSubject = createTestSubject();
|
| 384 | result = testSubject.setPortOnConfigurationStatus(request, path);
|
| 385 | } catch (Exception e) {
|
| 386 | }
|
| 387 | }
|
| 388 |
|
| 389 | @Test
|
| 390 | public void testChangeManagementUpdate() throws Exception {
|
| 391 | MsoRestClientNew testSubject;
|
| 392 | RequestDetailsWrapper requestDetails = null;
|
| 393 | String endpoint = "";
|
| 394 | MsoResponseWrapperInterface result;
|
| 395 |
|
| 396 | // default test
|
| 397 | try {
|
| 398 | testSubject = createTestSubject();
|
| 399 | result = testSubject.changeManagementUpdate(requestDetails, endpoint);
|
| 400 | } catch (Exception e) {
|
| 401 | }
|
| 402 | }
|
| 403 |
|
| 404 | @Test
|
| 405 | public void testSetServiceInstanceStatus() throws Exception {
|
| 406 | MsoRestClientNew testSubject;
|
| 407 | RequestDetails requestDetails = null;
|
| 408 | String t = "";
|
| 409 | String sourceId = "";
|
| 410 | String endpoint = "";
|
| 411 | RestObject<String> restObject = null;
|
| 412 |
|
| 413 | // default test
|
| 414 | try {
|
| 415 | testSubject = createTestSubject();
|
| 416 | testSubject.setServiceInstanceStatus(requestDetails, t, sourceId, endpoint, restObject);
|
| 417 | } catch (Exception e) {
|
| 418 | }
|
| 419 | }
|
| 420 |
|
| 421 | @Test
|
| 422 | public void testRemoveRelationshipFromServiceInstance() throws Exception {
|
| 423 | String serviceEndpoint = props.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
|
| 424 | String removeRelationshipsPath = serviceEndpoint + "/" + SERVICE_INSTANCE_ID + "/removeRelationships";
|
| 425 |
|
| 426 | try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 427 | server,
|
| 428 | removeRelationshipsPath,
|
| 429 | HttpStatus.ACCEPTED_202,
|
| 430 | CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) {
|
| 431 | closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::removeRelationshipFromServiceInstance);
|
| 432 | }
|
| 433 | }
|
| 434 |
|
| 435 | @Test
|
| 436 | public void testAddRelationshipToServiceInstance() throws Exception {
|
| 437 | MsoRestClientNew testSubject;
|
| 438 | RequestDetails requestDetails = null;
|
| 439 | String addRelationshipsPath = "";
|
| 440 | MsoResponseWrapper result;
|
| 441 |
|
| 442 | // default test
|
| 443 | try {
|
| 444 | testSubject = createTestSubject();
|
| 445 | result = testSubject.addRelationshipToServiceInstance(requestDetails, addRelationshipsPath);
|
| 446 | } catch (Exception e) {
|
| 447 | }
|
| 448 | }
|
| 449 | @Test
|
| 450 | public void testScaleOutVfModule() throws IOException {
|
| 451 | String serviceEndpoint = props.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_SCALE_OUT);
|
| 452 | String partial_endpoint = serviceEndpoint.replaceFirst(SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
|
| 453 | String vf_module_endpoint = partial_endpoint.replaceFirst(VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID);
|
| 454 | try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
|
| 455 | server,
|
| 456 | vf_module_endpoint,
|
| 457 | HttpStatus.ACCEPTED_202,
|
| 458 | CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) {
|
| 459 | closure.executePostCall(msoScaleOutVfModule, msoRestClient()::scaleOutVFModuleInstance);
|
| 460 | }
|
| 461 |
|
| 462 | }
|
| 463 |
|
| 464 | private MsoRestClientNew msoRestClient() {
|
| 465 | return new MsoRestClientNew(new SyncRestClient(MsoInterface.objectMapper()), baseUrl());
|
| 466 | }
|
| 467 |
|
| 468 | private MsoRestClientNew createTestSubject() {
|
| 469 | return new MsoRestClientNew(null, "");
|
| 470 | }
|
| 471 | }
|