本文整理匯總了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");
}
示例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();
}
}
示例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();
}
示例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());
});
}
示例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);
}
示例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());
}
示例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();
}
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例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");
}
示例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;
}
示例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();
}
}