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


Java RestAssured.port方法代碼示例

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


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

示例1: configureRestAssured

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
@BeforeClass
public static void configureRestAssured() {
	Vertx vertx = Vertx.vertx();

	JsonObject config = new JsonObject().put("server.port", getRandomPort());

	LoginHandler loginHandler = new LoginHandler();
	loginHandler.setInvocationHandler(new VertxInvocationHandler(vertx));

	RestVerticle restVerticle = new RestVerticle();
	restVerticle.setRequestHandlers(Arrays.asList(loginHandler));

	ServiceVerticle serviceVerticle = new ServiceVerticle();
	serviceVerticle.setServiceHandlers(Arrays.asList(loginHandler));

	DeploymentOptions options = new DeploymentOptions().setConfig(config);
	vertx.deployVerticle(restVerticle, options);
	vertx.deployVerticle(serviceVerticle, options);

	RestAssured.baseURI = "http://localhost";
	RestAssured.port = config.getInteger("server.port");
}
 
開發者ID:simonemasoni,項目名稱:vertx_spring,代碼行數:23,代碼來源:IntegrationTest.java

示例2: setup

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
@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();
    }

}
 
開發者ID:eclipse,項目名稱:microprofile-metrics,代碼行數:29,代碼來源:MpMetricTest.java

示例3: init

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
/**
 * Method called to initialize basic resources after the object is created.
 */
@PostConstruct
public void init() {
  mockExternalAuthorization();

  RestAssured.baseURI = BASE_URL;
  RestAssured.port = serverPort;
  RestAssured.config = RestAssuredConfig.config().objectMapperConfig(
      new ObjectMapperConfig().jackson2ObjectMapperFactory((clazz, charset) -> objectMapper)
  );

  RamlDefinition ramlDefinition = RamlLoaders.fromClasspath()
      .load("api-definition-raml.yaml").ignoringXheaders();

  restAssured = ramlDefinition.createRestAssured();
}
 
開發者ID:OpenLMIS,項目名稱:openlmis-stockmanagement,代碼行數:19,代碼來源:BaseWebIntegrationTest.java

示例4: setUp

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
@Before
public void setUp(TestContext context) {
  Async async = context.async();
  VertxOptions options = new VertxOptions();
  options.setBlockedThreadCheckInterval(60000); // in ms
  options.setWarningExceptionTime(60000); // in ms
  vertx = Vertx.vertx(options);
  RestAssured.port = port;
  client = vertx.createHttpClient();

  checkDocker(res2 -> {
    haveDocker = res2.succeeded();
    logger.info("haveDocker = " + haveDocker);

    DeploymentOptions opt = new DeploymentOptions()
      .setConfig(new JsonObject().put("port", Integer.toString(port)));

    vertx.deployVerticle(MainVerticle.class.getName(),
      opt, res -> async.complete());
  });
}
 
開發者ID:folio-org,項目名稱:okapi,代碼行數:22,代碼來源:DockerTest.java

示例5: testLogLevel

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
@Test
public void testLogLevel() {
  RestAssured.port = port;

  String currentLevel = given().get("/_/test/loglevel").then()
    .assertThat().statusCode(200).extract().body().asString();

  String trace = "{\"level\":\"TRACE\"}";
  given().header("Content-Type", "application/json")
    .body(trace)
    .post("/_/test/loglevel").then()
    .assertThat().statusCode(200);

  given().get("/_/test/loglevel").then()
    .assertThat().statusCode(200);

  given() // Put the level back to what it was
    .header("Content-Type", "application/json")
    .body(currentLevel)
    .post("/_/test/loglevel").then()
    .assertThat().statusCode(200);

}
 
開發者ID:folio-org,項目名稱:okapi,代碼行數:24,代碼來源:LogLevelTest.java

示例6: before

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
@Before
public final void before() {
	RestAssured.port = port;
	loadJsonApiSchema();

	client = new CrnkClient("http://localhost:" + port + "/api");
	client.addModule(ValidationModule.newInstance());
	client.addModule(JpaModule.newClientModule());
}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:10,代碼來源:BaseTest.java

示例7: beforeClass

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
@BeforeClass
public static void beforeClass() {
   RestAssured.baseURI = BASE_URL;
   RestAssured.port = PORT;
   RestAssured.basePath = STREAMS;
   if (!EVENT_STORE_PROVIDER.isRunning()) {
      EVENT_STORE_PROVIDER.start();
   }
}
 
開發者ID:Qyotta,項目名稱:axon-eventstore,代碼行數:10,代碼來源:AbstractEsTest.java

