assertTrue(all.implies(collection1));
}
@Test
public void testCollectionAll() throws Exception {
Permission collectionAll = create(new KeyValue("collection", ALL));
Permission collection1 = create(new KeyValue("collection", "coll1"));
assertTrue(collectionAll.implies(collection1));
assertTrue(collection1.implies(collectionAll));
Permission allUpdate =
create(new KeyValue("collection", ALL), new KeyValue("action", "update"));
Permission allQuery =
create(new KeyValue("collection", ALL), new KeyValue("action", "query"));
Permission coll1Update =
create(new KeyValue("collection", "coll1"), new KeyValue("action", "update"));
Permission coll1Query =
create(new KeyValue("collection", "coll1"), new KeyValue("action", "query"));
assertTrue(allUpdate.implies(coll1Update));
assertTrue(allQuery.implies(coll1Query));
assertTrue(coll1Update.implies(allUpdate));
assertTrue(coll1Query.implies(allQuery));
assertFalse(allUpdate.implies(coll1Query));
assertFalse(coll1Update.implies(coll1Query));
assertFalse(allQuery.implies(coll1Update));
assertFalse(coll1Query.implies(allUpdate));
assertFalse(allUpdate.implies(allQuery));
assertFalse(allQuery.implies(allUpdate));
assertFalse(coll1Update.implies(coll1Query));
assertFalse(coll1Query.implies(coll1Update));
// test different length paths
assertTrue(collectionAll.implies(allUpdate));
assertTrue(collectionAll.implies(allQuery));
assertTrue(collectionAll.implies(coll1Update));
assertTrue(collectionAll.implies(coll1Query));
assertFalse(allUpdate.implies(collectionAll));
assertFalse(allQuery.implies(collectionAll));
assertFalse(coll1Update.implies(collectionAll));
assertFalse(coll1Query.implies(collectionAll));
}