@Test public void findFileByContentHash() { List<FileInfo> validFile1 = fileInfoDao.findByContentHash("CONTENT_HASH_FILE_1"); assertEquals("The returned file list should have two items", 2, validFile1.size()); List<FileInfo> validFile2 = fileInfoDao.findByContentHash("CONTENT_HASH_FILE_2"); assertEquals("The returned file list should have one item", 1, validFile2.size()); List<FileInfo> invalidFile = fileInfoDao.findByContentHash(""); assertEquals("The returned file list should have no items", 0, invalidFile.size()); }
@Override public List<FileInfo> findByContentHash(String contentHash) { return query().field("contentHash").equal(contentHash) .order("-created").asList(); }
MongoFileInfoDao extends MongoDao<FileInfo, String> implements FileInfoDao { @Override public List<FileInfo> findByContentHash(String contentHash) { return query().field("contentHash").equal(contentHash) .order("-created").asList(); } }
MongoFileInfoDao extends MongoDao<FileInfo, String> implements FileInfoDao { @Override public List<FileInfo> findByContentHash(String contentHash) { return query().field("contentHash").equal(contentHash) .order("-created").asList(); } @Inject  MongoFileInfoDao(Datastore datastore); }
MongoFileInfoDao extends MongoDao<FileInfo, String> implements FileInfoDao { @Override public List<FileInfo> findByContentHash(String contentHash) { return query().field("contentHash").equal(contentHash) .order("-created").asList(); } @Inject  MongoFileInfoDao(Datastore datastore); @Override List<FileInfo> findAll(); @Override List<FileInfo> findByContentHash(String contentHash); }
MongoFileInfoDao extends MongoDao<FileInfo, String> implements FileInfoDao { @Override public List<FileInfo> findByContentHash(String contentHash) { return query().field("contentHash").equal(contentHash) .order("-created").asList(); } @Inject  MongoFileInfoDao(Datastore datastore); @Override List<FileInfo> findAll(); @Override List<FileInfo> findByContentHash(String contentHash);  }