use of org.eclipse.vorto.repository.domain.Privilege in project vorto by eclipse.
the class SearchTestInfrastructure method setupNamespaceMocking.
private void setupNamespaceMocking() throws OperationForbiddenException, DoesNotExistException {
when(namespaceService.resolveWorkspaceIdForNamespace(anyString())).thenReturn(Optional.of("playground"));
when(namespaceService.findNamespaceByWorkspaceId(anyString())).thenReturn(mockNamespace());
when(namespaceRepository.findAll()).thenReturn(Arrays.asList(mockNamespace()));
when(userNamespaceRoleService.hasRole(anyString(), any(), any())).thenReturn(true);
when(userNamespaceRoleService.getNamespaces(anyString(), anyString())).thenReturn(Arrays.asList(mockNamespace()));
List<String> workspaceIds = new ArrayList<>();
workspaceIds.add("playground");
when(namespaceService.findAllWorkspaceIds()).thenReturn(workspaceIds);
NamespaceRole role = new NamespaceRole();
role.setName("namespace_admin");
role.setPrivileges(7);
role.setRole(32);
Set<IRole> roles = new HashSet<>();
roles.add(role);
when(userNamespaceRoleService.getRoles(anyString(), anyString())).thenReturn(roles);
when(userNamespaceRoleService.getRoles(any(User.class), any(Namespace.class))).thenReturn(roles);
Set<Privilege> privileges = new HashSet<>(Arrays.asList(Privilege.DEFAULT_PRIVILEGES));
when(privilegeService.getPrivileges(anyLong())).thenReturn(privileges);
}
Aggregations