Пример #1
0
 @AfterClass
 public static void destroMongo() {
   log.info("Dispose test server");
   mongo.close();
   server.dispose();
   mongo = null;
   server = null;
   ds = null;
   morphia = null;
 }
Пример #2
0
 @BeforeClass
 public static void initMongo() throws Exception {
   log.info("Init test server");
   final int port = Math.max(1025, RandomUtils.JVM_RANDOM.nextInt() % 15000);
   server = new JMongoServer(port);
   server.listen();
   mongo = new Mongo("127.0.0.1:" + port);
   morphia = new Morphia();
   morphia.map(Person.class);
   morphia.map(BlogEntry.class);
 }