use of org.molgenis.data.Fetch in project molgenis by molgenis.
the class TransactionalRepositoryDecoratorTest method forEachBatchedFetch.
@Test
public void forEachBatchedFetch() throws Exception {
Fetch fetch = mock(Fetch.class);
@SuppressWarnings("unchecked") Consumer<List<Entity>> consumer = mock(Consumer.class);
int batchSize = 1000;
transactionalRepo.forEachBatched(fetch, consumer, batchSize);
verify(transactionManager).getTransaction(any(TransactionDefinition.class));
verify(delegateRepository).forEachBatched(fetch, consumer, batchSize);
}
use of org.molgenis.data.Fetch in project molgenis by molgenis.
the class TransactionalRepositoryDecoratorTest method findAllStreamFetch.
@Test
public void findAllStreamFetch() throws Exception {
@SuppressWarnings("unchecked") Stream<Object> entityIds = mock(Stream.class);
Fetch fetch = mock(Fetch.class);
transactionalRepo.findAll(entityIds, fetch);
verify(transactionManager).getTransaction(any(TransactionDefinition.class));
verify(delegateRepository).findAll(entityIds, fetch);
}
use of org.molgenis.data.Fetch in project molgenis by molgenis.
the class EntityTypeUtilsTest method testCreateFetchForReindexingIndexingDepth1.
@Test
public void testCreateFetchForReindexingIndexingDepth1() {
EntityType entityType = createMockEntityType();
when(entityType.getIndexingDepth()).thenReturn(1);
Fetch expectedFetch = new Fetch().field("MyEntityTypeAttr").field("MyEntityTypeRefAttr", new Fetch().field("MyRefEntityTypeAttr").field("MyRefEntityTypeRefAttr"));
assertEquals(EntityTypeUtils.createFetchForReindexing(entityType), expectedFetch);
}
use of org.molgenis.data.Fetch in project molgenis by molgenis.
the class QueryImplTest method setFetch.
@Test
public void setFetch() {
Fetch fetch = new Fetch();
QueryImpl<Entity> q = new QueryImpl<>();
q.setFetch(fetch);
assertEquals(fetch, q.getFetch());
}
use of org.molgenis.data.Fetch in project molgenis by molgenis.
the class AttributeFilterToFetchConverterTest method convertAttrFilterCompoundAttr.
@Test
public void convertAttrFilterCompoundAttr() {
AttributeFilter attrFilter = new AttributeFilter().add(COMPOUND_ATTR_NAME);
assertEquals(AttributeFilterToFetchConverter.convert(attrFilter, entityType, "en"), new Fetch().field(COMPOUND_PART_FILE_ATTR_NAME, new Fetch().field(FileMetaMetaData.ID).field(FileMetaMetaData.FILENAME).field(FileMetaMetaData.URL)).field(COMPOUND_PART_COMPOUND_PART_ATTR_NAME).field(COMPOUND_PART_COMPOUND_PART_ATTR2_NAME));
}
Aggregations