use of org.eclipse.sw360.datahandler.couchdb.AttachmentConnector in project sw360portal by sw360.
the class RemoteAttachmentDownloaderTest method setUp.
@Before
public void setUp() throws Exception {
DatabaseConnector databaseConnector = new DatabaseConnector(DatabaseSettings.getConfiguredHttpClient(), dbName);
attachmentConnector = new AttachmentConnector(DatabaseSettings.getConfiguredHttpClient(), dbName, downloadTimeout);
repository = new AttachmentRepository(databaseConnector);
garbage = new ArrayList<>();
}
use of org.eclipse.sw360.datahandler.couchdb.AttachmentConnector in project sw360portal by sw360.
the class FossologyFileHandlerTest method setUp.
@Before
public void setUp() throws TException {
ThriftClients thriftClients = TestUtils.failingMock(ThriftClients.class);
doReturn(componentService).when(thriftClients).makeComponentClient();
user = TestUtils.getAdminUser(getClass());
fossologyFileHandler = spy(new FossologyFileHandler(attachmentConnector, fossologyUploader, thriftClients));
}
use of org.eclipse.sw360.datahandler.couchdb.AttachmentConnector 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);
}
Aggregations