Java Code Examples for io.restassured.RestAssured#basic()
The following examples show how to use
io.restassured.RestAssured#basic() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppTestBase.java From microprofile-open-api with Apache License 2.0 | 5 votes |
@BeforeClass public static void configureRestAssured() throws MalformedURLException { // set base URI and port number to use for all requests serverUrl = System.getProperty("test.url"); String protocol = DEFAULT_PROTOCOL; String host = DEFAULT_HOST; int port = DEFAULT_PORT; if (serverUrl != null) { URL url = new URL(serverUrl); protocol = url.getProtocol(); host = url.getHost(); port = (url.getPort() == -1) ? DEFAULT_PORT : url.getPort(); } RestAssured.baseURI = protocol + "://" + host; RestAssured.port = port; username = System.getProperty("test.user"); password = System.getProperty("test.pwd"); if (username != null && password != null) { RestAssured.authentication = RestAssured.basic(username, password); RestAssured.useRelaxedHTTPSValidation(); } RestAssured.defaultParser = Parser.JSON; if (StringUtils.isBlank(serverUrl)) { serverUrl = DEFAULT_PROTOCOL + "://" + DEFAULT_HOST + ":" + DEFAULT_PORT; } }
Example 2
Source File: MpMetricOptionalTest.java From microprofile-metrics with Apache License 2.0 | 5 votes |
@BeforeClass static public void setup() throws MalformedURLException { // set base URI and port number to use for all requests String serverUrl = System.getProperty("test.url"); String protocol = DEFAULT_PROTOCOL; String host = DEFAULT_HOST; int port = DEFAULT_PORT; if (serverUrl != null) { URL url = new URL(serverUrl); protocol = url.getProtocol(); host = url.getHost(); port = (url.getPort() == -1) ? DEFAULT_PORT : url.getPort(); } RestAssured.baseURI = protocol + "://" + host; RestAssured.port = port; // set user name and password to use for basic authentication for all requests String userName = System.getProperty("test.user"); String password = System.getProperty("test.pwd"); if (userName != null && password != null) { RestAssured.authentication = RestAssured.basic(userName, password); RestAssured.useRelaxedHTTPSValidation(); } contextRoot = System.getProperty("context.root", "/optionalTCK"); applicationPort = Integer.parseInt(System.getProperty("application.port", Integer.toString(port))); }
Example 3
Source File: ReusedMetricsTest.java From microprofile-metrics with Apache License 2.0 | 5 votes |
@BeforeClass static public void setup() throws MalformedURLException { // set base URI and port number to use for all requests String serverUrl = System.getProperty("test.url"); String protocol = DEFAULT_PROTOCOL; String host = DEFAULT_HOST; int port = DEFAULT_PORT; if (serverUrl != null) { URL url = new URL(serverUrl); protocol = url.getProtocol(); host = url.getHost(); port = (url.getPort() == -1) ? DEFAULT_PORT : url.getPort(); } RestAssured.baseURI = protocol + "://" + host; RestAssured.port = port; // set user name and password to use for basic authentication for all requests String userName = System.getProperty("test.user"); String password = System.getProperty("test.pwd"); if (userName != null && password != null) { RestAssured.authentication = RestAssured.basic(userName, password); RestAssured.useRelaxedHTTPSValidation(); } }
Example 4
Source File: MpMetricTest.java From microprofile-metrics with Apache License 2.0 | 5 votes |
@BeforeClass static public void setup() throws MalformedURLException { // set base URI and port number to use for all requests String serverUrl = System.getProperty("test.url"); String protocol = DEFAULT_PROTOCOL; String host = DEFAULT_HOST; int port = DEFAULT_PORT; if (serverUrl != null) { URL url = new URL(serverUrl); protocol = url.getProtocol(); host = url.getHost(); port = (url.getPort() == -1) ? DEFAULT_PORT : url.getPort(); } RestAssured.baseURI = protocol + "://" + host; RestAssured.port = port; // set user name and password to use for basic authentication for all requests String userName = System.getProperty("test.user"); String password = System.getProperty("test.pwd"); if (userName != null && password != null) { RestAssured.authentication = RestAssured.basic(userName, password); RestAssured.useRelaxedHTTPSValidation(); } }
Example 5
Source File: RestBase.java From spring-cloud-contract with Apache License 2.0 | 5 votes |
@Before public void setup() { RestAssured.baseURI = this.url; if (StringUtils.hasText(this.username)) { RestAssured.authentication = RestAssured.basic(this.username, this.password); } }