Search in sources :

Example 1 with Jackson2ObjectMapperFactory

use of com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory in project kylo by Teradata.

the class IntegrationTestBase method setupRestAssured.

@Before
public void setupRestAssured() throws URISyntaxException {
    UserContext.setUser(UserContext.User.ADMIN);
    RestAssured.baseURI = kyloConfig.getProtocol() + kyloConfig.getHost();
    RestAssured.port = kyloConfig.getPort();
    RestAssured.basePath = kyloConfig.getBasePath();
    RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
    Jackson2ObjectMapperFactory factory = (aClass, s) -> {
        ObjectMapper om = new ObjectMapper();
        om.registerModule(new JodaModule());
        om.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
        om.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
        om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        configureObjectMapper(om);
        return om;
    };
    com.jayway.restassured.mapper.ObjectMapper objectMapper = new Jackson2Mapper(factory);
    RestAssured.objectMapper(objectMapper);
    startClean();
}
Also used : Arrays(java.util.Arrays) PartitionField(com.thinkbiganalytics.feedmgr.rest.model.schema.PartitionField) ReusableTemplateConnectionInfo(com.thinkbiganalytics.feedmgr.rest.model.ReusableTemplateConnectionInfo) StringUtils(org.apache.commons.lang3.StringUtils) MediaType(javax.ws.rs.core.MediaType) DefaultDataTypeDescriptor(com.thinkbiganalytics.discovery.model.DefaultDataTypeDescriptor) SpringJUnit4ClassRunner(org.springframework.test.context.junit4.SpringJUnit4ClassRunner) AlertsController(com.thinkbiganalytics.alerts.rest.controller.AlertsController) SchedulerRestController(com.thinkbiganalytics.scheduler.rest.controller.SchedulerRestController) NifiFeed(com.thinkbiganalytics.feedmgr.rest.model.NifiFeed) JsonNode(com.fasterxml.jackson.databind.JsonNode) Tag(com.thinkbiganalytics.discovery.schema.Tag) Scp(org.apache.tools.ant.taskdefs.optional.ssh.Scp) JsonPath(com.jayway.restassured.path.json.JsonPath) PermissionsChange(com.thinkbiganalytics.security.rest.model.PermissionsChange) FeedSchedule(com.thinkbiganalytics.feedmgr.rest.model.FeedSchedule) NifiProperty(com.thinkbiganalytics.nifi.rest.model.NifiProperty) JobsRestController(com.thinkbiganalytics.jobrepo.rest.controller.JobsRestController) ActionGroup(com.thinkbiganalytics.security.rest.model.ActionGroup) Set(java.util.Set) ServiceLevelAssessment(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAssessment) EntityVersionDifference(com.thinkbiganalytics.feedmgr.rest.model.EntityVersionDifference) JobAction(com.thinkbiganalytics.jobrepo.repository.rest.model.JobAction) PortDTO(org.apache.nifi.web.api.dto.PortDTO) ImportTemplateOptions(com.thinkbiganalytics.feedmgr.rest.model.ImportTemplateOptions) RestAssured(com.jayway.restassured.RestAssured) RoleMembershipChange(com.thinkbiganalytics.security.rest.model.RoleMembershipChange) AdminControllerV2(com.thinkbiganalytics.feedmgr.rest.controller.AdminControllerV2) SearchResultImpl(com.thinkbiganalytics.rest.model.search.SearchResultImpl) AdminController(com.thinkbiganalytics.feedmgr.rest.controller.AdminController) DatasourceController(com.thinkbiganalytics.feedmgr.rest.controller.DatasourceController) RunWith(org.junit.runner.RunWith) LocalDateTime(java.time.LocalDateTime) Jackson2ObjectMapperFactory(com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) AccessControlController(com.thinkbiganalytics.security.rest.controller.AccessControlController) ArrayList(java.util.ArrayList) HTTP_OK(java.net.HttpURLConnection.HTTP_OK) FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) RestResponseStatus(com.thinkbiganalytics.rest.model.RestResponseStatus) JdbcDatasource(com.thinkbiganalytics.metadata.rest.model.data.JdbcDatasource) AlertRange(com.thinkbiganalytics.alerts.rest.model.AlertRange) User(com.thinkbiganalytics.security.rest.model.User) RegisteredTemplate(com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate) ObligationGroup(com.thinkbiganalytics.metadata.sla.api.ObligationGroup) Before(org.junit.Before) Uninterruptibles(com.google.common.util.concurrent.Uninterruptibles) FeedCategoryRestController(com.thinkbiganalytics.feedmgr.rest.controller.FeedCategoryRestController) ServiceLevelAgreement(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAgreement) DefaultHiveSchema(com.thinkbiganalytics.discovery.model.DefaultHiveSchema) SearchResult(com.thinkbiganalytics.rest.model.search.SearchResult) File(java.io.File) ExecutedStep(com.thinkbiganalytics.jobrepo.query.model.ExecutedStep) NifiIntegrationRestController(com.thinkbiganalytics.feedmgr.rest.controller.NifiIntegrationRestController) HiveRestController(com.thinkbiganalytics.hive.rest.controller.HiveRestController) ContextConfiguration(org.springframework.test.context.ContextConfiguration) Assert(org.junit.Assert) ContentType(com.jayway.restassured.http.ContentType) ImportComponentOption(com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOption) DefaultExecutedJob(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob) HTTP_BAD_REQUEST(java.net.HttpURLConnection.HTTP_BAD_REQUEST) DefaultExecutedStep(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedStep) ImportComponentOptionBuilder(com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOptionBuilder) URL(java.net.URL) URISyntaxException(java.net.URISyntaxException) LoggerFactory(org.slf4j.LoggerFactory) ServiceLevelAgreementRestController(com.thinkbiganalytics.feedmgr.rest.controller.ServiceLevelAgreementRestController) HTTP_NO_CONTENT(java.net.HttpURLConnection.HTTP_NO_CONTENT) DeserializationFeature(com.fasterxml.jackson.databind.DeserializationFeature) ObjectMapperSerializer(com.thinkbiganalytics.json.ObjectMapperSerializer) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) ServiceLevelAssessmentsController(com.thinkbiganalytics.jobrepo.rest.controller.ServiceLevelAssessmentsController) FeedVersions(com.thinkbiganalytics.feedmgr.rest.model.FeedVersions) ServiceLevelAgreementGroup(com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementGroup) SSHBase(org.apache.tools.ant.taskdefs.optional.ssh.SSHBase) ImportTemplate(com.thinkbiganalytics.feedmgr.service.template.importing.model.ImportTemplate) FeedRestController(com.thinkbiganalytics.feedmgr.rest.controller.FeedRestController) JSON(com.jayway.restassured.http.ContentType.JSON) DefaultTag(com.thinkbiganalytics.discovery.model.DefaultTag) UUID(java.util.UUID) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary) ScheduleIdentifier(com.thinkbiganalytics.scheduler.rest.model.ScheduleIdentifier) List(java.util.List) ImportFeed(com.thinkbiganalytics.feedmgr.service.feed.importing.model.ImportFeed) JodaModule(com.fasterxml.jackson.datatype.joda.JodaModule) ImportComponent(com.thinkbiganalytics.feedmgr.rest.ImportComponent) Jackson2Mapper(com.jayway.restassured.internal.mapping.Jackson2Mapper) ChronoField(java.time.temporal.ChronoField) RequestSpecification(com.jayway.restassured.specification.RequestSpecification) Feed(com.thinkbiganalytics.metadata.api.feed.Feed) HashMap(java.util.HashMap) Response(com.jayway.restassured.response.Response) DefaultField(com.thinkbiganalytics.discovery.model.DefaultField) HashSet(java.util.HashSet) Inject(javax.inject.Inject) TemplatesRestController(com.thinkbiganalytics.feedmgr.rest.controller.TemplatesRestController) NifiFlowProcessGroup(com.thinkbiganalytics.nifi.rest.model.flow.NifiFlowProcessGroup) Project(org.apache.tools.ant.Project) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) SSHExec(org.apache.tools.ant.taskdefs.optional.ssh.SSHExec) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SystemNamingService(com.thinkbiganalytics.feedmgr.rest.support.SystemNamingService) FieldRuleProperty(com.thinkbiganalytics.policy.rest.model.FieldRuleProperty) TimeUnit(java.util.concurrent.TimeUnit) ServiceLevelAgreementRule(com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementRule) DateTimeFormatter(java.time.format.DateTimeFormatter) SerializationFeature(com.fasterxml.jackson.databind.SerializationFeature) Jackson2ObjectMapperFactory(com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory) JodaModule(com.fasterxml.jackson.datatype.joda.JodaModule) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Jackson2Mapper(com.jayway.restassured.internal.mapping.Jackson2Mapper) Before(org.junit.Before)

