當前位置: 首頁>>代碼示例>>Java>>正文


Java RestAssured.baseURI方法代碼示例

本文整理匯總了Java中io.restassured.RestAssured.baseURI方法的典型用法代碼示例。如果您正苦於以下問題:Java RestAssured.baseURI方法的具體用法?Java RestAssured.baseURI怎麽用?Java RestAssured.baseURI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.restassured.RestAssured的用法示例。


在下文中一共展示了RestAssured.baseURI方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Resource

import io.restassured.RestAssured; //導入方法依賴的package包/類
public Resource(HashMap<CommsRouterResource, String> state) {
  RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
  java.util.Map<String, String> env = System.getenv();

  if (System.getProperty("autHost") == null) {
    String host = env.get("AUT_HOST");
    if (host != null) {
      RestAssured.baseURI = host;
    } else {
      RestAssured.baseURI = "http://localhost:8080";
    }
  } else {
    // you can specify it using -DautHost=http://localhost:8080
    RestAssured.baseURI = System.getProperty("autHost");
  }
  RestAssured.basePath = "/comms-router-web/api";
  this.state = state;
}
 
開發者ID:Nexmo,項目名稱:comms-router,代碼行數:19,代碼來源:Resource.java

示例2: setUp

import io.restassured.RestAssured; //導入方法依賴的package包/類
@BeforeClass
public static void setUp() 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;
    }
    headers.put(YamlToJsonConverterServlet.TCK_HEADER_SERVERURL, serverUrl);
    if (StringUtils.isNotBlank(username)) {
        headers.put(YamlToJsonConverterServlet.TCK_HEADER_USERNAME, username);
    }
    if (StringUtils.isNotBlank(password)) {
        headers.put(YamlToJsonConverterServlet.TCK_HEADER_PASSWORD, password);
    }
}
 
開發者ID:eclipse,項目名稱:microprofile-open-api,代碼行數:39,代碼來源:AppTestBase.java

示例3: setup

import io.restassured.RestAssured; //導入方法依賴的package包/類
@Before
public void setup() {
	RestAssured.baseURI = "https://127.0.0.1:6443/as-api";
	RestAssured.basePath = "/api/v1";
	//單項認證允許所有客戶端通過
	RestAssured.useRelaxedHTTPSValidation();
}
 
開發者ID:strictnerd,項目名稱:LearningSummary,代碼行數:8,代碼來源:HTTPAPITest.java

示例4: setup

import io.restassured.RestAssured; //導入方法依賴的package包/類
@BeforeClass
public static void setup() {
	String port = System.getProperty("server.port");
	RestAssured.port = (port == null) ? 8082 : Integer.valueOf(port);

	String basePath = System.getProperty("server.base");
	if (basePath == null) 
		basePath = "/openrouteservice-" + Utils.getORSVersion() + "/";
	
	RestAssured.basePath = basePath;

	String baseHost = System.getProperty("server.host");
	if (baseHost == null) 
		baseHost = "http://localhost";
	
	RestAssured.baseURI = baseHost;
}
 
開發者ID:GIScience,項目名稱:openrouteservice,代碼行數:18,代碼來源:ServiceTest.java

示例5: beforeAll

import io.restassured.RestAssured; //導入方法依賴的package包/類
@Override
public void beforeAll(ExtensionContext context) throws Exception {
	Optional<String> baseUri = getProperty(BASE_URI_PROPERTY);
	Optional<String> port = getProperty(DEPLOY_PORT_PROPERTY);

	RestAssured.port = Integer.parseInt(port.orElse("8080"));
	RestAssured.baseURI = baseUri.map(host -> "http://" + host).orElse(RestAssured.DEFAULT_URI);
	RestAssured.rootPath = ROOT_PATH;

	waitForIt(baseUri.orElse("localhost"), RestAssured.port);
}
 
開發者ID:CMSgov,項目名稱:qpp-conversion-tool,代碼行數:12,代碼來源:RestExtension.java

示例6: setup

import io.restassured.RestAssured; //導入方法依賴的package包/類
@Before
public void setup() {
	RestAssured.baseURI =
			"https://api.stripe.com/";
	RestAssured.authentication =
			RestAssured.basic("sk_test_BQokikJOvBiI2HlWgH4olfQ2", "");
}
 
開發者ID:marcingrzejszczak,項目名稱:the-legacy-app,代碼行數:8,代碼來源:BaseClass.java

示例7: setup

import io.restassured.RestAssured; //導入方法依賴的package包/類
@Before
public void setup() {
	RestAssured.baseURI = "https://127.0.0.1:8443/web";
	RestAssured.basePath = "";
	//RestAssured.useRelaxedHTTPSValidation();
	//RestAssured.config = RestAssuredConfig.newConfig().sslConfig(SSLConfig.sslConfig().allowAllHostnames());
			
	RestAssured.authentication = RestAssured
			.certificate("clq.truststore",
					"123456","clq.p12", "123456",
					CertificateAuthSettings
					.certAuthSettings()
					.keyStoreType("PKCS12")
					.trustStoreType("jks"));
}
 
開發者ID:strictnerd,項目名稱:LearningSummary,代碼行數:16,代碼來源:HTTPSApiJsonTest.java

示例8: initClass

import io.restassured.RestAssured; //導入方法依賴的package包/類
@BeforeAll
public static void initClass(){
    restController.setControllerPort(0);
    restController.startTheControllerServer();

    RestAssured.baseURI = "http://localhost";
    RestAssured.port = restController.getControllerServerPort();
    RestAssured.basePath = "/controller/api";
    RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
}
 
