.getCollection("historymessages");
messagesCollection.drop();
}
public void insert10Messages() {
MessagesHistoryMongo conect = new MessagesHistoryMongo();
Statut statut = Statut.EN_LIGNE;
Message message1 = new Message();
message1.setMessage("comment vas-tu?");
message1.setUserFrom(new User("benoit", statut, "192.168.1.1"));
message1.setUserTo("florian");
message1.setEvent(Event.ALL_CLIENTS);
message1.setDate(new Date(1394743482).toString());
conect.saveMessage(message1);
Statut statut2 = Statut.ABSENT;
Message message2 = new Message();
message2.setMessage("bien et toi");
message2.setUserFrom(new User("florian", statut2, "192.168.1.2"));
message2.setUserTo("Benoit");
message2.setEvent(Event.ONE_CLIENT);
message2.setDate(new Date(1394829882).toString());
conect.saveMessage(message2);
Message message3 = new Message();
message3.setMessage("cool raoul");
message3.setUserFrom(new User("antho", statut, "192.168.1.3"));
message3.setUserTo("All");
message3.setEvent(Event.ALL_CLIENTS);
message3.setDate(new Date(1394916282).toString());
conect.saveMessage(message3);
Message message4 = new Message();
message4.setMessage("on se fait un mac DO");
message4.setUserFrom(new User("benoit", statut, "192.168.1.1"));
message4.setUserTo("florian");
message4.setEvent(Event.ALL_CLIENTS);
message4.setDate(new Date(1395002682).toString());
conect.saveMessage(message4);
Message message5 = new Message();
message5.setMessage("ou un kebab");
message5.setUserFrom(new User("florian", statut, "192.168.1.2"));
message5.setUserTo("all");
message5.setEvent(Event.ALL_CLIENTS);
message5.setDate(new Date(1395089082).toString());
conect.saveMessage(message5);
Message message6 = new Message();
message6.setMessage("pour moi mc do c'est cool!");
message6.setUserFrom(new User("antho", statut, "192.168.1.3"));
message6.setUserTo("all");
message6.setEvent(Event.ALL_CLIENTS);
message6.setDate(new Date(1395175482).toString());
conect.saveMessage(message6);
Message message7 = new Message();
message7.setMessage("bon ben mc do");
message7.setUserFrom(new User("florian", statut, "192.168.1.2"));
message7.setUserTo("all");
message7.setEvent(Event.ALL_CLIENTS);
message7.setDate(new Date(1395261882).toString());
conect.saveMessage(message7);
Message message8 = new Message();
message8.setMessage("on prend quelle voiture?");
message8.setUserFrom(new User("florian", statut, "192.168.1.2"));
message8.setUserTo("all");
message8.setEvent(Event.ALL_CLIENTS);
message8.setDate(new Date(1395348282).toString());
conect.saveMessage(message8);
Message message9 = new Message();
message9.setMessage("la mienne c'est bon");
message9.setUserFrom(new User("benoit", statut, "192.168.1.1"));
message9.setUserTo("all");
message9.setEvent(Event.ALL_CLIENTS);
message9.setDate(new Date(1395434682).toString());
conect.saveMessage(message9);
Message message10 = new Message();
message10.setMessage("allez go en B! on va les avoir");
message10.setUserFrom(new User("florian", statut, "192.168.1.2"));
message10.setUserTo("all");
message10.setEvent(Event.ALL_CLIENTS);
message10.setDate(new Date(1395521082).toString());
conect.saveMessage(message10);
}