Java Code Examples for io.restassured.RestAssured#baseURI()
The following examples show how to use
io.restassured.RestAssured#baseURI() .
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: AbstractApiTests.java From molgenis with GNU Lesser General Public License v3.0 | 6 votes |
/** * Subclasses most call this method: * * <pre> * @BeforeClass * public static void setUpBeforeClass() { * AbstractApiTest.setUpBeforeClass(); * ... * } * </pre> */ protected static void setUpBeforeClass() { String restTestHost = System.getProperty("REST_TEST_HOST"); if (restTestHost == null) { restTestHost = RestTestUtils.DEFAULT_HOST; } RestAssured.baseURI = restTestHost; RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); String restTestAdminName = System.getProperty("REST_TEST_ADMIN_NAME"); if (restTestAdminName == null) { restTestAdminName = RestTestUtils.DEFAULT_ADMIN_NAME; } String restTestAdminPw = System.getProperty("REST_TEST_ADMIN_PW"); if (restTestAdminPw == null) { restTestAdminPw = RestTestUtils.DEFAULT_ADMIN_PW; } String adminToken = login(restTestAdminName, restTestAdminPw); ADMIN_TOKENS.set(adminToken); }
Example 2
Source File: AbstractApiTest.java From molgenis with GNU Lesser General Public License v3.0 | 6 votes |
/** * Subclasses most call this method: * * <pre> * @BeforeClass * public static void setUpBeforeClass() { * AbstractApiTest.setUpBeforeClass(); * ... * } * </pre> */ protected static void setUpBeforeClass() { String restTestHost = System.getProperty("REST_TEST_HOST"); if (restTestHost == null) { restTestHost = RestTestUtils.DEFAULT_HOST; } RestAssured.baseURI = restTestHost; RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); String restTestAdminName = System.getProperty("REST_TEST_ADMIN_NAME"); if (restTestAdminName == null) { restTestAdminName = RestTestUtils.DEFAULT_ADMIN_NAME; } String restTestAdminPw = System.getProperty("REST_TEST_ADMIN_PW"); if (restTestAdminPw == null) { restTestAdminPw = RestTestUtils.DEFAULT_ADMIN_PW; } ADMIN_TOKEN = login(restTestAdminName, restTestAdminPw); }
Example 3
Source File: CrawlerLogTests.java From fess with Apache License 2.0 | 6 votes |
@BeforeAll protected static void initAll() { RestAssured.baseURI = getFessUrl(); settingTestToken(); // create and execute a web crawler try { createWebConfig(); logger.info("WebConfig is created"); refresh(); webConfigId = getWebConfigIds(NAME_PREFIX).get(0); createJob(); logger.info("Job is created"); refresh(); startJob(NAME_PREFIX); waitJob(NAME_PREFIX); refresh(); } catch (InterruptedException e) { e.printStackTrace(); assertTrue(false); } }
Example 4
Source File: ForwardedHeaderAPIIT.java From molgenis with GNU Lesser General Public License v3.0 | 5 votes |
/** * Pass down system properties via the mvn commandline argument * * <p>example: mvn test -Dtest="ForwardedHeaderAPIIT" * -DREST_TEST_HOST="https://latest.test.molgenis.org/" */ @BeforeAll static void beforeClass() { LOG.info("Read environment variables"); String envHost = System.getProperty("REST_TEST_HOST"); RestAssured.baseURI = Strings.isNullOrEmpty(envHost) ? RestTestUtils.DEFAULT_HOST : envHost; LOG.info("baseURI: " + RestAssured.baseURI); }
Example 5
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 6
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 7
Source File: BaseIT.java From validator with Apache License 2.0 | 5 votes |
@Before public void setup() { final String port = System.getProperty("daemon.port"); if (port != null) { RestAssured.port = Integer.valueOf(port); } final String baseHost = System.getProperty("daemon.host"); if (baseHost != null) { RestAssured.baseURI = baseHost; } RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); }
Example 8
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 9
Source File: SearchApiTests.java From fess with Apache License 2.0 | 5 votes |
@BeforeAll protected static void initAll() { RestAssured.baseURI = getFessUrl(); settingTestToken(); // create and execute a file crawler try { labelId = createLabel(); crawlLabelId = createCrawlLabel(); createFileConfig(); logger.info("FileConfig is created"); refresh(); fileConfigId = getFileConfigIds(NAME_PREFIX).get(0); createJob(); logger.info("Job is created"); refresh(); startJob(NAME_PREFIX); waitJob(NAME_PREFIX); refresh(); } catch (Exception e) { e.printStackTrace(); assertTrue(false); } }
Example 10
Source File: ConfigurationExtension.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void beforeAll( ExtensionContext context ) { RestAssured.baseURI = TestConfiguration.get().baseUrl(); RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); RestAssured.defaultParser = Parser.JSON; RestAssured.requestSpecification = defaultRequestSpecification(); }
Example 11
Source File: RestAssured3Test.java From raml-tester with Apache License 2.0 | 5 votes |
@Before public void before() { RestAssured.baseURI = baseUrlWithPort(); api = RamlLoaders.fromClasspath(RestAssured3Test.class).load("restAssured.raml") .assumingBaseUri("http://nidi.guru/raml/v1"); restAssured = api.createRestAssured3(); }
Example 12
Source File: AbstractResourceTestBase.java From apicurio-registry with Apache License 2.0 | 5 votes |
@BeforeEach protected void beforeEach() throws Exception { RestAssured.baseURI = "http://localhost:8081/api"; // run all initializers::beforeEach initializers.stream().forEach(ServiceInitializer::beforeEach); // Delete all global rules given().when().delete("/rules").then().statusCode(204); TestUtils.retry(() -> { given().when().get("/rules").then().statusCode(200).body("size()", CoreMatchers.is(0)); }); }
Example 13
Source File: BusinessPartnerServletTest.java From cloud-s4-sdk-book with Apache License 2.0 | 4 votes |
@Before public void before() { RestAssured.baseURI = baseUrl.toExternalForm(); }
Example 14
Source File: AddressServletTest.java From cloud-s4-sdk-book with Apache License 2.0 | 4 votes |
@Before public void before() { RestAssured.baseURI = baseUrl.toExternalForm(); }
Example 15
Source File: OrderServiceTest.java From cap-community with MIT License | 4 votes |
@Before public void before() { RestAssured.baseURI = baseUrl.toExternalForm(); RestAssured.urlEncodingEnabled = false; }
Example 16
Source File: BindingReactiveBase.java From spring-cloud-open-service-broker with Apache License 2.0 | 4 votes |
@BeforeEach void setUp() { RestAssured.baseURI = "http://localhost"; RestAssured.port = this.port; }
Example 17
Source File: HoverflyTest.java From monolith with Apache License 2.0 | 4 votes |
@Before public void init() { RestAssured.baseURI = "http://ticketmonster.io/"; }
Example 18
Source File: CrudTestBase.java From fess with Apache License 2.0 | 4 votes |
@BeforeAll protected static void initAll() { RestAssured.baseURI = getFessUrl(); settingTestToken(); }
Example 19
Source File: CatalogReactiveBase.java From spring-cloud-open-service-broker with Apache License 2.0 | 4 votes |
@BeforeEach void setUp() { RestAssured.baseURI = "http://localhost"; RestAssured.port = this.port; }
Example 20
Source File: BaseClass.java From spring_io_2019 with Apache License 2.0 | 3 votes |
@Before public void before() { RestAssured.baseURI = "http://localhost:" + this.port; Mockito .when(this.repository.findAll()) .thenReturn(Flux.just(new Reservation("1", "Jane"), new Reservation("2", "John"))); }