summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test/java
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 09:55:48 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 09:59:06 -0400
commit86c09b9e23e7f41019eb4b70a0f95e6f7dbeb7bb (patch)
treebe2883789a5835f4177afdf2ce31d8e9437b7cdc /bpmn/so-bpmn-tasks/src/test/java
parente757e801c665a1758cf4c976b24df13adda38b2b (diff)
SDNHandler callback correlation issue.
SDNHandler callback correlation issue. Should not go back to waiting for callback when final_indicator=Y is receibed in callback. Raise an error when responseCode in callback mesage is not 200. Change-Id: Ia55ab5a9bafdfe877a1221b67d5f3258039a3900 Issue-ID: SO-1761 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
index f1779cf119..043aad43b1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
@@ -27,9 +27,13 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.io.IOException;
+import java.io.StringReader;
import java.nio.file.Files;
import java.nio.file.Paths;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -51,6 +55,8 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -131,12 +137,29 @@ public class SDNCRequestTasksTest extends SDNCRequestTasks{
@Test
public void processCallBack_Final_Test() throws MapperException, BadResponseException, IOException{
- final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_ASYNC_Request.json")));
+ final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_Async_Request2.xml")));
delegateExecution.setVariable("correlationName_MESSAGE", sdncResponse);
sndcRequestTasks.processCallback(delegateExecution);
assertEquals(true,delegateExecution.getVariable(IS_CALLBACK_COMPLETED));
}
+ @Test
+ public void getXmlElementTest() throws Exception {
+ final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_Async_Request2.xml")));
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance ();
+ DocumentBuilder db;
+ db = dbf.newDocumentBuilder ();
+ Document doc = db.parse (new InputSource(new StringReader(sdncResponse)));
+
+ String finalMessageIndicator = getXmlElement(doc, "/input/ack-final-indicator");
+ String responseCode = getXmlElement(doc, "/input/response-code");
+ String responseMessage = getXmlElement(doc, "/input/response-message");
+
+ assertEquals("Y", finalMessageIndicator);
+ assertEquals("200", responseCode);
+ assertEquals("Success", responseMessage);
+ }
+
public SDNCRequest createSDNCRequest(){
SDNCRequest request = new SDNCRequest();
request.setCorrelationName("correlationName");