From fbe35388ec1841b8a75fb054d2fc809b901c11aa Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Thu, 14 Sep 2017 16:11:00 +0200 Subject: Add new tests for DAO New test to validate some methods of the DAO and attempt to disable Camunda in IT when it was not required to have it Change-Id: I231230a7a4818f4bfd7887319a321625f66ffcae Issue-ID: CLAMP-54 Signed-off-by: Determe, Sebastien (sd378r) --- .../java/org/onap/clamp/clds/it/CldsDaoIT.java | 149 +++++++++++++++++++++ src/test/java/org/onap/clamp/clds/it/DcaeIT.java | 10 +- src/test/java/org/onap/clamp/clds/it/HttpsIT.java | 3 +- .../org/onap/clamp/clds/it/PolicyClientIT.java | 2 + .../org/onap/clamp/clds/it/PropJsonBuilderIT.java | 83 ++++++------ .../java/org/onap/clamp/clds/it/RefPropIT.java | 5 +- .../onap/clamp/clds/it/SdcCatalogServicesIT.java | 5 +- src/test/java/org/onap/clamp/clds/it/SdcIT.java | 20 +-- 8 files changed, 213 insertions(+), 64 deletions(-) create mode 100644 src/test/java/org/onap/clamp/clds/it/CldsDaoIT.java (limited to 'src/test/java/org/onap') diff --git a/src/test/java/org/onap/clamp/clds/it/CldsDaoIT.java b/src/test/java/org/onap/clamp/clds/it/CldsDaoIT.java new file mode 100644 index 00000000..bd419647 --- /dev/null +++ b/src/test/java/org/onap/clamp/clds/it/CldsDaoIT.java @@ -0,0 +1,149 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.clamp.clds.it; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; + +import javax.ws.rs.NotFoundException; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.clamp.clds.AbstractIT; +import org.onap.clamp.clds.dao.CldsDao; +import org.onap.clamp.clds.model.CldsEvent; +import org.onap.clamp.clds.model.CldsModel; +import org.onap.clamp.clds.model.CldsTemplate; +import org.onap.clamp.clds.util.ResourceFileUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; + +/** + * Test CldsDAO calls through CldsModel and CldsEvent. This really test the DB + * and stored procedures. + */ +@RunWith(SpringRunner.class) +@SpringBootTest +@TestPropertySource(locations = "classpath:application-no-camunda.properties") +public class CldsDaoIT extends AbstractIT { + + @Autowired + public CldsDao cldsDao; + + private String bpmnText; + private String imageText; + private String bpmnPropText; + + @Before + public void setupBefore() throws IOException { + bpmnText = ResourceFileUtil.getResourceAsString("example/dao/bpmn-template.xml"); + imageText = ResourceFileUtil.getResourceAsString("example/dao/image-template.xml"); + bpmnPropText = ResourceFileUtil.getResourceAsString("example/dao/bpmn-prop.json"); + } + + @Test + public void testModelSave() throws IOException { + // Add the template first + CldsTemplate newTemplate = new CldsTemplate(); + newTemplate.setName("test-template"); + + newTemplate.setBpmnText(bpmnText); + newTemplate.setImageText(imageText); + + // Save the template in DB + cldsDao.setTemplate(newTemplate, "user"); + // Test if it's well there + CldsTemplate newTemplateRead = cldsDao.getTemplate("test-template"); + assertEquals(bpmnText, newTemplateRead.getBpmnText()); + assertEquals(imageText, newTemplateRead.getImageText()); + + // Save the model + CldsModel newModel = new CldsModel(); + newModel.setName("test-model"); + + newModel.setBpmnText(bpmnText); + newModel.setImageText(imageText); + newModel.setPropText(bpmnPropText); + newModel.setControlNamePrefix("ClosedLoop-"); + newModel.setTemplateName("test-template"); + newModel.setTemplateId(newTemplate.getId()); + newModel.setDocText(newTemplate.getPropText()); + newModel.setDocId(newTemplate.getPropId()); + // Save the model in DB + cldsDao.setModel(newModel, "user"); + // Test if the model can be retrieved + CldsModel newCldsModel = cldsDao.getModelTemplate("test-model"); + assertEquals(bpmnText, newCldsModel.getBpmnText()); + assertEquals(imageText, newCldsModel.getImageText()); + assertEquals(bpmnPropText, newCldsModel.getPropText()); + + } + + @Test(expected = NotFoundException.class) + public void testGetModelNotFound() { + CldsModel.retrieve(cldsDao, "test-model-not-found", false); + } + + @Test(expected = NotFoundException.class) + public void testGetTemplateNotFound() { + CldsTemplate.retrieve(cldsDao, "test-template-not-found", false); + } + + @Test + public void testInsEvent() { + // Add the template first + CldsTemplate newTemplate = new CldsTemplate(); + newTemplate.setName("test-template-for-event"); + + newTemplate.setBpmnText(bpmnText); + newTemplate.setImageText(imageText); + + newTemplate.save(cldsDao, "user"); + + // Test if it's well there + CldsTemplate newTemplateRead = CldsTemplate.retrieve(cldsDao, "test-template-for-event", false); + assertEquals(bpmnText, newTemplateRead.getBpmnText()); + assertEquals(imageText, newTemplateRead.getImageText()); + + // Save the model + CldsModel newModel = new CldsModel(); + newModel.setName("test-model-for-event"); + + newModel.setBpmnText(bpmnText); + newModel.setImageText(imageText); + newModel.setPropText(bpmnPropText); + newModel.setControlNamePrefix("ClosedLoop-"); + newModel.setTemplateName("test-template-for-event"); + newModel.setTemplateId(newTemplate.getId()); + newModel.setDocText(newTemplate.getPropText()); + newModel.setDocId(newTemplate.getPropId()); + + CldsEvent.insEvent(cldsDao, newModel, "user", CldsEvent.ACTION_RESTART, CldsEvent.ACTION_STATE_COMPLETED, + "process-instance-id"); + } +} diff --git a/src/test/java/org/onap/clamp/clds/it/DcaeIT.java b/src/test/java/org/onap/clamp/clds/it/DcaeIT.java index fc13270c..4f0ebb4e 100644 --- a/src/test/java/org/onap/clamp/clds/it/DcaeIT.java +++ b/src/test/java/org/onap/clamp/clds/it/DcaeIT.java @@ -25,7 +25,6 @@ package org.onap.clamp.clds.it; import org.junit.Test; import org.junit.runner.RunWith; - import org.onap.clamp.clds.AbstractIT; import org.onap.clamp.clds.client.req.DcaeReq; import org.onap.clamp.clds.model.CldsEvent; @@ -33,13 +32,16 @@ import org.onap.clamp.clds.model.prop.ModelProperties; import org.onap.clamp.clds.util.ResourceFileUtil; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; /** - * Test DCAE API in org.onap.clamp.ClampDesigner.client package - replicate DCAE Delegates in test. + * Test DCAE API in org.onap.clamp.ClampDesigner.client package - replicate DCAE + * Delegates in test. */ @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@TestPropertySource(locations = "classpath:application-no-camunda.properties") public class DcaeIT extends AbstractIT { @Test @@ -49,8 +51,8 @@ public class DcaeIT extends AbstractIT { String modelName = "example-model"; String controlName = "ClosedLoop-FRWL-SIG-1582f840-2881-11e6-b4ec-005056a9d756"; - ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, - true, modelBpmnProp, modelProp); + ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, true, modelBpmnProp, + modelProp); String dcaeReq = DcaeReq.format(refProp, prop); System.out.println("dcaeReq=" + dcaeReq); diff --git a/src/test/java/org/onap/clamp/clds/it/HttpsIT.java b/src/test/java/org/onap/clamp/clds/it/HttpsIT.java index ff630330..98319b41 100644 --- a/src/test/java/org/onap/clamp/clds/it/HttpsIT.java +++ b/src/test/java/org/onap/clamp/clds/it/HttpsIT.java @@ -50,8 +50,7 @@ import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.client.RestTemplate; /** - * Test DCAE API in org.onap.clamp.ClampDesigner.client package - replicate DCAE - * Delegates in test. + * Test HTTP and HTTPS settings + redirection of HTTP to HTTPS. */ @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT) diff --git a/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java b/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java index 69df9721..09f1efef 100644 --- a/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java +++ b/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java @@ -48,6 +48,7 @@ import org.onap.policy.api.AttributeType; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; /** @@ -56,6 +57,7 @@ import org.springframework.test.context.junit4.SpringRunner; */ @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@TestPropertySource(locations = "classpath:application-no-camunda.properties") public class PolicyClientIT extends AbstractIT { String modelProp; String modelBpmnProp; diff --git a/src/test/java/org/onap/clamp/clds/it/PropJsonBuilderIT.java b/src/test/java/org/onap/clamp/clds/it/PropJsonBuilderIT.java index c3b35eec..525f9cb3 100644 --- a/src/test/java/org/onap/clamp/clds/it/PropJsonBuilderIT.java +++ b/src/test/java/org/onap/clamp/clds/it/PropJsonBuilderIT.java @@ -39,6 +39,7 @@ import org.onap.clamp.clds.client.req.SdcReq; import org.onap.clamp.clds.model.CldsSdcServiceDetail; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; /** @@ -49,9 +50,10 @@ import org.springframework.test.context.junit4.SpringRunner; */ @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@TestPropertySource(locations = "classpath:application-no-camunda.properties") public class PropJsonBuilderIT extends AbstractIT { - private String globalPropsPartial; + private String globalPropsPartial; private ObjectMapper mapper; /** @@ -86,8 +88,8 @@ public class PropJsonBuilderIT extends AbstractIT { private void sampleJsonObject() throws JsonProcessingException { /** - * Create three JSON Objects objectNode1, objectNode2, objectNode3. - * Add all these three objects in the array + * Create three JSON Objects objectNode1, objectNode2, objectNode3. Add + * all these three objects in the array */ ObjectNode objectNode1 = mapper.createObjectNode(); objectNode1.put("bookName", "Java"); @@ -124,9 +126,8 @@ public class PropJsonBuilderIT extends AbstractIT { private String createEmptySharedObject() throws JsonProcessingException { /** - * Empty Object initialization. - * "": { "vf": { "": "" }, "location": { "": "" }, "alarmCondition": { - * "": "" } } + * Empty Object initialization. "": { "vf": { "": "" }, "location": { + * "": "" }, "alarmCondition": { "": "" } } */ ObjectNode emptyObjectNode = mapper.createObjectNode(); emptyObjectNode.put("", ""); @@ -144,8 +145,8 @@ public class PropJsonBuilderIT extends AbstractIT { emptyServiceObjectNode.putPOJO("", samArrayNode); /** - * Object initialization. - * "vf": { " ": " ", "DCAE_CLAMP_DEMO3 1": "DCAE_CLAMP_DEMO3" } + * Object initialization. "vf": { " ": " ", "DCAE_CLAMP_DEMO3 1": + * "DCAE_CLAMP_DEMO3" } * */ ObjectNode dcaeClampDemo3Node = mapper.createObjectNode(); @@ -157,9 +158,8 @@ public class PropJsonBuilderIT extends AbstractIT { vfObjectNode2.putPOJO("vf", vfArrayNode); /** - * Object initialization. - * "location": { "SNDGCA64": "San Diego SAN3", "ALPRGAED": - * "Alpharetta PDK1", "LSLEILAA": "Lisle DPA3" }, + * Object initialization. "location": { "SNDGCA64": "San Diego SAN3", + * "ALPRGAED": "Alpharetta PDK1", "LSLEILAA": "Lisle DPA3" }, */ ObjectNode sandiegoLocationNode = mapper.createObjectNode(); sandiegoLocationNode.put("SNDGCA64", "San Diego SAN3"); @@ -173,10 +173,10 @@ public class PropJsonBuilderIT extends AbstractIT { locationObjectNode2.putPOJO("location", locationArrayNode); /** - * Object initialization. - * "alarmCondition": { "A+Fallback+Operation+will+soon+be+started": - * "A Fallback Operation will soon be started", - * "BRM%2C+Auto+Export+Backup+Failed": "BRM, Auto Export Backup Failed", + * Object initialization. "alarmCondition": { + * "A+Fallback+Operation+will+soon+be+started": "A Fallback Operation + * will soon be started", "BRM%2C+Auto+Export+Backup+Failed": "BRM, Auto + * Export Backup Failed", */ ObjectNode alamrCondition1 = mapper.createObjectNode(); alamrCondition1.put("A+Fallback+Operation+will+soon+be+started", "A Fallback Operation will soon be started"); @@ -206,8 +206,7 @@ public class PropJsonBuilderIT extends AbstractIT { byServiceBasicObjetNode.putPOJO("byService", byServiceBasicArrayNode); /** - * Object initialization. - * "byVf": { "": { "vfc": { "": "" }, + * Object initialization. "byVf": { "": { "vfc": { "": "" }, * "03596c12-c7e3-44b7-8994-5cdfeda8afdd": { "vfc": { " ": " " } } } } */ ObjectNode vfCObjectNode = mapper.createObjectNode(); @@ -240,9 +239,8 @@ public class PropJsonBuilderIT extends AbstractIT { private String createTestEmptySharedObject() throws IOException { /** - * Object initialization. - * "": { "vf": { "": "" }, "location": { "": "" }, "alarmCondition": { - * "": "" } } + * Object initialization. "": { "vf": { "": "" }, "location": { "": "" + * }, "alarmCondition": { "": "" } } */ ObjectNode emptyObjectNode = mapper.createObjectNode(); emptyObjectNode.put("", ""); @@ -254,8 +252,8 @@ public class PropJsonBuilderIT extends AbstractIT { emptyServiceObjectNode.putPOJO("", vfObjectNode); /** - * Object initialization. - * "vf": { " ": " ", "DCAE_CLAMP_DEMO3 1": "DCAE_CLAMP_DEMO3" } + * Object initialization. "vf": { " ": " ", "DCAE_CLAMP_DEMO3 1": + * "DCAE_CLAMP_DEMO3" } * */ ObjectNode vfObjectNode2 = mapper.createObjectNode(); @@ -265,9 +263,8 @@ public class PropJsonBuilderIT extends AbstractIT { vfObjectNode2.putPOJO("vf", dcaeClampDemo3Node); /** - * Object initialization. - * "location": { "SNDGCA64": "San Diego SAN3", "ALPRGAED": - * "Alpharetta PDK1", "LSLEILAA": "Lisle DPA3" }, + * Object initialization. "location": { "SNDGCA64": "San Diego SAN3", + * "ALPRGAED": "Alpharetta PDK1", "LSLEILAA": "Lisle DPA3" }, */ // ObjectNode sandiegoLocationNode = mapper.createObjectNode(); // sandiegoLocationNode.put("SNDGCA64","San Diego SAN3"); @@ -277,10 +274,10 @@ public class PropJsonBuilderIT extends AbstractIT { vfObjectNode2.putPOJO("location", locationJsonNode); /** - * Object initialization. - * "alarmCondition": { "A+Fallback+Operation+will+soon+be+started": - * "A Fallback Operation will soon be started", - * "BRM%2C+Auto+Export+Backup+Failed": "BRM, Auto Export Backup Failed", + * Object initialization. "alarmCondition": { + * "A+Fallback+Operation+will+soon+be+started": "A Fallback Operation + * will soon be started", "BRM%2C+Auto+Export+Backup+Failed": "BRM, Auto + * Export Backup Failed", */ // ObjectNode alamrCondition1 = mapper.createObjectNode(); // alamrCondition1.put("A+Fallback+Operation+will+soon+be+started","A @@ -295,8 +292,7 @@ public class PropJsonBuilderIT extends AbstractIT { byServiceBasicObjetNode.putPOJO("byService", emptyServiceObjectNode); /** - * Object initialization. - * "byVf": { "": { "vfc": { "": "" }, + * Object initialization. "byVf": { "": { "vfc": { "": "" }, * "03596c12-c7e3-44b7-8994-5cdfeda8afdd": { "vfc": { " ": " " } } } } */ ObjectNode vfCObjectNode = mapper.createObjectNode(); @@ -316,9 +312,8 @@ public class PropJsonBuilderIT extends AbstractIT { private String createCldsSharedObject(CldsSdcServiceDetail CldsSdcServiceDetail) throws IOException { /** - * Object initialization. - * "": { "vf": { "": "" }, "location": { "": "" }, "alarmCondition": { - * "": "" } } + * Object initialization. "": { "vf": { "": "" }, "location": { "": "" + * }, "alarmCondition": { "": "" } } */ ObjectNode emptyObjectNode = mapper.createObjectNode(); emptyObjectNode.put("", ""); @@ -330,8 +325,8 @@ public class PropJsonBuilderIT extends AbstractIT { emptyServiceObjectNode.putPOJO("", vfObjectNode); /** - * Object initialization. - * "vf": { " ": " ", "DCAE_CLAMP_DEMO3 1": "DCAE_CLAMP_DEMO3" } + * Object initialization. "vf": { " ": " ", "DCAE_CLAMP_DEMO3 1": + * "DCAE_CLAMP_DEMO3" } * */ ObjectNode vfObjectNode2 = mapper.createObjectNode(); @@ -341,9 +336,8 @@ public class PropJsonBuilderIT extends AbstractIT { vfObjectNode2.putPOJO("vf", dcaeClampDemo3Node); /** - * Object initialization. - * "location": { "SNDGCA64": "San Diego SAN3", "ALPRGAED": - * "Alpharetta PDK1", "LSLEILAA": "Lisle DPA3" }, + * Object initialization. "location": { "SNDGCA64": "San Diego SAN3", + * "ALPRGAED": "Alpharetta PDK1", "LSLEILAA": "Lisle DPA3" }, */ ObjectNode sandiegoLocationNode = mapper.createObjectNode(); sandiegoLocationNode.put("SNDGCA64", "San Diego SAN3"); @@ -351,10 +345,10 @@ public class PropJsonBuilderIT extends AbstractIT { vfObjectNode2.putPOJO("location", sandiegoLocationNode); /** - * Object initialization. - * "alarmCondition": { "A+Fallback+Operation+will+soon+be+started": - * "A Fallback Operation will soon be started", - * "BRM%2C+Auto+Export+Backup+Failed": "BRM, Auto Export Backup Failed", + * Object initialization. "alarmCondition": { + * "A+Fallback+Operation+will+soon+be+started": "A Fallback Operation + * will soon be started", "BRM%2C+Auto+Export+Backup+Failed": "BRM, Auto + * Export Backup Failed", */ ObjectNode alamrCondition1 = mapper.createObjectNode(); alamrCondition1.put("A+Fallback+Operation+will+soon+be+started", "A Fallback Operation will soon be started"); @@ -365,8 +359,7 @@ public class PropJsonBuilderIT extends AbstractIT { byServiceBasicObjetNode.putPOJO("byService", emptyServiceObjectNode); /** - * Object initialization. - * "byVf": { "": { "vfc": { "": "" }, + * Object initialization. "byVf": { "": { "vfc": { "": "" }, * "03596c12-c7e3-44b7-8994-5cdfeda8afdd": { "vfc": { " ": " " } } } } */ diff --git a/src/test/java/org/onap/clamp/clds/it/RefPropIT.java b/src/test/java/org/onap/clamp/clds/it/RefPropIT.java index c6a5de29..473ce4a2 100644 --- a/src/test/java/org/onap/clamp/clds/it/RefPropIT.java +++ b/src/test/java/org/onap/clamp/clds/it/RefPropIT.java @@ -32,6 +32,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.onap.clamp.clds.AbstractIT; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; /** @@ -39,12 +40,14 @@ import org.springframework.test.context.junit4.SpringRunner; */ @RunWith(SpringRunner.class) @SpringBootTest +@TestPropertySource(locations = "classpath:application-no-camunda.properties") public class RefPropIT extends AbstractIT { /** * Test getting prop value as a JSON Node / template. * - * @throws IOException when JSON parsing fails + * @throws IOException + * when JSON parsing fails */ @Test public void testJsonTemplate() throws IOException { diff --git a/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java b/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java index 2995b6c8..dce6c901 100644 --- a/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java +++ b/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java @@ -41,14 +41,15 @@ import org.onap.clamp.clds.model.CldsSdcServiceInfo; import org.onap.clamp.clds.model.CldsServiceData; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; /** - * Test DCAE API in org.onap.clamp.ClampDesigner.client package - replicate DCAE - * Delegates in test. + * Test SDC Catalog Service class by mocking the SDC answers. */ @RunWith(SpringRunner.class) @SpringBootTest +@TestPropertySource(locations = "classpath:application-no-camunda.properties") public class SdcCatalogServicesIT extends AbstractIT { @Autowired private SdcCatalogServices sdcCatalogWired = new SdcCatalogServices(); diff --git a/src/test/java/org/onap/clamp/clds/it/SdcIT.java b/src/test/java/org/onap/clamp/clds/it/SdcIT.java index da9e5af7..025420ff 100644 --- a/src/test/java/org/onap/clamp/clds/it/SdcIT.java +++ b/src/test/java/org/onap/clamp/clds/it/SdcIT.java @@ -26,7 +26,6 @@ package org.onap.clamp.clds.it; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; - import org.onap.clamp.clds.AbstractIT; import org.onap.clamp.clds.client.SdcCatalogServices; import org.onap.clamp.clds.client.req.SdcReq; @@ -36,16 +35,18 @@ import org.onap.clamp.clds.model.refprop.RefProp; import org.onap.clamp.clds.util.ResourceFileUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; /** - * Test DCAE API in org.onap.clamp.ClampDesigner.client package - replicate DCAE Delegates in test. + * Test SDC Blueprint formater. */ @RunWith(SpringRunner.class) @SpringBootTest +@TestPropertySource(locations = "classpath:application-no-camunda.properties") public class SdcIT extends AbstractIT { @Autowired - private RefProp refProp; + private RefProp refProp; @Autowired private SdcCatalogServices sdcCatalogServices; @@ -62,14 +63,13 @@ public class SdcIT extends AbstractIT { String modelName = "example-model06"; String controlName = "ClosedLoop-FRWL-SIG04-1582f840-test-test-1234-005056a9d756"; String docText = ResourceFileUtil.getResourceAsString("example/templateProp.json"); - ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, - true, modelBpmnProp, modelProp); + ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, true, modelBpmnProp, + modelProp); String blueprint = SdcReq.formatBlueprint(refProp, prop, docText); System.out.println("blueprint=" + blueprint); - //assertEquals(blueprint, ""); + // assertEquals(blueprint, ""); } - @Test public void testTcaBlueprint() throws Exception { String modelProp = ResourceFileUtil.getResourceAsString("example/modelPropForPolicy.json"); @@ -77,10 +77,10 @@ public class SdcIT extends AbstractIT { String modelName = "example-model06"; String controlName = "ClosedLoop-FRWL-SIG04-1582f840-test-test-1234-005056a9d756"; String docText = ResourceFileUtil.getResourceAsString("example/templatePropForTca.json"); - ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, - true, modelBpmnProp, modelProp); + ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, true, modelBpmnProp, + modelProp); String blueprint = SdcReq.formatBlueprint(refProp, prop, docText); System.out.println("blueprint=" + blueprint); - //assertEquals(blueprint, ""); + // assertEquals(blueprint, ""); } } -- cgit 1.2.3-korg