本文整理汇总了Java中io.restassured.builder.RequestSpecBuilder类的典型用法代码示例。如果您正苦于以下问题:Java RequestSpecBuilder类的具体用法?Java RequestSpecBuilder怎么用?Java RequestSpecBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestSpecBuilder类属于io.restassured.builder包,在下文中一共展示了RequestSpecBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testCRUDOperationsAllTogether
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Test
public void testCRUDOperationsAllTogether() {
final String token = queryForToken();
final RequestSpecification reqSpec = new RequestSpecBuilder()
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
.addHeader("Authorization", String.format("Bearer %s", token))
.setRelaxedHTTPSValidation("TLS")
.build();
final String newCustomerUrl = create(reqSpec);
final Customer createdCustomer = read(reqSpec, newCustomerUrl);
update(reqSpec, newCustomerUrl, createdCustomer);
delete(reqSpec, newCustomerUrl);
}
开发者ID:dserradji,项目名称:reactive-customer-service,代码行数:18,代码来源:CustomerServiceIT.java
示例2: getRequestSpecification
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
private RequestSpecification getRequestSpecification(UserTimingRequest userTimingRequest) {
RequestSpecBuilder requestSpecBuilder = new RequestSpecBuilder();
requestSpecBuilder.setConfig(getConfiguration());
requestSpecBuilder.setBody(userTimingRequest);
requestSpecBuilder.setContentType(ContentType.JSON);
getFilters(requestSpecBuilder);
return requestSpecBuilder.build();
}
开发者ID:kaygee,项目名称:timings-client,代码行数:9,代码来源:TimingsFacade.java
示例3: should_get_v1_if_not_logged
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Test
public void should_get_v1_if_not_logged() {
// given
final RequestSpecification requestConfiguration = new RequestSpecBuilder()
.setBaseUri(url.toString())
.build();
// when
given()
.spec(requestConfiguration)
.when()
.get("api/v1/products/{productId}/reviews", 0)
.then()
.assertThat()
.statusCode(200)
.body("$.reviews", not(hasKey("rating")));
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:20,代码来源:ReviewsIT.java
示例4: getFilters
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
private void getFilters(RequestSpecBuilder requestSpecBuilder) {
if (logErrors) {
requestSpecBuilder.addFilter(new ErrorLoggingFilter());
}
if (logRequests) {
requestSpecBuilder.addFilter(new RequestLoggingFilter());
}
if (logResponses) {
requestSpecBuilder.addFilter(new ResponseLoggingFilter());
}
}
开发者ID:kaygee,项目名称:timings-client,代码行数:12,代码来源:TimingsFacade.java
示例5: setUp
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Before
public void setUp() {
// Re-init main channel after clean-up.
channel = channelService.init();
account = accountFactory.register();
requestSpecification = new RequestSpecBuilder()
.setContentType(ContentType.JSON)
.addHeader(HttpHeaders.AUTHORIZATION, "Bearer " + tokenHandler.createToken(account).getToken())
.setBaseUri("http://localhost")
.setBasePath("/api/v1/channels")
.setPort(port)
.build();
}
开发者ID:Edvinas01,项目名称:chat-rooms,代码行数:16,代码来源:ChannelControllerIntegrationTest.java
示例6: setUp
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Before
public void setUp() {
Account account = accountFactory.registerAdmin();
channel = channelRepository.save(new Channel(mainChannelName + "other"));
requestSpecification = new RequestSpecBuilder()
.setContentType(ContentType.JSON)
.addHeader(HttpHeaders.AUTHORIZATION, "Bearer " + tokenHandler.createToken(account).getToken())
.setBaseUri("http://localhost")
.setBasePath("/api/v1/admin/channels")
.setPort(port)
.build();
}
开发者ID:Edvinas01,项目名称:chat-rooms,代码行数:14,代码来源:ChannelManagementControllerIntegrationTest.java
示例7: setUp
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Before
public void setUp() {
account = accountFactory.registerAdmin();
requestSpecification = new RequestSpecBuilder()
.setContentType(ContentType.JSON)
.addHeader(HttpHeaders.AUTHORIZATION, "Bearer " + tokenHandler.createToken(account).getToken())
.setBaseUri("http://localhost")
.setBasePath("/api/v1/admin/accounts")
.setPort(port)
.build();
}
开发者ID:Edvinas01,项目名称:chat-rooms,代码行数:13,代码来源:AccountManagementControllerIntegrationTest.java
示例8: setUp
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Before
public void setUp() {
requestSpecification = new RequestSpecBuilder()
.setContentType(ContentType.JSON)
.setBaseUri("http://localhost")
.setBasePath("/api/v1/accounts")
.setPort(port)
.build();
// Setup test account.
account = accountFactory.register();
}
开发者ID:Edvinas01,项目名称:chat-rooms,代码行数:13,代码来源:AccountControllerIntegrationTest.java
示例9: fieldSpec
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Override
public FieldSpec fieldSpec() {
return FieldSpec.builder(ParameterizedTypeName.get(
ClassName.get(Supplier.class),
ClassName.get(RequestSpecBuilder.class)
), name(), PRIVATE).build();
}
开发者ID:qameta,项目名称:rarc,代码行数:8,代码来源:ReqSpecSupplField.java
示例10: shouldBeAbleToCompile
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Test
public void shouldBeAbleToCompile() throws Exception {
ApiExample.example(
ApiExample.Config.exampleConfig()
.withReqSpecSupplier(
() -> new RequestSpecBuilder().setBaseUri("http://your_host/")
)
)
.rpcApi()
.uid().withUid("1")
.info()
.get(identity()).prettyPeek();
}
开发者ID:qameta,项目名称:rarc,代码行数:15,代码来源:ApiExampleUsageTest.java
示例11: shouldUseDuplicateParams
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Test
public void shouldUseDuplicateParams() {
ApiExample.example(
ApiExample.Config.exampleConfig()
.withReqSpecSupplier(
() -> new RequestSpecBuilder().setBaseUri("http://your_host/")
)
).hardDuplicate().withDuplicatedParam("blah").post(identity()).prettyPeek();
}
开发者ID:qameta,项目名称:rarc,代码行数:10,代码来源:ApiExampleUsageTest.java
示例12: configureRequestSpecBuilder
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
void configureRequestSpecBuilder(@Observes RestAssuredConfiguration restAssuredConfiguration,
CubeDockerConfiguration cubeDockerConfiguration, RequestSpecBuilder requestSpecBuilder) {
if (restAssuredConfiguration.isBaseUriSet()) {
requestSpecBuilder.setBaseUri(restAssuredConfiguration.getBaseUri());
} else {
requestSpecBuilder.setBaseUri(
restAssuredConfiguration.getSchema() + "://" + cubeDockerConfiguration.getDockerServerIp());
}
if (restAssuredConfiguration.isPortSet()) {
requestSpecBuilder.setPort(SinglePortBindResolver.resolveBindPort(cubeDockerConfiguration,
restAssuredConfiguration.getPort(),
restAssuredConfiguration.getExclusionContainers()));
} else {
requestSpecBuilder.setPort(SinglePortBindResolver.resolveBindPort(cubeDockerConfiguration,
restAssuredConfiguration.getExclusionContainers()));
}
if (restAssuredConfiguration.isBasePathSet()) {
requestSpecBuilder.setBasePath(restAssuredConfiguration.getBasePath());
}
if (restAssuredConfiguration.isAuthenticationSchemeSet()) {
requestSpecBuilder.setAuth(restAssuredConfiguration.getAuthenticationScheme());
}
if (restAssuredConfiguration.isUseRelaxedHttpsValidationSet()) {
if (restAssuredConfiguration.isUseRelaxedHttpsValidationInAllProtocols()) {
requestSpecBuilder.setRelaxedHTTPSValidation();
} else {
requestSpecBuilder.setRelaxedHTTPSValidation(restAssuredConfiguration.getUseRelaxedHttpsValidation());
}
}
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:35,代码来源:RestAssuredCustomizer.java
示例13: lookup
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Override
public Object lookup(ArquillianResource resource, Annotation... qualifiers) {
RequestSpecBuilder requestSpecBuilder = requestSpecBuilderInstance.get();
if (requestSpecBuilder == null) {
throw new IllegalStateException("RequestSpecBuilder was not found.");
}
//Override with elements provided in DockerUrl
final Optional<DockerUrl> dockerUrlAnnotation = getDockerUrlAnnotation(qualifiers);
if (dockerUrlAnnotation.isPresent()) {
final DockerUrl dockerUrl = dockerUrlAnnotation.get();
//We only override in case of setting here as https, in other cases, the original value is used which correctly
// points to docker host.
if ("https".equals(dockerUrl.protocol())) {
requestSpecBuilder.setBaseUri(dockerUrl.protocol() + "://" + getHost());
}
final String containerName = dockerUrl.containerName();
final int exposedPort = dockerUrl.exposedPort();
final int bindPort = getBindingPort(containerName, exposedPort);
if (bindPort > 0) {
return requestSpecBuilder.setPort(bindPort);
} else {
logger.log(Level.WARNING, String.format("There is no container with id %s.", containerName));
}
requestSpecBuilder.setBasePath(dockerUrl.context());
}
return requestSpecBuilder;
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:38,代码来源:RequestSpecBuilderResourceProvider.java
示例14: configureRequestSpecBuilder
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
void configureRequestSpecBuilder(@Observes RestAssuredConfiguration restAssuredConfiguration, CubeOpenShiftConfiguration openShiftConfiguration, RequestSpecBuilder requestSpecBuilder) {
if (restAssuredConfiguration.isBaseUriSet()) {
requestSpecBuilder.setBaseUri(restAssuredConfiguration.getBaseUri());
} else {
requestSpecBuilder.setBaseUri(
restAssuredConfiguration.getSchema() + "://" + openShiftConfiguration.getMasterUrl());
}
if (restAssuredConfiguration.isPortSet()) {
requestSpecBuilder.setPort(restAssuredConfiguration.getPort());
} else {
requestSpecBuilder.setPort(openShiftConfiguration.getOpenshiftRouterHttpPort());
}
if (restAssuredConfiguration.isBasePathSet()) {
requestSpecBuilder.setBasePath(restAssuredConfiguration.getBasePath());
}
if (restAssuredConfiguration.isAuthenticationSchemeSet()) {
requestSpecBuilder.setAuth(restAssuredConfiguration.getAuthenticationScheme());
}
if (restAssuredConfiguration.isUseRelaxedHttpsValidationSet()) {
if (restAssuredConfiguration.isUseRelaxedHttpsValidationInAllProtocols()) {
requestSpecBuilder.setRelaxedHTTPSValidation();
} else {
requestSpecBuilder.setRelaxedHTTPSValidation(restAssuredConfiguration.getUseRelaxedHttpsValidation());
}
}
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:31,代码来源:RestAssuredCustomizer.java
示例15: configureRequestSpecBuilder
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
private RequestSpecBuilder configureRequestSpecBuilder(URL route) {
final RequestSpecBuilder requestSpecBuilder = requestSpecBuilderInstance.get();
if (requestSpecBuilder == null) {
throw new IllegalStateException("RequestSpecBuilder was not found.");
}
requestSpecBuilder.setBaseUri(route.getProtocol() + "://" + route.getHost());
requestSpecBuilder.setPort(route.getPort());
requestSpecBuilder.setBasePath(route.getPath());
awaitRoute(route);
return requestSpecBuilder;
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:14,代码来源:RequestSpecBuilderResourceProvider.java
示例16: configureEndpoint
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
public RequestSpecification configureEndpoint() {
return new RequestSpecBuilder().setBaseUri(UriBuilder.fromUri(deploymentUri).path("api").path("launchpad").build()).build();
}
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:4,代码来源:LaunchResourceIT.java
示例17: setUp
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
this.documentationFilter = document("{method-name}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()));
this.spec = new RequestSpecBuilder().addFilter(documentationConfiguration(this.restDocumentation)).addFilter(this.documentationFilter).build();
this.token = new Pkcs12SignatureToken(new FileInputStream("src/test/resources/user_a_rsa.p12"), "password");
}
开发者ID:esig,项目名称:dss-demonstrations,代码行数:7,代码来源:RestDocumentationApp.java
示例18: fieldSpec
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Override
public FieldSpec fieldSpec() {
return FieldSpec.builder(ClassName.get(RequestSpecBuilder.class), name(), Modifier.PRIVATE).build();
}
开发者ID:qameta,项目名称:rarc,代码行数:5,代码来源:ReqSpecField.java
示例19: RestAssuredTool
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
public RestAssuredTool(final String baseURI) {
this.requestSpecification = new RequestSpecBuilder().setBaseUri(baseURI).build();
}
开发者ID:MagenTys,项目名称:cinnamon,代码行数:4,代码来源:RestAssuredTool.java
示例20: canProvide
import io.restassured.builder.RequestSpecBuilder; //导入依赖的package包/类
@Override
public boolean canProvide(Class<?> type) {
return RequestSpecBuilder.class.isAssignableFrom(type);
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:5,代码来源:RequestSpecBuilderResourceProvider.java
注:本文中的io.restassured.builder.RequestSpecBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论