Containerization feature of SO
[so.git] / adapters / mso-adapter-utils / src / test / java / org / onap / so / openstack / beans / VnfRollbackTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 - 2018 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.so.openstack.beans;
22
23 import static org.junit.Assert.assertEquals;
24
25 import org.junit.Test;
26 import org.onap.so.BaseTest;
27 import org.onap.so.entity.MsoRequest;
28 import org.springframework.beans.factory.annotation.Autowired;
29
30 public class VnfRollbackTest extends BaseTest {
31         @Autowired
32         private VnfRollback vnfRollback;
33         
34         private String vnfId = "testVnfId";
35         private String tenantId = "testTenantId";
36         private String cloudSiteId = "testCloudSiteId";
37         private boolean tenantCreated = true;
38         private boolean vnfCreated = true;
39         private MsoRequest msoRequest = new MsoRequest();
40         private String volumeGroupName = "testVolumeGroupName";
41         private String volumeGroupId = "testVolumeGroupId";
42         private String requestType = "testRequestType";
43         private String modelCustomizationUuid = "testModelCustimizationUuid";
44         private String orchestrationMode = "testOrchestrationMode";
45         private static final String VNF_ROLLBACK_STRING = "VnfRollback: cloud=testCloudSiteId, tenant=testTenantId, vnf=testVnfId, "
46                         + "tenantCreated=true, vnfCreated=true, requestType = testRequestType, modelCustomizationUuid=testModelCustimizationUuid, mode=testOrchestrationMode";
47         
48         @Test
49         public void VnfRollbackInstantiationTest() {
50                 vnfRollback = new VnfRollback(vnfId, tenantId, cloudSiteId, tenantCreated, vnfCreated,
51                                 msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid);
52                 
53                 assertEquals(vnfId, vnfRollback.getVnfId());
54                 assertEquals(tenantId, vnfRollback.getTenantId());
55                 assertEquals(cloudSiteId, vnfRollback.getCloudSiteId());
56                 assertEquals(tenantCreated, vnfRollback.getTenantCreated());
57                 assertEquals(vnfCreated, vnfRollback.getVnfCreated());
58                 assertEquals(msoRequest, vnfRollback.getMsoRequest());
59                 assertEquals(volumeGroupName, vnfRollback.getVolumeGroupName());
60                 assertEquals(volumeGroupId, vnfRollback.getVolumeGroupId());
61                 assertEquals(requestType, vnfRollback.getRequestType());
62                 assertEquals(modelCustomizationUuid, vnfRollback.getModelCustomizationUuid());
63         }
64         
65         @Test
66         public void VnfRollbackInstantiationOrchestrationModeTest() {
67                 vnfRollback = new VnfRollback(vnfId, tenantId, cloudSiteId, tenantCreated, vnfCreated,
68                                 msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid, orchestrationMode);
69                 
70                 assertEquals(vnfId, vnfRollback.getVnfId());
71                 assertEquals(tenantId, vnfRollback.getTenantId());
72                 assertEquals(cloudSiteId, vnfRollback.getCloudSiteId());
73                 assertEquals(tenantCreated, vnfRollback.getTenantCreated());
74                 assertEquals(vnfCreated, vnfRollback.getVnfCreated());
75                 assertEquals(msoRequest, vnfRollback.getMsoRequest());
76                 assertEquals(volumeGroupName, vnfRollback.getVolumeGroupName());
77                 assertEquals(volumeGroupId, vnfRollback.getVolumeGroupId());
78                 assertEquals(requestType, vnfRollback.getRequestType());
79                 assertEquals(modelCustomizationUuid, vnfRollback.getModelCustomizationUuid());
80                 assertEquals(orchestrationMode, vnfRollback.getMode());
81         }
82         
83         @Test
84         public void toStringTest() {
85                 vnfRollback = new VnfRollback(vnfId, tenantId, cloudSiteId, tenantCreated, vnfCreated,
86                                 msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid, orchestrationMode);
87                 
88                 assertEquals(VNF_ROLLBACK_STRING, vnfRollback.toString());
89         }
90 }