Workspace workspace = workspaceRepository.add("workspace1", user1);
assertEquals(startingVertexCount + 1, graph.getAllVertices().size()); // +1 = the workspace vertex
assertEquals(startingEdgeCount + 1, graph.getAllEdges().size()); // +1 = the edges between workspaces and users
try {
workspaceRepository.updateEntityOnWorkspace(workspace, entity1Vertex.getId(), true, new GraphPosition(100, 100), user2);
fail("user2 should not have write access to workspace");
} catch (LumifyAccessDeniedException ex) {
assertEquals(user2, ex.getUser());
assertEquals(workspace.getWorkspaceId(), ex.getResourceId());
}
idGenerator.push(workspaceId + "_to_" + entity1Vertex.getId());
workspaceRepository.updateEntityOnWorkspace(workspace, entity1Vertex.getId(), true, new GraphPosition(100, 200), user1);
assertEquals(startingVertexCount + 1, graph.getAllVertices().size()); // +1 = the workspace vertex
assertEquals(startingEdgeCount + 2, graph.getAllEdges().size()); // +2 = the edges between workspaces, users, and entities
workspaceRepository.updateEntityOnWorkspace(workspace, entity1Vertex.getId(), true, new GraphPosition(200, 300), user1);
assertEquals(startingVertexCount + 1, graph.getAllVertices().size()); // +1 = the workspace vertex
assertEquals(startingEdgeCount + 2, graph.getAllEdges().size()); // +2 = the edges between workspaces, users, and entities
List<WorkspaceEntity> entities = workspaceRepository.findEntities(workspace, user1);
assertEquals(1, entities.size());