summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend
diff options
context:
space:
mode:
authorChrisC <christophe.closset@intl.att.com>2020-06-19 18:05:20 +0200
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-06-21 07:04:46 +0000
commit8a44c78d37e82363cf572b6d9578e1cc6f6860bd (patch)
treeef19668b9ed8091881127c19e025779fb222e5c9 /openecomp-be/backend
parent886ffd112569eaa02cab85fb59a5a47db52c312d (diff)
Fix Assert usage
Sonar Fix, fix assert usage in this file Issue-ID: SDC-3116 Signed-off-by: ChrisC <christophe.closset@intl.att.com> Change-Id: I292649e84e589a35eb69139de53b3ee95223be26
Diffstat (limited to 'openecomp-be/backend')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java487
1 files changed, 243 insertions, 244 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java
index 579f19715b..9b45b4be4a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2018 European Support Limited
+ * Modifications © 2020 AT&T
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -12,10 +13,15 @@
* 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.
-*/
+ */
package org.openecomp.sdc.vendorsoftwareproduct.services.impl.composition;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -26,9 +32,8 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;
import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
@@ -40,276 +45,270 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
-/**
- * @author shiria
- * @since July 17, 2016.
- */
-
public class CompositionDataExtractorImplTest {
- @InjectMocks
- private static CompositionDataExtractorImpl compositionDataExtractor;
+ @InjectMocks
+ private static CompositionDataExtractorImpl compositionDataExtractor;
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- }
+ private ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath,
+ String globalServiceTemplatesPath,
+ String entryDefinitionServiceTemplate)
+ throws IOException {
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
+ Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
+ if (entryDefinitionServiceTemplate == null) {
+ entryDefinitionServiceTemplate = "MainServiceTemplate.yaml";
+ }
- private static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath,
- String globalServiceTemplatesPath,
- String entryDefinitionServiceTemplate)
- throws IOException {
- ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
- Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
- if (entryDefinitionServiceTemplate == null) {
- entryDefinitionServiceTemplate = "MainServiceTemplate.yaml";
- }
+ loadServiceTemplates(serviceTemplatesPath, toscaExtensionYamlUtil, serviceTemplates);
+ if (globalServiceTemplatesPath != null) {
+ loadServiceTemplates(globalServiceTemplatesPath, toscaExtensionYamlUtil, serviceTemplates);
+ }
- loadServiceTemplates(serviceTemplatesPath, toscaExtensionYamlUtil, serviceTemplates);
- if (globalServiceTemplatesPath != null) {
- loadServiceTemplates(globalServiceTemplatesPath, toscaExtensionYamlUtil, serviceTemplates);
+ return new ToscaServiceModel(null, serviceTemplates, entryDefinitionServiceTemplate);
}
- return new ToscaServiceModel(null, serviceTemplates, entryDefinitionServiceTemplate);
- }
-
- private static void loadServiceTemplates(String serviceTemplatesPath,
- ToscaExtensionYamlUtil toscaExtensionYamlUtil,
- Map<String, ServiceTemplate> serviceTemplates)
- throws IOException {
- URL urlFile = CompositionDataExtractorImplTest.class.getResource(serviceTemplatesPath);
- if (urlFile != null) {
- File pathFile = new File(urlFile.getFile());
- Collection<File> files = FileUtils.listFiles(pathFile, null, true);
- if (files != null) {
- addServiceTemplateFiles(serviceTemplates, files, toscaExtensionYamlUtil);
- } else {
- throw new NotDirectoryException(serviceTemplatesPath);
- }
- } else {
- throw new NotDirectoryException(serviceTemplatesPath);
+ private void loadServiceTemplates(String serviceTemplatesPath,
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil,
+ Map<String, ServiceTemplate> serviceTemplates)
+ throws IOException {
+ URL urlFile = CompositionDataExtractorImplTest.class.getResource(serviceTemplatesPath);
+ if (urlFile != null) {
+ File pathFile = new File(urlFile.getFile());
+ Collection<File> files = FileUtils.listFiles(pathFile, null, true);
+ if (files != null) {
+ addServiceTemplateFiles(serviceTemplates, files, toscaExtensionYamlUtil);
+ } else {
+ throw new NotDirectoryException(serviceTemplatesPath);
+ }
+ } else {
+ throw new NotDirectoryException(serviceTemplatesPath);
+ }
}
- }
- private static void addServiceTemplateFiles(Map<String, ServiceTemplate> serviceTemplates,
- Collection<File> files,
- ToscaExtensionYamlUtil toscaExtensionYamlUtil)
- throws IOException {
- for (File file : files) {
- try (InputStream yamlFile = new FileInputStream(file)) {
- ServiceTemplate serviceTemplateFromYaml =
- toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
- serviceTemplates.put(ToscaUtil.getServiceTemplateFileName(serviceTemplateFromYaml),
- serviceTemplateFromYaml);
- }
+ private void addServiceTemplateFiles(Map<String, ServiceTemplate> serviceTemplates,
+ Collection<File> files,
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil)
+ throws IOException {
+ for (File file : files) {
+ try (InputStream yamlFile = new FileInputStream(file)) {
+ ServiceTemplate serviceTemplateFromYaml =
+ toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+ serviceTemplates.put(ToscaUtil.getServiceTemplateFileName(serviceTemplateFromYaml),
+ serviceTemplateFromYaml);
+ }
+ }
}
- }
- @Test
- public void testExtractNetworks() throws Exception {
- ToscaServiceModel toscaServiceModel =
- loadToscaServiceModel("/extractServiceComposition/networks/",
- "/extractServiceComposition/toscaGlobalServiceTemplates/", null);
- CompositionData compositionData =
- compositionDataExtractor.extractServiceCompositionData(toscaServiceModel);
- Assert.assertEquals(compositionData.getComponents().size(), 0);
- Assert.assertEquals(compositionData.getNetworks().size(), 7);
+ @BeforeEach
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ }
- for (Network network : compositionData.getNetworks()) {
- boolean dhcp = network.isDhcp();
- switch (network.getName()) {
- case "contail-net-default-true-dhcp":
- Assert.assertEquals(dhcp, true);
- break;
- case "contail-net-dhcp-false-param":
- Assert.assertEquals(dhcp, false);
- break;
- case "contail-net-dhcp-false":
- Assert.assertEquals(dhcp, false);
- break;
- case "contail-net-dhcp-true-param":
- Assert.assertEquals(dhcp, true);
- break;
- case "contail-net-dhcp-true":
- Assert.assertEquals(dhcp, true);
- break;
- case "contail-net-dhcp-default-true-param":
- Assert.assertEquals(dhcp, true);
- break;
- case "neutron-net-default-dhcp":
- Assert.assertEquals(dhcp, true);
- break;
- default:
- throw new Exception("Unexpected Network Name " + network.getName());
- }
+ @Test
+ public void testExtractNetworks() throws Exception {
+ ToscaServiceModel toscaServiceModel =
+ loadToscaServiceModel("/extractServiceComposition/networks/",
+ "/extractServiceComposition/toscaGlobalServiceTemplates/", null);
+ CompositionData compositionData =
+ compositionDataExtractor.extractServiceCompositionData(toscaServiceModel);
+ assertEquals(0, compositionData.getComponents().size());
+ assertEquals(7, compositionData.getNetworks().size());
+ for (Network network : compositionData.getNetworks()) {
+ boolean dhcp = network.isDhcp();
+ switch (network.getName()) {
+ case "contail-net-default-true-dhcp":
+ assertTrue(dhcp);
+ break;
+ case "contail-net-dhcp-false-param":
+ assertFalse(dhcp);
+ break;
+ case "contail-net-dhcp-false":
+ assertFalse(dhcp);
+ break;
+ case "contail-net-dhcp-true-param":
+ assertTrue(dhcp);
+ break;
+ case "contail-net-dhcp-true":
+ assertTrue(dhcp);
+ break;
+ case "contail-net-dhcp-default-true-param":
+ assertTrue(dhcp);
+ break;
+ case "neutron-net-default-dhcp":
+ assertTrue(dhcp);
+ break;
+ default:
+ throw new Exception("Unexpected Network Name " + network.getName());
+ }
+ }
}
- }
- @Test
- public void testExtractOnlyComponents() throws Exception {
- ToscaServiceModel toscaServiceModel =
- loadToscaServiceModel("/extractServiceComposition/onlyComponents/",
- "/extractServiceComposition/toscaGlobalServiceTemplates/", null);
- CompositionData compositionData =
- compositionDataExtractor.extractServiceCompositionData(toscaServiceModel);
- Assert.assertEquals(compositionData.getComponents().size(), 3);
- Assert.assertEquals(compositionData.getNetworks().size(), 0);
+ @Test
+ public void testExtractOnlyComponents() throws Exception {
+ ToscaServiceModel toscaServiceModel =
+ loadToscaServiceModel("/extractServiceComposition/onlyComponents/",
+ "/extractServiceComposition/toscaGlobalServiceTemplates/", null);
+ CompositionData compositionData =
+ compositionDataExtractor.extractServiceCompositionData(toscaServiceModel);
+ assertEquals(3, compositionData.getComponents().size());
+ assertEquals(0, compositionData.getNetworks().size());
- for (Component component : compositionData.getComponents()) {
- switch (component.getData().getName()) {
- case "org.openecomp.resource.vfc.nodes.heat.pcrf_psm":
- Assert.assertNull(component.getNics());
- Assert.assertEquals(component.getData().getDisplayName(), "pcrf_psm");
- break;
- case "org.openecomp.resource.vfc.nodes.heat.nova.Server":
- Assert.assertNull(component.getNics());
- Assert.assertEquals(component.getData().getDisplayName(), "Server");
- break;
- case "org.openecomp.resource.vfc.nodes.heat.pcm":
- Assert.assertNull(component.getNics());
- Assert.assertEquals(component.getData().getDisplayName(), "pcm");
- break;
- default:
- throw new Exception("Unexpected ComponentData Name " + component.getData().getName());
- }
+ for (Component component : compositionData.getComponents()) {
+ switch (component.getData().getName()) {
+ case "org.openecomp.resource.vfc.nodes.heat.pcrf_psm":
+ assertNull(component.getNics());
+ assertEquals("pcrf_psm", component.getData().getDisplayName());
+ break;
+ case "org.openecomp.resource.vfc.nodes.heat.nova.Server":
+ assertNull(component.getNics());
+ assertEquals("Server", component.getData().getDisplayName());
+ break;
+ case "org.openecomp.resource.vfc.nodes.heat.pcm":
+ assertNull(component.getNics());
+ assertEquals("pcm", component.getData().getDisplayName());
+ break;
+ default:
+ throw new Exception("Unexpected ComponentData Name " + component.getData().getName());
+ }
+ }
}
- }
- @Test
- public void testExtractComponentsWithPorts() throws Exception {
+ @Test
+ public void testExtractComponentsWithPorts() throws Exception {
- ToscaServiceModel toscaServiceModel =
- loadToscaServiceModel("/extractServiceComposition/componentsWithPort/",
- "/extractServiceComposition/toscaGlobalServiceTemplates/", null);
- CompositionData compositionData =
- compositionDataExtractor.extractServiceCompositionData(toscaServiceModel);
+ ToscaServiceModel toscaServiceModel =
+ loadToscaServiceModel("/extractServiceComposition/componentsWithPort/",
+ "/extractServiceComposition/toscaGlobalServiceTemplates/", null);
+ CompositionData compositionData =
+ compositionDataExtractor.extractServiceCompositionData(toscaServiceModel);
- Assert.assertEquals(compositionData.getComponents().size(), 3);
- Assert.assertEquals(compositionData.getNetworks().size(), 0);
+ assertEquals(3, compositionData.getComponents().size());
+ assertEquals(0, compositionData.getNetworks().size());
- for (Component component : compositionData.getComponents()) {
- switch (component.getData().getName()) {
- case "org.openecomp.resource.vfc.nodes.heat.pcrf_psm":
- Assert.assertEquals(component.getNics().size(), 1);
- Assert.assertEquals(component.getNics().get(0).getName(), "psm01_port_0");
- Assert.assertNull(component.getNics().get(0).getNetworkName());
- Assert.assertEquals(component.getData().getDisplayName(), "pcrf_psm");
- break;
- case "org.openecomp.resource.vfc.nodes.heat.nova.Server":
- Assert.assertEquals(component.getNics().size(), 2);
- Assert.assertEquals(component.getNics().get(0).getName(), "template_VMInt_OAM_lb_2");
- Assert.assertNull(component.getNics().get(0).getNetworkName());
- Assert.assertEquals(component.getNics().get(1).getName(), "FSB1_Internal2");
- Assert.assertNull(component.getNics().get(1).getNetworkName());
- Assert.assertEquals(component.getData().getDisplayName(), "Server");
- break;
- case "org.openecomp.resource.vfc.nodes.heat.pcm":
- Assert.assertEquals(component.getNics().size(), 2);
- Assert.assertEquals(component.getData().getDisplayName(), "pcm");
- break;
- default:
- throw new Exception("Unexpected ComponentData Name " + component.getData().getName());
- }
+ for (Component component : compositionData.getComponents()) {
+ switch (component.getData().getName()) {
+ case "org.openecomp.resource.vfc.nodes.heat.pcrf_psm":
+ assertEquals(1, component.getNics().size());
+ assertEquals("psm01_port_0", component.getNics().get(0).getName());
+ assertNull(component.getNics().get(0).getNetworkName());
+ assertEquals("pcrf_psm", component.getData().getDisplayName());
+ break;
+ case "org.openecomp.resource.vfc.nodes.heat.nova.Server":
+ assertEquals(2, component.getNics().size());
+ assertEquals("template_VMInt_OAM_lb_2", component.getNics().get(0).getName());
+ assertNull(component.getNics().get(0).getNetworkName());
+ assertEquals("FSB1_Internal2", component.getNics().get(1).getName());
+ assertNull(component.getNics().get(1).getNetworkName());
+ assertEquals("Server", component.getData().getDisplayName());
+ break;
+ case "org.openecomp.resource.vfc.nodes.heat.pcm":
+ assertEquals(2, component.getNics().size());
+ assertEquals("pcm", component.getData().getDisplayName());
+ break;
+ default:
+ throw new Exception("Unexpected ComponentData Name " + component.getData().getName());
+ }
+ }
}
- }
- @Test
- public void testExtractFullComposition() throws Exception {
+ @Test
+ public void testExtractFullComposition() throws Exception {
- ToscaServiceModel toscaServiceModel =
- loadToscaServiceModel("/extractServiceComposition/fullComposition/",
- "/extractServiceComposition/toscaGlobalServiceTemplates/", null);
- CompositionData compositionData =
- compositionDataExtractor.extractServiceCompositionData(toscaServiceModel);
- Assert.assertEquals(compositionData.getComponents().size(), 3);
- Assert.assertEquals(compositionData.getNetworks().size(), 4);
+ ToscaServiceModel toscaServiceModel =
+ loadToscaServiceModel("/extractServiceComposition/fullComposition/",
+ "/extractServiceComposition/toscaGlobalServiceTemplates/", null);
+ CompositionData compositionData =
+ compositionDataExtractor.extractServiceCompositionData(toscaServiceModel);
+ assertEquals(3, compositionData.getComponents().size());
+ assertEquals(4, compositionData.getNetworks().size());
- for (Component component : compositionData.getComponents()) {
- switch (component.getData().getName()) {
- case "org.openecomp.resource.vfc.nodes.heat.pcrf_psm":
- Assert.assertEquals(component.getNics().size(), 1);
- Assert.assertEquals(component.getNics().get(0).getName(), "psm01_port_0");
- Assert.assertNull(component.getNics().get(0).getNetworkName());
- Assert.assertEquals(component.getData().getDisplayName(), "pcrf_psm");
- break;
- case "org.openecomp.resource.vfc.nodes.heat.nova.Server":
- Assert.assertEquals(component.getNics().size(), 4);
- Assert.assertEquals(component.getData().getDisplayName(), "Server");
- for (Nic port : component.getNics()) {
- switch (port.getName()) {
- case "FSB1_Internal2_port":
- Assert.assertEquals(port.getNetworkName(), "Internal2-net");
- break;
- case "FSB1_OAM_Port":
- Assert.assertNull(port.getNetworkName());
- break;
- case "FSB1_Internal1_port":
- Assert.assertEquals(port.getNetworkName(), "Internal1-net");
- break;
- case "template_VMInt_OAM_lb_2":
- Assert.assertEquals(port.getNetworkName(), "jsa_net1");
- break;
- default:
- throw new Exception("Unexpected Nic " + port.getName());
+ for (Component component : compositionData.getComponents()) {
+ switch (component.getData().getName()) {
+ case "org.openecomp.resource.vfc.nodes.heat.pcrf_psm":
+ assertEquals(1, component.getNics().size());
+ assertEquals("psm01_port_0", component.getNics().get(0).getName());
+ assertNull(component.getNics().get(0).getNetworkName());
+ assertEquals("pcrf_psm", component.getData().getDisplayName());
+ break;
+ case "org.openecomp.resource.vfc.nodes.heat.nova.Server":
+ assertEquals(4, component.getNics().size());
+ assertEquals("Server", component.getData().getDisplayName());
+ for (Nic port : component.getNics()) {
+ switch (port.getName()) {
+ case "FSB1_Internal2_port":
+ assertEquals("Internal2-net", port.getNetworkName());
+ break;
+ case "FSB1_OAM_Port":
+ assertNull(port.getNetworkName());
+ break;
+ case "FSB1_Internal1_port":
+ assertEquals("Internal1-net", port.getNetworkName());
+ break;
+ case "template_VMInt_OAM_lb_2":
+ assertEquals("jsa_net1", port.getNetworkName());
+ break;
+ default:
+ throw new Exception("Unexpected Nic " + port.getName());
+ }
+ }
+ break;
+ case "org.openecomp.resource.vfc.nodes.heat.pcm":
+ assertEquals(2, component.getNics().size());
+ assertEquals("pcm", component.getData().getDisplayName());
+ break;
+ default:
+ throw new Exception("Unexpected ComponentData Name " + component.getData().getName());
}
- }
- break;
- case "org.openecomp.resource.vfc.nodes.heat.pcm":
- Assert.assertEquals(component.getNics().size(), 2);
- Assert.assertEquals(component.getData().getDisplayName(), "pcm");
- break;
- default:
- throw new Exception("Unexpected ComponentData Name " + component.getData().getName());
- }
+ }
}
- }
- @Test
- public void testExtractSubstitutionComposition() throws Exception {
+ @Test
+ public void testExtractSubstitutionComposition() throws Exception {
- ToscaServiceModel toscaServiceModel =
- loadToscaServiceModel("/extractServiceComposition/substitution/",
- "/extractServiceComposition/toscaGlobalServiceTemplates/", null);
- CompositionData compositionData =
- compositionDataExtractor.extractServiceCompositionData(toscaServiceModel);
- Assert.assertEquals(compositionData.getComponents().size(), 2);
- Assert.assertEquals(compositionData.getNetworks().size(), 4);
+ ToscaServiceModel toscaServiceModel =
+ loadToscaServiceModel("/extractServiceComposition/substitution/",
+ "/extractServiceComposition/toscaGlobalServiceTemplates/", null);
+ CompositionData compositionData =
+ compositionDataExtractor.extractServiceCompositionData(toscaServiceModel);
+ assertEquals(2, compositionData.getComponents().size());
+ assertEquals(4, compositionData.getNetworks().size());
- for (Component component : compositionData.getComponents()) {
- switch (component.getData().getName()) {
- case "org.openecomp.resource.vfc.nodes.heat.cmaui_image":
- Assert.assertEquals(component.getNics().size(), 1);
- Assert.assertEquals(component.getNics().get(0).getName(), "cmaui_port_1");
- Assert.assertEquals(component.getNics().get(0).getNetworkName(), "test_net1");
- Assert.assertEquals(component.getData().getDisplayName(), "cmaui_image");
- break;
- case "org.openecomp.resource.vfc.nodes.heat.abc_image":
- Assert.assertEquals(component.getNics().size(), 1);
- Assert.assertEquals(component.getNics().get(0).getName(), "abc_port_1");
- Assert.assertEquals(component.getNics().get(0).getNetworkName(), "test_net2");
- Assert.assertEquals(component.getData().getDisplayName(), "abc_image");
- break;
- default:
- throw new Exception("Unexpected ComponentData Name " + component.getData().getName());
- }
- }
- for (Network network : compositionData.getNetworks()) {
- boolean dhcp = network.isDhcp();
- switch (network.getName()) {
- case "test_net2":
- Assert.assertEquals(dhcp, true);
- break;
- case "test_net1":
- Assert.assertEquals(dhcp, true);
- break;
- case "Internal1-net": // same network display twice since define in 2 nested files with the same key
- Assert.assertEquals(dhcp, true);
- break;
- default:
- throw new Exception("Unexpected Network Name " + network.getName());
- }
+ for (Component component : compositionData.getComponents()) {
+ switch (component.getData().getName()) {
+ case "org.openecomp.resource.vfc.nodes.heat.cmaui_image":
+ assertEquals(1, component.getNics().size());
+ assertEquals("cmaui_port_1", component.getNics().get(0).getName());
+ assertEquals("test_net1", component.getNics().get(0).getNetworkName());
+ assertEquals("cmaui_image", component.getData().getDisplayName());
+ break;
+ case "org.openecomp.resource.vfc.nodes.heat.abc_image":
+ assertEquals(1, component.getNics().size());
+ assertEquals("abc_port_1", component.getNics().get(0).getName());
+ assertEquals("test_net2", component.getNics().get(0).getNetworkName());
+ assertEquals("abc_image", component.getData().getDisplayName());
+ break;
+ default:
+ throw new Exception("Unexpected ComponentData Name " + component.getData().getName());
+ }
+ }
+ for (Network network : compositionData.getNetworks()) {
+ boolean dhcp = network.isDhcp();
+ switch (network.getName()) {
+ case "test_net2":
+ assertTrue(dhcp);
+ break;
+ case "test_net1":
+ assertTrue(dhcp);
+ break;
+ case "Internal1-net": // same network display twice since define in 2 nested files with the same key
+ assertTrue(dhcp);
+ break;
+ default:
+ throw new Exception("Unexpected Network Name " + network.getName());
+ }
+ }
}
- }
}