use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class ProjectDatabaseHandlerTest method testUpdateProject2_1.
@Test
public void testUpdateProject2_1() throws Exception {
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);
}
use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class ComponentDatabaseHandlerTest method testDeleteComponent.
@Test
public void testDeleteComponent() throws Exception {
RequestStatus status = handler.deleteComponent("C3", user1);
assertEquals(RequestStatus.SUCCESS, status);
List<Component> componentSummary = handler.getComponentSummary(user1);
assertEquals(2, componentSummary.size());
assertFalse("Component deleted", componentsContain(componentSummary, "C3"));
}
use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class ComponentDatabaseHandlerTest method testEccUpdateSentToEccModeration.
@Test
public void testEccUpdateSentToEccModeration() throws Exception {
Release release = releases.get(1);
String expected = release.getEccInformation().getAL();
release.getEccInformation().setAL("UPDATED");
when(releaseModerator.updateReleaseEccInfo(release, user1)).thenReturn(RequestStatus.SENT_TO_MODERATOR);
RequestStatus status = handler.updateRelease(release, user1, ThriftUtils.IMMUTABLE_OF_RELEASE);
Release actual = handler.getRelease("R1B", user1);
assertEquals(RequestStatus.SENT_TO_MODERATOR, status);
assertEquals(expected, actual.getEccInformation().getAL());
verify(releaseModerator).updateReleaseEccInfo(release, user1);
}
use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class ComponentDatabaseHandlerTest method testDeleteComponentNotModerator.
@Test
public void testDeleteComponentNotModerator() throws Exception {
when(moderator.deleteComponent(any(Component.class), eq(user2))).thenReturn(RequestStatus.SENT_TO_MODERATOR);
RequestStatus status = handler.deleteComponent("C3", user2);
assertEquals(RequestStatus.SENT_TO_MODERATOR, status);
List<Component> componentSummary = handler.getComponentSummary(user1);
assertEquals(3, componentSummary.size());
assertTrue("Component NOT deleted", componentsContain(componentSummary, "C1"));
verify(moderator).deleteComponent(any(Component.class), eq(user2));
}
use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class ComponentDatabaseHandlerTest method testUpdateSentToModeration.
@Test
public void testUpdateSentToModeration() throws Exception {
Release release = releases.get(1);
String expected = release.getName();
release.setName("UPDATED");
when(releaseModerator.updateRelease(release, user1)).thenReturn(RequestStatus.SENT_TO_MODERATOR);
RequestStatus status = handler.updateRelease(release, user1, ThriftUtils.IMMUTABLE_OF_RELEASE);
Release actual = handler.getRelease("R1B", user1);
assertEquals(RequestStatus.SENT_TO_MODERATOR, status);
assertEquals(expected, actual.getName());
verify(releaseModerator).updateRelease(release, user1);
}
Aggregations