use of org.eclipse.sw360.datahandler.thrift.components.Release._Fields in project sw360portal by sw360.
the class FossologyFileHandlerTest method testNotUnlockingIfATeamIsWorkingOnIt.
@Test
public void testNotUnlockingIfATeamIsWorkingOnIt() 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.OPEN, "b", FossologyStatus.REJECTED));
fossologyFileHandler.getReleaseAndUnlockIt(releaseId, user, componentService);
verify(fossologyFileHandler, never()).updateRelease(release, user, componentService);
verify(componentService).getReleaseById(releaseId, user);
verify(release).getClearingTeamToFossologyStatus();
verifyNoMoreInteractions(release);
}
use of org.eclipse.sw360.datahandler.thrift.components.Release._Fields in project sw360portal by sw360.
the class FossologyFileHandlerTest method testSendToFossologySendsAnAttachment.
@Test
public void testSendToFossologySendsAnAttachment() throws Exception {
final String id = "41";
final FilledAttachment filledAttachment = getMockFilledAttachment(id);
final AttachmentContent attachmentContent = filledAttachment.getAttachmentContent();
final Release release = mock(Release.class);
when(componentService.getReleaseById(releaseId, user)).thenReturn(release);
spyGetFilledSourceAttachment(filledAttachment);
final InputStream inputStream = mock(InputStream.class);
when(release.isSetFossologyId()).thenReturn(false);
when(release.getClearingState()).thenReturn(ClearingState.NEW_CLEARING);
when(attachmentConnector.getAttachmentStream(attachmentContent, user, release)).thenReturn(inputStream);
when(fossologyUploader.uploadToFossology(inputStream, attachmentContent, clearingTeam)).thenReturn(1);
doNothing().when(fossologyFileHandler).setFossologyStatus(eq(release), anyString(), eq(FossologyStatus.SENT), eq("" + 1), eq(id));
doReturn(true).when(fossologyFileHandler).checkSourceAttachment(release, filledAttachment);
assertThat(fossologyFileHandler.sendToFossology(releaseId, user, clearingTeam), is(RequestStatus.SUCCESS));
verify(inputStream).close();
// the release should be updated
verify(componentService).updateReleaseFossology(release, user);
verify(fossologyFileHandler).setFossologyStatus(eq(release), anyString(), eq(FossologyStatus.SENT), eq("" + 1), eq(id));
// unimportant verifies
verify(componentService, times(1)).getReleaseById(releaseId, user);
verify(attachmentConnector).getAttachmentStream(attachmentContent, user, release);
verify(fossologyUploader).uploadToFossology(inputStream, attachmentContent, clearingTeam);
}
use of org.eclipse.sw360.datahandler.thrift.components.Release._Fields in project sw360portal by sw360.
the class CveSearchWrapperTest method testLargeData.
@Ignore
@Test
public void testLargeData() throws IOException {
Release release = new ReleaseBuilder().setName("server").get();
Optional<List<CveSearchData>> resultWrapped = cveSearchWrapper.searchForRelease(release);
assert (resultWrapped.isPresent());
assert (resultWrapped.get() != null);
}
use of org.eclipse.sw360.datahandler.thrift.components.Release._Fields in project sw360portal by sw360.
the class CveSearchWrapperTest method compareToSearchByCPE.
@Test
public void compareToSearchByCPE() throws IOException {
Release release = new ReleaseBuilder().setName("blindstring").setVendorFullname("blindstring").setVendorShortname("blindstring").setCpe(CPE).get();
List<CveSearchData> resultDirect = cveSearchApi.cvefor(CPE);
Optional<List<CveSearchData>> resultWrapped = cveSearchWrapper.searchForRelease(release);
assert (resultWrapped.isPresent());
assert (resultWrapped.get() != null);
assert (isEquivalent(resultDirect, resultWrapped.get()));
}
use of org.eclipse.sw360.datahandler.thrift.components.Release._Fields in project sw360portal by sw360.
the class CveSearchWrapperTest method compareToWithoutWrapper.
@Ignore("meanwhile cveSearchWrapper implementation changed, test maybe suitable for later use")
@Test
public void compareToWithoutWrapper() throws IOException {
Release release = new ReleaseBuilder().setName(PRODUCTNAME).setVendorFullname(VENDORNAME).get();
List<CveSearchData> resultDirect = cveSearchApi.search(VENDORNAME, PRODUCTNAME);
Optional<List<CveSearchData>> resultWrapped = cveSearchWrapper.searchForRelease(release);
assert (resultWrapped.isPresent());
assert (resultWrapped.get() != null);
assert (resultWrapped.get().size() > 0);
assert (isEquivalent(resultDirect, resultWrapped.get()));
}
Aggregations