use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method shouldContainMetaInformationField.
@Test
public void shouldContainMetaInformationField() throws Exception {
ResourceInformation resourceInformation = resourceInformationProvider.build(Task.class);
assertThat(resourceInformation.getMetaField().getUnderlyingName()).isEqualTo("metaInformation");
}
use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method shouldIgnoreTransientAttributes.
@Test
public void shouldIgnoreTransientAttributes() throws Exception {
ResourceInformation resourceInformation = resourceInformationProvider.build(IgnoredTransientAttributeResource.class);
Assert.assertNull(resourceInformation.findFieldByName("attribute"));
}
use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method checkJsonApiAttributeAnnotationDefaults.
@Test
public void checkJsonApiAttributeAnnotationDefaults() throws Exception {
ResourceInformation resourceInformation = resourceInformationProvider.build(Task.class);
ResourceField field = resourceInformation.findAttributeFieldByName("name");
Assert.assertTrue(field.getAccess().isPatchable());
Assert.assertTrue(field.getAccess().isPostable());
}
use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class ClientResourceUpsertTest method setLinks.
@Test
public void setLinks() throws IOException {
Resource resource = new Resource();
JsonNode links = boot.getObjectMapper().reader().readTree("{\"value\": \"linksValue\"}");
resource.setLinks((ObjectNode) links);
Task task = new Task();
ResourceInformation resourceInformation = boot.getResourceRegistry().getEntry(Task.class).getResourceInformation();
upsert.setLinks(resource, task, resourceInformation);
Assert.assertEquals("linksValue", task.getLinksInformation().value);
}
use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class BasicProxyFactory method createResourceProxy.
@Override
public <T> T createResourceProxy(Class<T> clazz, Object id) {
T instance = ClassUtils.newInstance(clazz);
ResourceRegistry resourceRegistry = context.getModuleRegistry().getResourceRegistry();
RegistryEntry entry = resourceRegistry.findEntry(clazz);
ResourceInformation resourceInformation = entry.getResourceInformation();
resourceInformation.setId(instance, id);
return instance;
}
Aggregations