Ejemplo n.º 1
0
 @Test
 public void delete() throws ModelException {
   DBCollection spaces = Database.getCollection("spaces");
   assertEquals(0, spaces.count());
   Space space = new Space();
   space._id = new ObjectId();
   space.name = "Test space";
   space.owner = new ObjectId();
   space.visualization = new ObjectId();
   space.order = 1;
   space.records = new HashSet<ObjectId>();
   Space.add(space);
   assertEquals(1, spaces.count());
   Space.delete(space.owner, space._id);
   assertEquals(0, spaces.count());
 }
Ejemplo n.º 2
0
 @Test
 public void notExists() throws ModelException {
   DBCollection spaces = Database.getCollection("spaces");
   assertEquals(0, spaces.count());
   Space space = new Space();
   space._id = new ObjectId();
   space.name = "Test space";
   space.owner = new ObjectId();
   space.visualization = new ObjectId();
   space.order = 1;
   space.records = new HashSet<ObjectId>();
   Space.add(space);
   assertEquals(1, spaces.count());
   assertFalse(
       Space.exists(
           new ChainedMap<String, ObjectId>()
               .put("_id", new ObjectId())
               .put("owner", space.owner)
               .get()));
 }
Ejemplo n.º 3
0
 @After
 public void tearDown() {
   Database.close();
 }
Ejemplo n.º 4
0
 @Before
 public void setUp() {
   start(fakeApplication(fakeGlobal()));
   Database.connectToTest();
   Database.destroy();
 }