@Test public void testUpdateLastHeartbeat() { Date expectedDate = heartbeatDAO.updateLastHeartbeat(IP); Date actualDate = heartbeatDAO.findLastHeartbeat(IP); Assert.assertEquals(expectedDate, actualDate); }
@Override public Date updateLastHeartbeat(String ip) { DBCollection collection = this.mongoClient.getHeartbeatCollection(ip.replace('.', '_')); Date curTime = new Date(); DBObject insert = BasicDBObjectBuilder.start().add(TICK, curTime).get(); collection.insert(insert); return curTime; }
HeartbeatDAOImpl implements HeartbeatDAO { @Override public Date updateLastHeartbeat(String ip) { DBCollection collection = this.mongoClient.getHeartbeatCollection(ip.replace('.', '_')); Date curTime = new Date(); DBObject insert = BasicDBObjectBuilder.start().add(TICK, curTime).get(); collection.insert(insert); return curTime; } }
HeartbeatDAOImpl implements HeartbeatDAO { @Override public Date updateLastHeartbeat(String ip) { DBCollection collection = this.mongoClient.getHeartbeatCollection(ip.replace('.', '_')); Date curTime = new Date(); DBObject insert = BasicDBObjectBuilder.start().add(TICK, curTime).get(); collection.insert(insert); return curTime; }  }
HeartbeatDAOImpl implements HeartbeatDAO { @Override public Date updateLastHeartbeat(String ip) { DBCollection collection = this.mongoClient.getHeartbeatCollection(ip.replace('.', '_')); Date curTime = new Date(); DBObject insert = BasicDBObjectBuilder.start().add(TICK, curTime).get(); collection.insert(insert); return curTime; }  void setMongoClient(MongoClient mongoClient); @Override Date updateLastHeartbeat(String ip); @Override Date findLastHeartbeat(String ip); }
HeartbeatDAOImpl implements HeartbeatDAO { @Override public Date updateLastHeartbeat(String ip) { DBCollection collection = this.mongoClient.getHeartbeatCollection(ip.replace('.', '_')); Date curTime = new Date(); DBObject insert = BasicDBObjectBuilder.start().add(TICK, curTime).get(); collection.insert(insert); return curTime; }  void setMongoClient(MongoClient mongoClient); @Override Date updateLastHeartbeat(String ip); @Override Date findLastHeartbeat(String ip); static final String TICK; }