use of example.FunWithPermissions in project elide by yahoo.
the class IncludedProcessorTest method newFunWithPermissions.
private FunWithPermissions newFunWithPermissions(int id) {
FunWithPermissions funWithPermissions = new FunWithPermissions();
funWithPermissions.setId(id);
funWithPermissions.setRelation1(new HashSet<>());
return funWithPermissions;
}
use of example.FunWithPermissions in project elide by yahoo.
the class PersistentResourceNoopUpdateTest method testNOOPToManyAddRelation.
@Test
public void testNOOPToManyAddRelation() {
FunWithPermissions fun = new FunWithPermissions();
Child child = newChild(1);
Set<Child> children = new HashSet<>();
children.add(child);
fun.setRelation1(children);
DataStoreTransaction tx = mock(DataStoreTransaction.class);
RequestScope goodScope = new RequestScope(null, null, NO_VERSION, null, tx, goodUser, null, null, UUID.randomUUID(), elideSettings);
PersistentResource<FunWithPermissions> funResource = new PersistentResource<>(fun, "3", goodScope);
PersistentResource<Child> childResource = new PersistentResource<>(child, null, goodScope);
// We do not want the update to one method to be called when we add the existing entity to the relation
funResource.addRelation("relation1", childResource);
verify(tx, never()).updateToManyRelation(eq(tx), eq(child), eq("relation1"), any(), any(), eq(goodScope));
}
use of example.FunWithPermissions in project elide by yahoo.
the class PersistentResourceNoopUpdateTest method testNOOPToOneAddRelation.
@Test
public void testNOOPToOneAddRelation() {
FunWithPermissions fun = new FunWithPermissions();
Child child = newChild(1);
fun.setRelation3(child);
DataStoreTransaction tx = mock(DataStoreTransaction.class);
RequestScope goodScope = new RequestScope(null, null, NO_VERSION, null, tx, goodUser, null, null, UUID.randomUUID(), elideSettings);
PersistentResource<FunWithPermissions> funResource = new PersistentResource<>(fun, "3", goodScope);
PersistentResource<Child> childResource = new PersistentResource<>(child, "1", goodScope);
when(tx.getToOneRelation(eq(tx), eq(fun), any(), any())).thenReturn(child);
// We do not want the update to one method to be called when we add the existing entity to the relation
funResource.addRelation("relation3", childResource);
verify(tx, never()).updateToOneRelation(eq(tx), eq(fun), any(), any(), eq(goodScope));
}
use of example.FunWithPermissions in project elide by yahoo.
the class PersistentResourceNoopUpdateTest method testToManyAddRelation.
@Test
public void testToManyAddRelation() {
FunWithPermissions fun = new FunWithPermissions();
Child child = newChild(1);
DataStoreTransaction tx = mock(DataStoreTransaction.class);
RequestScope goodScope = new RequestScope(null, null, NO_VERSION, null, tx, goodUser, null, null, UUID.randomUUID(), elideSettings);
PersistentResource<FunWithPermissions> funResource = new PersistentResource<>(fun, "3", goodScope);
PersistentResource<Child> childResource = new PersistentResource<>(child, null, goodScope);
funResource.addRelation("relation1", childResource);
verify(tx, times(1)).updateToManyRelation(eq(tx), eq(fun), eq("relation1"), any(), any(), eq(goodScope));
}
use of example.FunWithPermissions in project elide by yahoo.
the class PersistentResourceNoopUpdateTest method testToOneAddRelation.
@Test
public void testToOneAddRelation() {
FunWithPermissions fun = new FunWithPermissions();
Child child = newChild(1);
DataStoreTransaction tx = mock(DataStoreTransaction.class);
RequestScope goodScope = new RequestScope(null, null, NO_VERSION, null, tx, goodUser, null, null, UUID.randomUUID(), elideSettings);
PersistentResource<FunWithPermissions> funResource = new PersistentResource<>(fun, "3", goodScope);
PersistentResource<Child> childResource = new PersistentResource<>(child, "1", goodScope);
funResource.addRelation("relation3", childResource);
verify(tx, times(1)).updateToOneRelation(eq(tx), eq(fun), any(), any(), eq(goodScope));
}
Aggregations