Exemple #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);
 }
Exemple #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);
   }
 }
Exemple #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());
    }
  }
Exemple #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);
  }