From a87dc9c351b0c08d20adc428c215cf3934bb79bb Mon Sep 17 00:00:00 2001 From: Ganesh Chandrasekaran Date: Thu, 14 Jun 2018 08:02:31 +0900 Subject: CCSDK plugin has authType param for DG to sel type Issue-ID: CCSDK-299 Change-Id: I61a56c873189ccc6ba9985c5121d50e2ad1f3f48 Signed-off-by: Ganesh Chandrasekaran --- .../plugins/restapicall/TestRestapiCallNode.java | 137 +++++++++++++++++++++ 1 file changed, 137 insertions(+) (limited to 'restapi-call-node/provider/src/test/java') diff --git a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java index 88a1eeae..81806f6d 100644 --- a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java +++ b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java @@ -435,4 +435,141 @@ public class TestRestapiCallNode { RestapiCallNode rcn = new RestapiCallNode(); rcn.sendRequest(p, ctx); } + + @Test + public void testDeleteAuthTypeBasic() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map p = new HashMap(); + p.put("restapiUrl", "https://echo.getpostman.com/delete"); + p.put("authType", "basic"); + p.put("restapiUser", "admin"); + p.put("restapiPassword", "admin123"); + p.put("httpMethod", "delete"); + p.put("format", "none"); + p.put("skipSending", "true"); + + RestapiCallNode rcn = new RestapiCallNode(); + rcn.sendRequest(p, ctx); + } + + @Test + public void testDeleteAuthTypeDigest() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map p = new HashMap(); + p.put("restapiUrl", "https://echo.getpostman.com/delete"); + p.put("authType", "digest"); + p.put("restapiUser", "admin"); + p.put("restapiPassword", "admin123"); + p.put("httpMethod", "delete"); + p.put("format", "none"); + p.put("skipSending", "true"); + + RestapiCallNode rcn = new RestapiCallNode(); + rcn.sendRequest(p, ctx); + } + + @Test + public void testDeleteAuthTypeOAuth() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map p = new HashMap(); + p.put("restapiUrl", "https://echo.getpostman.com/delete"); + p.put("authType", "oauth"); + p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3"); + p.put("oAuthConsumerSecret", "secret"); + p.put("oAuthSignatureMethod", "plainTEXT"); + p.put("oAuthVersion", "1.0"); + p.put("httpMethod", "delete"); + p.put("format", "none"); + p.put("skipSending", "true"); + + RestapiCallNode rcn = new RestapiCallNode(); + rcn.sendRequest(p, ctx); + } + + @Test + public void testDeleteAuthTypeNoneOAuth() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map p = new HashMap(); + p.put("restapiUrl", "https://echo.getpostman.com/delete"); + p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3"); + p.put("oAuthConsumerSecret", "secret"); + p.put("oAuthSignatureMethod", "plainTEXT"); + p.put("oAuthVersion", "1.0"); + p.put("httpMethod", "delete"); + p.put("format", "none"); + p.put("skipSending", "true"); + + RestapiCallNode rcn = new RestapiCallNode(); + rcn.sendRequest(p, ctx); + } + @Test + public void testDeleteAuthTypeNoneBasic() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map p = new HashMap(); + p.put("restapiUrl", "https://echo.getpostman.com/delete"); + p.put("restapiUser", "admin"); + p.put("restapiPassword", "admin123"); + p.put("httpMethod", "delete"); + p.put("format", "none"); + p.put("skipSending", "true"); + + RestapiCallNode rcn = new RestapiCallNode(); + rcn.sendRequest(p, ctx); + } + + @Test(expected = SvcLogicException.class) + public void testInvalidDeleteAuthTypeOAuth() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map p = new HashMap(); + p.put("restapiUrl", "https://echo.getpostman.com/delete"); + p.put("authType", "oauth"); + p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3"); + p.put("oAuthConsumerSecret", "secret"); + p.put("httpMethod", "delete"); + p.put("format", "none"); + p.put("skipSending", "true"); + + RestapiCallNode rcn = new RestapiCallNode(); + rcn.sendRequest(p, ctx); + } + + @Test(expected = SvcLogicException.class) + public void testInvalidDeleteAuthTypeBasic() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map p = new HashMap(); + p.put("restapiUrl", "https://echo.getpostman.com/delete"); + p.put("authType", "basic"); + p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3"); + p.put("oAuthConsumerSecret", "secret"); + p.put("httpMethod", "delete"); + p.put("format", "none"); + p.put("skipSending", "true"); + + RestapiCallNode rcn = new RestapiCallNode(); + rcn.sendRequest(p, ctx); + } + + @Test(expected = SvcLogicException.class) + public void testInvalidDeleteAuthTypeDigest() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map p = new HashMap(); + p.put("restapiUrl", "https://echo.getpostman.com/delete"); + p.put("authType", "digest"); + p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3"); + p.put("oAuthConsumerSecret", "secret"); + p.put("httpMethod", "delete"); + p.put("format", "none"); + p.put("skipSending", "true"); + + RestapiCallNode rcn = new RestapiCallNode(); + rcn.sendRequest(p, ctx); + } } -- cgit 1.2.3-korg