use of example.nontransferable.ShareableWithPackageShare in project elide by yahoo.
the class PersistentResourceTest method testTransferPermissionSuccessOnUpdateManyRelationshipPackageLevel.
@Test
public void testTransferPermissionSuccessOnUpdateManyRelationshipPackageLevel() {
ContainerWithPackageShare containerWithPackageShare = new ContainerWithPackageShare();
ShareableWithPackageShare shareableWithPackageShare = new ShareableWithPackageShare();
shareableWithPackageShare.setContainerWithPackageShare(containerWithPackageShare);
List<Resource> shareableList = new ArrayList<>();
shareableList.add(new ResourceIdentifier("shareableWithPackageShare", "1").castToResource());
Relationship shareables = new Relationship(null, new Data<>(shareableList));
when(tx.loadObject(any(), eq(1L), any())).thenReturn(shareableWithPackageShare);
RequestScope goodScope = buildRequestScope(tx, goodUser);
PersistentResource<ContainerWithPackageShare> containerResource = new PersistentResource<>(containerWithPackageShare, goodScope.getUUIDFor(containerWithPackageShare), goodScope);
containerResource.updateRelation("shareableWithPackageShares", shareables.toPersistentResources(goodScope));
assertEquals(1, containerWithPackageShare.getShareableWithPackageShares().size());
assertTrue(containerWithPackageShare.getShareableWithPackageShares().contains(shareableWithPackageShare));
}
Aggregations