444a9a8e945d46b9092048813b9dabe15e4715a3
[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 cloudOwner = "testCloudOwner";
37         private String cloudSiteId = "testCloudSiteId";
38         private boolean tenantCreated = true;
39         private boolean vnfCreated = true;
40         private MsoRequest msoRequest = new MsoRequest();
41         private String volumeGroupName = "testVolumeGroupName";
42         private String volumeGroupId = "testVolumeGroupId";
43         private String requestType = "testRequestType";
44         private String modelCustomizationUuid = "testModelCustimizationUuid";
45         private String orchestrationMode = "testOrchestrationMode";
46         private static final String VNF_ROLLBACK_STRING = "VnfRollback: cloud=testCloudSiteId, cloudOwner=testCloudOwner, tenant=testTenantId, vnf=testVnfId, "
47                         + "tenantCreated=true, vnfCreated=true, requestType = testRequestType, modelCustomizationUuid=testModelCustimizationUuid, mode=testOrchestrationMode";
48         
49         @Test
50         public void VnfRollbackInstantiationTest() {
51                 vnfRollback = new VnfRollback(vnfId, tenantId, cloudOwner, cloudSiteId, tenantCreated, vnfCreated,
52                                 msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid);
53                 
54                 assertEquals(vnfId, vnfRollback.getVnfId());
55                 assertEquals(tenantId, vnfRollback.getTenantId());
56                 assertEquals(cloudOwner, vnfRollback.getCloudOwner());
57                 assertEquals(cloudSiteId, vnfRollback.getCloudSiteId());
58                 assertEquals(tenantCreated, vnfRollback.getTenantCreated());
59                 assertEquals(vnfCreated, vnfRollback.getVnfCreated());
60                 assertEquals(msoRequest, vnfRollback.getMsoRequest());
61                 assertEquals(volumeGroupName, vnfRollback.getVolumeGroupName());
62                 assertEquals(volumeGroupId, vnfRollback.getVolumeGroupId());
63                 assertEquals(requestType, vnfRollback.getRequestType());
64                 assertEquals(modelCustomizationUuid, vnfRollback.getModelCustomizationUuid());
65         }
66         
67         @Test
68         public void VnfRollbackInstantiationOrchestrationModeTest() {
69                 vnfRollback = new VnfRollback(vnfId, tenantId, cloudOwner, cloudSiteId, tenantCreated, vnfCreated,
70                                 msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid, orchestrationMode);
71                 
72                 assertEquals(vnfId, vnfRollback.getVnfId());
73                 assertEquals(tenantId, vnfRollback.getTenantId());
74                 assertEquals(cloudOwner, vnfRollback.getCloudOwner());
75                 assertEquals(cloudSiteId, vnfRollback.getCloudSiteId());
76                 assertEquals(tenantCreated, vnfRollback.getTenantCreated());
77                 assertEquals(vnfCreated, vnfRollback.getVnfCreated());
78                 assertEquals(msoRequest, vnfRollback.getMsoRequest());
79                 assertEquals(volumeGroupName, vnfRollback.getVolumeGroupName());
80                 assertEquals(volumeGroupId, vnfRollback.getVolumeGroupId());
81                 assertEquals(requestType, vnfRollback.getRequestType());
82                 assertEquals(modelCustomizationUuid, vnfRollback.getModelCustomizationUuid());
83                 assertEquals(orchestrationMode, vnfRollback.getMode());
84         }
85         
86         @Test
87         public void toStringTest() {
88                 vnfRollback = new VnfRollback(vnfId, tenantId, cloudOwner, cloudSiteId, tenantCreated, vnfCreated,
89                                 msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid, orchestrationMode);
90                 
91                 assertEquals(VNF_ROLLBACK_STRING, vnfRollback.toString());
92         }
93 }