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.adapter_utils.tests;
\r
23 import static org.junit.Assert.assertTrue;
\r
25 import com.woorea.openstack.heat.model.Stack;
\r
26 import java.util.ArrayList;
\r
27 import java.util.HashMap;
\r
28 import java.util.List;
\r
29 import java.util.Map;
\r
30 import org.junit.Test;
\r
31 import org.openecomp.mso.entity.MsoRequest;
\r
32 import org.openecomp.mso.openstack.beans.HeatStatus;
\r
33 import org.openecomp.mso.openstack.beans.MsoTenant;
\r
34 import org.openecomp.mso.openstack.beans.NetworkRollback;
\r
35 import org.openecomp.mso.openstack.beans.Pool;
\r
36 import org.openecomp.mso.openstack.beans.StackInfo;
\r
37 import org.openecomp.mso.openstack.beans.Subnet;
\r
38 import org.openecomp.mso.openstack.beans.VnfRollback;
\r
40 public class AdapterBeansTest {
\r
42 public final void msoTenantTest() {
\r
43 MsoTenant tenant = new MsoTenant();
\r
44 tenant.setTenantId("1");
\r
45 assertTrue(tenant.getTenantId().equalsIgnoreCase("1"));
\r
46 tenant.setTenantName("TenantName");
\r
47 assertTrue(tenant.getTenantName().equalsIgnoreCase("TenantName"));
\r
48 Map<String, String> hm = new HashMap<>();
\r
49 hm.put("Key1", "value1");
\r
50 tenant.setMetadata(hm);
\r
51 assertTrue(tenant.getMetadata() != null);
\r
52 new MsoTenant("1", "TenantName", hm);
\r
53 // assertTrue(tenant.toString() != null);
\r
57 public final void networkRollbackTest() {
\r
58 NetworkRollback networkRollback = new NetworkRollback();
\r
59 networkRollback.setCloudId("cloudId");
\r
60 assertTrue(networkRollback.getCloudId().equalsIgnoreCase("cloudId"));
\r
61 networkRollback.setModelCustomizationUuid("modelCustomizationUuid");
\r
62 assertTrue(networkRollback.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid"));
\r
63 MsoRequest msoRequest = new MsoRequest();
\r
64 networkRollback.setMsoRequest(msoRequest);
\r
65 networkRollback.getMsoRequest();
\r
66 // assertTrue(networkRollback.getMsoRequest() == null);
\r
67 networkRollback.setNetworkCreated(Boolean.TRUE);
\r
68 assertTrue(networkRollback.getNetworkCreated());
\r
69 networkRollback.setNetworkId("networkId");
\r
70 assertTrue(networkRollback.getNetworkId().equalsIgnoreCase("networkId"));
\r
71 networkRollback.setNetworkName("networkName");
\r
72 assertTrue(networkRollback.getNetworkName().equalsIgnoreCase("networkName"));
\r
73 networkRollback.setNetworkStackId("networkStackId");
\r
74 assertTrue(networkRollback.getNetworkStackId().equalsIgnoreCase("networkStackId"));
\r
75 networkRollback.setNetworkType("networkType");
\r
76 assertTrue(networkRollback.getNetworkType().equalsIgnoreCase("networkType"));
\r
77 networkRollback.setNeutronNetworkId("neutronNetworkId");
\r
78 assertTrue(networkRollback.getNeutronNetworkId().equalsIgnoreCase("neutronNetworkId"));
\r
79 networkRollback.setPhysicalNetwork("physicalNetwork");
\r
80 assertTrue(networkRollback.getPhysicalNetwork().equalsIgnoreCase("physicalNetwork"));
\r
81 networkRollback.setTenantId("tenantId");
\r
82 assertTrue(networkRollback.getTenantId().equalsIgnoreCase("tenantId"));
\r
83 List<Integer> al = new ArrayList<>();
\r
86 networkRollback.setVlans(al);
\r
87 assertTrue(networkRollback.getVlans() != null);
\r
88 assertTrue(networkRollback.toString() != null);
\r
92 public final void poolTest() {
\r
93 Pool p = new Pool();
\r
94 p.setStart("start");
\r
102 public final void stackInfoTest() {
\r
103 StackInfo stackInfo = new StackInfo();
\r
104 new StackInfo(new Stack());
\r
105 new StackInfo("name", HeatStatus.CREATED, "statusmessage", new HashMap<>());
\r
106 new StackInfo("name", HeatStatus.CREATED);
\r
107 stackInfo.setCanonicalName("Canonicalname");
\r
108 stackInfo.getCanonicalName();
\r
109 stackInfo.setName("name");
\r
110 stackInfo.getName();
\r
111 stackInfo.setOutputs(new HashMap<>());
\r
112 stackInfo.getOutputs();
\r
113 stackInfo.setParameters(new HashMap<>());
\r
114 stackInfo.getParameters();
\r
115 stackInfo.setStatus(HeatStatus.CREATED);
\r
116 stackInfo.getStatus();
\r
117 stackInfo.setStatusMessage("statusMessage");
\r
118 stackInfo.getStatusMessage();
\r
122 public final void subnetTest() {
\r
123 Subnet subnet = new Subnet();
\r
124 subnet.setAllocationPools(new ArrayList<>());
\r
125 subnet.getAllocationPools();
\r
126 subnet.setCidr("cidr");
\r
128 subnet.setDnsNameServers(new ArrayList<>());
\r
129 subnet.getDnsNameServers();
\r
130 subnet.setEnableDHCP(true);
\r
131 subnet.getEnableDHCP();
\r
132 subnet.setGatewayIp("gatewayIp");
\r
133 subnet.getGatewayIp();
\r
134 subnet.setHostRoutes(new ArrayList<>());
\r
135 subnet.getHostRoutes();
\r
136 subnet.setIpVersion("ipVersion");
\r
137 subnet.getIpVersion();
\r
138 subnet.setNeutronId("neutronId");
\r
139 subnet.getNeutronId();
\r
140 subnet.setSubnetId("subnetId");
\r
141 subnet.getSubnetId();
\r
142 subnet.setSubnetName("subnetName");
\r
143 subnet.getSubnetName();
\r
148 public final void vnfRollbackTest() {
\r
149 VnfRollback vnfRollback = new VnfRollback();
\r
150 new VnfRollback("vnfId", "tenantId", "cloudSiteId", true, true, new MsoRequest(), "volumeGroupName",
\r
151 "volumeGroupId", "requestType", "modelCustomizationUuid");
\r
152 vnfRollback.setBaseGroupHeatStackId("baseGroupHeatStackId");
\r
153 vnfRollback.getBaseGroupHeatStackId();
\r
154 vnfRollback.setCloudSiteId("cloudId");
\r
155 vnfRollback.getCloudSiteId();
\r
156 vnfRollback.setIsBase(false);
\r
157 vnfRollback.isBase();
\r
158 vnfRollback.setModelCustomizationUuid("modelCustomizationUuid");
\r
159 vnfRollback.getModelCustomizationUuid();
\r
160 vnfRollback.setMsoRequest(new MsoRequest());
\r
161 vnfRollback.getMsoRequest();
\r
162 vnfRollback.setRequestType("requestType");
\r
163 vnfRollback.getRequestType();
\r
164 vnfRollback.setTenantCreated(true);
\r
165 vnfRollback.getTenantCreated();
\r
166 vnfRollback.setTenantId("tenantId");
\r
167 vnfRollback.getTenantId();
\r
168 vnfRollback.setVfModuleStackId("vfModuleStackId");
\r
169 vnfRollback.getVfModuleStackId();
\r
170 vnfRollback.setVnfCreated(true);
\r
171 vnfRollback.getVnfCreated();
\r
172 vnfRollback.setVnfId("vnfId");
\r
173 vnfRollback.getVnfId();
\r
174 vnfRollback.setVolumeGroupHeatStackId("volumeGroupHeatStackId");
\r
175 vnfRollback.getVolumeGroupHeatStackId();
\r
176 vnfRollback.setVolumeGroupId("volumeGroupId");
\r
177 vnfRollback.getVolumeGroupId();
\r
178 vnfRollback.setVolumeGroupName("volumeGroupName");
\r
179 vnfRollback.getVolumeGroupName();
\r
180 vnfRollback.toString();
\r