Examples of TestParentCfg


Examples of org.nasutekds.server.admin.TestParentCfg

    ConfigurationChangeListener<TestChildCfg> cl = new DummyChangeListener();
    try {
      // Retrieve the parent and child managed objects and register
      // delete and change listeners respectively in order to trigger
      // the constraint call-backs.
      TestParentCfg parent = getParent("test parent 1");
      parent.addTestChildDeleteListener(dl);

      TestChildCfg child = parent.getTestChild("test child 7");
      child.addChangeListener(cl);

      // Now attempt to disable the referenced connection handler.
      // This should fail.
      try {
        RootCfgClient root = TestCaseUtils.getRootConfiguration();
        ConnectionHandlerCfgClient client = root
            .getConnectionHandler(TEST_CONNECTION_HANDLER_NAME);
        client.setEnabled(false);
        client.commit();
        Assert.fail("Successfully disabled a referenced component");
      } catch (OperationRejectedException e) {
        // This is the expected exception - do nothing.
      }
    } finally {
      try {
        deleteSubtree(TEST_CHILD_7_DN);
      } finally {
        try {
          deleteConnectionHandler();
        } finally {
          // Remove the temporary delete listener.
          TestParentCfg parent = getParent("test parent 1");
          parent.removeTestChildDeleteListener(dl);

          // Put back the default aggregation definition.
          TestCfg
              .removeConstraint(aggregationPropertyDefinitionTargetMustBeEnabled
                  .getSourceConstraint());
View Full Code Here

Examples of org.nasutekds.server.admin.TestParentCfg

  // Gets the named parent configuration.
  private TestParentCfg getParent(String name) throws IllegalArgumentException,
      ConfigException {
    ServerManagementContext ctx = ServerManagementContext.getInstance();
    ServerManagedObject<RootCfg> root = ctx.getRootConfigurationManagedObject();
    TestParentCfg parent = root.getChild(
        TestCfg.getTestOneToManyParentRelationDefinition(), name)
        .getConfiguration();
    return parent;
  }
View Full Code Here

Examples of org.nasutekds.server.admin.TestParentCfg

  public void testChildValues3() throws Exception {
    // Add the entry.
    TestCaseUtils.addEntry(TEST_CHILD_3);

    try {
      TestParentCfg parent = getParent("test parent 1");
      assertChild3(parent.getTestChild("test child 3"));
    } finally {
      deleteSubtree("cn=test child 3,cn=test children,cn=test parent 1,cn=test parents,cn=config");
    }
  }
View Full Code Here

Examples of org.nasutekds.server.admin.TestParentCfg

  public void testChildValues4() throws Exception {
    // Add the entry.
    TestCaseUtils.addEntry(TEST_CHILD_4);

    try {
      TestParentCfg parent = getParent("test parent 2");
      assertChild4(parent.getTestChild("test child 4"));
    } finally {
      deleteSubtree("cn=test child 4,cn=test children,cn=test parent 2,cn=test parents,cn=config");
    }
  }
View Full Code Here

Examples of org.nasutekds.server.admin.TestParentCfg

   * @throws Exception
   *           If the test unexpectedly fails.
   */
  @Test
  public void testParentValues1() throws Exception {
    TestParentCfg parent = getParent("test parent 1");

    Assert.assertEquals(parent.getMandatoryClassProperty(),
        "org.nasutekds.server.extensions.UserDefinedVirtualAttributeProvider");
    Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(),
        DirectoryServer.getAttributeType("description"));
    assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(),
        "dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com");
  }
View Full Code Here

Examples of org.nasutekds.server.admin.TestParentCfg

   * @throws Exception
   *           If the test unexpectedly fails.
   */
  @Test
  public void testParentValues2() throws Exception {
    TestParentCfg parent = getParent("test parent 2");

    Assert.assertEquals(parent.getMandatoryClassProperty(),
        "org.nasutekds.server.extensions.UserDefinedVirtualAttributeProvider");
    Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(),
        DirectoryServer.getAttributeType("description"));
    assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(),
        "dc=default value p2v1,dc=com", "dc=default value p2v2,dc=com");
  }
View Full Code Here

Examples of org.nasutekds.server.admin.TestParentCfg

  // Gets the named parent configuration.
  private TestParentCfg getParent(String name) throws IllegalArgumentException,
      ConfigException {
    ServerManagementContext ctx = ServerManagementContext.getInstance();
    ServerManagedObject<RootCfg> root = ctx.getRootConfigurationManagedObject();
    TestParentCfg parent = root.getChild(TestCfg.getTestOneToManyParentRelationDefinition(),
        name).getConfiguration();
    return parent;
  }
View Full Code Here

Examples of org.nasutekds.server.admin.TestParentCfg

    try {
      TestCaseUtils.addEntry(TEST_CHILD_1);
      TestCfg.addConstraint(constraint);

      TestParentCfg parent = getParent("test parent 1");
      parent.getTestChild("test child 1");
    } finally {
      TestCfg.removeConstraint(constraint);

      try {
        deleteSubtree(TEST_CHILD_1_DN);
View Full Code Here

Examples of org.nasutekds.server.admin.TestParentCfg

    try {
      TestCaseUtils.addEntry(TEST_CHILD_1);
      TestCfg.addConstraint(constraint);

      TestParentCfg parent = getParent("test parent 1");
      parent.getTestChild("test child 1");
    } catch (ConfigException e) {
      Throwable cause = e.getCause();
      if (cause instanceof ConstraintViolationException) {
        ConstraintViolationException cve = (ConstraintViolationException) cause;
        Assert.assertEquals(cve.getMessages().size(), 1);
View Full Code Here

Examples of org.nasutekds.server.admin.TestParentCfg

   * @throws Exception
   *           If the test unexpectedly fails.
   */
  @Test
  public void testAddConstraintSuccess() throws Exception {
    TestParentCfg parent = getParent("test parent 1");
    AddListener listener = new AddListener();
    parent.addTestChildAddListener(listener);

    MockConstraint constraint = new MockConstraint(true, false);
    TestCfg.addConstraint(constraint);

    try {
      try {
        // Add the entry.
        addEntry(ResultCode.SUCCESS, TEST_CHILD_1);
      } finally {
        try {
          deleteSubtree(TEST_CHILD_1_DN);
        } catch (Exception e) {
          // Do nothing.
        }
      }
    } finally {
      TestCfg.removeConstraint(constraint);
      parent.removeTestChildAddListener(listener);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.