use of io.crnk.core.engine.information.repository.RepositoryInformationProviderContext in project crnk-framework by crnk-project.
the class DefaultRegistryEntryBuilder method fromImplementation.
@Override
public void fromImplementation(Object repository) {
RepositoryInformationProvider repositoryInformationBuilder = moduleRegistry.getRepositoryInformationBuilder();
RepositoryInformationProviderContext builderContext = new DefaultRepositoryInformationProviderContext(moduleRegistry);
ResourceRepositoryInformation repositoryInformation = (ResourceRepositoryInformation) repositoryInformationBuilder.build(repository, builderContext);
ResourceInformation resourceInformation = repositoryInformation.getResourceInformation().get();
resource().from(resourceInformation);
resourceRepository().information().from(repositoryInformation);
resourceRepository().instance(repository);
}
use of io.crnk.core.engine.information.repository.RepositoryInformationProviderContext in project crnk-framework by crnk-project.
the class ModuleRegistryTest method buildWithInvalidRepositoryClass.
@Test(expected = UnsupportedOperationException.class)
public void buildWithInvalidRepositoryClass() {
RepositoryInformationProviderContext context = Mockito.mock(RepositoryInformationProviderContext.class);
moduleRegistry.getRepositoryInformationBuilder().build(String.class, context);
}
use of io.crnk.core.engine.information.repository.RepositoryInformationProviderContext 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());
}
};
}
Aggregations