aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java
blob: 250211845fd4dc205f8ef03aff646a6dd7bbd527 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*-
 * ============LICENSE_START=======================================================
 * ONAP - SO
 * ================================================================================
 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.mso.adapter_utils.tests;

import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.openecomp.mso.entity.MsoRequest;
import org.openecomp.mso.openstack.beans.MsoTenant;
import org.openecomp.mso.openstack.beans.NetworkRollback;
import org.openecomp.mso.openstack.beans.Pool;
import org.openecomp.mso.openstack.beans.Subnet;
import org.openecomp.mso.openstack.beans.VnfRollback;

public class AdapterBeansTest {
	@Test
	public final void msoTenantTest() {
		MsoTenant tenant = new MsoTenant();
		tenant.setTenantId("1");
		assertTrue(tenant.getTenantId().equalsIgnoreCase("1"));
		tenant.setTenantName("TenantName");
		assertTrue(tenant.getTenantName().equalsIgnoreCase("TenantName"));
		Map<String, String> hm = new HashMap<>();
		hm.put("Key1", "value1");
		tenant.setMetadata(hm);
		assertTrue(tenant.getMetadata() != null);
		new MsoTenant("1", "TenantName", hm);
		// assertTrue(tenant.toString() != null);
	}

	@Test
	public final void networkRollbackTest() {
		NetworkRollback networkRollback = new NetworkRollback();
		networkRollback.setCloudId("cloudId");
		assertTrue(networkRollback.getCloudId().equalsIgnoreCase("cloudId"));
		networkRollback.setModelCustomizationUuid("modelCustomizationUuid");
		assertTrue(networkRollback.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid"));
		MsoRequest msoRequest = new MsoRequest();
		networkRollback.setMsoRequest(msoRequest);
		networkRollback.getMsoRequest();
		// assertTrue(networkRollback.getMsoRequest() == null);
		networkRollback.setNetworkCreated(Boolean.TRUE);
		assertTrue(networkRollback.getNetworkCreated());
		networkRollback.setNetworkId("networkId");
		assertTrue(networkRollback.getNetworkId().equalsIgnoreCase("networkId"));
		networkRollback.setNetworkName("networkName");
		assertTrue(networkRollback.getNetworkName().equalsIgnoreCase("networkName"));
		networkRollback.setNetworkStackId("networkStackId");
		assertTrue(networkRollback.getNetworkStackId().equalsIgnoreCase("networkStackId"));
		networkRollback.setNetworkType("networkType");
		assertTrue(networkRollback.getNetworkType().equalsIgnoreCase("networkType"));
		networkRollback.setNeutronNetworkId("neutronNetworkId");
		assertTrue(networkRollback.getNeutronNetworkId().equalsIgnoreCase("neutronNetworkId"));
		networkRollback.setPhysicalNetwork("physicalNetwork");
		assertTrue(networkRollback.getPhysicalNetwork().equalsIgnoreCase("physicalNetwork"));
		networkRollback.setTenantId("tenantId");
		assertTrue(networkRollback.getTenantId().equalsIgnoreCase("tenantId"));
		List<Integer> al = new ArrayList<>();
		al.add(1);
		al.add(2);
		networkRollback.setVlans(al);
		assertTrue(networkRollback.getVlans() != null);
		assertTrue(networkRollback.toString() != null);
	}

	@Test
	public final void poolTest() {
		Pool p = new Pool();
		p.setStart("start");
		p.getStart();
		p.setEnd("end");
		p.getEnd();
		p.toString();
	}

	@Test
	public final void subnetTest() {
		Subnet subnet = new Subnet();
		subnet.setAllocationPools(new ArrayList<>());
		subnet.getAllocationPools();
		subnet.setCidr("cidr");
		subnet.getCidr();
		subnet.setDnsNameServers(new ArrayList<>());
		subnet.getDnsNameServers();
		subnet.setEnableDHCP(true);
		subnet.getEnableDHCP();
		subnet.setGatewayIp("gatewayIp");
		subnet.getGatewayIp();
		subnet.setHostRoutes(new ArrayList<>());
		subnet.getHostRoutes();
		subnet.setIpVersion("ipVersion");
		subnet.getIpVersion();
		subnet.setNeutronId("neutronId");
		subnet.getNeutronId();
		subnet.setSubnetId("subnetId");
		subnet.getSubnetId();
		subnet.setSubnetName("subnetName");
		subnet.getSubnetName();
		subnet.toString();
	}

	@Test
	public final void vnfRollbackTest() {
		VnfRollback vnfRollback = new VnfRollback();
		new VnfRollback("vnfId", "tenantId", "cloudSiteId", true, true, new MsoRequest(), "volumeGroupName",
				"volumeGroupId", "requestType", "modelCustomizationUuid");
		vnfRollback.setBaseGroupHeatStackId("baseGroupHeatStackId");
		vnfRollback.getBaseGroupHeatStackId();
		vnfRollback.setCloudSiteId("cloudId");
		vnfRollback.getCloudSiteId();
		vnfRollback.setIsBase(false);
		vnfRollback.isBase();
		vnfRollback.setModelCustomizationUuid("modelCustomizationUuid");
		vnfRollback.getModelCustomizationUuid();
		vnfRollback.setMsoRequest(new MsoRequest());
		vnfRollback.getMsoRequest();
		vnfRollback.setRequestType("requestType");
		vnfRollback.getRequestType();
		vnfRollback.setTenantCreated(true);
		vnfRollback.getTenantCreated();
		vnfRollback.setTenantId("tenantId");
		vnfRollback.getTenantId();
		vnfRollback.setVfModuleStackId("vfModuleStackId");
		vnfRollback.getVfModuleStackId();
		vnfRollback.setVnfCreated(true);
		vnfRollback.getVnfCreated();
		vnfRollback.setVnfId("vnfId");
		vnfRollback.getVnfId();
		vnfRollback.setVolumeGroupHeatStackId("volumeGroupHeatStackId");
		vnfRollback.getVolumeGroupHeatStackId();
		vnfRollback.setVolumeGroupId("volumeGroupId");
		vnfRollback.getVolumeGroupId();
		vnfRollback.setVolumeGroupName("volumeGroupName");
		vnfRollback.getVolumeGroupName();
		vnfRollback.toString();
	}
}