diff options
author | sebdet <sebastien.determe@intl.att.com> | 2018-12-20 09:42:53 +0100 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2018-12-20 09:42:53 +0100 |
commit | da1d57b1870726437149949d1228848ac37da165 (patch) | |
tree | fa85cf04674ec16aa5b5144d1cbc8672fb9b0f4f /src/test/java | |
parent | 5ece487f3896affa9aa9d9860e843585b7609cd6 (diff) |
Add tests
Add tests to Tosca code to increase coverage
Issue-ID: CLAMP-252
Change-Id: Ie18cb94444e7e47b6dfb3e8271a0db238cfeeb1b
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/org/onap/clamp/clds/it/CldsToscaServiceItCase.java | 3 | ||||
-rw-r--r-- | src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java | 19 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/CldsToscaServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsToscaServiceItCase.java index 75579df5f..d4c7e5c2a 100644 --- a/src/test/java/org/onap/clamp/clds/it/CldsToscaServiceItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/CldsToscaServiceItCase.java @@ -40,7 +40,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Matchers; import org.mockito.Mockito; -import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.CldsToscaModel; import org.onap.clamp.clds.service.CldsToscaService; import org.onap.clamp.clds.util.LoggingUtils; @@ -67,8 +66,6 @@ public class CldsToscaServiceItCase { protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsToscaServiceItCase.class); @Autowired private CldsToscaService cldsToscaService; - @Autowired - private CldsDao cldsDao; private String toscaModelYaml; private Authentication authentication; private CldsToscaModel cldsToscaModel; diff --git a/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java b/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java index d0a0fd982..31594cbac 100644 --- a/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java @@ -39,7 +39,9 @@ import org.onap.clamp.clds.client.req.policy.OperationalPolicyAttributesConstruc import org.onap.clamp.clds.client.req.policy.PolicyClient; import org.onap.clamp.clds.client.req.tca.TcaRequestFormatter; import org.onap.clamp.clds.config.ClampProperties; +import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.CldsEvent; +import org.onap.clamp.clds.model.CldsToscaModel; import org.onap.clamp.clds.model.properties.ModelProperties; import org.onap.clamp.clds.model.properties.Policy; import org.onap.clamp.clds.model.properties.PolicyItem; @@ -66,6 +68,8 @@ import org.springframework.test.context.junit4.SpringRunner; public class PolicyClientItCase { @Autowired + private CldsDao cldsDao; + @Autowired private ClampProperties refProp; @Autowired private PolicyClient policyClient; @@ -255,6 +259,21 @@ public class PolicyClientItCase { Assertions.entry("policyName", modelName.replace("-", "_") + "." + controlName + "_Policy_12lup3h_0"), Assertions.entry("policyType", "BRMS_Param"), Assertions.entry("policyComponent", "PAP"), Assertions.entry("deleteCondition", "ALL")); + } + + @Test + public void testImportToscaModel() throws IOException { + String toscaModelYaml = ResourceFileUtil.getResourceAsString("tosca/tca-policy-test.yaml"); + CldsToscaModel cldsToscaModel = new CldsToscaModel(); + cldsToscaModel.setToscaModelName("tca-policy-test"); + cldsToscaModel.setToscaModelYaml(toscaModelYaml); + cldsToscaModel.setUserId("admin"); + cldsToscaModel.setPolicyType("tca"); + cldsToscaModel = cldsToscaModel.save(cldsDao, refProp, policyClient, "test"); + String tosca = policyClient.importToscaModel(cldsToscaModel); + Assertions.assertThat(tosca).contains( + "{\"serviceName\":\"tca-policy-test\",\"description\":\"tca-policy-test\",\"requestID\":null,\"filePath\":\"/tmp/tosca-models/tca-policy-test.yml\","); + Assertions.assertThat(tosca).contains(toscaModelYaml); } } |