開發者ID:EMResearch,項目名稱:EvoMaster,代碼行數:11,代碼來源:SutControllerTest.java

示例9: retrieveOAuthToken

import io.restassured.RestAssured; //導入方法依賴的package包/類
/*******************************************************
 * Request an authentication token for the Paypal sandbox
 * API and write the response to the console
 * Use Basic authentication
 * username = oauth
 * password = gimmeatoken
 * Use /v1/oauth2/token
 * Store this authentication token in a String variable
 * for future reference
 ******************************************************/
	
@BeforeClass
public void retrieveOAuthToken() {
	
	RestAssured.baseURI = "http://localhost:9876";
					
	given().
	when().
	then();
}
 
開發者ID:basdijkstra,項目名稱:workshops,代碼行數:21,代碼來源:RestAssuredExercises4.java

示例10: setup

import io.restassured.RestAssured; //導入方法依賴的package包/類
@BeforeClass
public static void setup(){
  RestAssured.baseURI = "http://localhost";
  RestAssured.port = 9267;
  
  if(application == null) {
    application = new Application();
  }
}
 
開發者ID:sysunite,項目名稱:excel-microservice,代碼行數:10,代碼來源:BaseTest.java

示例11: getReleaseId

import io.restassured.RestAssured; //導入方法依賴的package包/類
/**
 * Get release ID.
 */
public String getReleaseId(String releaseName) {
    RestAssured.baseURI = SPIRA_URI;
    String path = String.format(
            "find {it.FullName == '%s'}.ReleaseId", releaseName);

    return given().contentType("application/json")
            .param("username", SpiraConfig.USERNAME)
            .param("api-key", SpiraConfig.API_KEY)
            .when()
            .get("/releases")
            .thenReturn().jsonPath()
            .getString(path);
}
 
開發者ID:Frameworkium,項目名稱:frameworkium-core,代碼行數:17,代碼來源:SpiraExecution.java

示例12: before

import io.restassured.RestAssured; //導入方法依賴的package包/類
@Before
public void before() {
    RestAssured.baseURI = baseUrlWithPort();
    api = RamlLoaders.fromClasspath(RestAssured3Test.class).load("restAssured.raml")
            .assumingBaseUri("http://nidi.guru/raml/v1");
    restAssured = api.createRestAssured3();
}
 
開發者ID:nidi3,項目名稱:raml-tester,代碼行數:8,代碼來源:RestAssured3Test.java

示例13: testWithoutBaseUri

import io.restassured.RestAssured; //導入方法依賴的package包/類
@Test
public void testWithoutBaseUri() throws IOException {
    RestAssured.baseURI = baseUrlWithPort();
    api = RamlLoaders.fromClasspath(RestAssured3Test.class).load("restAssuredWithoutBaseUri.raml");
    restAssured = api.createRestAssured3();

    restAssured.given().get("/base/data").andReturn();
    assertThat(restAssured.getLastReport(), checks());
}
 
開發者ID:nidi3,項目名稱:raml-tester,代碼行數:10,代碼來源:RestAssured3Test.java

示例14: testWithPortAndPath

import io.restassured.RestAssured; //導入方法依賴的package包/類
@Test
public void testWithPortAndPath() throws IOException {
    RestAssured.baseURI = baseUrl();
    RestAssured.port = PORT;
    restAssured.given().get("/base/data").andReturn();
    assertThat(restAssured.getLastReport(), checks());
}
 
開發者ID:nidi3,項目名稱:raml-tester,代碼行數:8,代碼來源:RestAssured3Test.java

示例15: beforeClass

import io.restassured.RestAssured; //導入方法依賴的package包/類
/**
 * Pass down system properties via the mvn commandline argument
 * <p>
 * example:
 * mvn test -Dtest="RestControllerIT" -DREST_TEST_HOST="https://molgenis01.gcc.rug.nl" -DREST_TEST_ADMIN_NAME="admin" -DREST_TEST_ADMIN_PW="admin"
 */
@BeforeClass
public 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);

	String envAdminName = System.getProperty("REST_TEST_ADMIN_NAME");
	String adminUserName = Strings.isNullOrEmpty(envAdminName) ? RestTestUtils.DEFAULT_ADMIN_NAME : envAdminName;
	LOG.info("adminUserName: " + adminUserName);

	String envAdminPW = System.getProperty("REST_TEST_ADMIN_PW");
	String adminPassword = Strings.isNullOrEmpty(envAdminPW) ? RestTestUtils.DEFAULT_ADMIN_PW : envAdminPW;
	LOG.info("adminPassword: " + adminPassword);

	adminToken = login(adminUserName, adminPassword);

	createUser(adminToken, REST_TEST_USER, REST_TEST_USER_PASSWORD);
	testUserId = getUserId(adminToken, REST_TEST_USER);

	grantSystemRights(adminToken, testUserId, "sys_FreemarkerTemplate", WRITE);
	grantSystemRights(adminToken, testUserId, "sys_scr_ScriptType", READ);
	grantSystemRights(adminToken, testUserId, "sys_sec_UserAuthority", COUNT);
	grantSystemRights(adminToken, testUserId, "sys_FileMeta", WRITEMETA);

	testUserToken = login(REST_TEST_USER, REST_TEST_USER_PASSWORD);
}
 
開發者ID:molgenis,項目名稱:molgenis,代碼行數:35,代碼來源:RestControllerIT.java


注:本文中的io.restassured.RestAssured.baseURI方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。