use of io.crnk.jpa.model.TestEntity in project crnk-framework by crnk-project.
the class JpaEntityRepositoryTestBase method testIncludeNoRelations.
@Test
public void testIncludeNoRelations() throws InstantiationException, IllegalAccessException {
em.clear();
List<TestEntity> list = repo.findAll(new QuerySpec(TestEntity.class));
Assert.assertEquals(numTestEntities, list.size());
for (TestEntity entity : list) {
RelatedEntity relatedValue = entity.getOneRelatedValue();
if (relatedValue != null)
Assert.assertFalse(Hibernate.isInitialized(relatedValue));
}
}
use of io.crnk.jpa.model.TestEntity in project crnk-framework by crnk-project.
the class JpaEntityRepositoryTestBase method testFilterBooleanTrue.
@Test
public void testFilterBooleanTrue() throws InstantiationException, IllegalAccessException {
QuerySpec querySpec = new QuerySpec(TestEntity.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("embValue", "nestedValue", "embBoolValue"), FilterOperator.EQ, true));
List<TestEntity> list = repo.findAll(querySpec);
Assert.assertEquals(1, list.size());
TestEntity entity = list.get(0);
Assert.assertTrue(entity.getEmbValue().getNestedValue().getEmbBoolValue());
}
use of io.crnk.jpa.model.TestEntity in project crnk-framework by crnk-project.
the class JpaEntityRepositoryTestBase method testPagingFirst.
@Test
public void testPagingFirst() throws InstantiationException, IllegalAccessException {
QuerySpec querySpec = new QuerySpec(TestEntity.class);
querySpec.setOffset(0L);
querySpec.setLimit(3L);
ResourceList<TestEntity> list = repo.findAll(querySpec);
Assert.assertEquals(3, list.size());
Assert.assertEquals(0, list.get(0).getId().intValue());
Assert.assertEquals(1, list.get(1).getId().intValue());
Assert.assertEquals(2, list.get(2).getId().intValue());
PagedMetaInformation metaInformation = list.getMeta(PagedMetaInformation.class);
Assert.assertEquals(5, metaInformation.getTotalResourceCount().longValue());
}
use of io.crnk.jpa.model.TestEntity in project crnk-framework by crnk-project.
the class JpaEntityRepositoryTestBase method testFilterString.
@Test
public void testFilterString() throws InstantiationException, IllegalAccessException {
QuerySpec querySpec = new QuerySpec(TestEntity.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("stringValue"), FilterOperator.EQ, "test1"));
List<TestEntity> list = repo.findAll(querySpec);
Assert.assertEquals(1, list.size());
TestEntity entity = list.get(0);
Assert.assertEquals("test1", entity.getStringValue());
}
use of io.crnk.jpa.model.TestEntity in project crnk-framework by crnk-project.
the class JpaEntityRepositoryTestBase method testFilterInt.
@Test
public void testFilterInt() throws InstantiationException, IllegalAccessException {
QuerySpec querySpec = new QuerySpec(TestEntity.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("embValue", "embIntValue"), FilterOperator.EQ, 2));
List<TestEntity> list = repo.findAll(querySpec);
Assert.assertEquals(1, list.size());
TestEntity entity = list.get(0);
Assert.assertEquals(2L, entity.getId().longValue());
Assert.assertEquals(2, entity.getEmbValue().getEmbIntValue().intValue());
}
Aggregations