diff options
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace/src')
4 files changed, 23 insertions, 17 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java index 1f588c1f..e0513360 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java @@ -88,17 +88,23 @@ public class VTPExecutionResource extends VTPResource{ execution.setEndTime(endTime); execution.setExecutionId(output.getAddonsMap().get("execution-id")); + // set execution status based on success from test. if (output.getSuccess()) { - execution.setStatus(VTPTestExecution.Status.COMPLETED.name()); + execution.setStatus(VTPTestExecution.Status.COMPLETED.name()); + } + else { + execution.setStatus(VTPTestExecution.Status.FAILED.name()); + } - ObjectMapper mapper = new ObjectMapper(); - JsonNode resultJson = mapper.readTree(output.getAttrsMap().get("results")); - execution.setResults(resultJson); - } else { - execution.setStatus(VTPTestExecution.Status.FAILED.name()); - ObjectMapper mapper = new ObjectMapper(); - JsonNode resultJson = mapper.readTree(output.getAttrsMap().get("error")); - execution.setResults(resultJson); + // set the results from what is available in the output independent of status. + // tests can fail but still produce results. + ObjectMapper mapper = new ObjectMapper(); + Map<String,String> m = output.getAttrsMap(); + if (m.containsKey("results")) { + execution.setResults(mapper.readTree(m.get("results"))); + } + else if (m.containsKey("error")) { + execution.setResults(mapper.readTree(m.get("error"))); } } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/VTPScenarioResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/VTPScenarioResource.java index 66849f34..fda50ca4 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/VTPScenarioResource.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/VTPScenarioResource.java @@ -198,7 +198,7 @@ public class VTPScenarioResource extends VTPResource{ VTPTestCase tc = new VTPTestCase(); tc.setTestCaseName(schema.get("name").asText()); - tc.setDescripton(schema.get("description").asText()); + tc.setDescription(schema.get("description").asText()); tc.setTestSuiteName(schema.get("service").asText()); tc.setAuthor(schema.get("author").asText()); JsonNode inputsJson = schema.get("inputs"); diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/model/VTPTestCase.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/model/VTPTestCase.java index f0ab2e38..8e7d76c2 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/model/VTPTestCase.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/model/VTPTestCase.java @@ -27,7 +27,7 @@ public class VTPTestCase extends VTPModelBase{ private String scenario; private String testCaseName; private String testSuiteName; - private String descripton; + private String description; private String author; private List<VTPTestCaseInput> inputs = new ArrayList<>(); private List<VTPTestCaseOutput> outputs = new ArrayList<>(); @@ -47,11 +47,11 @@ public class VTPTestCase extends VTPModelBase{ return this; } - public String getDescripton() { - return descripton; + public String getDescription() { + return description; } - public void setDescripton(String descripton) { - this.descripton = descripton; + public void setDescription(String description) { + this.description = description; } public List<VTPTestCaseInput> getInputs() { diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/model/VTPTestCaseTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/model/VTPTestCaseTest.java index 6c0e9027..67e85d7e 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/model/VTPTestCaseTest.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/model/VTPTestCaseTest.java @@ -38,14 +38,14 @@ public class VTPTestCaseTest { List<VTPTestCase.VTPTestCaseInput> list= new ArrayList<>(); List<VTPTestCase.VTPTestCaseOutput> list1=new ArrayList<>(); vtpTestCase.setAuthor("abc"); - vtpTestCase.setDescripton("abc"); + vtpTestCase.setDescription("abc"); vtpTestCase.setInputs(null); vtpTestCase.setOutputs(null); vtpTestCase.setScenario("abc"); vtpTestCase.setTestCaseName("abc"); vtpTestCase.setTestSuiteName("abc"); assertEquals(vtpTestCase.getAuthor(),"abc"); - assertEquals(vtpTestCase.getDescripton(),"abc"); + assertEquals(vtpTestCase.getDescription(),"abc"); assertNull(vtpTestCase.getInputs()); assertNull(vtpTestCase.getOutputs()); assertEquals(vtpTestCase.getTestCaseName(),"abc"); |