use of com.blazebit.persistence.view.testsuite.cte.model.PersonWithPartnerDocumentFullAged.FullAgedCTEProvider in project blaze-persistence by Blazebit.
the class WithCTEMappingTest method testCteBindingWithSubview.
@Test
public void testCteBindingWithSubview() {
EntityViewManager evm = build(DocumentWithCTE.class, PersonWithPartnerDocument.class, PersonWithPartnerDocumentFullAged.class, PersonWithPartnerDocumentUnderAged.class);
CriteriaBuilder<Person> cb = cbf.create(em, Person.class).orderByAsc("id");
EntityViewSetting<PersonWithPartnerDocument, CriteriaBuilder<PersonWithPartnerDocument>> setting;
setting = EntityViewSetting.create(PersonWithPartnerDocument.class);
List<PersonWithPartnerDocument> list = evm.applySetting(setting, cb).getResultList();
assertEquals(3, list.size());
assertEquals("doc1", list.get(0).getPartnerDocument().getName());
assertEquals(Long.valueOf(1), list.get(0).getPartnerDocument().getOwnedDocumentCount());
boolean containsProvider = false;
ManagedViewType<?> viewType = evm.getMetamodel().managedView(PersonWithPartnerDocumentFullAged.class);
for (CTEProvider provider : viewType.getCteProviders()) {
if (provider instanceof FullAgedCTEProvider) {
containsProvider = true;
}
}
assertTrue(containsProvider);
}
Aggregations