Example 2 with Jackson2ObjectMapperFactory

use of com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory in project muikku by otavanopisto.

the class AbstractUITest method setupRestAssured.

@Before
public void setupRestAssured() {
    RestAssured.baseURI = getAppUrl(true) + "/rest";
    RestAssured.port = getPortHttps();
    RestAssured.authentication = certificate(getKeystoreFile(), getKeystorePass());
    RestAssured.config = RestAssuredConfig.config().objectMapperConfig(ObjectMapperConfig.objectMapperConfig().jackson2ObjectMapperFactory(new Jackson2ObjectMapperFactory() {

        @SuppressWarnings("rawtypes")
        @Override
        public com.fasterxml.jackson.databind.ObjectMapper create(Class cls, String charset) {
            com.fasterxml.jackson.databind.ObjectMapper objectMapper = new com.fasterxml.jackson.databind.ObjectMapper();
            objectMapper.registerModule(new JSR310Module());
            objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
            return objectMapper;
        }
    }));
}
Also used : Jackson2ObjectMapperFactory(com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JSR310Module(com.fasterxml.jackson.datatype.jsr310.JSR310Module) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 3 with Jackson2ObjectMapperFactory

use of com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory in project muikku by otavanopisto.

the class AbstractRESTTest method setupRestAssured.

@Before
public void setupRestAssured() throws JsonProcessingException {
    RestAssured.baseURI = getAppUrl(true) + "/rest";
    RestAssured.port = getPortHttps();
    RestAssured.authentication = certificate(getKeystoreFile(), getKeystorePass());
    RestAssured.config = RestAssuredConfig.config().objectMapperConfig(ObjectMapperConfig.objectMapperConfig().jackson2ObjectMapperFactory(new Jackson2ObjectMapperFactory() {

        @SuppressWarnings("rawtypes")
        @Override
        public com.fasterxml.jackson.databind.ObjectMapper create(Class cls, String charset) {
            com.fasterxml.jackson.databind.ObjectMapper objectMapper = new com.fasterxml.jackson.databind.ObjectMapper();
            objectMapper.registerModule(new JSR310Module());
            objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
            return objectMapper;
        }
    }));
}
Also used : Jackson2ObjectMapperFactory(com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory) JSR310Module(com.fasterxml.jackson.datatype.jsr310.JSR310Module) Before(org.junit.Before)

Aggregations

Jackson2ObjectMapperFactory (com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory)3 Before (org.junit.Before)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 JSR310Module (com.fasterxml.jackson.datatype.jsr310.JSR310Module)2 DeserializationFeature (com.fasterxml.jackson.databind.DeserializationFeature)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 SerializationFeature (com.fasterxml.jackson.databind.SerializationFeature)1 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 JodaModule (com.fasterxml.jackson.datatype.joda.JodaModule)1 Uninterruptibles (com.google.common.util.concurrent.Uninterruptibles)1 RestAssured (com.jayway.restassured.RestAssured)1 ContentType (com.jayway.restassured.http.ContentType)1 JSON (com.jayway.restassured.http.ContentType.JSON)1 Jackson2Mapper (com.jayway.restassured.internal.mapping.Jackson2Mapper)1 JsonPath (com.jayway.restassured.path.json.JsonPath)1 Response (com.jayway.restassured.response.Response)1 RequestSpecification (com.jayway.restassured.specification.RequestSpecification)1 AlertsController (com.thinkbiganalytics.alerts.rest.controller.AlertsController)1 AlertRange (com.thinkbiganalytics.alerts.rest.model.AlertRange)1