AttachmentHandler implements AttachmentService.Iface { @Override public AttachmentContent getAttachmentContent(String id) throws TException { assertNotEmpty(id); AttachmentContent attachment = attachmentRepository.get(id); assertNotNull(attachment, "Cannot find "+ id + " in database."); validateAttachment(attachment); return attachment; } AttachmentHandler(); @Override AttachmentContent makeAttachmentContent(AttachmentContent attachmentContent); @Override List<AttachmentContent> makeAttachmentContents(List<AttachmentContent> attachmentContents); @Override AttachmentContent getAttachmentContent(String id); @Override void updateAttachmentContent(AttachmentContent attachment); @Override RequestSummary bulkDelete(List<String> ids); @Override RequestStatus deleteAttachmentContent(String attachmentId); @Override RequestSummary vacuumAttachmentDB(User user, Set<String> usedIds); @Override String getSha1FromAttachmentContentId(String attachmentContentId); @Override AttachmentUsage makeAttachmentUsage(AttachmentUsage attachmentUsage); @Override void makeAttachmentUsages(List<AttachmentUsage> attachmentUsages); @Override AttachmentUsage getAttachmentUsage(String id); @Override AttachmentUsage updateAttachmentUsage(AttachmentUsage attachmentUsage); @Override void updateAttachmentUsages(List<AttachmentUsage> attachmentUsages); @Override void deleteAttachmentUsage(AttachmentUsage attachmentUsage); @Override void deleteAttachmentUsages(List<AttachmentUsage> attachmentUsages); @Override void deleteAttachmentUsagesByUsageDataType(Source usedBy, UsageData usageData); @Override List<AttachmentUsage> getAttachmentUsages(Source owner, String attachmentContentId, UsageData filter); @Override List<AttachmentUsage> getUsedAttachments(Source usedBy, UsageData filter); @Override void replaceAttachmentUsages(Source usedBy, List<AttachmentUsage> attachmentUsages); @Override Map<Map<Source, String>, Integer> getAttachmentUsageCount(Map<Source, Set<String>> attachments, UsageData filter); static final String ATTACHMENTS_FIELD_NAME; }
@Test public void testGetAttachmentContent() throws Exception { AttachmentContent attachment = handler.getAttachmentContent("A1"); assertEquals("A1", attachment.id); assertEquals("a.txt", attachment.filename); assertEquals("text", attachment.contentType); }