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


Java RestAssured.port方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: startApp

import io.restassured.RestAssured; //導入方法依賴的package包/類
@BeforeClass
public static void startApp() {

    RestAssured.config = RestAssured.config().sessionConfig(new SessionConfig().sessionIdName("APPSESSIONID"));
    RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
    RestAssured.port = 9090;

    Thread thread = new Thread(() -> {
        try {
            JettyApp.main(new String[]{Integer.toString(RestAssured.port)});
        } catch (Exception e) {
            e.printStackTrace();
        }
    });
    thread.start();
    // give the app time to spin up
    try {
        Thread.sleep(3000);
    } catch (InterruptedException ex) {
        Thread.currentThread().interrupt();
    }

}
 
開發者ID:wmluke,項目名稱:pipes,代碼行數:24,代碼來源:ExampleAppWithJettyTest.java

示例4: startApp

import io.restassured.RestAssured; //導入方法依賴的package包/類
@BeforeClass
public static void startApp() {
    RestAssured.port = 9191;

    Thread thread = new Thread(() -> {
        try {
            NettyApp.main(new String[]{Integer.toString(RestAssured.port)});
        } catch (Exception e) {
            e.printStackTrace();
        }
    });
    thread.start();
    // give the app time to spin up
    try {
        Thread.sleep(3000);
    } catch (InterruptedException ex) {
        Thread.currentThread().interrupt();
    }
}
 
開發者ID:wmluke,項目名稱:pipes,代碼行數:20,代碼來源:ExampleAppWithNettyTest.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: BaseHttpTest

import io.restassured.RestAssured; //導入方法依賴的package包/類
public BaseHttpTest(String httpLoggingFilename) {
    LoggingHttpRequestFactory request = new LoggingHttpRequestFactory(httpLoggingFilename);

    Guice.createInjector(new WayfGuiceModule()).injectMembers(this);

    RestAssured.port = port;

    publisherTestUtil = new PublisherTestUtil(request);
    deviceTestUtil = new DeviceTestUtil(request);
    deviceAccessTestUtil = new DeviceAccessTestUtil(request);
    identityProviderTestUtil = new IdentityProviderTestUtil(request);
    publisherRegistrationTestUtil = new PublisherRegistrationTestUtil(request);
    userTestUtil = new UserTestUtil(request);
}
 
開發者ID:Atypon-OpenSource,項目名稱:wayf-cloud,代碼行數:15,代碼來源:BaseHttpTest.java

示例7: 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

示例8: init

import io.restassured.RestAssured; //導入方法依賴的package包/類
@Before
public void init() {
    LOG.info("Testing on serverPort: " + serverPort);

    // port from the funktion.yml
    RestAssured.port = serverPort;
}
 
開發者ID:funktionio,項目名稱:funktion-connectors,代碼行數:8,代碼來源:LocalRestTest.java

示例9: setUpRestAssured

import io.restassured.RestAssured; //導入方法依賴的package包/類
/**
 * Sets up RestAssured test framework before tests.
 */
@BeforeTest
public void setUpRestAssured() {
    RestAssured.reset();
    RestAssured.port = ENDPOINT_PORT;
    RestAssured.basePath = "";
}
 
開發者ID:krizsan,項目名稱:rest-example,代碼行數:10,代碼來源:RestResourceTestBase.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: startingApplicationUp

import io.restassured.RestAssured; //導入方法依賴的package包/類
@BeforeClass
public void startingApplicationUp() {
    RestAssured.basePath = "sample-app";
    int port = SocketUtils.findAvailableTcpPort();
    RestAssured.port = port;

    SpringApplication springApplication = new SpringApplication(Application.class);
    springApplication.addListeners(new LogbackTestApplicationListener());
    springApplication.run("--server.port=" + port).registerShutdownHook();
}
 
開發者ID:paypal,項目名稱:resteasy-spring-boot,代碼行數:11,代碼來源:CommonUseCasesIT.java

示例12: setUp

import io.restassured.RestAssured; //導入方法依賴的package包/類
@BeforeClass
public void setUp() {
    int appPort = SocketUtils.findAvailableTcpPort();

    RestAssured.basePath = "sample-app";
    RestAssured.port = appPort;

    Properties properties = new Properties();
    properties.put("server.context-parameters.resteasy.async.job.service.enabled", true);

    SpringApplication app = new SpringApplication(Application.class);
    app.setDefaultProperties(properties);
    app.addListeners(new LogbackTestApplicationListener());
    app.run("--server.port=" + appPort).registerShutdownHook();
}
 
開發者ID:paypal,項目名稱:resteasy-spring-boot,代碼行數:16,代碼來源:AsyncJobIT.java

示例13: 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

示例14: abstractBefore

import io.restassured.RestAssured; //導入方法依賴的package包/類
@Before
public final void abstractBefore() {
    RestAssured.baseURI = "http://localhost";
    RestAssured.basePath = basePath;
    RestAssured.port = getApplicationPort(applicationName);
}
 
開發者ID:enadim,項目名稱:spring-cloud-ribbon-extensions,代碼行數:7,代碼來源:AbstractTest.java

示例15: before

import io.restassured.RestAssured; //導入方法依賴的package包/類
@Before
public void before() {
    RestAssured.port = port;
    server1.setPort(port);
    server2.setPort(port);
}
 
開發者ID:enadim,項目名稱:spring-cloud-ribbon-extensions,代碼行數:7,代碼來源:AbstractSupportTest.java


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