MongoDBIpBasedQueue extends AbstractIpAddressBasedQueue { protected void addCrawleableUri(CrawleableUri uri) { try { Document uriDoc = getUriDocument(uri); if (mongoDB.getCollection(COLLECTION_URIS).find(uriDoc).first() == null) { mongoDB.getCollection(COLLECTION_URIS).insertOne(uriDoc); } } catch (Exception e) { LOGGER.error("Error while adding uri to MongoDBQueue", e); } } 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 addCrawleableUri() throws Exception { mongodbQueue.open(); mongodbQueue.purge(); mongodbQueue.addUri(uris.get(1)); assertEquals(1, mongodbQueue.length()); mongodbQueue.addUri(uris.get(2)); assertEquals(1, mongodbQueue.length()); mongodbQueue.close(); }