diff options
Diffstat (limited to 'adapters/mso-vnf-adapter/src/test/java')
7 files changed, 117 insertions, 28 deletions
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java index a045b00699..acde3153ab 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java @@ -44,7 +44,7 @@ public class MsoVnfAdapterAsyncImplTest { try {
instance.createVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", new HashMap<String, String>(), Boolean.FALSE, Boolean.TRUE, "messageId",
+ "volumeGroupHeatStackId|1", new HashMap<>(), Boolean.FALSE, Boolean.TRUE, "messageId",
null, "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
} catch (Exception e) {
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java index 6f01954db3..eec2257c7f 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java @@ -48,8 +48,8 @@ public class MsoVnfAdapterImplTest { try {
instance.createVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
- Boolean.FALSE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
- new Holder<VnfRollback>());
+ Boolean.FALSE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<>(),
+ new Holder<>());
} catch (Exception e) {
}
@@ -67,8 +67,8 @@ public class MsoVnfAdapterImplTest { try {
instance.updateVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
- "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
- new Holder<VnfRollback>());
+ "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<>(),
+ new Holder<>());
} catch (Exception e) {
}
@@ -82,7 +82,7 @@ public class MsoVnfAdapterImplTest { msoRequest.setServiceInstanceId("12345");
try {
instance.deleteVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
- new Holder<Map<String, String>>());
+ new Holder<>());
} catch (Exception e) {
}
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java index f6e79e12a0..d898a6547e 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java @@ -55,10 +55,10 @@ public class QueryTest { String cloudId = "MT"; String tenantId = "MSO_Test"; String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<Boolean>(); - Holder<String> vnfId = new Holder<String>(); - Holder<VnfStatus> status = new Holder<VnfStatus>(); - Holder<Map<String, String>> outputs = new Holder<Map<String, String>>(); + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vnfId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); @@ -82,10 +82,10 @@ public class QueryTest { String cloudId = "MT"; String tenantId = "MSO_Test"; String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<Boolean>(); - Holder<String> vnfId = new Holder<String>(); - Holder<VnfStatus> status = new Holder<VnfStatus>(); - Holder<Map<String, String>> outputs = new Holder<Map<String, String>>(); + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vnfId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); @@ -101,10 +101,10 @@ public class QueryTest { String cloudId = "MT"; String tenantId = "MSO_Test"; String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<Boolean>(); - Holder<String> vnfId = new Holder<String>(); - Holder<VnfStatus> status = new Holder<VnfStatus>(); - Holder<Map<String, String>> outputs = new Holder<Map<String, String>>(); + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vnfId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfCreateTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfCreateTest.java index 52e1797531..000ed8aef3 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfCreateTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfCreateTest.java @@ -42,16 +42,16 @@ public class VnfCreateTest { String tenantName = "John_Test"; String vnfType = "ApacheDemo"; String vnfName = "AdapterTest"; - Map<String,String> inputs = new HashMap<String,String>(); + Map<String,String> inputs = new HashMap<>(); inputs.put("vnf_id", "abc"); inputs.put("extra", "whocares"); inputs.put("private_subnet_gateway", "10.4.1.1"); inputs.put("private_subnet_cidr", "10.4.1.0/29"); // Web Service Outputs - Holder<String> vnfId = new Holder<String>(); - Holder<Map<String,String>> outputs = new Holder<Map<String,String>>(); - Holder<VnfRollback> vnfRollback = new Holder<VnfRollback>(); + Holder<String> vnfId = new Holder<>(); + Holder<Map<String,String>> outputs = new Holder<>(); + Holder<VnfRollback> vnfRollback = new Holder<>(); try { vnfAdapter.createVnf(cloudId, tenantName, vnfType,null, vnfName, null, null, inputs, false, true, null, diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfQueryTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfQueryTest.java index 84f2f2ff57..bbffddfd15 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfQueryTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfQueryTest.java @@ -39,10 +39,10 @@ public class VnfQueryTest { String cloudId = "MT"; String tenantId = "MSO_Test"; String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<Boolean>(); - Holder<String> vnfId = new Holder<String>(); - Holder<VnfStatus> status = new Holder<VnfStatus>(); - Holder<Map<String,String>> outputs = new Holder<Map<String,String>>(); + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vnfId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String,String>> outputs = new Holder<>(); try { vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java index 21a71ccf61..019ae1e3f9 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java @@ -60,7 +60,7 @@ public class VduBlueprintTest { @Test public void testGetTemplateFiles() { byte[] templateFileData = "some template file data".getBytes(); - templateFiles = new HashMap<String, byte[]>(); + templateFiles = new HashMap<>(); templateFiles.put("templateKey1", templateFileData); vduBlueprint.setTemplateFiles(templateFiles); Assert.assertNotNull(vduBlueprint.getTemplateFiles()); @@ -71,7 +71,7 @@ public class VduBlueprintTest { @Test public void testGetAttachedFiles() { byte[] attachedFileData = "some file data".getBytes(); - attachedFiles = new HashMap<String, byte[]>(); + attachedFiles = new HashMap<>(); attachedFiles.put("attachedKey1", attachedFileData); vduBlueprint.setAttachedFiles(attachedFiles); Assert.assertNotNull(vduBlueprint.getAttachedFiles()); diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java new file mode 100644 index 0000000000..98a00033f7 --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java @@ -0,0 +1,89 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * 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.vdu.utils; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class VduInfoTest { + + private VduInfo vduInfo; + private VduStatus status = VduStatus.NOTFOUND; + private Map<String, Object> outputs; + private Map<String, Object> inputs; + + @Before + public void setUp() { + vduInfo = new VduInfo(); + } + + @Test + public void testGetVnfInstanceId() { + String vnfInstanceId = "vnfInstanceId"; + vduInfo.setVnfInstanceId(vnfInstanceId); + Assert.assertNotNull(vduInfo.getVnfInstanceId()); + Assert.assertEquals(vduInfo.getVnfInstanceId(), "vnfInstanceId"); + } + + @Test + public void testGetVnfInstanceName() { + String vnfInstanceName = "vnfInstanceName"; + vduInfo.setVnfInstanceName(vnfInstanceName); + Assert.assertNotNull(vduInfo.getVnfInstanceName()); + Assert.assertEquals(vduInfo.getVnfInstanceName(), "vnfInstanceName"); + } + + @Test + public void testGetStatus() { + vduInfo.setStatus(status); + Assert.assertNotNull(vduInfo.getStatus()); + Assert.assertEquals(status, vduInfo.getStatus()); + } + + @Test + public void testGetOutputs() { + Object obj = new Object(); + String str = "some text"; + outputs = new HashMap<>(); + outputs.put(str, obj); + vduInfo.setOutputs(outputs); + Assert.assertNotNull(vduInfo.getOutputs()); + Assert.assertTrue(vduInfo.getOutputs().containsKey(str)); + Assert.assertTrue(vduInfo.getOutputs().containsValue(obj)); + } + + @Test + public void testGetInputs() { + Object obj = new Object(); + String str = "some text"; + inputs = new HashMap<>(); + inputs.put(str, obj); + vduInfo.setInputs(inputs); + Assert.assertNotNull(vduInfo.getInputs()); + Assert.assertTrue(vduInfo.getInputs().containsKey(str)); + Assert.assertTrue(vduInfo.getInputs().containsValue(obj)); + } + +} |