All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.github.hi_fi.httprequestlibrary.keywords.Session Maven / Gradle / Ivy
package com.github.hi_fi.httprequestlibrary.keywords;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.robotframework.javalib.annotation.ArgumentNames;
import org.robotframework.javalib.annotation.RobotKeyword;
import org.robotframework.javalib.annotation.RobotKeywords;
import com.github.hi_fi.httpclient.domain.Authentication;
import com.github.hi_fi.httpclient.RestClient;
import com.github.hi_fi.httprequestlibrary.utils.Robot;
import com.github.hi_fi.httprequestlibrary.utils.RobotLogger;
@RobotKeywords
public class Session {
@RobotKeyword("Create a HTTP session to a server\n\n"
+ "``url`` Base url of the server\n\n"
+ "``alias`` Robot Framework alias to identify the session\n\n"
+ "``headers`` Dictionary of default headers\n\n"
+ "``auth`` List of username & password for HTTP Basic Auth\n\n"
+ "``timeout`` Connection timeout\n\n"
+ "\n\n"
+ "``proxies`` Dictionary that contains proxy urls for HTTP and HTTPS communication\n\n"
+ "``verify`` Whether the SSL cert will be verified. A CA_BUNDLE path can also be provided.\n\n"
+ "``debug`` Enable http verbosity option more information.\n\n")
@ArgumentNames({ "alias", "url", "headers={}", "cookies=None", "auth=None", "timeout=None", "proxies=None",
"verify=False", "debug=False" })
public void createSession(String alias, String url, String... params) {
RestClient rc = new RestClient();
Map headers = Robot.getParamsValue(params, 0, new HashMap());
String verify = Robot.getParamsValue(params, 5, "False");
RobotLogger.setDebugToAll(Boolean.parseBoolean(Robot.getParamsValue(params, 6, "False")));
Authentication auth = Authentication
.getAuthentication(Robot.getParamsValue(params, 2, (List) new ArrayList()));
rc.createSession(alias, url, headers, auth, verify);
}
@RobotKeyword("Create a HTTP session to a server\n\n"
+ "``url`` Base url of the server\n\n"
+ "``alias`` Robot Framework alias to identify the session\n\n"
+ "``headers`` Dictionary of default headers\n\n"
+ "``auth`` List of username & password for HTTP Digest Auth\n\n"
+ "``timeout`` Connection timeout\n\n"
+ "\n\n"
+ "``proxies`` Dictionary that contains proxy urls for HTTP and HTTPS communication\n\n"
+ "``verify`` Whether the SSL cert will be verified. A CA_BUNDLE path can also be provided.\n\n"
+ "``debug`` Enable http verbosity option more information.\n\n")
@ArgumentNames({ "alias", "url", "headers={}", "cookies=None", "auth=None", "timeout=None", "proxies=None",
"verify=False", "debug=False" })
public void createDigestSession(String alias, String url, String... params) {
RestClient rc = new RestClient();
Map headers = Robot.getParamsValue(params, 0, new HashMap());
String verify = Robot.getParamsValue(params, 5, "False");
RobotLogger.setDebugToAll(Boolean.parseBoolean(Robot.getParamsValue(params, 6, "False")));
Authentication auth = Authentication.getAuthentication(
Robot.getParamsValue(params, 2, (List) new ArrayList()), Authentication.Type.DIGEST);
rc.createSession(alias, url, headers, auth, verify);
}
}