use of org.ligoj.app.model.CacheProjectGroup in project ligoj-api by ligoj.
the class SubscriptionResourceTest method prepareDelegate.
private DelegateOrg prepareDelegate() {
// Persist the delegate and the related group to the project
final CacheProjectGroup projectGroup = new CacheProjectGroup();
final CacheGroup group = new CacheGroup();
group.setId("group-project");
group.setName("group-project");
group.setDescription("cn=group-project,ou=parent");
em.persist(group);
final CacheMembership membership = new CacheMembership();
membership.setGroup(group);
membership.setUser(em.find(CacheUser.class, "fdaugan"));
em.persist(membership);
projectGroup.setGroup(group);
projectGroup.setProject(repository.findOne(subscription).getProject());
em.persist(projectGroup);
final DelegateOrg delegate = new DelegateOrg();
delegate.setReceiver("fdaugan");
delegate.setReceiverType(ReceiverType.USER);
delegate.setReceiverDn("uid=fdaugan,ou=company");
delegate.setType(DelegateType.GROUP);
delegate.setName("group-project");
delegate.setDn("cn=group-project,ou=parent");
em.persist(delegate);
em.flush();
return delegate;
}
Aggregations