Search in sources :

Example 6 with TypeParser

use of io.crnk.core.engine.parser.TypeParser in project crnk-framework by crnk-project.

the class DefaultQueryParamsParserTest method parseQueryParams.

private QueryParams parseQueryParams() {
    TestResourceInformationProvider infoBuilder = new TestResourceInformationProvider();
    infoBuilder.init(new ResourceInformationProviderContext() {

        @Override
        public String getResourceType(Class<?> clazz) {
            throw new UnsupportedOperationException();
        }

        @Override
        public boolean accept(Class<?> type) {
            throw new UnsupportedOperationException();
        }

        @Override
        public TypeParser getTypeParser() {
            return new TypeParser();
        }

        @Override
        public InformationBuilder getInformationBuilder() {
            throw new UnsupportedOperationException();
        }

        @Override
        public ObjectMapper getObjectMapper() {
            throw new UnsupportedOperationException();
        }
    });
    return parser.parse(new SimpleQueryParamsParserContext(queryParams, infoBuilder.build(TestResource.class)));
}
Also used : InformationBuilder(io.crnk.core.engine.information.InformationBuilder) SimpleQueryParamsParserContext(io.crnk.legacy.queryParams.context.SimpleQueryParamsParserContext) TypeParser(io.crnk.core.engine.parser.TypeParser) ResourceInformationProviderContext(io.crnk.core.engine.information.resource.ResourceInformationProviderContext) TestResourceInformationProvider(io.crnk.core.module.TestResourceInformationProvider) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 7 with TypeParser

use of io.crnk.core.engine.parser.TypeParser in project crnk-framework by crnk-project.

the class JsonApiQueryParamsParserTest method parseQueryParams.

private QueryParams parseQueryParams() {
    TestResourceInformationProvider infoBuilder = new TestResourceInformationProvider();
    infoBuilder.init(new ResourceInformationProviderContext() {

        @Override
        public String getResourceType(Class<?> clazz) {
            throw new UnsupportedOperationException();
        }

        @Override
        public boolean accept(Class<?> type) {
            throw new UnsupportedOperationException();
        }

        @Override
        public TypeParser getTypeParser() {
            return new TypeParser();
        }

        @Override
        public InformationBuilder getInformationBuilder() {
            throw new UnsupportedOperationException();
        }

        @Override
        public ObjectMapper getObjectMapper() {
            throw new UnsupportedOperationException();
        }
    });
    return parser.parse(new SimpleQueryParamsParserContext(queryParams, infoBuilder.build(TestResource.class)));
}
Also used : InformationBuilder(io.crnk.core.engine.information.InformationBuilder) SimpleQueryParamsParserContext(io.crnk.legacy.queryParams.context.SimpleQueryParamsParserContext) TypeParser(io.crnk.core.engine.parser.TypeParser) ResourceInformationProviderContext(io.crnk.core.engine.information.resource.ResourceInformationProviderContext) TestResourceInformationProvider(io.crnk.core.module.TestResourceInformationProvider) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 8 with TypeParser

use of io.crnk.core.engine.parser.TypeParser in project crnk-framework by crnk-project.

the class DefaultQuerySpecDeserializerTestBase method setup.

@Before
public void setup() {
    super.setup();
    deserializerContext = new QuerySpecDeserializerContext() {

        @Override
        public ResourceRegistry getResourceRegistry() {
            return resourceRegistry;
        }

        @Override
        public TypeParser getTypeParser() {
            return moduleRegistry.getTypeParser();
        }
    };
    deserializer = new DefaultQuerySpecDeserializer();
    deserializer.init(deserializerContext);
    taskInformation = resourceRegistry.getEntry(Task.class).getResourceInformation();
    taskWithPagingBehaviorInformation = resourceRegistry.getEntry(TaskWithPagingBehavior.class).getResourceInformation();
}
Also used : TypeParser(io.crnk.core.engine.parser.TypeParser) DefaultQuerySpecDeserializer(io.crnk.core.queryspec.DefaultQuerySpecDeserializer) ResourceRegistry(io.crnk.core.engine.registry.ResourceRegistry) QuerySpecDeserializerContext(io.crnk.core.queryspec.QuerySpecDeserializerContext) Before(org.junit.Before)

Example 9 with TypeParser

use of io.crnk.core.engine.parser.TypeParser in project crnk-framework by crnk-project.

the class JpaResourceInformationProviderTest method setup.

@Before
public void setup() {
    jpaMetaProvider = new JpaMetaProvider(Collections.<Class>emptySet());
    lookup = new MetaLookup();
    lookup.addProvider(jpaMetaProvider);
    builder = new JpaResourceInformationProvider(new NullPropertiesProvider());
    builder.init(new DefaultResourceInformationProviderContext(builder, new DefaultInformationBuilder(new TypeParser()), new TypeParser(), new ObjectMapper()));
}
Also used : JpaResourceInformationProvider(io.crnk.jpa.internal.JpaResourceInformationProvider) MetaLookup(io.crnk.meta.MetaLookup) DefaultInformationBuilder(io.crnk.core.engine.internal.information.DefaultInformationBuilder) TypeParser(io.crnk.core.engine.parser.TypeParser) JpaMetaProvider(io.crnk.jpa.meta.JpaMetaProvider) NullPropertiesProvider(io.crnk.core.engine.properties.NullPropertiesProvider) DefaultResourceInformationProviderContext(io.crnk.legacy.registry.DefaultResourceInformationProviderContext) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 10 with TypeParser

