当前位置: 首页>>代码示例>>Java>>正文


Java RequestSpecBuilder类代码示例

本文整理汇总了Java中io.restassured.builder.RequestSpecBuilder的典型用法代码示例。如果您正苦于以下问题:Java RequestSpecBuilder类的具体用法?Java RequestSpecBuilder怎么用?Java RequestSpecBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RequestSpecBuilder类属于io.restassured.builder包,在下文中一共展示了RequestSpecBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的io.restassured.builder.RequestSpecBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。