@BeforeMethod public void setUp() throws Exception { includedProcessor = new IncludedProcessor(); EntityDictionary dictionary = new EntityDictionary(); dictionary.bindEntity(Child.class); dictionary.bindEntity(Parent.class); RequestScope goodUserScope = new RequestScope( new JsonApiDocument(), null, new User(1), dictionary, null, new TestLogger()); // Create objects Parent parent1 = newParent(1); Parent parent2 = newParent(2); Parent parent3 = newParent(3); Child child1 = newChild(2); Child child2 = newChild(3); Child child3 = newChild(4); Child child4 = newChild(5); // Form relationships parent1.setSpouses(new HashSet<>(Collections.singletonList(parent2))); parent1.setChildren(new HashSet<>(Collections.singletonList(child1))); parent2.setChildren(new HashSet<>(Collections.singletonList(child2))); child1.setFriends(new HashSet<>(Collections.singletonList(child2))); // Parent with multiple children each with a friend parent3.setChildren(new HashSet<>(Arrays.asList(child3, child4))); child3.setFriends(new HashSet<>(Collections.singletonList(child1))); child4.setFriends(new HashSet<>(Collections.singletonList(child2))); // Create Persistent Resources parentRecord1 = new PersistentResource<>(parent1, goodUserScope); parentRecord2 = new PersistentResource<>(parent2, goodUserScope); parentRecord3 = new PersistentResource<>(parent3, goodUserScope); childRecord1 = new PersistentResource<>(child1, goodUserScope); childRecord2 = new PersistentResource<>(child2, goodUserScope); childRecord3 = new PersistentResource<>(child3, goodUserScope); childRecord4 = new PersistentResource<>(child4, goodUserScope); }
@Override public void populateEntityDictionary(EntityDictionary dictionary) { for (EntityType entity : entityManagerFactory.getMetamodel().getEntities()) { dictionary.bindEntity(entity.getBindableJavaType()); } }