use of org.eclipse.sw360.attachments.AttachmentHandler in project sw360portal by sw360.
the class AttachmentHandlerTest method setUp.
@Before
public void setUp() throws Exception {
// Create the database
TestUtils.createDatabase(DatabaseSettings.getConfiguredHttpClient(), dbName);
TestUtils.createDatabase(DatabaseSettings.getConfiguredHttpClient(), DatabaseSettings.COUCH_DB_DATABASE);
DatabaseConnector databaseConnector = new DatabaseConnector(DatabaseSettings.getConfiguredHttpClient(), dbName);
databaseConnector.add(new AttachmentContent().setId("A1").setFilename("a.txt").setContentType("text"));
databaseConnector.add(new AttachmentContent().setId("A2").setFilename("b.jpg").setContentType("image"));
handler = new AttachmentHandler();
}
use of org.eclipse.sw360.attachments.AttachmentHandler in project sw360portal by sw360.
the class ComponentAndAttachmentAwareDBTest method getThriftClients.
protected static ThriftClients getThriftClients() throws TException, IOException {
assertTestDbNames();
ThriftClients thriftClients = failingMock(ThriftClients.class);
ComponentHandler componentHandler = new ComponentHandler(thriftClients);
VendorHandler vendorHandler = new VendorHandler();
AttachmentHandler attachmentHandler = new AttachmentHandler();
ModerationService.Iface moderationService = failingMock(ModerationService.Iface.class);
doNothing().when(moderationService).deleteRequestsOnDocument(anyString());
doReturn(componentHandler).when(thriftClients).makeComponentClient();
doReturn(vendorHandler).when(thriftClients).makeVendorClient();
doReturn(attachmentHandler).when(thriftClients).makeAttachmentClient();
doReturn(moderationService).when(thriftClients).makeModerationClient();
return thriftClients;
}
Aggregations