use of org.eclipse.sw360.datahandler.thrift.components.ComponentService in project sw360portal by sw360.
the class FossologyFileHandlerTest method testSendToFossologyDuplicates.
@Test
public void testSendToFossologyDuplicates() throws Exception {
final FilledAttachment filledAttachment = getMockFilledAttachment("17");
final Release release = mock(Release.class);
when(componentService.getReleaseById(releaseId, user)).thenReturn(release);
when(release.getFossologyId()).thenReturn("41");
when(release.isSetFossologyId()).thenReturn(true);
when(release.getClearingState()).thenReturn(ClearingState.SENT_TO_FOSSOLOGY);
spyGetFilledSourceAttachment(filledAttachment);
when(fossologyUploader.duplicateInFossology(41, clearingTeam)).thenReturn(true);
doNothing().when(fossologyFileHandler).setFossologyStatus(eq(release), anyString(), any(FossologyStatus.class));
doReturn(true).when(fossologyFileHandler).checkSourceAttachment(release, filledAttachment);
assertThat(fossologyFileHandler.sendToFossology(releaseId, user, clearingTeam), is(RequestStatus.SUCCESS));
verify(fossologyUploader).duplicateInFossology(41, clearingTeam);
verify(fossologyUploader).getStatusInFossology(eq(41), eq(clearingTeam));
verify(fossologyFileHandler).setFossologyStatus(eq(release), eq(clearingTeam), eq(FossologyStatus.SENT));
verify(componentService).updateReleaseFossology(release, user);
verify(componentService, atLeastOnce()).getReleaseById(releaseId, user);
verifyNoMoreInteractions(attachmentConnector);
}
use of org.eclipse.sw360.datahandler.thrift.components.ComponentService in project sw360portal by sw360.
the class FossologyFileHandlerTest method testUnlocking.
@Test
public void testUnlocking() throws Exception {
Release release = mock(Release.class);
doReturn(null).when(fossologyFileHandler).updateRelease(release, user, componentService);
doReturn(release).when(componentService).getReleaseById(releaseId, user);
when(release.getClearingTeamToFossologyStatus()).thenReturn(ImmutableMap.of("a", FossologyStatus.REJECTED, "b", FossologyStatus.REJECTED));
fossologyFileHandler.getReleaseAndUnlockIt(releaseId, user, componentService);
verify(fossologyFileHandler).updateRelease(release, user, componentService);
verify(componentService).getReleaseById(releaseId, user);
verify(release).unsetAttachmentInFossology();
verify(release).unsetFossologyId();
}
Aggregations