Here are the examples of the java api org.springframework.http.MediaType.APPLICATION_JSON_VALUE taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1153 Examples
19
View Source File : OAuth2ResourceServerAutoConfigurationTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private void setupMockResponse(String issuer) throws JsonProcessingException {
MockResponse mockResponse = new MockResponse().setResponseCode(HttpStatus.OK.value()).setBody(new ObjectMapper().writeValuereplacedtring(getResponse(issuer))).setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
this.server.enqueue(mockResponse);
}
19
View Source File : RiderAcceptanceTest.java
License : MIT License
Project Creator : woowacourse-teams
License : MIT License
Project Creator : woowacourse-teams
private void fetchUpdateRider(final String resource, final JwtTokenResponse tokenResponse) {
final RiderUpdateRequest riderUpdateRequest = updateMockRequest();
final String location = given().header(createTokenHeader(tokenResponse)).body(riderUpdateRequest).contentType(MediaType.APPLICATION_JSON_VALUE).when().put(resource).then().log().all().statusCode(HttpStatus.OK.value()).extract().header("Location");
replacedertThat(resource).isEqualTo(location);
}
19
View Source File : RiderAcceptanceTest.java
License : MIT License
Project Creator : woowacourse-teams
License : MIT License
Project Creator : woowacourse-teams
private RiderResponses findAllRidersInRace(final Long raceId, final JwtTokenResponse tokenResponse) {
return given().header(createTokenHeader(tokenResponse)).accept(MediaType.APPLICATION_JSON_VALUE).when().get("/api/riders/races/{id}", raceId).then().log().all().statusCode(HttpStatus.OK.value()).extract().as(RiderResponses.clreplaced);
}
19
View Source File : MemberAcceptanceTest.java
License : MIT License
Project Creator : woowacourse-teams
License : MIT License
Project Creator : woowacourse-teams
private MemberResponses requestFindAll(final Long kakaoId) {
return given().header(createTokenHeader(kakaoId)).accept(MediaType.APPLICATION_JSON_VALUE).when().get(RESOURCE_URL + "/all").then().log().all().statusCode(HttpStatus.OK.value()).extract().as(MemberResponses.clreplaced);
}
19
View Source File : CertificationAcceptanceTest.java
License : MIT License
Project Creator : woowacourse-teams
License : MIT License
Project Creator : woowacourse-teams
private CertificationResponse fetchRetrieveCertification(final JwtTokenResponse token, final String resource) {
return given().header(createTokenHeader(token)).accept(MediaType.APPLICATION_JSON_VALUE).when().get(resource).then().log().all().statusCode(HttpStatus.OK.value()).extract().as(CertificationResponse.clreplaced);
}
19
View Source File : RequestMappingHandlerAdapterTests.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
// SPR-10859
@Test
public void responseBodyAdvice() throws Exception {
List<HttpMessageConverter<?>> converters = new ArrayList<>();
converters.add(new MappingJackson2HttpMessageConverter());
this.handlerAdapter.setMessageConverters(converters);
this.webAppContext.registerSingleton("rba", ResponseCodeSuppressingAdvice.clreplaced);
this.webAppContext.refresh();
this.request.addHeader("Accept", MediaType.APPLICATION_JSON_VALUE);
this.request.setParameter("c", "callback");
HandlerMethod handlerMethod = handlerMethod(new SimpleController(), "handleBadRequest");
this.handlerAdapter.afterPropertiesSet();
this.handlerAdapter.handle(this.request, this.response, handlerMethod);
replacedertThat(this.response.getStatus()).isEqualTo(200);
replacedertThat(this.response.getContentreplacedtring()).isEqualTo("{\"status\":400,\"message\":\"body\"}");
}
19
View Source File : HttpEntityMethodProcessorTests.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
@Test
public void resolveArgumentTypeVariable() throws Exception {
Method method = MySimpleParameterizedController.clreplaced.getMethod("handleDto", HttpEnreplacedy.clreplaced);
HandlerMethod handlerMethod = new HandlerMethod(new MySimpleParameterizedController(), method);
MethodParameter methodParam = handlerMethod.getMethodParameters()[0];
String content = "{\"name\" : \"Jad\"}";
this.servletRequest.setContent(content.getBytes("UTF-8"));
this.servletRequest.setContentType(MediaType.APPLICATION_JSON_VALUE);
List<HttpMessageConverter<?>> converters = new ArrayList<>();
converters.add(new MappingJackson2HttpMessageConverter());
HttpEnreplacedyMethodProcessor processor = new HttpEnreplacedyMethodProcessor(converters);
@SuppressWarnings("unchecked")
HttpEnreplacedy<SimpleBean> result = (HttpEnreplacedy<SimpleBean>) processor.resolveArgument(methodParam, mavContainer, webRequest, binderFactory);
replacedertThat(result).isNotNull();
replacedertThat(result.getBody().getName()).isEqualTo("Jad");
}
19
View Source File : XsuaaRequestDispatcher.java
License : Apache License 2.0
Project Creator : SAP
License : Apache License 2.0
Project Creator : SAP
protected MockResponse getResponse(String message, HttpStatus status) {
return new MockResponse().setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).setResponseCode(status.value()).setBody(message);
}
19
View Source File : ElasticsearchCollectionService.java
License : Apache License 2.0
Project Creator : planetlabs
License : Apache License 2.0
Project Creator : planetlabs
private void initLinks() {
collectionsLinks.add(new Link().rel("self").type(MediaType.APPLICATION_JSON_VALUE).href(LinksConfigProps.LINK_PREFIX + "/collections"));
}
19
View Source File : LinkBuilderFilter.java
License : Apache License 2.0
Project Creator : planetlabs
License : Apache License 2.0
Project Creator : planetlabs
private void buildRootLink(Item item) {
item.getLinks().add(Link.build().href(LINK_BASE + "stac").type(MediaType.APPLICATION_JSON_VALUE).rel("root"));
}
19
View Source File : LinkBuilderFilter.java
License : Apache License 2.0
Project Creator : planetlabs
License : Apache License 2.0
Project Creator : planetlabs
private void buildCollectionLink(Item item) {
item.getLinks().add(Link.build().href(LINK_BASE + "collections/" + item.getCollection()).type(MediaType.APPLICATION_JSON_VALUE).rel("collection"));
}
19
View Source File : KeycloakSecurityClientTest.java
License : Apache License 2.0
Project Creator : OctoPerf
License : Apache License 2.0
Project Creator : OctoPerf
@Test
@Timeout(5)
public void shouldExchangeToken() throws InterruptedException {
server.enqueue(new MockResponse().setResponseCode(200).setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).setBody(tokenStr));
final var token = client.exchangeToken(containerCredentials, "accessToken").block();
replacedertThat(token).isNotNull();
replacedertThat(token).isEqualTo(krakenToken);
final var request = server.takeRequest();
replacedertThat(request.getMethod()).isEqualTo("POST");
replacedertThat(request.getPath()).isEqualTo("/auth/realms/kraken/protocol/openid-connect/token");
replacedertThat(request.getBody().readUtf8()).isEqualTo("client_id=kraken-container&client_secret=container-secret&grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&subject_token=accessToken&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Arefresh_token&audience=kraken-container");
}
19
View Source File : KeycloakSecurityClientTest.java
License : Apache License 2.0
Project Creator : OctoPerf
License : Apache License 2.0
Project Creator : OctoPerf
@Test
@Timeout(5)
public void shouldUserLogin() throws InterruptedException {
System.out.println("test");
server.enqueue(new MockResponse().setResponseCode(200).setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).setBody(tokenStr));
final var token = client.userLogin(webCredentials, "username", "preplacedword").block();
replacedertThat(token).isNotNull();
replacedertThat(token).isEqualTo(krakenToken);
final var request = server.takeRequest();
replacedertThat(request.getMethod()).isEqualTo("POST");
replacedertThat(request.getPath()).isEqualTo("/auth/realms/kraken/protocol/openid-connect/token");
replacedertThat(request.getBody().readUtf8()).isEqualTo("username=username&preplacedword=preplacedword&grant_type=preplacedword&client_id=kraken-web");
}
19
View Source File : KeycloakSecurityClientTest.java
License : Apache License 2.0
Project Creator : OctoPerf
License : Apache License 2.0
Project Creator : OctoPerf
@Test
@Timeout(5)
public void shouldRefreshToken() throws InterruptedException {
server.enqueue(new MockResponse().setResponseCode(200).setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).setBody(tokenStr));
final var token = client.refreshToken(containerCredentials, "refreshToken").block();
replacedertThat(token).isNotNull();
replacedertThat(token).isEqualTo(krakenToken);
final var request = server.takeRequest();
replacedertThat(request.getMethod()).isEqualTo("POST");
replacedertThat(request.getPath()).isEqualTo("/auth/realms/kraken/protocol/openid-connect/token");
replacedertThat(request.getBody().readUtf8()).isEqualTo("grant_type=refresh_token&refresh_token=refreshToken&client_id=kraken-container&client_secret=container-secret");
}
19
View Source File : KeycloakSecurityClientTest.java
License : Apache License 2.0
Project Creator : OctoPerf
License : Apache License 2.0
Project Creator : OctoPerf
@Test
@Timeout(5)
public void shouldClientLogin() throws InterruptedException {
server.enqueue(new MockResponse().setResponseCode(200).setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).setBody(tokenStr));
final var token = client.clientLogin(apiCredentials).block();
replacedertThat(token).isNotNull();
replacedertThat(token).isEqualTo(krakenToken);
final var request = server.takeRequest();
replacedertThat(request.getMethod()).isEqualTo("POST");
replacedertThat(request.getPath()).isEqualTo("/auth/realms/kraken/protocol/openid-connect/token");
replacedertThat(request.getBody().readUtf8()).isEqualTo("client_id=kraken-api&client_secret=api-secret&grant_type=client_credentials");
}
19
View Source File : KeycloakSecurityAdminClientTest.java
License : Apache License 2.0
Project Creator : OctoPerf
License : Apache License 2.0
Project Creator : OctoPerf
@Test
@Timeout(5)
public void shouldSetUser() throws InterruptedException, IOException {
server.enqueue(new MockResponse().setResponseCode(200).setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE));
client.setUser(KrakenUserTest.KRAKEN_USER).block();
final var request = server.takeRequest();
replacedertions.replacedertThat(request.getPath()).isEqualTo("/auth/admin/realms/kraken/users/" + KrakenUserTest.KRAKEN_USER.getId());
replacedertions.replacedertThat(request.getMethod()).isEqualTo("PUT");
replacedertions.replacedertThat(mapper.readValue(request.getBody().readUtf8(), KrakenUser.clreplaced)).isEqualTo(KrakenUserTest.KRAKEN_USER);
}
19
View Source File : KeycloakSecurityAdminClientTest.java
License : Apache License 2.0
Project Creator : OctoPerf
License : Apache License 2.0
Project Creator : OctoPerf
@Test
@Timeout(5)
public void shouldGetUser() throws InterruptedException, IOException {
server.enqueue(new MockResponse().setResponseCode(200).setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).setBody(mapper.writeValuereplacedtring(KrakenUserTest.KRAKEN_USER)));
final var user = client.getUser("userId").block();
replacedertions.replacedertThat(user).isEqualTo(KrakenUserTest.KRAKEN_USER);
final var request = server.takeRequest();
replacedertions.replacedertThat(request.getPath()).isEqualTo("/auth/admin/realms/kraken/users/userId");
replacedertions.replacedertThat(request.getMethod()).isEqualTo("GET");
}
19
View Source File : RequestMappingHandlerAdapterTests.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
private void testJsonp(String value, boolean validValue) throws Exception {
this.request = new MockHttpServletRequest("GET", "/");
this.request.addHeader("Accept", MediaType.APPLICATION_JSON_VALUE);
this.request.setParameter("c", value);
this.response = new MockHttpServletResponse();
HandlerMethod handlerMethod = handlerMethod(new SimpleController(), "handleWithResponseEnreplacedy");
this.handlerAdapter.afterPropertiesSet();
this.handlerAdapter.handle(this.request, this.response, handlerMethod);
replacedertEquals(200, this.response.getStatus());
if (validValue) {
replacedertEquals("/**/" + value + "({\"foo\":\"bar\"});", this.response.getContentreplacedtring());
} else {
replacedertEquals("{\"foo\":\"bar\"}", this.response.getContentreplacedtring());
}
}
19
View Source File : DefaultControllerPlugin.java
License : Apache License 2.0
Project Creator : Frodez
License : Apache License 2.0
Project Creator : Frodez
private String[] resolveJsonInfo(boolean isRestController, String[] strings) {
if (!isRestController) {
return strings;
}
boolean isAbsent = true;
for (String string : strings) {
if (string.equals(MediaType.APPLICATION_JSON_VALUE)) {
isAbsent = false;
break;
}
}
if (isAbsent) {
if (strings.length == 0) {
return new String[] { MediaType.APPLICATION_JSON_VALUE };
}
String[] newStrings = new String[strings.length + 1];
System.arraycopy(strings, 0, newStrings, 0, strings.length);
newStrings[strings.length] = MediaType.APPLICATION_JSON_VALUE;
return newStrings;
} else {
return strings;
}
}
19
View Source File : ComicVineGetVolumesActionTest.java
License : GNU General Public License v3.0
Project Creator : comixed
License : GNU General Public License v3.0
Project Creator : comixed
@Test(expected = ScrapingException.clreplaced)
public void testExecuteBadResponse() throws ScrapingException {
this.comicVineServer.enqueue(new MockResponse().setBody(TEST_BAD_RESPONSE_BODY).addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE));
getVolumesAction.execute();
}
19
View Source File : ComicVineGetVolumeDetailsActionTest.java
License : GNU General Public License v3.0
Project Creator : comixed
License : GNU General Public License v3.0
Project Creator : comixed
@Test(expected = ScrapingException.clreplaced)
public void testExecuteBadData() throws ScrapingException {
this.comicVineServer.enqueue(new MockResponse().setBody(TEST_BAD_DATA).addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE));
getVolumeDetailsAction.execute();
}
19
View Source File : ComicVineGetPublisherDetailsActionTest.java
License : GNU General Public License v3.0
Project Creator : comixed
License : GNU General Public License v3.0
Project Creator : comixed
@Test(expected = ScrapingException.clreplaced)
public void testExecuteBadData() throws ScrapingException {
this.comicVineServer.enqueue(new MockResponse().setBody(TEST_BAD_DATA).addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE));
getPublisherDetailsAction.execute();
}
19
View Source File : ComicVineGetIssueWithDetailsActionTest.java
License : GNU General Public License v3.0
Project Creator : comixed
License : GNU General Public License v3.0
Project Creator : comixed
@Test(expected = ScrapingException.clreplaced)
public void testExecuteBadData() throws ScrapingException {
this.comicVineServer.enqueue(new MockResponse().setBody(TEST_BAD_DATA).addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE));
getIssueDetailsAction.execute();
}
19
View Source File : PatientExperienceControllerTest.java
License : Creative Commons Zero v1.0 Universal
Project Creator : CDCgov
License : Creative Commons Zero v1.0 Universal
Project Creator : CDCgov
@Test
void preAuthorizerThrows403() throws Exception {
String dob = "1900-01-01";
String requestBody = "{\"patientLinkId\":\"" + UUID.randomUUID() + "\",\"dateOfBirth\":\"" + dob + "\"}";
MockHttpServletRequestBuilder builder = put("/pxp/link/verify").contentType(MediaType.APPLICATION_JSON_VALUE).accept(MediaType.APPLICATION_JSON).characterEncoding("UTF-8").content(requestBody);
this._mockMvc.perform(builder).andExpect(status().isForbidden());
}
19
View Source File : Xs2aCardTransactionsReport.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
public boolean isResponseContentTypeJson() {
return MediaType.APPLICATION_JSON_VALUE.equals(responseContentType);
}
19
View Source File : CmsPsuPiisControllerIT.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
@BeforeEach
void setUp() {
httpHeaders = new HttpHeaders();
httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
httpHeaders.add("psu-id", "PSU ID");
httpHeaders.add("psu-id-type", "PSU ID TYPE");
httpHeaders.add("psu-corporate-id", "PSU CORPORATE ID");
httpHeaders.add("psu-corporate-id-type", "PSU CORPORATE ID TYPE");
httpHeaders.add("PSU-IP-Address", "1.1.1.1");
httpHeaders.add("instance-id", INSTANCE_ID);
psuIdData = jsonReader.getObjectFromFile("json/consent/integration/psu/psu-id-data.json", PsuIdData.clreplaced);
consentEnreplacedy = jsonReader.getObjectFromFile("json/consent/integration/psu/consent-enreplacedy.json", ConsentEnreplacedy.clreplaced);
consentEnreplacedy.setData(jsonReader.getBytesFromFile("json/consent/integration/psu/piis-consent-data.json"));
}
19
View Source File : AspspConsentDataPsuApiControllerIT.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
@BeforeEach
void setUp() {
httpHeaders = new HttpHeaders();
httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
aspspConsentDataEnreplacedy = new AspspConsentDataEnreplacedy();
aspspConsentDataEnreplacedy.setConsentId(CONSENT_ID);
aspspConsentDataEnreplacedy.setData("data".getBytes());
}
19
View Source File : CmsAspspTppInfoControllerIT.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
@BeforeEach
void setUp() {
httpHeaders = new HttpHeaders();
httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
httpHeaders.add("tpp-authorisation-number", TPP_AUTHORISATION_NUMBER);
httpHeaders.add("instance-id", INSTANCE_ID);
}
19
View Source File : CmsAspspStopListControllerIT.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
@BeforeEach
void setUp() {
httpHeaders = new HttpHeaders();
httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
httpHeaders.add("tpp-authorisation-number", TPP_AUTHORISATION_NUMBER);
httpHeaders.add("instance-id", INSTANCE_ID);
httpHeaders.add("lock-period", LOCK_PERIOD.toString());
}
19
View Source File : CmsAspspPsuConsentManagementControllerIT.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
@BeforeEach
void setUp() {
httpHeaders = new HttpHeaders();
httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
httpHeaders.add("account-id", ACCOUNT_ID);
httpHeaders.add("psu-id", "PSU ID");
httpHeaders.add("psu-id-type", "PSU ID TYPE");
httpHeaders.add("psu-corporate-id", "PSU CORPORATE ID");
httpHeaders.add("psu-corporate-id-type", "PSU CORPORATE ID TYPE");
httpHeaders.add("PSU-IP-Address", "1.1.1.1");
httpHeaders.add("instance-id", INSTANCE_ID);
psuIdData = jsonReader.getObjectFromFile("json/consent/integration/aspsp/psu-id-data.json", PsuIdData.clreplaced);
consentEnreplacedy = jsonReader.getObjectFromFile("json/consent/integration/aspsp/consent-enreplacedy.json", ConsentEnreplacedy.clreplaced);
consentEnreplacedy.setData(jsonReader.getBytesFromFile("json/consent/integration/ais/ais-consent-data.json"));
}
19
View Source File : CmsAspspPisTransactionControllerIT.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
@BeforeEach
void setUp() {
httpHeaders = new HttpHeaders();
httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
httpHeaders.add("instance-id", INSTANCE_ID);
pisCommonPaymentData = jsonReader.getObjectFromFile("json/consent/integration/aspsp/common-payment-data.json", PisCommonPaymentData.clreplaced);
pisCommonPaymentData.getPayments().forEach(p -> p.setPaymentData(pisCommonPaymentData));
}
19
View Source File : CmsAspspEventControllerIT.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
@BeforeEach
void setUp() {
httpHeaders = new HttpHeaders();
httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
httpHeaders.add("start-date", START_DATE);
httpHeaders.add("end-date", END_DATE);
httpHeaders.add("instance-id", INSTANCE_ID);
}
19
View Source File : WiremockAccountInformationRequest.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
public SELF user_anton_brueckner_provided_initial_parameters_but_without_psu_id_to_list_accounts_with_all_accounts_consent() {
String body = readResource("restrecord/tpp-ui-input/params/unknown-user-all-accounts-consent.json");
ExtractableResponse<Response> response = Restreplacedured.given().header(X_REQUEST_ID, UUID.randomUUID().toString()).header(X_XSRF_TOKEN, UUID.randomUUID().toString()).cookie(AUTHORIZATION_SESSION_KEY, authSessionCookie).queryParam(REDIRECT_CODE_QUERY, redirectCode).contentType(MediaType.APPLICATION_JSON_VALUE).body(body).when().post(AUTHORIZE_CONSENT_ENDPOINT, serviceSessionId).then().statusCode(HttpStatus.ACCEPTED.value()).extract();
replacedertThat(LocationExtractorUtil.getLocation(response)).contains("redirectCode").doesNotContain("consent-result");
this.responseContent = response.body().replacedtring();
this.redirectUriToGetUserParams = LocationExtractorUtil.getLocation(response);
updateRedirectCode(response);
updateServiceSessionId(response);
updateRedirectCode(response);
return self();
}
19
View Source File : AccountInformationResult.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
public SELF fintech_calls_consent_activation_for_current_authorization_id(String serviceSessionId) {
withSignatureHeaders(Restreplacedured.given().header(SERVICE_SESSION_PreplacedWORD, SESSION_PreplacedWORD).contentType(MediaType.APPLICATION_JSON_VALUE)).when().post(CONFIRM_CONSENT_ENDPOINT, serviceSessionId).then().statusCode(HttpStatus.OK.value());
return self();
}
19
View Source File : AccountInformationResult.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
public SELF user_anton_brueckner_provided_initial_parameters_to_list_accounts_with_all_accounts_consent_and_gets_202() {
String body = readResource("restrecord/tpp-ui-input/params/anton-brueckner-account-all-accounts-consent.json");
ExtractableResponse<Response> response = Restreplacedured.given().header(X_REQUEST_ID, UUID.randomUUID().toString()).header(X_XSRF_TOKEN, UUID.randomUUID().toString()).queryParam(REDIRECT_CODE_QUERY, redirectCode).cookie(AUTHORIZATION_SESSION_KEY, authSessionCookie).contentType(MediaType.APPLICATION_JSON_VALUE).body(body).when().post(AUTHORIZE_CONSENT_ENDPOINT, serviceSessionId).then().statusCode(HttpStatus.ACCEPTED.value()).extract();
replacedertThat(LocationExtractorUtil.getLocation(response)).matches(".+/ais/.+");
return self();
}
19
View Source File : AccountInformationRequestCommon.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
public SELF user_denied_consent() {
ExtractableResponse<Response> response = Restreplacedured.given().header(X_REQUEST_ID, UUID.randomUUID().toString()).header(X_XSRF_TOKEN, UUID.randomUUID().toString()).cookie(AUTHORIZATION_SESSION_KEY, authSessionCookie).queryParam(REDIRECT_CODE_QUERY, redirectCode).contentType(MediaType.APPLICATION_JSON_VALUE).body("{}").when().post(DENY_CONSENT_AUTH_ENDPOINT, serviceSessionId).then().statusCode(HttpStatus.ACCEPTED.value()).extract();
replacedertThat(LocationExtractorUtil.getLocation(response)).isEqualTo(FINTECH_REDIR_NOK);
return self();
}
19
View Source File : AccountInformationRequestCommon.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
public SELF user_anton_brueckner_provided_initial_parameters_to_list_accounts_with_all_accounts_consent_without_cookie_unauthorized() {
Restreplacedured.given().header(X_REQUEST_ID, UUID.randomUUID().toString()).header(X_XSRF_TOKEN, UUID.randomUUID().toString()).queryParam(REDIRECT_CODE_QUERY, redirectCode).contentType(MediaType.APPLICATION_JSON_VALUE).body(readResource("restrecord/tpp-ui-input/params/anton-brueckner-account-all-accounts-consent.json")).when().post(AUTHORIZE_CONSENT_ENDPOINT, serviceSessionId).then().statusCode(HttpStatus.UNAUTHORIZED.value()).extract();
return self();
}
19
View Source File : SandboxServers.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
public SELF enabled_redirect_sandbox_mode(String aspspProfileUri) {
Restreplacedured.given().contentType(MediaType.APPLICATION_JSON_VALUE).body("[\"REDIRECT\",\"EMBEDDED\",\"DECOUPLED\",\"OAUTH\"]").when().put(aspspProfileUri + "/api/v1/aspsp-profile/for-debug/sca-approaches").then().statusCode(HttpStatus.OK.value());
return self();
}
19
View Source File : SandboxServers.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
public SELF enabled_embedded_sandbox_mode(String aspspProfileUri) {
Restreplacedured.given().contentType(MediaType.APPLICATION_JSON_VALUE).body("[\"EMBEDDED\",\"REDIRECT\",\"DECOUPLED\"]").when().put(aspspProfileUri + "/api/v1/aspsp-profile/for-debug/sca-approaches").then().statusCode(HttpStatus.OK.value());
return self();
}
19
View Source File : MultiPartContentUtils.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
private static String getJsonStandingOrderType(String content, String boundary) {
return getPartByTypeAndStartText(content, boundary, MediaType.APPLICATION_JSON_VALUE, "{");
}
18
View Source File : WebUtils.java
License : Apache License 2.0
Project Creator : zhuangjinming16
License : Apache License 2.0
Project Creator : zhuangjinming16
/**
* 返回json
*
* @param response HttpServletResponse
* @param result 结果对象
*/
public void renderJson(HttpServletResponse response, Object result) {
renderJson(response, result, MediaType.APPLICATION_JSON_VALUE);
}
18
View Source File : SampleReactiveOAuth2ResourceServerApplicationTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private static MockResponse mockResponse() {
String body = "{\"keys\":[{\"p\":\"2p-ViY7DE9ZrdWQb544m0Jp7Cv03YCSljqfim9pD4ALhObX0OrAznOiowTjwBky9JGffMw" + "DBVSfJSD9TSU7aH2sbbfi0bZLMdekKAuimudXwUqPDxrrg0BCyvCYgLmKjbVT3zcdylWSog93CNTxGDPzauu-oc0XPNKCXnaDpNvE\"" + ",\"kty\":\"RSA\",\"q\":\"sP_QYavrpBvSJ86uoKVGj2AGl78CSsAtpf1ybSY5TwUlorXSdqapRbY69Y271b0aMLzlleUn9ZTBO" + "1dlKV2_dw_lPADHVia8z3pxL-8sUhIXLsgj4acchMk4c9YX-sFh07xENnyZ-_TXm3llPLuL67HUfBC2eKe800TmCYVWc9U\",\"d\"" + ":\"bn1nFxCQT4KLTHqo8mo9HvHD0cRNRNdWcKNnnEQkCF6tKbt-ILRyQGP8O40axLd7CoNVG9c9p_-g4-2kwCtLJNv_STLtwfpCY7" + "VN5o6-ZIpfTjiW6duoPrLWq64Hm_4LOBQTiZfUPcLhsuJRHbWqakj-kV_YbUyC2Ocf_dd8IAQcSrAU2SCcDebhDCWwRUFvaa9V5eq0" + "851S9goaA-AJz-JXyePH6ZFr8JxmWkWxYZ5kdcMD-sm9ZbxE0CaEk32l4fE4hR-L8x2dDtjWA-ahKCZ091z-gV3HWtR2JOjvxoNRjxUo" + "3UxaGiFJHWNIl0EYUJZu1Cb-5wIlEI7wPx5mwQ\",\"e\":\"AQAB\",\"use\":\"sig\",\"kid\":\"one\",\"qi\":\"qS0OK4" + "8M2CIAA6_4Wdw4EbCaAfcTLf5Oy9t5BOF_PFUKqoSpZ6JsT5H0a_4zkjt-oI969v78OTlvBKbmEyKO-KeytzHBAA5CsLmVcz0THrMSg6o" + "XZqu66MPnvWoZN9FEN5TklPOvBFm8Bg1QZ3k-YMVaM--DLvhaYR95_mqaz50\",\"dp\":\"Too2NozLGD1XrXyhabZvy1E0EuaVFj0UHQ" + "PDLSpkZ_2g3BK6Art6T0xmE8RYtmqrKIEIdlI3IliAvyvAx_1D7zWTTRaj-xlZyqJFrnXWL7zj8UxT8PkB-r2E-ILZ3NAi1gxIWezlBTZ8" + "M6NfObDFmbTc_3tJkN_raISo8z_ziIE\",\"dq\":\"U0yhSkY5yOsa9YcMoigGVBWSJLpNHtbg5NypjHrPv8OhWbkOSq7WvSstBkF" + "k5AtyFvvfZLMLIkWWxxGzV0t6f1MoxBtttLrYYyCxwihiiGFhLbAdSuZ1wnxcqA9bC7UVECvrQmVTpsMs8UupfHKbQBpZ8OWAqrn" + "uYNNtG4_4Bt0\",\"n\":\"lygtuZj0lJjqOqIWocF8Bb583QDdq-aaFg8PesOp2-EDda6GqCpL-_NZVOflNGX7XIgjsWHcPsQHs" + "V9gWuOzSJ0iEuWvtQ6eGBP5M6m7pccLNZfwUse8Cb4Ngx3XiTlyuqM7pv0LPyppZusfEHVEdeelou7Dy9k0OQ_nJTI3b2E1WBoHC5" + "8CJ453lo4gcBm1efURN3LIVc1V9NQY_ESBKVdwqYyoJPEanURLVGRd6cQKn6YrCbbIRHjqAyqOE-z3KmgDJnPriljfR5XhSGyM9eq" + "D9Xpy6zu_MAeMJJfSArp857zLPk-Wf5VP9STAcjyfdBIybMKnwBYr2qHMT675hQ\"}]}";
return new MockResponse().setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).setResponseCode(200).setBody(body);
}
18
View Source File : OAuth2ClientPropertiesRegistrationAdapterTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private void setupMockResponse(String issuer) throws Exception {
MockResponse mockResponse = new MockResponse().setResponseCode(HttpStatus.OK.value()).setBody(new ObjectMapper().writeValuereplacedtring(getResponse(issuer))).setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
this.server.enqueue(mockResponse);
}
18
View Source File : XssHttpServletRequestWrapper.java
License : MIT License
Project Creator : yangzongzhuan
License : MIT License
Project Creator : yangzongzhuan
/**
* 是否是Json请求
*
* @param request
*/
public boolean isJsonRequest() {
String header = super.getHeader(HttpHeaders.CONTENT_TYPE);
return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header);
}
18
View Source File : ProxyFilterUnitTest.java
License : Apache License 2.0
Project Creator : xm-online
License : Apache License 2.0
Project Creator : xm-online
@Test
public void testTenantNotSet() throws Exception {
when(request.getHeader(HEADER_TENANT)).thenReturn(null);
filter.doFilter(request, response, chain);
verify(response).setStatus(HttpServletResponse.SC_BAD_REQUEST);
verify(response).setContentType(MediaType.APPLICATION_JSON_VALUE);
verify(response, times(2)).getWriter();
verify(writer).write(String.format(ERROR_PATTERN, ERR_TENANT_NOT_SUPPLIED, TENANT_NOT_SUPPLIED));
verify(writer).flush();
verify(lepRequestEnrichmentService, times(0)).enrichRequest(request);
}
18
View Source File : AcceptanceTest.java
License : MIT License
Project Creator : woowacourse-teams
License : MIT License
Project Creator : woowacourse-teams
protected <T> String post(String path, String inputJson) {
// @formatter:off
String[] locations = given().auth().oauth2(bearerToken).body(inputJson).contentType(MediaType.APPLICATION_JSON_VALUE).accept(MediaType.APPLICATION_JSON_VALUE).when().post(path).then().log().all().statusCode(HttpStatus.CREATED.value()).extract().header("location").split("/");
return locations[locations.length - 1];
// @formatter:on
}
18
View Source File : AcceptanceTest.java
License : MIT License
Project Creator : woowacourse-teams
License : MIT License
Project Creator : woowacourse-teams
protected <T> T post(String path, String inputJson, Clreplaced<T> responseType) {
// @formatter:off
return given().body(inputJson).contentType(MediaType.APPLICATION_JSON_VALUE).accept(MediaType.APPLICATION_JSON_VALUE).when().post(path).then().log().all().statusCode(HttpStatus.CREATED.value()).extract().as(responseType);
// @formatter:on
}
18
View Source File : AcceptanceTest.java
License : MIT License
Project Creator : woowacourse-teams
License : MIT License
Project Creator : woowacourse-teams
protected <T> void patch(String path, String inputJson) {
// @formatter:off
given().auth().oauth2(bearerToken).body(inputJson).contentType(MediaType.APPLICATION_JSON_VALUE).accept(MediaType.APPLICATION_JSON_VALUE).when().patch(path).then().log().all().statusCode(HttpStatus.NO_CONTENT.value());
// @formatter:on
}
18
View Source File : AcceptanceTest.java
License : MIT License
Project Creator : woowacourse-teams
License : MIT License
Project Creator : woowacourse-teams
protected <T> void post(String path) {
// @formatter:off
given().auth().oauth2(bearerToken).contentType(MediaType.APPLICATION_JSON_VALUE).accept(MediaType.APPLICATION_JSON_VALUE).when().post(path).then().log().all().statusCode(HttpStatus.CREATED.value());
// @formatter:on
}
18
View Source File : AcceptanceTest.java
License : MIT License
Project Creator : woowacourse-teams
License : MIT License
Project Creator : woowacourse-teams
protected <T> void put(String path, String inputJson) {
// @formatter:off
given().auth().oauth2(bearerToken).body(inputJson).contentType(MediaType.APPLICATION_JSON_VALUE).accept(MediaType.APPLICATION_JSON_VALUE).when().put(path).then().log().all().statusCode(HttpStatus.NO_CONTENT.value());
// @formatter:on
}
See More Examples