use of io.crnk.core.engine.parser.TypeParser in project crnk-framework by crnk-project.

the class JaxrsModuleTest method setup.

@Before
public void setup() {
    final ModuleRegistry moduleRegistry = new ModuleRegistry();
    builder = new JaxrsModule.JaxrsResourceRepositoryInformationProvider();
    final ResourceInformationProvider resourceInformationProvider = new DefaultResourceInformationProvider(moduleRegistry.getPropertiesProvider(), ImmutableList.<PagingBehavior>of(new OffsetLimitPagingBehavior()), new DefaultResourceFieldInformationProvider(), new JacksonResourceFieldInformationProvider());
    resourceInformationProvider.init(new DefaultResourceInformationProviderContext(resourceInformationProvider, new DefaultInformationBuilder(moduleRegistry.getTypeParser()), moduleRegistry.getTypeParser(), new ObjectMapper()));
    context = new RepositoryInformationProviderContext() {

        @Override
        public ResourceInformationProvider getResourceInformationBuilder() {
            return resourceInformationProvider;
        }

        @Override
        public TypeParser getTypeParser() {
            return moduleRegistry.getTypeParser();
        }

        @Override
        public InformationBuilder builder() {
            return new DefaultInformationBuilder(moduleRegistry.getTypeParser());
        }
    };
}
Also used : OffsetLimitPagingBehavior(io.crnk.core.queryspec.pagingspec.OffsetLimitPagingBehavior) TypeParser(io.crnk.core.engine.parser.TypeParser) ModuleRegistry(io.crnk.core.module.ModuleRegistry) JaxrsModule(io.crnk.rs.internal.JaxrsModule) DefaultResourceInformationProviderContext(io.crnk.legacy.registry.DefaultResourceInformationProviderContext) RepositoryInformationProviderContext(io.crnk.core.engine.information.repository.RepositoryInformationProviderContext) DefaultResourceInformationProvider(io.crnk.core.engine.internal.information.resource.DefaultResourceInformationProvider) JacksonResourceFieldInformationProvider(io.crnk.core.engine.internal.jackson.JacksonResourceFieldInformationProvider) InformationBuilder(io.crnk.core.engine.information.InformationBuilder) DefaultInformationBuilder(io.crnk.core.engine.internal.information.DefaultInformationBuilder) DefaultInformationBuilder(io.crnk.core.engine.internal.information.DefaultInformationBuilder) ResourceInformationProvider(io.crnk.core.engine.information.resource.ResourceInformationProvider) DefaultResourceInformationProvider(io.crnk.core.engine.internal.information.resource.DefaultResourceInformationProvider) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultResourceFieldInformationProvider(io.crnk.core.engine.internal.information.resource.DefaultResourceFieldInformationProvider) Before(org.junit.Before)

Aggregations

TypeParser (io.crnk.core.engine.parser.TypeParser)13 Before (org.junit.Before)7 ResourceInformation (io.crnk.core.engine.information.resource.ResourceInformation)5 OffsetLimitPagingBehavior (io.crnk.core.queryspec.pagingspec.OffsetLimitPagingBehavior)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 InformationBuilder (io.crnk.core.engine.information.InformationBuilder)4 ResourceField (io.crnk.core.engine.information.resource.ResourceField)4 DefaultInformationBuilder (io.crnk.core.engine.internal.information.DefaultInformationBuilder)3 ModuleRegistry (io.crnk.core.module.ModuleRegistry)3 ResourceInformationProvider (io.crnk.core.engine.information.resource.ResourceInformationProvider)2 ResourceInformationProviderContext (io.crnk.core.engine.information.resource.ResourceInformationProviderContext)2 DefaultResourceFieldInformationProvider (io.crnk.core.engine.internal.information.resource.DefaultResourceFieldInformationProvider)2 DefaultResourceInformationProvider (io.crnk.core.engine.internal.information.resource.DefaultResourceInformationProvider)2 ResourceFieldImpl (io.crnk.core.engine.internal.information.resource.ResourceFieldImpl)2 JacksonResourceFieldInformationProvider (io.crnk.core.engine.internal.jackson.JacksonResourceFieldInformationProvider)2 NullPropertiesProvider (io.crnk.core.engine.properties.NullPropertiesProvider)2 ResourceRegistry (io.crnk.core.engine.registry.ResourceRegistry)2 Task (io.crnk.core.mock.models.Task)2 TestResourceInformationProvider (io.crnk.core.module.TestResourceInformationProvider)2 SimpleQueryParamsParserContext (io.crnk.legacy.queryParams.context.SimpleQueryParamsParserContext)2