use of io.crnk.core.engine.properties.NullPropertiesProvider in project crnk-framework by crnk-project.
the class JpaPartialEntityExposureTest method testInformationBuilder.
@Test
public void testInformationBuilder() {
EntityManager em = null;
JpaResourceInformationProvider builder = new JpaResourceInformationProvider(new NullPropertiesProvider());
ResourceInformation info = builder.build(TestEntity.class);
List<ResourceField> relationshipFields = info.getRelationshipFields();
Assert.assertEquals(0, relationshipFields.size());
}
use of io.crnk.core.engine.properties.NullPropertiesProvider in project crnk-framework by crnk-project.
the class ClientDocumentMapperTest method setup.
@Before
public void setup() {
boot = new CrnkBoot();
boot.addModule(new TestModule());
boot.boot();
NullPropertiesProvider properties = new NullPropertiesProvider();
documentMapper = new ClientDocumentMapper(boot.getModuleRegistry(), boot.getObjectMapper(), properties);
}
use of io.crnk.core.engine.properties.NullPropertiesProvider in project crnk-framework by crnk-project.
the class ResourceIdControllerTest method checkPatchResource.
private Resource checkPatchResource(Resource resource) {
JsonPath path = pathBuilder.build("/relationIdTest/" + resource.getId());
resource.getRelationships().put("testLookupAlways", new Relationship(schedule2Id));
Document newDocument = createDocument(resource);
// WHEN PATCH
ResourcePatch sut = new ResourcePatch(resourceRegistry, new NullPropertiesProvider(), typeParser, objectMapper, documentMapper, modificationFilters);
Response taskResponse = sut.handle(path, emptyTaskQuery, null, newDocument);
// THEN PATCH
assertThat(taskResponse.getHttpStatus()).isEqualTo(HttpStatus.OK_200);
Resource updatedResource = taskResponse.getDocument().getSingleData().get();
Assert.assertEquals(resource.getType(), updatedResource.getType());
Assert.assertEquals(resource.getId(), updatedResource.getId());
Assert.assertEquals(resource.getAttributes().get("name"), updatedResource.getAttributes().get("name"));
Relationship relationship = updatedResource.getRelationships().get("testLookupAlways");
Assert.assertTrue(relationship.getData().isPresent());
Assert.assertEquals(schedule2Id, relationship.getData().get());
// validate relationship not accessed, only id set => performance
RelationIdTestResource entity = repository.findOne(1L, new QuerySpec(RelationIdTestResource.class));
Assert.assertEquals(schedule2.getId(), entity.getTestLookupAlwaysId());
Assert.assertNull(entity.getTestLookupAlways());
return updatedResource;
}
use of io.crnk.core.engine.properties.NullPropertiesProvider in project crnk-framework by crnk-project.
the class FallbackServiceDiscoveryFactoryTest method returnDefaultDiscoveryIfAvailable.
@Test
public void returnDefaultDiscoveryIfAvailable() {
PropertiesProvider propertiesProvider = new NullPropertiesProvider();
DefaultServiceDiscoveryFactory defaultFactory = new DefaultServiceDiscoveryFactory();
FallbackServiceDiscoveryFactory fallbackFactory = new FallbackServiceDiscoveryFactory(defaultFactory, new SampleJsonServiceLocator(), propertiesProvider);
Assert.assertTrue(fallbackFactory.getInstance() instanceof TestServiceDiscovery);
}
use of io.crnk.core.engine.properties.NullPropertiesProvider in project crnk-framework by crnk-project.
the class AbstractQueryParamsTest method setup.
@Before
public void setup() {
JsonServiceLocator jsonServiceLocator = new SampleJsonServiceLocator();
ResourceInformationProvider resourceInformationProvider = new DefaultResourceInformationProvider(new NullPropertiesProvider(), (PagingBehavior) null, new DefaultResourceFieldInformationProvider(), new JacksonResourceFieldInformationProvider());
SimpleModule testModule = new SimpleModule("test");
CrnkBoot boot = new CrnkBoot();
boot.addModule(testModule);
boot.boot();
moduleRegistry = boot.getModuleRegistry();
resourceRegistry = boot.getResourceRegistry();
converter = new DefaultQueryParamsConverter(resourceRegistry);
paramsToSpecConverter = new DefaultQuerySpecConverter(moduleRegistry);
}
Aggregations