Esempio n. 1
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    identityStorage =
        (IdentityStorage) getContainer().getComponentInstanceOfType(IdentityStorage.class);
    activityStorage =
        (ActivityStorage) getContainer().getComponentInstanceOfType(ActivityStorage.class);
    relationshipManager =
        (RelationshipManagerImpl)
            getContainer().getComponentInstanceOfType(RelationshipManager.class);

    assertNotNull(identityStorage);
    assertNotNull(activityStorage);
    assertNotNull(relationshipManager);

    rootIdentity = new Identity("organization", "root");
    johnIdentity = new Identity("organization", "john");
    maryIdentity = new Identity("organization", "mary");
    demoIdentity = new Identity("organization", "demo");

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

    assertNotNull(rootIdentity.getId());
    assertNotNull(johnIdentity.getId());
    assertNotNull(maryIdentity.getId());
    assertNotNull(demoIdentity.getId());

    tearDownActivityList = new ArrayList<ExoSocialActivity>();
    tearDownRelationshipList = new ArrayList<Relationship>();
  }
Esempio n. 2
0
 public Space updateSpaceAvatar(Space existingSpace) {
   Identity spaceIdentity =
       identityStorage.findIdentity(SpaceIdentityProvider.NAME, existingSpace.getPrettyName());
   Profile profile = spaceIdentity.getProfile();
   profile.setProperty(Profile.AVATAR, existingSpace.getAvatarAttachment());
   identityStorage.updateProfile(profile);
   return existingSpace;
 }
Esempio n. 3
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();
  }
Esempio n. 4
0
  private void assertClean(String userBaseName, String spacePrettyBaseName) throws Exception {

    if (userBaseName != null) {
      assertEquals(null, organizationService.getUserHandler().findUserByName(userBaseName + "0"));
      assertEquals(
          null,
          identityStorage.findIdentity(OrganizationIdentityProvider.NAME, userBaseName + "0"));
    }

    if (spacePrettyBaseName != null) {
      assertEquals(
          null,
          spaceService.getSpaceByPrettyName(SpaceUtils.cleanString(spacePrettyBaseName) + "0"));
      assertEquals(
          null,
          identityStorage.findIdentity(
              SpaceIdentityProvider.NAME, spacePrettyBaseName.toLowerCase() + "0"));
    }
  }
Esempio n. 5
0
  @Override
  public void tearDown() throws Exception {

    //
    for (String space : spaces) {
      spaceService.deleteSpace(spaceService.getSpaceByPrettyName(SpaceUtils.cleanString(space)));
      Identity i = identityStorage.findIdentity(SpaceIdentityProvider.NAME, space.toLowerCase());
      identityStorage.deleteIdentity(i);
    }

    //
    for (String user : users) {
      organizationService.getUserHandler().removeUser(user, false);
      Identity i = identityStorage.findIdentity(OrganizationIdentityProvider.NAME, user);
      identityStorage.deleteIdentity(i);
    }

    //
    end();
  }