aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/test/java/org
diff options
context:
space:
mode:
authorseshukm <seshu.kumar.m@huawei.com>2017-10-06 11:10:59 +0530
committerseshukm <seshu.kumar.m@huawei.com>2017-10-06 11:10:59 +0530
commitd88601feb7f3fff14c9cb3633a1d95229f97ee92 (patch)
tree1106a07210ed8821376fccc087f2a0a13400bb4f /adapters/mso-adapter-utils/src/test/java/org
parentfc0e957f6c3adb18eba669b0dd808398da24a003 (diff)
Adding UT for SO
IssueId: SO-191 Change-Id: Ic9fb77341842fd48efc81341c3a42c26d101b60d Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'adapters/mso-adapter-utils/src/test/java/org')
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java213
1 files changed, 213 insertions, 0 deletions
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java
new file mode 100644
index 0000000000..f231c75211
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java
@@ -0,0 +1,213 @@
+/*-
+ * ============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.HeatStatus;
+import org.openecomp.mso.openstack.beans.MsoTenant;
+import org.openecomp.mso.openstack.beans.NetworkInfo;
+import org.openecomp.mso.openstack.beans.NetworkRollback;
+import org.openecomp.mso.openstack.beans.NetworkStatus;
+import org.openecomp.mso.openstack.beans.Pool;
+import org.openecomp.mso.openstack.beans.StackInfo;
+import org.openecomp.mso.openstack.beans.Subnet;
+import org.openecomp.mso.openstack.beans.VnfRollback;
+
+import com.woorea.openstack.heat.model.Stack;
+
+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 networkInfoTest() {
+ NetworkInfo networkInfo = new NetworkInfo();
+ networkInfo.setName("name");
+ assertTrue(networkInfo.getName().equalsIgnoreCase("name"));
+ networkInfo.setId("1");
+ assertTrue(networkInfo.getId().equalsIgnoreCase("1"));
+ networkInfo.setStatus(NetworkStatus.ACTIVE);
+ assertTrue(networkInfo.getStatus().equals(NetworkStatus.ACTIVE));
+ networkInfo.setProvider("provider");
+ networkInfo.getProvider().equalsIgnoreCase("provider");
+ List<Integer> al = new ArrayList<>();
+ al.add(1);
+ al.add(2);
+ networkInfo.setVlans(al);
+ assertTrue(networkInfo.getVlans() != null);
+ networkInfo.setShared("shared");
+ assertTrue(networkInfo.getShared().equalsIgnoreCase("shared"));
+ List<String> als = new ArrayList<>();
+ als.add("1");
+ als.add("2");
+ networkInfo.setSubnets(als);
+ assertTrue(networkInfo.getSubnets() != null);
+ new NetworkInfo("string", NetworkStatus.ACTIVE);
+ assertTrue(networkInfo.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 stackInfoTest() {
+ StackInfo stackInfo = new StackInfo();
+ new StackInfo(new Stack());
+ new StackInfo("name", HeatStatus.CREATED, "statusmessage", new HashMap<>());
+ new StackInfo("name", HeatStatus.CREATED);
+ stackInfo.setCanonicalName("Canonicalname");
+ stackInfo.getCanonicalName();
+ stackInfo.setName("name");
+ stackInfo.getName();
+ stackInfo.setOutputs(new HashMap<>());
+ stackInfo.getOutputs();
+ stackInfo.setParameters(new HashMap<>());
+ stackInfo.getParameters();
+ stackInfo.setStatus(HeatStatus.CREATED);
+ stackInfo.getStatus();
+ stackInfo.setStatusMessage("statusMessage");
+ stackInfo.getStatusMessage();
+ }
+
+ @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();
+ }
+}