Esempio n. 1
0
 @Test
 public void testRemoveMark() {
   for (final Identity ident : identities) {
     marking.setMark(ores, ident, subPath1, "");
   }
   marking.removeMark(ores, ident1, subPath1);
   final boolean markedAfterRemove = marking.isMarked(ores, ident1, subPath1);
   assertEquals(markedAfterRemove, false);
   final boolean marked = marking.isMarked(ores, ident2, subPath1);
   assertTrue(marked);
 }
Esempio n. 2
0
 @Test
 public void testSetMark() {
   for (final Identity ident : identities) {
     final Mark mark = marking.setMark(ores, ident, subPath1, "");
     assertEquals(ident, mark.getCreator());
     assertEquals(subPath1, mark.getResSubPath());
     assertEquals(
         ores.getResourceableTypeName(), mark.getOLATResourceable().getResourceableTypeName());
     assertEquals(ores.getResourceableId(), mark.getOLATResourceable().getResourceableId());
     final boolean marked = marking.isMarked(ores, ident, subPath1);
     assertTrue(marked);
   }
 }
Esempio n. 3
0
  @Test
  public void testIdentityStats() {
    for (final String subPath : subPaths) {
      if (subPath.equals(subPath3)) {
        continue;
      }
      marking.setMark(ores, ident1, subPath, "");
    }

    final List<String> subPathList = Arrays.asList(subPaths);
    final List<MarkResourceStat> stats = marking.getStats(ores, subPathList, ident1);
    assertEquals(3, stats.size());

    for (final MarkResourceStat stat : stats) {
      assertEquals(1, stat.getCount());
    }
  }
Esempio n. 4
0
  @Test
  public void testRemoveResource() {
    for (final Identity ident : identities) {
      for (final String subPath : subPaths) {
        marking.setMark(ores, ident, subPath, "");
      }
    }

    marking.deleteMark(ores);

    boolean marked = false;
    for (final Identity ident : identities) {
      for (final String subPath : subPaths) {
        marked |= marking.isMarked(ores, ident, subPath);
      }
    }
    assertFalse(marked);
  }