@Before public void setup() { permissionManager = new DefaultPermissionManager(); treeProvider = new RepositoryTreeProvider(permissionManager, new CallerMock<>(searchService)); rootNode = treeProvider.buildRootNode(); rootNode.setPermissionTree(permissionTree); when(repo1.getIdentifier()).thenReturn("r1"); when(repo2.getIdentifier()).thenReturn("r2"); when(repo1.getAlias()).thenReturn("r1"); when(repo2.getAlias()).thenReturn("r2"); when(repo1.getResourceType()).thenReturn(Repository.RESOURCE_TYPE); when(repo2.getResourceType()).thenReturn(Repository.RESOURCE_TYPE); when(permissionTree.getChildrenResourceIds(any())).thenReturn(null); when(searchService.searchByAlias(anyString(), anyInt(), anyBoolean())).thenReturn(Arrays.asList(repo1, repo2)); }
@Before public void setup() { permissionManager = new DefaultPermissionManager(); treeProvider = new RepositoryTreeProvider(permissionManager, new CallerMock<>(searchService)); rootNode = treeProvider.buildRootNode(); rootNode.setPermissionTree(permissionTree); when(repo1.getIdentifier()).thenReturn("r1"); when(repo2.getIdentifier()).thenReturn("r2"); when(repo1.getAlias()).thenReturn("r1"); when(repo2.getAlias()).thenReturn("r2"); when(repo1.getResourceType()).thenReturn(Repository.RESOURCE_TYPE); when(repo2.getResourceType()).thenReturn(Repository.RESOURCE_TYPE); when(permissionTree.getChildrenResourceIds(any())).thenReturn(null); when(searchService.searchByAlias(anyString(), anyInt(), anyBoolean())).thenReturn(Arrays.asList(repo1, repo2)); }
@Before public void setUp() { permissionManager = new DefaultPermissionManager(); authorizationPolicy = permissionManager.newAuthorizationPolicy().build(); migrationTool = spy(new ACLMigrationTool(organizationalUnitService, repositoryService, permissionManager, policyStorage)); final Path repo1root = mock(Path.class); when(organizationalUnitService.getAllOrganizationalUnits()).thenReturn(Collections.singleton(orgUnit1)); when(repositoryService.getAllRepositoriesFromAllUserSpaces()).thenReturn(Collections.singleton(repo1)); when(orgUnit1.getIdentifier()).thenReturn("orgUnit1"); when(orgUnit1.getResourceType()).thenReturn(OrganizationalUnit.RESOURCE_TYPE); when(orgUnit1.getGroups()).thenReturn(Collections.singleton("group1")); when(repo1.getIdentifier()).thenReturn("repo1"); final Branch master = new Branch("master", repo1root); when(repo1.getBranch("master")).thenReturn(Optional.of(master)); when(repo1.getDefaultBranch()).thenReturn(Optional.of(master)); when(repo1.getResourceType()).thenReturn(Repository.RESOURCE_TYPE); final ArrayList<String> groupList = new ArrayList<>(); groupList.add("group1"); groupList.add("group2"); when(repo1.getGroups()).thenReturn(groupList); }
@Before public void setUp() { permissionManager = new DefaultPermissionManager(); authorizationPolicy = permissionManager.newAuthorizationPolicy().build(); migrationTool = spy(new ACLMigrationTool(organizationalUnitService, repositoryService, mock(Instance.class), permissionManager, policyStorage)); when(migrationTool.getProjectService()).thenReturn(projectService); when(organizationalUnitService.getAllOrganizationalUnits()).thenReturn(Collections.singleton(orgUnit1)); when(repositoryService.getAllRepositories()).thenReturn(Collections.singleton(repo1)); when(projectService.getAllProjects(repo1, "master")).thenReturn(Collections.singleton(project1)); when(orgUnit1.getIdentifier()).thenReturn("orgUnit1"); when(orgUnit1.getResourceType()).thenReturn(OrganizationalUnit.RESOURCE_TYPE); when(orgUnit1.getGroups()).thenReturn(Collections.singleton("group1")); when(repo1.getIdentifier()).thenReturn("repo1"); when(repo1.getResourceType()).thenReturn(Repository.RESOURCE_TYPE); when(repo1.getGroups()).thenReturn(Collections.singleton("group1")); when(project1.getIdentifier()).thenReturn("project1"); when(project1.getResourceType()).thenReturn(Project.RESOURCE_TYPE); when(project1.getGroups()).thenReturn(Collections.singleton("group2")); }
@Before public void setUp() { permissionManager = new DefaultPermissionManager(); authorizationPolicy = permissionManager.newAuthorizationPolicy().build(); migrationTool = spy(new ACLMigrationTool(organizationalUnitService, repositoryService, permissionManager, policyStorage)); final Path repo1root = mock(Path.class); when(organizationalUnitService.getAllOrganizationalUnits()).thenReturn(Collections.singleton(orgUnit1)); when(repositoryService.getAllRepositoriesFromAllUserSpaces()).thenReturn(Collections.singleton(repo1)); when(orgUnit1.getIdentifier()).thenReturn("orgUnit1"); when(orgUnit1.getResourceType()).thenReturn(OrganizationalUnit.RESOURCE_TYPE); when(orgUnit1.getGroups()).thenReturn(Collections.singleton("group1")); when(repo1.getIdentifier()).thenReturn("repo1"); final Branch master = new Branch("master", repo1root); when(repo1.getBranch("master")).thenReturn(Optional.of(master)); when(repo1.getDefaultBranch()).thenReturn(Optional.of(master)); when(repo1.getResourceType()).thenReturn(Repository.RESOURCE_TYPE); final ArrayList<String> groupList = new ArrayList<>(); groupList.add("group1"); groupList.add("group2"); when(repo1.getGroups()).thenReturn(groupList); }