Search in sources :

Example 1 with ProjectModerator

use of org.eclipse.sw360.datahandler.entitlement.ProjectModerator in project sw360portal by sw360.

the class ProjectHandlerTest method testUpdateProject2_1.

@Test
public void testUpdateProject2_1() throws Exception {
    ProjectModerator moderator = Mockito.mock(ProjectModerator.class);
    ProjectDatabaseHandler handler = new ProjectDatabaseHandler(DatabaseSettings.getConfiguredHttpClient(), dbName, attachmentDbName, moderator, new ComponentDatabaseHandler(DatabaseSettings.getConfiguredHttpClient(), dbName, attachmentDbName));
    Project project2 = handler.getProjectById("P2", user1);
    project2.setName("Project2new");
    Mockito.doReturn(RequestStatus.SENT_TO_MODERATOR).when(moderator).updateProject(project2, user1);
    RequestStatus status = handler.updateProject(project2, user1);
    // Now contributors can also change the project
    assertEquals(RequestStatus.SUCCESS, status);
// assertEquals(RequestStatus.SENT_TO_MODERATOR, status);
// assertEquals("Project2", handler.getProjectById("P2", user1).getName());
// Mockito.verify(moderator, times(1)).updateProject(project2, user1.getEmail());
// Mockito.verifyNoMoreInteractions(moderator);
}
Also used : Project(org.eclipse.sw360.datahandler.thrift.projects.Project) ProjectModerator(org.eclipse.sw360.datahandler.entitlement.ProjectModerator) ProjectDatabaseHandler(org.eclipse.sw360.datahandler.db.ProjectDatabaseHandler) ComponentDatabaseHandler(org.eclipse.sw360.datahandler.db.ComponentDatabaseHandler) RequestStatus(org.eclipse.sw360.datahandler.thrift.RequestStatus) Test(org.junit.Test)

Aggregations

ComponentDatabaseHandler (org.eclipse.sw360.datahandler.db.ComponentDatabaseHandler)1 ProjectDatabaseHandler (org.eclipse.sw360.datahandler.db.ProjectDatabaseHandler)1 ProjectModerator (org.eclipse.sw360.datahandler.entitlement.ProjectModerator)1 RequestStatus (org.eclipse.sw360.datahandler.thrift.RequestStatus)1 Project (org.eclipse.sw360.datahandler.thrift.projects.Project)1 Test (org.junit.Test)1