use of org.eclipse.sw360.datahandler.thrift.projects.Project in project sw360portal by sw360.
the class ProjectHandlerTest method testUpdateProject2_2.
@Test
public void testUpdateProject2_2() throws Exception {
Project project2 = handler.getProjectById("P2", user2);
project2.setName("Project2new");
project2.setBusinessUnit("AB CD EF");
RequestStatus status = handler.updateProject(project2, user2);
assertEquals(RequestStatus.SUCCESS, status);
assertEquals("Project2new", handler.getProjectById("P2", user2).getName());
assertEquals("AB CD EF", handler.getProjectById("P2", user2).getBusinessUnit());
assertEquals(2, handler.getMyProjects(user1.getEmail()).size());
assertEquals(1, handler.getMyProjects(user2.getEmail()).size());
assertEquals(1, handler.getMyProjects(user3.getEmail()).size());
assertEquals(3, handler.getAccessibleProjectsSummary(user1).size());
assertEquals(1, handler.getAccessibleProjectsSummary(user2).size());
assertEquals(3, handler.getAccessibleProjectsSummary(user3).size());
}
use of org.eclipse.sw360.datahandler.thrift.projects.Project in project sw360portal by sw360.
the class ProjectHandlerTest method testAddProject.
@Test
public void testAddProject() throws Exception {
Project project4 = new Project();
project4.setName("Project4").setBusinessUnit("AB CD FE");
String id = handler.addProject(project4, user2).getId();
Project projectActual = handler.getProjectById(id, user2);
assertEquals("Project4", projectActual.getName());
assertEquals("user2", projectActual.getCreatedBy());
assertEquals(SW360Utils.getCreatedOn(), projectActual.getCreatedOn());
assertEquals("AB CD FE", projectActual.getBusinessUnit());
assertEquals(2, handler.getMyProjects(user1.getEmail()).size());
assertEquals(2, handler.getMyProjects(user2.getEmail()).size());
assertEquals(1, handler.getMyProjects(user3.getEmail()).size());
assertEquals(3, handler.getAccessibleProjectsSummary(user1).size());
assertEquals(2, handler.getAccessibleProjectsSummary(user2).size());
assertEquals(2, handler.getAccessibleProjectsSummary(user3).size());
}
use of org.eclipse.sw360.datahandler.thrift.projects.Project in project sw360portal by sw360.
the class ProjectHandlerTest method testGetProjectByIdUser1_1.
@Test
public void testGetProjectByIdUser1_1() throws Exception {
Project project1 = handler.getProjectById("P1", user1);
assertEquals("P1", project1.getId());
}
use of org.eclipse.sw360.datahandler.thrift.projects.Project in project sw360portal by sw360.
the class ProjectHandlerTest method testUpdateProject3_3.
@Test
public void testUpdateProject3_3() throws Exception {
Project project3 = handler.getProjectById("P3", user3);
project3.setName("Project3new");
project3.setBusinessUnit("AB CD FE");
RequestStatus status = handler.updateProject(project3, user3);
assertEquals(RequestStatus.SUCCESS, status);
assertEquals("Project3new", handler.getProjectById("P3", user3).getName());
assertEquals("AB CD FE", handler.getProjectById("P3", user3).getBusinessUnit());
assertEquals(2, handler.getMyProjects(user1.getEmail()).size());
assertEquals(1, handler.getMyProjects(user2.getEmail()).size());
assertEquals(1, handler.getMyProjects(user3.getEmail()).size());
assertEquals(2, handler.getAccessibleProjectsSummary(user1).size());
assertEquals(2, handler.getAccessibleProjectsSummary(user2).size());
assertEquals(2, handler.getAccessibleProjectsSummary(user3).size());
}
use of org.eclipse.sw360.datahandler.thrift.projects.Project in project sw360portal by sw360.
the class ProjectHandlerTest method testDontDeleteUsedProject1_1.
@Test
public void testDontDeleteUsedProject1_1() throws Exception {
final Project p2 = handler.getProjectById("P2", user2);
p2.setLinkedProjects(ImmutableMap.of("P1", ProjectRelationship.CONTAINED));
handler.updateProject(p2, user2);
RequestStatus status = handler.deleteProject("P1", user1);
assertEquals(RequestStatus.IN_USE, status);
assertEquals(2, handler.getMyProjects(user1.getEmail()).size());
assertEquals(1, handler.getMyProjects(user2.getEmail()).size());
assertEquals(1, handler.getMyProjects(user3.getEmail()).size());
assertEquals(3, handler.getAccessibleProjectsSummary(user1).size());
assertEquals(1, handler.getAccessibleProjectsSummary(user2).size());
assertEquals(2, handler.getAccessibleProjectsSummary(user3).size());
boolean deleted = (handler.getProjectById("P1", user1) == null);
assertEquals(false, deleted);
}
Aggregations