コード例 #1
0
 /** @throws java.lang.Exception */
 @Before
 public void setUp() throws Exception {
   setupPreliminaries();
   pagelet = new PageletImpl(location, module, id);
   pagelet.setContent(contentName, germanContent, german);
   pagelet.setContent(contentName, frenchContent, french);
   pagelet.setContent(lonelyContentName, lonelyContent, german);
   for (String s : multivalueGermanContent) pagelet.setContent(multivalueContentName, s, german);
   for (String s : multivalueFrenchContent) pagelet.setContent(multivalueContentName, s, french);
   pagelet.setProperty(propertyName, propertyValue);
   for (String s : multivaluePropertyValue) pagelet.addProperty(multivaluePropertyName, s);
   pagelet.setOwner(john);
   pagelet.setCreated(hans, creationDate);
   pagelet.setModified(hans, germanModificationDate, german);
   pagelet.setModified(amelie, frenchModificationDate, french);
   pagelet.setPublished(hans, publishingStartDate, publishingEndDate);
 }
コード例 #2
0
  /**
   * Test method for {@link
   * ch.entwine.weblounge.common.impl.content.page.PageletImpl#addSecurityListener(ch.entwine.weblounge.common.security.SecurityListener)}
   * .
   */
  @Test
  @Ignore
  public void testAddSecurityListener() {
    final List<String> result = new ArrayList<String>();
    pagelet.addSecurityListener(
        new SecurityListener() {
          public void ownerChanged(Securable source, User newOwner, User oldOwner) {
            result.add("Owner changed");
          }

          public void permissionChanged(Securable source, Permission p) {
            result.add("Permission changed");
          }
        });
    pagelet.setOwner(john);
    pagelet.allow(SystemPermission.READ, SystemRole.EDITOR);
    assertEquals(2, result.size());
  }