summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-heat-lib/src/test
diff options
context:
space:
mode:
authorxuegao <xue.gao@intl.att.com>2021-03-19 14:04:17 +0100
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-24 07:00:09 +0000
commitb2c0528da052b5c73e3fc1f7f98d22578acd91f0 (patch)
tree12a64e553c7c6c321b4a8ec83880777f1c485f5e /openecomp-be/lib/openecomp-heat-lib/src/test
parentd378c37fbd1ecec7b43394926f1ca32a695e07de (diff)
Improve test coverage
Add unit tests to improve test coverage. Issue-ID: SDC-3428 Change-Id: I29a8f1d49f1dfd6bca79f3d873d1e1ff7adc4fb2 Signed-off-by: xuegao <xue.gao@intl.att.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-heat-lib/src/test')
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypesTest.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypesTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypesTest.java
new file mode 100644
index 0000000000..1298681b70
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypesTest.java
@@ -0,0 +1,64 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 AT&T Intellectual Property. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.heat.datatypes.model;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+import org.junit.jupiter.api.Test;
+import java.util.List;
+import java.util.Map;
+
+public class HeatResourcesTypesTest {
+
+ @Test
+ public void findByHeatResourceTest() {
+ assertEquals(HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE,
+ HeatResourcesTypes.findByHeatResource("OS::Nova::ServerGroup"));
+ }
+
+ @Test
+ public void isResourceExpectedToBeExposedTest() {
+ assertEquals(true, HeatResourcesTypes.isResourceExpectedToBeExposed("OS::Nova::ServerGroup"));
+ assertEquals(true, HeatResourcesTypes.isResourceExpectedToBeExposed("OS::Contrail::VirtualNetwork"));
+ assertEquals(true, HeatResourcesTypes.isResourceExpectedToBeExposed("OS::Neutron::Net"));
+ assertEquals(true, HeatResourcesTypes.isResourceExpectedToBeExposed("OS::Cinder::Volume"));
+ assertEquals(true, HeatResourcesTypes.isResourceExpectedToBeExposed("OS::Neutron::SecurityGroup"));
+ assertEquals(false, HeatResourcesTypes.isResourceExpectedToBeExposed("OS::Nova::Server"));
+ }
+
+ @Test
+ public void isResourceTypeValidTest() {
+ assertEquals(true, HeatResourcesTypes.isResourceTypeValid("OS::Neutron::SecurityGroup"));
+ assertEquals(false, HeatResourcesTypes.isResourceTypeValid("OS::Neutron::test"));
+ }
+
+ @Test
+ public void getListForResourceTypeTest() {
+ Map<HeatResourcesTypes, List<String>> res = HeatResourcesTypes.getListForResourceType(
+ HeatResourcesTypes.CINDER_VOLUME_RESOURCE_TYPE, HeatResourcesTypes.HEAT_CLOUD_CONFIG_TYPE);
+
+ assertNotNull(res.get(HeatResourcesTypes.CINDER_VOLUME_RESOURCE_TYPE));
+ assertNotNull(res.get(HeatResourcesTypes.HEAT_CLOUD_CONFIG_TYPE));
+ assertNull(res.get(HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE));
+ }
+
+}