use of io.crnk.core.engine.url.ConstantServiceUrlProvider in project crnk-framework by crnk-project.
the class ResourceRegistryTest method resetResourceRegistry.
@Before
public void resetResourceRegistry() {
moduleRegistry = new ModuleRegistry();
moduleRegistry.getHttpRequestContextProvider().setServiceUrlProvider(new ConstantServiceUrlProvider(TEST_MODELS_URL));
resourceRegistry = new ResourceRegistryImpl(new DefaultResourceRegistryPart(), moduleRegistry);
}
use of io.crnk.core.engine.url.ConstantServiceUrlProvider in project crnk-framework by crnk-project.
the class DefaultQueryParamsSerializerTest method testHttpsSchema.
@Test
public void testHttpsSchema() {
CrnkBoot boot = new CrnkBoot();
boot.setServiceUrlProvider(new ConstantServiceUrlProvider("https://127.0.0.1"));
boot.setServiceDiscovery(new ReflectionsServiceDiscovery(MockConstants.TEST_MODELS_PACKAGE));
boot.boot();
urlBuilder = new JsonApiUrlBuilder(boot.getResourceRegistry());
check("https://127.0.0.1/tasks", null, new QueryParams());
}
use of io.crnk.core.engine.url.ConstantServiceUrlProvider in project crnk-framework by crnk-project.
the class QueryParamsAdapterTest method test.
@Test
public void test() {
ModuleRegistry moduleRegistry = new ModuleRegistry();
moduleRegistry.getHttpRequestContextProvider().setServiceUrlProvider(new ConstantServiceUrlProvider("http://localhost"));
ResourceRegistry resourceRegistry = new ResourceRegistryImpl(new DefaultResourceRegistryPart(), moduleRegistry);
QueryParams params = new QueryParams();
DefaultResourceInformationProvider builder = new DefaultResourceInformationProvider(new NullPropertiesProvider(), new OffsetLimitPagingBehavior(), new DefaultResourceFieldInformationProvider(), new JacksonResourceFieldInformationProvider());
builder.init(new DefaultResourceInformationProviderContext(builder, new DefaultInformationBuilder(moduleRegistry.getTypeParser()), moduleRegistry.getTypeParser(), new ObjectMapper()));
ResourceInformation info = builder.build(Task.class);
QueryParamsAdapter adapter = new QueryParamsAdapter(info, params, moduleRegistry);
Assert.assertEquals(Task.class, adapter.getResourceInformation().getResourceClass());
Assert.assertEquals(resourceRegistry, adapter.getResourceRegistry());
}
use of io.crnk.core.engine.url.ConstantServiceUrlProvider in project crnk-framework by crnk-project.
the class OppositeFowardingRelationshipRepositoryTest method setup.
@Before
public void setup() {
MockRepositoryUtil.clear();
CrnkBoot boot = new CrnkBoot();
boot.setServiceDiscovery(new ReflectionsServiceDiscovery(MockConstants.TEST_MODELS_PACKAGE));
boot.setServiceUrlProvider(new ConstantServiceUrlProvider(ResourceRegistryTest.TEST_MODELS_URL));
boot.boot();
resourceRegistry = boot.getResourceRegistry();
testRepository = (RelationIdTestRepository) resourceRegistry.getEntry(RelationIdTestResource.class).getResourceRepository().getResourceRepository();
RelationshipMatcher relMatcher = new RelationshipMatcher().rule().source(RelationIdTestResource.class).target(RelationIdTestResource.class).add();
relRepository = new ForwardingRelationshipRepository(RelationIdTestResource.class, relMatcher, ForwardingDirection.OPPOSITE, ForwardingDirection.OPPOSITE);
relRepository.setResourceRegistry(resourceRegistry);
}
use of io.crnk.core.engine.url.ConstantServiceUrlProvider in project crnk-framework by crnk-project.
the class HttpRequestContextAwareTest method check.
@Test
public void check() throws IOException {
HttTestModule testModule = Mockito.mock(HttTestModule.class);
CrnkBoot boot = new CrnkBoot();
boot.setServiceUrlProvider(new ConstantServiceUrlProvider("http://localhost:8080"));
boot.setServiceDiscovery(new ReflectionsServiceDiscovery(MockConstants.TEST_MODELS_PACKAGE));
boot.addModule(testModule);
boot.boot();
Mockito.verify(testModule, Mockito.times(1)).setHttpRequestContextProvider(Mockito.any(HttpRequestContextProvider.class));
}
Aggregations