Add pause after completion for vfModule
[vid.git] / vid-app-common / src / test / java / org / onap / vid / model / serviceInstantiation / VfModuleTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
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 package org.onap.vid.model.serviceInstantiation;
22
23 import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
24 import static org.hamcrest.CoreMatchers.equalTo;
25 import static org.hamcrest.MatcherAssert.assertThat;
26 import static org.hamcrest.beans.HasPropertyWithValue.hasProperty;
27 import static org.hamcrest.core.AllOf.allOf;
28 import static org.onap.vid.testUtils.TestUtils.setStringsInStringFields;
29
30 import org.onap.vid.mso.model.ModelInfo;
31 import org.testng.annotations.Test;
32
33 public class VfModuleTest {
34
35     @Test
36     public void cloneWithLcpCloudRegionIdAndTenantId() {
37         String targetLcpCloudRegionId = "dictated lcpCloudRegionId";
38         String targetTenantId = "dictated tenantId";
39
40         VfModule originVfModule = createVfModule();
41
42         assertThat(originVfModule.cloneWith(targetLcpCloudRegionId, targetTenantId), allOf(
43             hasProperty("lcpCloudRegionId", equalTo(targetLcpCloudRegionId)),
44             hasProperty("tenantId", equalTo(targetTenantId)),
45             jsonEquals(originVfModule).whenIgnoringPaths("lcpCloudRegionId", "tenantId")
46         ));
47
48         // verify vfModule did not mutate
49         assertThat(originVfModule, jsonEquals(createVfModule()));
50     }
51
52     private VfModule createVfModule() {
53         VfModule vfModule = new VfModule(
54             setStringsInStringFields(new ModelInfo()),
55             null, null, null, null, null,
56             null, null, null, true, true,
57             null, null, true, null, true,
58             true, null, null, null);
59
60         return setStringsInStringFields(vfModule);
61     }
62 }