summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImplTest.java155
-rw-r--r--src/test/java/org/onap/clamp/clds/util/XmlToolsTest.java72
-rw-r--r--src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java90
-rw-r--r--src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphTest.java77
-rw-r--r--src/test/java/org/onap/clamp/clds/util/drawing/DocumentBuilderTest.java80
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java4
-rw-r--r--src/test/resources/clds/util/file.xml6
7 files changed, 460 insertions, 24 deletions
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImplTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImplTest.java
index a995c523d..1fe3ff3d9 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImplTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImplTest.java
@@ -17,50 +17,161 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
+ * * Modifications copyright (c) 2019 Nokia
* ===================================================================
*
*/
-package org.onap.clamp.clds.sdc.controller.installer;
-import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+package org.onap.clamp.clds.sdc.controller.installer;
import com.google.gson.JsonObject;
import java.io.IOException;
+import java.io.InputStream;
+import org.apache.commons.io.IOUtils;
+import org.assertj.core.api.Assertions;
+import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.clamp.clds.client.DcaeInventoryServices;
+import org.onap.clamp.clds.config.sdc.BlueprintParserFilesConfiguration;
+import org.onap.clamp.clds.dao.CldsDao;
+import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
+import org.onap.clamp.clds.service.CldsService;
+import org.onap.clamp.clds.service.CldsTemplateService;
+import org.onap.clamp.clds.transform.XslTransformer;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.notification.IResourceInstance;
+import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.io.Resource;
+@RunWith(MockitoJUnitRunner.class)
public class CsarInstallerImplTest {
+ @Mock
+ private CsarHandler csarHandler;
+
+ @Mock
+ private ApplicationContext applicationContext;
+
+ @Mock
+ private DcaeInventoryServices dcaeInventoryServices;
+
+ @Mock
+ private IResourceInstance resourceInstance;
+
+ @Mock
+ private CldsService cldsService;
+
+ @Mock
+ private INotificationData notificationData;
+
+ @Mock
+ private Metadata metadata;
+
+ @Mock
+ private ISdcCsarHelper sdcCsarHelper;
+
+ private CsarInstallerImpl csarInstaller;
+ private BlueprintArtifact artifact;
+
+ /**
+ * Set up method.
+ * throws: Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ String dceaBlueprint = ResourceFileUtil.getResourceAsString("tosca/dcea_blueprint.yml");
+ artifact = prepareBlueprintArtifact(dceaBlueprint);
+ csarInstaller = new CsarInstallerImpl(applicationContext, new CldsDao(), new CldsTemplateService(),
+ cldsService, dcaeInventoryServices, new XslTransformer());
+ }
+
@Test
- public void shouldReturnInputParametersFromBlueprint() throws IOException {
+ public void shouldReturnInputParametersFromBlueprint() {
//given
String expectedBlueprintInputsText = "{\"aaiEnrichmentHost\":\"aai.onap.svc.cluster.local\""
- + ",\"aaiEnrichmentPort\":\"8443\""
- + ",\"enableAAIEnrichment\":true"
- + ",\"dmaap_host\":\"message-router\""
- + ",\"dmaap_port\":\"3904\""
- + ",\"enableRedisCaching\":false"
- + ",\"redisHosts\":\"dcae-redis:6379\""
- + ",\"tag_version\":\"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0\""
- + ",\"consul_host\":\"consul-server\""
- + ",\"consul_port\":\"8500\",\"cbs_host\":\"{\\\"test\\\":"
- + "{\\\"test\\\":\\\"test\\\"}}\",\"cbs_port\":\"10000\""
- + ",\"external_port\":\"32010\",\"policy_id\":\"AUTO_GENERATED_POLICY_ID_AT_SUBMIT\"}";
+ + ",\"aaiEnrichmentPort\":\"8443\""
+ + ",\"enableAAIEnrichment\":true"
+ + ",\"dmaap_host\":\"message-router\""
+ + ",\"dmaap_port\":\"3904\""
+ + ",\"enableRedisCaching\":false"
+ + ",\"redisHosts\":\"dcae-redis:6379\""
+ + ",\"tag_version\":"
+ + "\"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0\""
+ + ",\"consul_host\":\"consul-server\""
+ + ",\"consul_port\":\"8500\",\"cbs_host\":\"{\\\"test\\\":"
+ + "{\\\"test\\\":\\\"test\\\"}}\",\"cbs_port\":\"10000\""
+ + ",\"external_port\":\"32010\",\"policy_id\":\"AUTO_GENERATED_POLICY_ID_AT_SUBMIT\"}";
JsonObject expectedBlueprintInputs = JsonUtils.GSON.fromJson(expectedBlueprintInputsText, JsonObject.class);
- String dceaBlueprint = ResourceFileUtil.getResourceAsString("tosca/dcea_blueprint.yml");
- BlueprintArtifact blueprintArtifact = mock(BlueprintArtifact.class);
- when(blueprintArtifact.getDcaeBlueprint()).thenReturn(dceaBlueprint);
- CsarInstallerImpl csarInstaller = new CsarInstallerImpl();
+ //when
+ String parametersInJson = csarInstaller.getAllBlueprintParametersInJson(artifact);
+ //then
+ Assertions.assertThat(JsonUtils.GSON.fromJson(parametersInJson, JsonObject.class))
+ .isEqualTo(expectedBlueprintInputs);
+ }
+ @Test
+ public void shouldReturnBuildModelName() throws SdcArtifactInstallerException {
+ //given
+ String expectedModelName = "CLAMP_test_name_"
+ + "vtest_service_version_"
+ + "test_resource_instance_name_"
+ + "test_artifact_name";
+ prepareMockCsarHandler("name", "test_name",
+ "test_service_version");
+ Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn("test_resource_instance_name");
//when
- String parametersInJson = csarInstaller.getAllBlueprintParametersInJson(blueprintArtifact);
+ String actualModelName = CsarInstallerImpl.buildModelName(csarHandler, artifact);
+ //then
+ Assertions.assertThat(actualModelName).isEqualTo(expectedModelName);
+ }
+
+ @Test
+ public void shouldReturnRightMapping() throws SdcArtifactInstallerException, IOException {
+ //given
+ String input = "[{\"blueprintKey\":\"tca_k8s\","
+ + "\"dcaeDeployable\":false,"
+ + "\"files\":{\"svgXmlFilePath\":\"samplePath\",\"bpmnXmlFilePath\":\"samplePath\"}}]";
+ BlueprintParserFilesConfiguration filesConfiguration = new BlueprintParserFilesConfiguration();
+ filesConfiguration.setBpmnXmlFilePath("samplePath");
+ filesConfiguration.setSvgXmlFilePath("samplePath");
+ Resource resource = Mockito.mock(Resource.class);
+ InputStream inputStream = IOUtils.toInputStream(input, "UTF-8");
+ Mockito.when(applicationContext.getResource(Mockito.any(String.class))).thenReturn(resource);
+ Mockito.when(resource.getInputStream()).thenReturn(inputStream);
+ csarInstaller.loadConfiguration();
+ //when
+ BlueprintParserFilesConfiguration configuration = csarInstaller.searchForRightMapping(artifact);
//then
- assertThat(JsonUtils.GSON.fromJson(parametersInJson, JsonObject.class)).isEqualTo(expectedBlueprintInputs);
+ Assertions.assertThat(configuration.getBpmnXmlFilePath()).isEqualTo("samplePath");
+ Assertions.assertThat(configuration.getSvgXmlFilePath()).isEqualTo("samplePath");
+ }
+
+ private BlueprintArtifact prepareBlueprintArtifact(String dceaBlueprint) {
+ artifact = new BlueprintArtifact();
+ artifact.setBlueprintArtifactName("test_artifact_name");
+ artifact.setBlueprintInvariantServiceUuid("test_inv_uuid");
+ artifact.setResourceAttached(resourceInstance);
+ artifact.setDcaeBlueprint(dceaBlueprint);
+ return artifact;
+ }
+
+ private void prepareMockCsarHandler(String metadataNameMockInput, String metadataNameMockOutput,
+ String serviceVersion) {
+ Mockito.when(csarHandler.getSdcCsarHelper()).thenReturn(sdcCsarHelper);
+ Mockito.when(sdcCsarHelper.getServiceMetadata()).thenReturn(metadata);
+ Mockito.when(metadata.getValue(metadataNameMockInput)).thenReturn(metadataNameMockOutput);
+ Mockito.when(csarHandler.getSdcNotification()).thenReturn(notificationData);
+ Mockito.when(notificationData.getServiceVersion()).thenReturn(serviceVersion);
}
} \ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/clds/util/XmlToolsTest.java b/src/test/java/org/onap/clamp/clds/util/XmlToolsTest.java
new file mode 100644
index 000000000..4351a80d4
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/util/XmlToolsTest.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. 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.onap.clamp.clds.util;
+
+import java.io.IOException;
+import java.io.StringReader;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.apache.batik.anim.dom.SVGDOMImplementation;
+import org.apache.batik.util.SVGConstants;
+import org.junit.Assert;
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class XmlToolsTest {
+
+ @Test
+ public void exportXmlDocumentAsStringTest() throws IOException, ParserConfigurationException, SAXException {
+ String expected = ResourceFileUtil.getResourceAsString("clds/util/file.xml");
+ Document document = parseStringToXmlDocument(expected);
+ String actual = XmlTools.exportXmlDocumentAsString(document);
+ Assert.assertEquals(expected.trim(), actual.trim());
+ }
+
+ @Test
+ public void createEmptySvgDocumentTest() {
+ Document doc = XmlTools.createEmptySvgDocument();
+ Assert.assertEquals(SVGDOMImplementation.SVG_NAMESPACE_URI, doc.getDocumentElement().getNamespaceURI());
+ Assert.assertEquals(SVGConstants.SVG_SVG_TAG, doc.getDocumentElement().getNodeName());
+ Assert.assertNull(doc.getDoctype());
+ }
+
+
+ public static Document parseStringToXmlDocument(String res)
+ throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setValidating(false);
+ dbf.setNamespaceAware(true);
+ dbf.setFeature("http://xml.org/sax/features/namespaces", false);
+ dbf.setFeature("http://xml.org/sax/features/validation", false);
+ dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
+ dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ InputSource is = new InputSource(new StringReader(res));
+ return db.parse(is);
+ }
+
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
new file mode 100644
index 000000000..477e6a73f
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. 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.onap.clamp.clds.util.drawing;
+
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.Arrays;
+import java.util.List;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ClampGraphBuilderTest {
+ @Mock
+ private Painter mockPainter;
+
+ @Captor
+ private ArgumentCaptor<String> collectorCaptor;
+
+ @Captor
+ private ArgumentCaptor<List<String>> microServicesCaptor;
+
+ @Captor
+ private ArgumentCaptor<String> policyCaptor;
+
+ @Test
+ public void clampGraphBuilderCompleteChainTest() {
+ String collector = "VES";
+ String ms1 = "ms1";
+ String ms2 = "ms2";
+ String policy = "Policy";
+ List<String> microServices = Arrays.asList(ms1, ms2);
+
+ ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter);
+ clampGraphBuilder.collector(collector).microService(ms1).microService(ms2).policy(policy).build();
+
+ verify(mockPainter, times(1))
+ .doPaint(collectorCaptor.capture(), microServicesCaptor.capture(), policyCaptor.capture());
+
+ Assert.assertEquals(collector, collectorCaptor.getValue());
+ Assert.assertEquals(microServices, microServicesCaptor.getValue());
+ Assert.assertEquals(policy, policyCaptor.getValue());
+ }
+
+ @Test(expected = InvalidStateException.class)
+ public void clampGraphBuilderNoPolicyGivenTest() {
+ String collector = "VES";
+ String ms1 = "ms1";
+ String ms2 = "ms2";
+
+ ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter);
+ clampGraphBuilder.collector(collector).microService(ms1).microService(ms2).build();
+ }
+
+ @Test(expected = InvalidStateException.class)
+ public void clampGraphBuilderNoMicroServiceGivenTest() {
+ String collector = "VES";
+ String policy = "Policy";
+
+ ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter);
+ clampGraphBuilder.collector(collector).policy(policy).build();
+ }
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphTest.java b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphTest.java
new file mode 100644
index 000000000..6bbebdfde
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. 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.onap.clamp.clds.util.drawing;
+
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.XmlToolsTest;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ClampGraphTest {
+ @Mock
+ private DocumentBuilder mockDocumentBuilder;
+
+ @Test
+ public void getAsSVGTest() throws IOException, ParserConfigurationException, SAXException {
+ String expected = ResourceFileUtil.getResourceAsString("clds/util/file.xml");
+ Document document = XmlToolsTest.parseStringToXmlDocument(expected);
+
+ when(mockDocumentBuilder.getGroupingDocument()).thenReturn(document);
+
+ String actual = new ClampGraph(mockDocumentBuilder).getAsSVG();
+ Assert.assertEquals(expected.trim(), actual.trim());
+ }
+
+ @Test
+ public void getAsSVGLazyTest() throws IOException, ParserConfigurationException, SAXException {
+ String expected = ResourceFileUtil.getResourceAsString("clds/util/file.xml");
+ Document document = XmlToolsTest.parseStringToXmlDocument(expected);
+
+ when(mockDocumentBuilder.getGroupingDocument()).thenReturn(document);
+ ClampGraph cg = new ClampGraph(mockDocumentBuilder);
+
+ String actualFirst = cg.getAsSVG();
+ verify(mockDocumentBuilder, times(1)).getGroupingDocument();
+
+ String actualSecond = cg.getAsSVG();
+ verifyNoMoreInteractions(mockDocumentBuilder);
+
+ Assert.assertEquals(expected.trim(), actualFirst.trim());
+ Assert.assertEquals(expected.trim(), actualSecond.trim());
+
+ }
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/clds/util/drawing/DocumentBuilderTest.java b/src/test/java/org/onap/clamp/clds/util/drawing/DocumentBuilderTest.java
new file mode 100644
index 000000000..6546553c7
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/util/drawing/DocumentBuilderTest.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. 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.onap.clamp.clds.util.drawing;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
+import org.apache.batik.svggen.SVGGraphics2D;
+import org.apache.batik.util.SVGConstants;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.XmlToolsTest;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+@RunWith(MockitoJUnitRunner.class)
+public class DocumentBuilderTest {
+ @Mock
+ private SVGGraphics2D mockG2d;
+
+ @Mock
+ private Document mockDomImpl;
+
+ @Test
+ public void pushChangestoDocumentTest() throws IOException, ParserConfigurationException, SAXException {
+ String dataElementId = "someId";
+ String newNodeTag = "tagged";
+ String newNodeText = "Sample text";
+ String xml = ResourceFileUtil.getResourceAsString("clds/util/file.xml");
+ Document document = XmlToolsTest.parseStringToXmlDocument(xml);
+ Node newNode = document.createElement(newNodeTag);
+ newNode.appendChild(document.createTextNode(newNodeText));
+
+ when(mockG2d.getRoot(any(Element.class))).then(a -> a.getArgumentAt(0, Element.class).appendChild(newNode));
+
+ DocumentBuilder db = new DocumentBuilder(document, document);
+ db.pushChangestoDocument(mockG2d, dataElementId);
+ Document actualDocument = db.getGroupingDocument();
+
+ Node addedActualNode = actualDocument.getDocumentElement().getLastChild();
+ String actualDataElementId =
+ addedActualNode.getAttributes().getNamedItem(DocumentBuilder.DATA_ELEMENT_ID_ATTRIBUTE).getTextContent();
+
+ Assert.assertEquals(dataElementId, actualDataElementId);
+ Assert.assertEquals(SVGConstants.SVG_G_TAG, addedActualNode.getNodeName());
+
+ Node addedActualNodeChild = addedActualNode.getLastChild();
+ Assert.assertEquals(newNodeTag, addedActualNodeChild.getNodeName());
+ Assert.assertEquals(newNodeText, addedActualNodeChild.getTextContent());
+ }
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
index a9c308737..b7781bf2c 100644
--- a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
@@ -70,7 +70,7 @@ public class LoopServiceTestItCase {
testLoop.setLastComputedState(LoopState.DESIGN);
//when
- Loop actualLoop = loopService.addNewLoop(testLoop);
+ Loop actualLoop = loopService.saveOrUpdateLoop(testLoop);
//then
assertThat(actualLoop).isNotNull();
@@ -166,7 +166,7 @@ public class LoopServiceTestItCase {
private void saveTestLoopToDb() {
Loop testLoop = createTestLoop(EXAMPLE_LOOP_NAME, "blueprint", "representation");
testLoop.setGlobalPropertiesJson(JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class));
- loopService.addNewLoop(testLoop);
+ loopService.saveOrUpdateLoop(testLoop);
}
@Test
diff --git a/src/test/resources/clds/util/file.xml b/src/test/resources/clds/util/file.xml
new file mode 100644
index 000000000..81560bab4
--- /dev/null
+++ b/src/test/resources/clds/util/file.xml
@@ -0,0 +1,6 @@
+<note>
+ <to>Tove</to>
+ <from>Jani</from>
+ <heading>Reminder</heading>
+ <body>Message body</body>
+</note>