Exemplo n.º 1
0
  @MaxQueryNumber(500)
  public void testViewerOwnerAllCases() throws Exception {
    publisher =
        (RelationshipPublisher)
            this.getContainer().getComponentInstanceOfType(RelationshipPublisher.class);
    assertNotNull(publisher);
    relationshipManager.addListenerPlugin(publisher);
    connectIdentities(demoIdentity, johnIdentity, true);

    //
    ExoSocialActivity activity1 = new ExoSocialActivityImpl();
    activity1.setTitle("title @demo hi");
    activityStorage.saveActivity(rootIdentity, activity1);

    //
    ExoSocialActivity activity2 = new ExoSocialActivityImpl();
    activity2.setTitle("john title");
    activityStorage.saveActivity(rootIdentity, activity2);

    // owner poster comment
    createComment(activity2, demoIdentity, 2);

    List<ExoSocialActivity> list = activityStorage.getActivities(demoIdentity, johnIdentity, 0, 10);
    // only show demo's activity when John is viewer
    assertEquals(1, list.size());

    tearDownActivityList.addAll(list);
    relationshipManager.unregisterListener(publisher);
  }
Exemplo n.º 2
0
  /**
   * Connects 2 identities, if toConfirm = true, they're connected. If false, in pending connection
   * type.
   *
   * @param senderIdentity the identity who sends connection request
   * @param receiverIdentity the identity who receives connection request
   * @param beConfirmed boolean value
   */
  private void connectIdentities(
      Identity senderIdentity, Identity receiverIdentity, boolean beConfirmed) {
    relationshipManager.inviteToConnect(senderIdentity, receiverIdentity);
    if (beConfirmed) {
      relationshipManager.confirm(receiverIdentity, senderIdentity);
    }

    tearDownRelationshipList.add(relationshipManager.get(senderIdentity, receiverIdentity));
  }
Exemplo n.º 3
0
  @MaxQueryNumber(500)
  public void testViewerOwnerActivitiesSpecialCase() throws Exception {
    publisher =
        (RelationshipPublisher)
            this.getContainer().getComponentInstanceOfType(RelationshipPublisher.class);
    assertNotNull(publisher);
    relationshipManager.addListenerPlugin(publisher);
    connectIdentities(demoIdentity, johnIdentity, true);

    List<ExoSocialActivity> list = activityStorage.getActivities(demoIdentity, johnIdentity, 0, 10);

    // only show demo's activity when John is viewer
    assertEquals(1, list.size());

    tearDownActivityList.addAll(list);
    relationshipManager.unregisterListener(publisher);
  }
Exemplo n.º 4
0
  @MaxQueryNumber(500)
  public void testConnectionsTab() throws Exception {
    publisher =
        (RelationshipPublisher)
            this.getContainer().getComponentInstanceOfType(RelationshipPublisher.class);
    assertNotNull(publisher);
    relationshipManager.addListenerPlugin(publisher);
    connectIdentities(demoIdentity, johnIdentity, true);

    List<ExoSocialActivity> list = activityStorage.getActivitiesOfConnections(demoIdentity, 0, 2);

    assertEquals(1, list.size());
    ExoSocialActivity firstActivity = list.get(0);

    //
    list = activityStorage.getActivitiesOfConnections(demoIdentity, 0, 2);
    assertEquals(1, list.size());

    assertEquals(firstActivity.getTitle(), list.get(0).getTitle());

    tearDownActivityList.add(firstActivity);
    relationshipManager.unregisterListener(publisher);
  }
Exemplo n.º 5
0
  @Override
  protected void tearDown() throws Exception {

    for (ExoSocialActivity activity : tearDownActivityList) {
      activityStorage.deleteActivity(activity.getId());
    }

    for (Relationship relationship : tearDownRelationshipList) {
      relationshipManager.delete(relationship);
    }

    identityStorage.deleteIdentity(rootIdentity);
    identityStorage.deleteIdentity(johnIdentity);
    identityStorage.deleteIdentity(maryIdentity);
    identityStorage.deleteIdentity(demoIdentity);

    super.tearDown();
  }