MongoDBIpBasedQueue extends AbstractIpAddressBasedQueue { @SuppressWarnings("unchecked") @Override public List<CrawleableUri> getUris(InetAddress address) { Document query = getIpDocument(address); Iterator<Document> uriDocs = mongoDB.getCollection(COLLECTION_URIS).find(query).iterator(); List<CrawleableUri> listUris = new ArrayList<CrawleableUri>(); try { while (uriDocs.hasNext()) { Document doc = uriDocs.next(); listUris.add(serializer.deserialize(((Binary) doc.get("uri")).getData())); } } catch (Exception e) { LOGGER.error("Error while retrieving uri from MongoDBQueue. Returning emtpy list.", e); return Collections.EMPTY_LIST; } return listUris; } MongoDBIpBasedQueue(String hostName, Integer port, boolean includeDepth);  MongoDBIpBasedQueue(String hostName, Integer port, Serializer serializer, boolean includeDepth); void purge(); long length(); @Override void close(); @Override void open(); boolean queueTableExists(); @SuppressWarnings("unchecked") @Override List<CrawleableUri> getUris(InetAddress address); Document getUriDocument(CrawleableUri uri); Document getIpDocument(InetAddress address); @Deprecated List<String> getIpAddressTypeKey(CrawleableUri uri); @Deprecated List<String> packTuple(String str_1, String str_2); @Override boolean isEmpty();  }
@Test public void getUris() throws Exception { mongodbQueue.open(); mongodbQueue.purge(); for (CrawleableUri uri : uris) { mongodbQueue.addUri(uri); } Iterator<InetAddress> iter = mongodbQueue.getGroupIterator(); int count = 0; while (iter.hasNext()) { List<CrawleableUri> uriList = mongodbQueue.getUris(iter.next()); for (CrawleableUri uri : uriList) { assertTrue(uris.contains(uri)); ++count; } } assertEquals(uris.size(), count); mongodbQueue.close(); }