Example usage for org.springframework.http MediaType APPLICATION_JSON_UTF8

List of usage examples for org.springframework.http MediaType APPLICATION_JSON_UTF8

Introduction

In this page you can find the example usage for org.springframework.http MediaType APPLICATION_JSON_UTF8.

Prototype

MediaType APPLICATION_JSON_UTF8

To view the source code for org.springframework.http MediaType APPLICATION_JSON_UTF8.

Click Source Link

Document

Public constant media type for application/json;charset=UTF-8 .

Usage

From source file:com.hp.autonomy.frontend.find.core.databases.AbstractDatabasesControllerIT.java

@Test
public void noExcludedIndexes() throws Exception {
    mockMvc.perform(get(DatabasesController.GET_DATABASES_PATH).with(authentication(userAuth())))
            .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
            .andExpect(jsonPath("$", not(empty())));
}

From source file:com.hp.autonomy.frontend.find.core.fields.FieldsControllerIT.java

@Test
public void getParametricFields() throws Exception {
    final MockHttpServletRequestBuilder requestBuilder = get(
            FieldsController.FIELDS_PATH + FieldsController.GET_PARAMETRIC_FIELDS_PATH)
                    .with(authentication(userAuth()));
    addParams(requestBuilder);/*from  ww  w .j a va2 s. c  o m*/

    mockMvc.perform(requestBuilder).andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
            .andExpect(jsonPath("$", not(empty())));
}

From source file:com.hp.autonomy.frontend.find.hod.fields.HodFieldsControllerIT.java

@Override
public void getParametricDateFields() throws Exception {
    final MockHttpServletRequestBuilder requestBuilder = get(
            FieldsController.FIELDS_PATH + FieldsController.GET_PARAMETRIC_DATE_FIELDS_PATH)
                    .with(authentication(userAuth()));
    addParams(requestBuilder);//from  w w w  .ja va 2 s .  c o  m

    mockMvc.perform(requestBuilder).andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
            .andExpect(jsonPath("$", empty()));
}

From source file:com.torchmind.stockpile.server.configuration.WebMvcConfiguration.java

/**
 * {@inheritDoc}//from  ww w  .  j  a v a  2s . c  o m
 */
@Override
public void configureContentNegotiation(@Nonnull ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(MediaType.APPLICATION_JSON_UTF8);
    configurer.mediaType("json", MediaType.APPLICATION_JSON_UTF8);
    configurer.mediaType("xml", MediaType.APPLICATION_XML);
    configurer.favorPathExtension(true);
    configurer.ignoreUnknownPathExtensions(true);
    configurer.ignoreAcceptHeader(false);
}

From source file:com.hp.autonomy.frontend.find.core.search.AbstractRelatedConceptsServiceIT.java

@Test
public void findRelatedConcepts() throws Exception {
    final MockHttpServletRequestBuilder request = get(RelatedConceptsController.RELATED_CONCEPTS_PATH)
            .param(RelatedConceptsController.DATABASES_PARAM, mvcIntegrationTestUtils.getDatabases())
            .param(RelatedConceptsController.QUERY_TEXT_PARAM, "*")
            .param(RelatedConceptsController.FIELD_TEXT_PARAM, "").with(authentication(userAuth()));

    mockMvc.perform(request).andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
            .andExpect(jsonPath("$", not(empty())));
}

From source file:com.hp.autonomy.frontend.find.core.parametricfields.AbstractParametricValuesServiceIT.java

@Test
public void getParametricValues() throws Exception {
    final MockHttpServletRequestBuilder requestBuilder = get(ParametricValuesController.PARAMETRIC_VALUES_PATH)
            .param(ParametricValuesController.FIELD_NAMES_PARAM,
                    mvcIntegrationTestUtils.getFields(mockMvc, FieldsController.GET_PARAMETRIC_FIELDS_PATH))
            .param(ParametricValuesController.DATABASES_PARAM, mvcIntegrationTestUtils.getDatabases())
            .param(ParametricValuesController.QUERY_TEXT_PARAM, "*")
            .param(ParametricValuesController.FIELD_TEXT_PARAM, "").with(authentication(userAuth()));

    mockMvc.perform(requestBuilder).andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
            .andExpect(jsonPath("$", not(empty())));
}

From source file:com.hp.autonomy.frontend.find.core.fields.FieldsControllerIT.java

@Test
public void getParametricNumericFields() throws Exception {
    final MockHttpServletRequestBuilder requestBuilder = get(
            FieldsController.FIELDS_PATH + FieldsController.GET_PARAMETRIC_NUMERIC_FIELDS_PATH)
                    .with(authentication(userAuth()));
    addParams(requestBuilder);/*  www .ja v a 2 s .  com*/

    mockMvc.perform(requestBuilder).andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
            .andExpect(jsonPath("$", empty())); // TODO: need some parametric numeric fields configured
}

From source file:com.hp.autonomy.frontend.find.core.typeahead.AbstractTypeAheadIT.java

@Test
public void getsSuggestions() throws Exception {
    final RequestBuilder request = get(TypeAheadController.URL)
            .param(TypeAheadController.TEXT_PARAMETER, inputText).with(authentication(userAuth()));

    mockMvc.perform(request).andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(new ResultMatcher() {
                @Override//from w  ww.j av a  2  s  .  co  m
                public void match(final MvcResult result) throws Exception {
                    final List<String> output = objectMapper
                            .readValue(result.getResponse().getContentAsString(), RESPONSE_TYPE);
                    assertThat(output, hasItem(expectedSuggestion));
                }
            });
}

From source file:com.hp.autonomy.frontend.find.core.search.AbstractDocumentServiceIT.java

@Test
public void query() throws Exception {
    final MockHttpServletRequestBuilder requestBuilder = get(
            DocumentsController.SEARCH_PATH + '/' + DocumentsController.QUERY_PATH)
                    .param(DocumentsController.TEXT_PARAM, "*")
                    .param(DocumentsController.RESULTS_START_PARAM, "1")
                    .param(DocumentsController.MAX_RESULTS_PARAM, "50")
                    .param(DocumentsController.SUMMARY_PARAM, "context")
                    .param(DocumentsController.INDEXES_PARAM, mvcIntegrationTestUtils.getDatabases())
                    .with(authentication(userAuth()));

    mockMvc.perform(requestBuilder).andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
            .andExpect(jsonPath("$.documents", not(empty())));
}

From source file:com.hp.autonomy.frontend.find.hod.parametricfields.HodParametricValuesServiceIT.java

@Override
public void getDependentParametricValues() throws Exception {
    final MockHttpServletRequestBuilder requestBuilder = get(ParametricValuesController.PARAMETRIC_VALUES_PATH
            + ParametricValuesController.DEPENDENT_VALUES_PATH)
                    .param(ParametricValuesController.FIELD_NAMES_PARAM,
                            mvcIntegrationTestUtils.getFields(mockMvc,
                                    FieldsController.GET_PARAMETRIC_FIELDS_PATH))
                    .param(ParametricValuesController.DATABASES_PARAM, mvcIntegrationTestUtils.getDatabases())
                    .param(ParametricValuesController.QUERY_TEXT_PARAM, "*")
                    .param(ParametricValuesController.FIELD_TEXT_PARAM, "").with(authentication(userAuth()));

    mockMvc.perform(requestBuilder).andExpect(status().isInternalServerError()) // not implemented yt
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8));
}