use of io.crnk.core.engine.registry.RegistryEntry in project crnk-framework by crnk-project.
the class ResourceRegistryTest method onNonExistingTypeShouldReturnNull.
@Test
public void onNonExistingTypeShouldReturnNull() {
RegistryEntry entry = resourceRegistry.getEntry("nonExistingType");
assertThat(entry).isNull();
}
use of io.crnk.core.engine.registry.RegistryEntry in project crnk-framework by crnk-project.
the class ResourceRegistryTest method onResourceGetEntryWithBackUp.
@Test
public void onResourceGetEntryWithBackUp() {
String taskType = Task.class.getAnnotation(JsonApiResource.class).type();
resourceRegistry.addEntry(Task.class, newRegistryEntry(Task.class, taskType));
// WHEN
RegistryEntry registryEntry = resourceRegistry.findEntry(Task.class);
// THEN
assertNotNull(registryEntry);
assertNotNull(registryEntry.getResourceInformation().getResourceType(), taskType);
// WHEN
registryEntry = resourceRegistry.findEntry(Task.class);
// THEN
assertNotNull(registryEntry);
assertNotNull(registryEntry.getResourceInformation().getResourceType(), taskType);
}
use of io.crnk.core.engine.registry.RegistryEntry in project crnk-framework by crnk-project.
the class DefaultQuerySpecSerializerTest method testFilterByMany.
@Test
public void testFilterByMany() throws InstantiationException, IllegalAccessException {
QuerySpec querySpec = new QuerySpec(Task.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("name"), FilterOperator.EQ, Arrays.asList("value1", "value2")));
RegistryEntry entry = resourceRegistry.getEntry(Task.class);
String actualUrl = urlBuilder.buildUrl(entry.getResourceInformation(), null, querySpec);
String expectedUrl0 = "http://127.0.0.1/tasks?filter[tasks][name][EQ]=value2&filter[tasks][name][EQ]=value1";
String expectedUrl1 = "http://127.0.0.1/tasks?filter[tasks][name][EQ]=value1&filter[tasks][name][EQ]=value2";
Assert.assertTrue(expectedUrl0.equals(actualUrl) || expectedUrl1.equals(actualUrl));
}
use of io.crnk.core.engine.registry.RegistryEntry in project crnk-framework by crnk-project.
the class DefaultQuerySpecSerializerTest method check.
private void check(String expectedUrl, Object id, QuerySpec querySpec) {
RegistryEntry entry = resourceRegistry.getEntry(Task.class);
String actualUrl = urlBuilder.buildUrl(entry.getResourceInformation(), id, querySpec);
assertEquals(expectedUrl, actualUrl);
}
use of io.crnk.core.engine.registry.RegistryEntry in project crnk-framework by crnk-project.
the class DefaultQuerySpecSerializerTest method testNestedFilterSpecNotYetSupported.
@Test(expected = UnsupportedOperationException.class)
public void testNestedFilterSpecNotYetSupported() throws InstantiationException, IllegalAccessException {
QuerySpec querySpec = new QuerySpec(Task.class);
querySpec.addFilter(FilterSpec.or(new FilterSpec(Arrays.asList("name"), FilterOperator.EQ, "test"), new FilterSpec(Arrays.asList("name"), FilterOperator.GE, "test")));
RegistryEntry entry = resourceRegistry.getEntry(Task.class);
urlBuilder.buildUrl(entry.getResourceInformation(), null, querySpec);
}
Aggregations