diff options
author | Smokowski, Kevin (ks6305) <kevin.smokowski@att.com> | 2019-02-05 19:29:22 +0000 |
---|---|---|
committer | Smokowski, Kevin (ks6305) <kevin.smokowski@att.com> | 2019-02-05 19:29:22 +0000 |
commit | 1120a398b0e9cb2e1da7e12e45f9a14d4ac61ba3 (patch) | |
tree | 2457d6ce0b4b1d42acc03dd212a8d79bfa53c352 /template-node/provider/src/test | |
parent | a51e307659b1b3853e1d081064159572070a9a47 (diff) |
template node patch
Remove HideNullJson directive and update missing properties message
Change-Id: I8eb1404d3844284fe28ed0d49226ad166e185656
Issue-ID: CCSDK-1040
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Diffstat (limited to 'template-node/provider/src/test')
-rwxr-xr-x | template-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/template/HideNullJsonTest.java | 46 | ||||
-rwxr-xr-x | template-node/provider/src/test/resources/HideNullJson.vtl | 22 |
2 files changed, 0 insertions, 68 deletions
diff --git a/template-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/template/HideNullJsonTest.java b/template-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/template/HideNullJsonTest.java deleted file mode 100755 index 1fb1f676f..000000000 --- a/template-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/template/HideNullJsonTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.onap.ccsdk.sli.plugins.template; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; - -public class HideNullJsonTest { - - @Test - public void testSampleTemplate() throws Exception { - TemplateNode t = new MockTemplateNode(); - - Map<String, String> params = new HashMap<String, String>(); - params.put(TemplateNode.PREFIX_KEY, "output"); - params.put(TemplateNode.OUTPUT_PATH_KEY, "mycontainer"); - params.put(TemplateNode.TEMPLATE_PATH, "src/test/resources/HideNullJson.vtl"); - - //Setup sample data to feed into the directive - params.put("service-type", "\"VPN\""); //the value is quoted to test an override - params.put("svc-request-id", "REQ001"); - params.put("svc-action", "CREATE"); - params.put("service-instance-id", "SVC001"); - params.put("customerNameTag", "customer-name"); - params.put("customer-name", "TestCust"); - params.put("siidTag", "\"service-instance-id\""); //the value is quoted to test an override - - SvcLogicContext ctx = new SvcLogicContext(); - t.evaluateTemplate(params, ctx); - String result = ctx.getAttribute("output.mycontainer"); - assertTrue(result.contains("\"svc-request-id\":\"REQ001\",")); - assertTrue(result.contains("\"svc-action\":\"CREATE\"")); - assertFalse(result.contains("\"svc-action\":\"CREATE\",")); // there should be no trailing comma - assertTrue(result.contains("\"service-type\":\"VPN\",")); - assertTrue(result.contains("\"customer-name\":\"TestCust\",")); - assertTrue(result.contains("\"service-instance-id\":\"SVC001\"")); - assertFalse(result.contains("\"service-instance-id\":\"SVC001\",")); // there should be no trailing comma - //This should be hidden by the directive because the parameter was never populated - assertFalse(result.contains("customer-phone-number")); - } - -}
\ No newline at end of file diff --git a/template-node/provider/src/test/resources/HideNullJson.vtl b/template-node/provider/src/test/resources/HideNullJson.vtl deleted file mode 100755 index 306679457..000000000 --- a/template-node/provider/src/test/resources/HideNullJson.vtl +++ /dev/null @@ -1,22 +0,0 @@ -## This is an example comment -## This velocity template is used to test the hideNullJson directive -{ - "input": { - "request-header": { -## by default the values parameters provided are surrounded in double quotes and separated by a colon - #hideNullJson("svc-request-id",$svc-request-id)#end -## override default settings so the comma isn't written - #hideNullJson("svc-action",$svc-action, true, true, false)#end - }, - "service-information": { -## if we look at the values in parameters we see service-type is already surrounded by quotes -## we override the default so the string isn't surrounded by excess quotes - #hideNullJson("service-type",$service-type,true,false,true)#end -## the first parameter doesn't need to be a literal - #hideNullJson($customerNameTag,$customer-name)#end -## if the first parameter already has already been quoted we can override the default - #hideNullJson($siidTag,$service-instance-id,false,true,false)#end - #hideNullJson("customer-phone-number",$customer-phone-number)#end - } - } -}
\ No newline at end of file |