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;
rcn.sendRequest(p, ctx);
}
+ @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();
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);