diff options
author | 2020-02-28 15:25:21 -0500 | |
---|---|---|
committer | 2020-03-02 10:28:02 -0500 | |
commit | 94ca994a89607f28e38129f43c89d2402859092f (patch) | |
tree | b5002b158bab4265c6fc8a36759bcb9ec594b56d /restapi-call-node/provider/src/test | |
parent | b5c10c18ce806f875e9fd2c8dcaece5628898093 (diff) |
Restapi-call-node: Fix sending big files to DMAAP data router
Issue-ID: CCSDK-2122
Signed-off-by: Stan Bonev <sb5356@att.com>
Change-Id: If71e6d3ee0bd649994ce4b9a23dcbd1b42a64101
Diffstat (limited to 'restapi-call-node/provider/src/test')
-rwxr-xr-x | restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java | 28 | ||||
-rw-r--r-- | restapi-call-node/provider/src/test/resources/test_file.txt | 5 |
2 files changed, 25 insertions, 8 deletions
diff --git a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java index da7b80ee..b2f75bcd 100755 --- a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java +++ b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java @@ -24,12 +24,9 @@ package org.onap.ccsdk.sli.plugins.restapicall; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; - import java.util.HashMap; import java.util.Map; - import org.codehaus.jettison.json.JSONObject; - import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; @@ -81,6 +78,21 @@ public class TestRestapiCallNode { } @Test + public void testSendFile() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map<String, String> p = new HashMap<>(); + p.put("fileName", "src/test/resources/test_file.txt"); + p.put("url", "https://testurl.test"); + p.put("user", "user"); + p.put("password", "*******"); + p.put("skipSending", "true"); // Set real url, user, password, when testing actual sending + + RestapiCallNode rcn = new RestapiCallNode(); + rcn.sendFile(p, ctx); + } + + @Test public void testJsonTemplate() throws SvcLogicException { SvcLogicContext ctx = new SvcLogicContext(); ctx.setAttribute("tmp.sdn-circuit-req-row_length", "3"); @@ -479,16 +491,16 @@ public class TestRestapiCallNode { assertNull(rcn.partnerStore.get("partnerThree")); //In this scenario the caller expects username, password and url to be picked up from the partners json - Map<String, String> paramMap = new HashMap<String,String>(); + Map<String, String> paramMap = new HashMap<>(); paramMap.put("partner", partnerTwoKey); rcn.handlePartner(paramMap ); - assertEquals(partnerTwoUsername,paramMap.get(rcn.restapiUserKey)); - assertEquals(partnerTwoPassword,paramMap.get(rcn.restapiPasswordKey)); - assertEquals("http://localhost:7002",paramMap.get(rcn.restapiUrlString)); + assertEquals(partnerTwoUsername,paramMap.get(RestapiCallNode.restapiUserKey)); + assertEquals(partnerTwoPassword,paramMap.get(RestapiCallNode.restapiPasswordKey)); + assertEquals("http://localhost:7002",paramMap.get(RestapiCallNode.restapiUrlString)); //In this scenario the caller expects username, password and url to be picked up from the partners json //the provided suffix will be appended to the default url from the partners json - paramMap = new HashMap<String,String>(); + paramMap = new HashMap<>(); paramMap.put("partner", partnerTwoKey); paramMap.put("restapiUrlSuffix", "/networking/v1/instance/3"); rcn.handlePartner(paramMap); diff --git a/restapi-call-node/provider/src/test/resources/test_file.txt b/restapi-call-node/provider/src/test/resources/test_file.txt new file mode 100644 index 00000000..038d757d --- /dev/null +++ b/restapi-call-node/provider/src/test/resources/test_file.txt @@ -0,0 +1,5 @@ +“You think your pain and your heartbreak are unprecedented in the history of the world, but then you read. It was books that taught me that the things that tormented me most were the very things that connected me with all the people who were alive, who had ever been alive.” – James Baldwin +“When I have a little money, I buy books; and if I have any left, I buy food and clothes.” – Erasmus +“If you only read the books that everyone else is reading, you can only think what everyone else is thinking.” – Haruki Murakami +“You don’t have to burn books to destroy a culture. Just get people to stop reading them.” – Ray Bradbury +“A reader lives a thousand lives before he dies, said Jojen. The man who never reads lives only one.” – George R.R. Martin |