Search in sources :

Example 1 with NoTransferBiDirectional

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);
}
Also used : NoTransferBiDirectional(example.nontransferable.NoTransferBiDirectional) PatchRequestScope(com.yahoo.elide.jsonapi.extensions.PatchRequestScope) Test(org.junit.jupiter.api.Test)

Example 2 with NoTransferBiDirectional

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));
}
Also used : NoTransferBiDirectional(example.nontransferable.NoTransferBiDirectional) PatchRequestScope(com.yahoo.elide.jsonapi.extensions.PatchRequestScope) Test(org.junit.jupiter.api.Test)

Aggregations

PatchRequestScope (com.yahoo.elide.jsonapi.extensions.PatchRequestScope)2 NoTransferBiDirectional (example.nontransferable.NoTransferBiDirectional)2 Test (org.junit.jupiter.api.Test)2