public void setName( String name, boolean renameHomeDirectories ) throws Exception {
    if ( getDirectory().getName().equalsIgnoreCase( name ) ) {
      return;
    }

    if ( rep instanceof RepositoryExtended ) {
      ( (RepositoryExtended) rep ).renameRepositoryDirectory( getDirectory().getObjectId(), null, name,
          renameHomeDirectories );
    } else {
      rep.renameRepositoryDirectory( getDirectory().getObjectId(), null, name );
    }

    // Update the object reference so the new name is displayed
    obj = rep.getObjectInformation( getObjectId(), getRepositoryElementType() );
    refresh();
  }
@Test
  public void testSetName() throws Exception {
    final String newDirName = "foo";
    when( mockRepositoryDirectory.getName() ).thenReturn( "dirName" );

    uiRepDir.setName( newDirName, true );
    verify( mockRepository ).renameRepositoryDirectory( mockRepositoryDirectory.getObjectId(), null, newDirName );

    uiPurRepDir.setName( newDirName, true );
    verify( mockPurRepository ).renameRepositoryDirectory( mockRepositoryDirectory.getObjectId(), null, newDirName,
        true );
  }