use of com.mercedesbenz.sechub.domain.administration.project.Project in project sechub by mercedes-benz.
the class UserRepositoryDBTest method user_NOT_being_owner_of_project_but_listed_as_user_can_be_deleted__and_project_is_NOT_deleted.
@Test
public void user_NOT_being_owner_of_project_but_listed_as_user_can_be_deleted__and_project_is_NOT_deleted() throws Exception {
/* prepare */
Project project = TestProjectCreationFactory.createProject("project_repo_test3", user2);
project.getUsers().add(user1);
project.getWhiteList().add(new URI("http://www.example.org"));
entityManager.persist(project);
entityManager.persist(user1);
prepareForDBTest();
/* execute */
userRepository.deleteUserWithAssociations(user1.getName());
prepareForDBTest();
assertProjectFound(project);
assertUserNotFound(user1);
}
use of com.mercedesbenz.sechub.domain.administration.project.Project in project sechub by mercedes-benz.
the class UserRepositoryDBTest method user_being_owner_of_project_and_also_listed_as_user_can_NOT_be_deleted_instead_a_notacceptable_exception_is_thrown.
@Test
public void user_being_owner_of_project_and_also_listed_as_user_can_NOT_be_deleted_instead_a_notacceptable_exception_is_thrown() {
/* test */
expected.expect(NotAcceptableException.class);
expected.expectMessage("still owner of a project");
/* prepare */
Project project = TestProjectCreationFactory.createProject("project_repo_test2", user1);
project.getUsers().add(user1);
entityManager.persist(project);
prepareForDBTest();
/* execute */
userRepository.deleteUserWithAssociations(user1.getName());
}
use of com.mercedesbenz.sechub.domain.administration.project.Project in project sechub by mercedes-benz.
the class ProjectRepositoryDBTest method project_with_owner_and_users_can_be_deleted.
@Test
public void project_with_owner_and_users_can_be_deleted() {
/* prepare */
Project project = TestProjectCreationFactory.createProject("project_repo_test2", user1);
project.getUsers().add(user1);
entityManager.persist(project);
prepareForDBTest();
/* execute */
projectRepository.deleteProjectWithAssociations(project.getId());
prepareForDBTest();
assertProjectNotFound(project);
assertUserFound(user1);
}
use of com.mercedesbenz.sechub.domain.administration.project.Project in project sechub by mercedes-benz.
the class UserRepositoryDBTest method user_being_owner_of_project_can_NOT_be_deleted__instead_a_notaccetable_exception_is_thrown.
@Test
public void user_being_owner_of_project_can_NOT_be_deleted__instead_a_notaccetable_exception_is_thrown() {
/* test */
expected.expect(NotAcceptableException.class);
expected.expectMessage("still owner of a project");
/* prepare */
Project project = TestProjectCreationFactory.createProject("project_repo_test1", user1);
entityManager.persist(project);
/* execute */
userRepository.deleteUserWithAssociations(user1.getName());
}
use of com.mercedesbenz.sechub.domain.administration.project.Project in project sechub by mercedes-benz.
the class UserAdministrationRestControllerMockTest method show_user_details_returns_result_of_detail_service.
@Test
public void show_user_details_returns_result_of_detail_service() throws Exception {
User user = mock(User.class);
when(user.getName()).thenReturn("user1");
when(user.getEmailAdress()).thenReturn("user1@example.org");
Set<Project> projects = new LinkedHashSet<>();
Project project1 = mock(Project.class);
when(project1.getId()).thenReturn("project1");
projects.add(project1);
when(user.getProjects()).thenReturn(projects);
UserDetailInformation info = new UserDetailInformation(user);
when(mockedUserDetailInformationService.fetchDetails("user1")).thenReturn(info);
/* execute + test @formatter:off */
this.mockMvc.perform(get(https(PORT_USED).buildAdminShowsUserDetailsUrl("user1"))).andExpect(status().isOk()).andExpect(jsonPath("$.userId", equalTo("user1"))).andExpect(jsonPath("$.email", equalTo("user1@example.org"))).andExpect(jsonPath("$.projects", equalTo(Arrays.asList("project1"))));
/* @formatter:on */
}
Aggregations