Search in sources :

Example 1 with ClientProxyFactoryContext

use of io.crnk.client.internal.proxy.ClientProxyFactoryContext in project crnk-framework by crnk-project.

the class CrnkClient method setProxyFactory.

public void setProxyFactory(ClientProxyFactory proxyFactory) {
    proxyFactory.init(new ClientProxyFactoryContext() {

        @Override
        public ModuleRegistry getModuleRegistry() {
            return moduleRegistry;
        }

        @Override
        public <T> DefaultResourceList<T> getCollection(Class<T> resourceClass, String url) {
            RegistryEntry entry = resourceRegistry.findEntry(resourceClass);
            ResourceInformation resourceInformation = entry.getResourceInformation();
            final ResourceRepositoryStubImpl<T, ?> repositoryStub = new ResourceRepositoryStubImpl<>(CrnkClient.this, resourceClass, resourceInformation, urlBuilder);
            return repositoryStub.findAll(url);
        }
    });
    documentMapper.setProxyFactory(proxyFactory);
}
Also used : ResourceInformation(io.crnk.core.engine.information.resource.ResourceInformation) ResourceRepositoryStubImpl(io.crnk.client.internal.ResourceRepositoryStubImpl) DefaultResourceList(io.crnk.core.resource.list.DefaultResourceList) ModuleRegistry(io.crnk.core.module.ModuleRegistry) ClientProxyFactoryContext(io.crnk.client.internal.proxy.ClientProxyFactoryContext)

Example 2 with ClientProxyFactoryContext

use of io.crnk.client.internal.proxy.ClientProxyFactoryContext in project crnk-framework by crnk-project.

the class BasicProxyFactoryTest method setup.

@Before
public void setup() {
    factory = new BasicProxyFactory();
    ClientProxyFactoryContext context = Mockito.mock(ClientProxyFactoryContext.class);
    factory.init(context);
}
Also used : BasicProxyFactory(io.crnk.client.internal.proxy.BasicProxyFactory) ClientProxyFactoryContext(io.crnk.client.internal.proxy.ClientProxyFactoryContext) Before(org.junit.Before)

Aggregations

ClientProxyFactoryContext (io.crnk.client.internal.proxy.ClientProxyFactoryContext)2 ResourceRepositoryStubImpl (io.crnk.client.internal.ResourceRepositoryStubImpl)1 BasicProxyFactory (io.crnk.client.internal.proxy.BasicProxyFactory)1 ResourceInformation (io.crnk.core.engine.information.resource.ResourceInformation)1 ModuleRegistry (io.crnk.core.module.ModuleRegistry)1 DefaultResourceList (io.crnk.core.resource.list.DefaultResourceList)1 Before (org.junit.Before)1