示例8: setUp

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
/**
 * Run before each test.
 */
@Before
@Sql({"/schemaIT.sql", "/dataIT.sql"})
public void setUp() {
	
	RestAssured.baseURI="http://localhost";
	RestAssured.port=serverPort;
	
}
 
開發者ID:andju,項目名稱:findlunch,代碼行數:12,代碼來源:OfferRestControllerIT.java

示例9: setUp

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
@Before
public void setUp() {
    RestAssured.port = port;
    rmqHelper.rabbitMqPropertiesInit(protocol);
    rmqHelper.getRabbitMqPropertiesMap().get(protocol).setHost(host);
    rmqHelper.getRabbitMqPropertiesMap().get(protocol).setExchangeName(exchangeName);
    rmqHelper.getRabbitMqPropertiesMap().get(protocol).setDomainId(domainId);
}
 
開發者ID:Ericsson,項目名稱:eiffel-remrem-publish,代碼行數:9,代碼來源:ProducerControllerIntegrationTest.java

示例10: setUp

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
/**
 * Sets the up.
 */
@Before
@Sql({"/schemaIT.sql", "/dataIT.sql"})
public void setUp() {
	
	RestAssured.baseURI="http://localhost";
	RestAssured.port=serverPort;
	
}
 
開發者ID:andju,項目名稱:findlunch,代碼行數:12,代碼來源:FavoritesRestControllerIT.java

示例11: beforeClass

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
/**
 * Initialization that is performed once before any of the tests in this
 * class are executed.
 *
 * @throws Exception
 */
@BeforeClass
public static void beforeClass() throws Exception
{
    RestAssured.baseURI = BASE_URI;
    RestAssured.port = PORT;
    f = Fixtures.getInstance();
    RestExpressManager.getManager().ensureRestExpressRunning();
}
 
開發者ID:PearsonEducation,項目名稱:Docussandra,代碼行數:15,代碼來源:AbstractTableControllerTest.java

示例12: testHealthCheck

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
@Test
public void testHealthCheck() {
  RestAssured.port = port;

  RamlDefinition api = RamlLoaders.fromFile("src/main/raml").load("okapi.raml")
          .assumingBaseUri("https://okapi.cloud");

  RestAssuredClient c;

  c = api.createRestAssured();
  c.given().get("/_/proxy/health").then().assertThat().statusCode(200);
  Assert.assertTrue("raml report: " + c.getLastReport().toString(), c.getLastReport().isEmpty());

  given().get("/_/proxy/health2").then().assertThat().statusCode(404);
}
 
開發者ID:folio-org,項目名稱:okapi,代碼行數:16,代碼來源:HealthCheckTest.java

示例13: testEnsureTestDocussandraRunningWithMockCassandra

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
/**
 * Test of ensureTestDocussandraRunningWithMockCassandra method, of class
 * TestDocussandraManager.
 */
@Test
public void testEnsureTestDocussandraRunningWithMockCassandra() throws Exception
{
    System.out.println("ensureTestDocussandraRunningWithMockCassandra");
    //String keyspace = "docussandra";
    TestDocussandraManager instance = TestDocussandraManager.getManager();
    instance.ensureTestDocussandraRunning(true);
    RestAssured.baseURI = "http://localhost";
    RestAssured.port = 19080;
    RestAssured.basePath = "/";
    expect().statusCode(200)
            .body("isHealthy", equalTo(true))
            .get("/admin/health");
}
 
開發者ID:PearsonEducation,項目名稱:Docussandra,代碼行數:19,代碼來源:TestDocussandraManagerTest.java

示例14: setUp

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
/**
 * Run before each test.
 */
@Before
@Sql({"/schemaIT.sql", "/dataIT.sql"})
public void setUp() {
	
	RestAssured.baseURI="http://localhost";
	RestAssured.port=serverPort;
}
 
開發者ID:andju,項目名稱:findlunch,代碼行數:11,代碼來源:RestaurantRestControllerIT.java

示例15: setUp

import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
@Before
public void  setUp() throws IOException {
    RestAssured.port = port;
    artifactPublishedBody = loadEventBody(artifactPublishedFileName);
    activityFinishedBody = loadEventBody(activityFinishedFileName);

    if (version == null) {
        version = getMessagingVersion();
    }
}
 
開發者ID:Ericsson,項目名稱:eiffel-remrem-generate,代碼行數:11,代碼來源:EiffelRemremControllerIntegrationTest.java


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