mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
19.10.2007 496f8cd959b71bc4c049f6c17e765a890552031e
opendj-sdk/opends/src/server/org/opends/server/admin/ManagedObjectPath.java
@@ -1000,6 +1000,27 @@
  /**
   * Get the name of the managed object referred to by this path if
   * applicable.
   * <p>
   * If there path does not refer to an instantiable managed object
   * <code>null</code> is returned.
   *
   * @return Returns the name of the managed object referred to by
   *         this path, or <code>null</code> if the managed object
   *         does not have a name.
   */
  public String getName() {
    if (elements.isEmpty()) {
      return null;
    } else {
      return elements.get(elements.size() - 1).getName();
    }
  }
  /**
   * Get the relation definition of the managed object referred to by
   * this path.
   * <p>
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ManagedObjectPathTest.java
@@ -29,12 +29,10 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.*;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.opends.server.admin.std.client.ConnectionHandlerCfgClient;
import org.opends.server.admin.std.client.GlobalCfgClient;
import org.opends.server.admin.std.client.LDAPConnectionHandlerCfgClient;
@@ -129,6 +127,17 @@
  /**
   * Tests that the empty path has no name.
   */
  @Test
  public void testEmptyPathHasNoName() {
    ManagedObjectPath<?, ?> path = ManagedObjectPath.emptyPath();
    assertNull(path.getName());
  }
  /**
   * Tests that the empty path has a string representation of "/".
   */
  @Test
@@ -163,6 +172,7 @@
    assertFalse(child.isEmpty());
    assertEquals(child.size(), 1);
    assertEquals(child.parent(), path);
    assertNull(child.getName());
    assertEquals(child.getManagedObjectDefinition(), GlobalCfgDefn
        .getInstance());
    assertEquals(child.getRelationDefinition(), RootCfgDefn.getInstance()
@@ -188,6 +198,7 @@
    assertFalse(child.isEmpty());
    assertEquals(child.size(), 1);
    assertEquals(child.parent(), path);
    assertEquals(child.getName(), "LDAP connection handler");
    assertEquals(child.getManagedObjectDefinition(), ConnectionHandlerCfgDefn
        .getInstance());
    assertEquals(child.getRelationDefinition(), RootCfgDefn.getInstance()