summaryrefslogtreecommitdiffstats
path: root/appc-config/appc-flow-controller
diff options
context:
space:
mode:
Diffstat (limited to 'appc-config/appc-flow-controller')
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowSequenceGenerator.java4
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowSequenceGeneratorTest.java20
2 files changed, 22 insertions, 2 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowSequenceGenerator.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowSequenceGenerator.java
index db5791305..276301ed3 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowSequenceGenerator.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowSequenceGenerator.java
@@ -131,6 +131,10 @@ class FlowSequenceGenerator {
flowSequence = output.toString();
log.info("MultistepSequenceGenerator-Output: " + flowSequence);
+ if (!flowSequence.contains("transactions")) {
+ throw new Exception("No transactions were generated for this request");
+ }
+
} else if (sequenceType.equalsIgnoreCase(EXTERNAL)) {
//String input = collectInputParams(localContext);
// flowSequnce = ""; //get it from the External interface calling the Rest End point - TBD
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowSequenceGeneratorTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowSequenceGeneratorTest.java
index 533de5840..1846a0922 100644
--- a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowSequenceGeneratorTest.java
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowSequenceGeneratorTest.java
@@ -166,12 +166,28 @@ public class FlowSequenceGeneratorTest {
when(ctx.getAttribute(VNF_ID)).thenReturn("some-vnf-id");
Map<String, String> map = new HashMap<>();
- map.put("restResponse", "{'output':{'dummy-json-object':'some-param'}}".replaceAll("'", "\""));
+ map.put("restResponse", "{'output':{'transactions':[{'transaction-id':'1','payload':''}]}}".replaceAll("'", "\""));
when(restExecutor.execute(any(Transaction.class), eq(localCtx))).thenReturn(map);
String flowSequence = flowSequenceGenerator.getFlowSequence(inParams, ctx, localCtx);
- Assert.assertEquals("{'dummy-json-object':'some-param'}".replaceAll("'", "\""), flowSequence);
+ //Assert.assertEquals("{'dummy-json-object':'some-param'}".replaceAll("'", "\""), flowSequence);
+ Assert.assertEquals("{'transactions':[{'transaction-id':'1','payload':''}]}".replaceAll("'", "\""), flowSequence);
+ }
+
+ @Test
+ public void sequence_type_is_runtime_but_no_transactions_generated() throws Exception {
+ when(localCtx.getAttribute(SEQUENCE_TYPE)).thenReturn(RUNTIME);
+ when(ctx.getAttribute(VNF_TYPE)).thenReturn("some-vnf-type");
+ when(ctx.getAttribute(VNF_ID)).thenReturn("some-vnf-id");
+
+ Map<String, String> map = new HashMap<>();
+ // {"status":{"code":450,"message":"Request is not supported"}}
+ map.put("restResponse", "{'output':{'status':{'code':450,'message':'Request is not supported'}}}".replaceAll("'", "\""));
+ when(restExecutor.execute(any(Transaction.class), eq(localCtx))).thenReturn(map);
+ expectedException.expectMessage("No transactions were generated for this request");
+
+ String flowSequence = flowSequenceGenerator.getFlowSequence(inParams, ctx, localCtx);
}
@Test