use of example.nontransferable.NoTransferBiDirectional in project elide by yahoo.
the class PersistentResourceTest method testTransferPermissionSuccessOnLineageParent.
@Test
public void testTransferPermissionSuccessOnLineageParent() {
NoTransferBiDirectional a = new NoTransferBiDirectional();
a.setId(1);
NoTransferBiDirectional b = new NoTransferBiDirectional();
b.setId(2);
NoTransferBiDirectional c = new NoTransferBiDirectional();
c.setId(3);
a.setOther(b);
b.setOther(c);
RequestScope goodScope = buildRequestScope(tx, goodUser);
PersistentResource aResource = new PersistentResource(a, "1", goodScope);
PersistentResource bResource = new PersistentResource(b, aResource, "other", "2", goodScope);
PersistentResource cResource = new PersistentResource(c, bResource, "other", "3", goodScope);
cResource.addRelation("other", bResource);
}
use of example.nontransferable.NoTransferBiDirectional in project elide by yahoo.
the class PersistentResourceTest method testTransferPermissionErrorOnLineageAncestor.
@Test
public void testTransferPermissionErrorOnLineageAncestor() {
NoTransferBiDirectional a = new NoTransferBiDirectional();
a.setId(1);
NoTransferBiDirectional b = new NoTransferBiDirectional();
b.setId(2);
NoTransferBiDirectional c = new NoTransferBiDirectional();
c.setId(3);
a.setOther(b);
b.setOther(c);
RequestScope goodScope = buildRequestScope(tx, goodUser);
PersistentResource aResource = new PersistentResource(a, "1", goodScope);
PersistentResource bResource = new PersistentResource(b, aResource, "other", "2", goodScope);
PersistentResource cResource = new PersistentResource(c, bResource, "other", "3", goodScope);
assertThrows(ForbiddenAccessException.class, () -> cResource.addRelation("other", aResource));
}
Aggregations