From 79cb3d38939c48e71eb1d83592f61765d3983cf0 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Thu, 12 Jul 2007 22:46:42 +0000
Subject: [PATCH] Fix issues 1558 and 1919.

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestParentCfgClient.java |  305 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 240 insertions(+), 65 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestParentCfgClient.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestParentCfgClient.java
index b83125e..6bcf604 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestParentCfgClient.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestParentCfgClient.java
@@ -29,39 +29,155 @@
 
 
 import java.util.Collection;
-
-import org.opends.server.admin.ConfigurationClient;
-import org.opends.server.admin.ManagedObjectDefinition;
+import java.util.SortedSet;
 import org.opends.server.admin.client.AuthorizationException;
 import org.opends.server.admin.client.CommunicationException;
 import org.opends.server.admin.client.ConcurrentModificationException;
 import org.opends.server.admin.client.ManagedObjectDecodingException;
 import org.opends.server.admin.client.OperationRejectedException;
+import org.opends.server.admin.ConfigurationClient;
+import org.opends.server.admin.DefaultBehaviorException;
+import org.opends.server.admin.DefinitionDecodingException;
+import org.opends.server.admin.IllegalPropertyValueException;
+import org.opends.server.admin.ManagedObjectDefinition;
+import org.opends.server.admin.ManagedObjectNotFoundException;
+import org.opends.server.admin.PropertyIsReadOnlyException;
+import org.opends.server.types.AttributeType;
+import org.opends.server.types.DN;
 
 
 
 /**
- * A sample client-side configuration interface for testing.
+ * A client-side interface for reading and modifying Test Parent
+ * settings.
+ * <p>
+ * A configuration for testing components that have child components.
+ * It re-uses the virtual-attribute configuration LDAP profile.
  */
 public interface TestParentCfgClient extends ConfigurationClient {
 
   /**
-   * {@inheritDoc}
+   * Get the configuration definition associated with this Test Parent.
+   *
+   * @return Returns the configuration definition associated with this Test Parent.
    */
   ManagedObjectDefinition<? extends TestParentCfgClient, ? extends TestParentCfg> definition();
 
 
 
   /**
-   * Lists the test children.
+   * Get the "mandatory-boolean-property" property.
+   * <p>
+   * A mandatory boolean property.
    *
-   * @return Returns an array containing the names of the test
-   *         children.
+   * @return Returns the value of the "mandatory-boolean-property" property.
+   */
+  Boolean isMandatoryBooleanProperty();
+
+
+
+  /**
+   * Set the "mandatory-boolean-property" property.
+   * <p>
+   * A mandatory boolean property.
+   *
+   * @param value The value of the "mandatory-boolean-property" property.
+   * @throws IllegalPropertyValueException
+   *           If the new value is invalid.
+   */
+  void setMandatoryBooleanProperty(boolean value) throws IllegalPropertyValueException;
+
+
+
+  /**
+   * Get the "mandatory-class-property" property.
+   * <p>
+   * A mandatory Java-class property requiring a component restart.
+   *
+   * @return Returns the value of the "mandatory-class-property" property.
+   */
+  String getMandatoryClassProperty();
+
+
+
+  /**
+   * Set the "mandatory-class-property" property.
+   * <p>
+   * A mandatory Java-class property requiring a component restart.
+   *
+   * @param value The value of the "mandatory-class-property" property.
+   * @throws IllegalPropertyValueException
+   *           If the new value is invalid.
+   */
+  void setMandatoryClassProperty(String value) throws IllegalPropertyValueException;
+
+
+
+  /**
+   * Get the "mandatory-read-only-attribute-type-property" property.
+   * <p>
+   * A mandatory read-only attribute type property.
+   *
+   * @return Returns the value of the "mandatory-read-only-attribute-type-property" property.
+   */
+  AttributeType getMandatoryReadOnlyAttributeTypeProperty();
+
+
+
+  /**
+   * Set the "mandatory-read-only-attribute-type-property" property.
+   * <p>
+   * A mandatory read-only attribute type property.
+   * <p>
+   * This property is read-only and can only be modified during
+   * creation of a Test Parent.
+   *
+   * @param value The value of the "mandatory-read-only-attribute-type-property" property.
+   * @throws IllegalPropertyValueException
+   *           If the new value is invalid.
+   * @throws PropertyIsReadOnlyException
+   *           If this Test Parent is not being initialized.
+   */
+  void setMandatoryReadOnlyAttributeTypeProperty(AttributeType value) throws IllegalPropertyValueException, PropertyIsReadOnlyException;
+
+
+
+  /**
+   * Get the "optional-multi-valued-dn-property" property.
+   * <p>
+   * An optional multi-valued DN property with a defined default
+   * behavior.
+   *
+   * @return Returns the values of the "optional-multi-valued-dn-property" property.
+   */
+  SortedSet<DN> getOptionalMultiValuedDNProperty();
+
+
+
+  /**
+   * Set the "optional-multi-valued-dn-property" property.
+   * <p>
+   * An optional multi-valued DN property with a defined default
+   * behavior.
+   *
+   * @param values The values of the "optional-multi-valued-dn-property" property.
+   * @throws IllegalPropertyValueException
+   *           If one or more of the new values are invalid.
+   */
+  void setOptionalMultiValuedDNProperty(Collection<DN> values) throws IllegalPropertyValueException;
+
+
+
+  /**
+   * Lists the Test Children.
+   *
+   * @return Returns an array containing the names of the Test
+   *         Children.
    * @throws ConcurrentModificationException
-   *           If this test parent has been removed from the server by
+   *           If this Test Parent has been removed from the server by
    *           another client.
    * @throws AuthorizationException
-   *           If the server refuses to list the test children because
+   *           If the server refuses to list the Test Children because
    *           the client does not have the correct privileges.
    * @throws CommunicationException
    *           If the client cannot contact the server due to an
@@ -73,25 +189,26 @@
 
 
   /**
-   * Gets the named test child.
+   * Gets the named Test Child.
    *
    * @param name
-   *          The name of the test child to retrieve.
-   * @return Returns the named test child.
+   *           The name of the Test Child to retrieve.
+   * @return Returns the named Test Child.
    * @throws DefinitionDecodingException
-   *           If the named test child was found but its type could
-   *           not be determined.
+   *           If the named Test Child was found but its type
+   *           could not be determined.
    * @throws ManagedObjectDecodingException
-   *           If the named test child was found but one or more of
-   *           its properties could not be decoded.
+   *           If the named Test Child was found but one or
+   *           more of its properties could not be decoded.
    * @throws ManagedObjectNotFoundException
-   *           If the named test child was not found on the server.
+   *           If the named Test Child was not found on the
+   *           server.
    * @throws ConcurrentModificationException
-   *           If this test parent has been removed from the server by
+   *           If this Test Parent has been removed from the server by
    *           another client.
    * @throws AuthorizationException
-   *           If the server refuses to retrieve the named test child
-   *           because the client does not have the correct
+   *           If the server refuses to retrieve the named Multiple
+   *           Children because the client does not have the correct
    *           privileges.
    * @throws CommunicationException
    *           If the client cannot contact the server due to an
@@ -105,93 +222,151 @@
 
 
   /**
-   * Creates a new test child.
+   * Creates a new Test Child. The new Test Child will
+   * initially not contain any property values (including mandatory
+   * properties). Once the Test Child has been configured it can
+   * be added to the server using the {@link #commit()} method.
    *
    * @param <C>
-   *          The type of the test child being added.
+   *          The type of the Test Child being created.
    * @param d
-   *          The definition of the test child to be created.
+   *          The definition of the Test Child to be created.
    * @param name
-   *          The name of the new test child.
+   *          The name of the new Test Child.
    * @param exceptions
    *          An optional collection in which to place any {@link
    *          DefaultBehaviorException}s that occurred whilst
-   *          attempting to determine the default values of the test
-   *          child. This argument can be <code>null<code>.
-   * @return Returns a new test child instance representing the test
-   *         child that was created.
+   *          attempting to determine the default values of the
+   *          Test Child. This argument can be <code>null<code>.
+   * @return Returns a new Test Child configuration instance.
    */
   <C extends TestChildCfgClient> C createTestChild(
-      ManagedObjectDefinition<C, ?> d, String name,
-      Collection<DefaultBehaviorException> exceptions);
+      ManagedObjectDefinition<C, ?> d, String name, Collection<DefaultBehaviorException> exceptions);
 
 
 
   /**
-   * Removes the named test child.
+   * Removes the named Test Child.
    *
    * @param name
-   *          The name of the test child to remove.
+   *          The name of the Test Child to remove.
    * @throws ManagedObjectNotFoundException
-   *           If the test child does not exist.
+   *           If the Test Child does not exist.
    * @throws OperationRejectedException
-   *           If the server refuses to remove the test child due to
-   *           some server-side constraint which cannot be satisfied
-   *           (for example, if it is referenced by another managed
-   *           object).
+   *           If the server refuses to remove the Test Child
+   *           due to some server-side constraint which cannot be
+   *           satisfied (for example, if it is referenced by another
+   *           managed object).
    * @throws ConcurrentModificationException
-   *           If this test parent has been removed from the server by
+   *           If this Test Parent has been removed from the server by
    *           another client.
    * @throws AuthorizationException
-   *           If the server refuses to remove the test child because
+   *           If the server refuses to remove the Test Child
+   *           because the client does not have the correct privileges.
+   * @throws CommunicationException
+   *           If the client cannot contact the server due to an
+   *           underlying communication problem.
+   */
+  void removeTestChild(String name)
+      throws ManagedObjectNotFoundException, OperationRejectedException,
+      ConcurrentModificationException, AuthorizationException,
+      CommunicationException;
+
+
+
+  /**
+   * Determines whether or not the Optional Test Child exists.
+   *
+   * @return Returns <true> if the Optional Test Child exists.
+   * @throws ConcurrentModificationException
+   *           If this Test Parent has been removed from the server by
+   *           another client.
+   * @throws AuthorizationException
+   *           If the server refuses to make the determination because
    *           the client does not have the correct privileges.
    * @throws CommunicationException
    *           If the client cannot contact the server due to an
    *           underlying communication problem.
    */
-  void removeTestChild(String name) throws ManagedObjectNotFoundException,
-      OperationRejectedException, ConcurrentModificationException,
+  boolean hasOptionalTestChild() throws ConcurrentModificationException,
       AuthorizationException, CommunicationException;
 
 
 
   /**
-   * Get the "maximum-length" property.
+   * Gets the Optional Test Child if it is present.
    *
-   * @return Returns the value of the "maximum-length" property.
+   * @return Returns the Optional Test Child if it is present.
+   * @throws DefinitionDecodingException
+   *           If the Optional Test Child was found but its type could not
+   *           be determined.
+   * @throws ManagedObjectDecodingException
+   *           If the Optional Test Child was found but one or more of its
+   *           properties could not be decoded.
+   * @throws ManagedObjectNotFoundException
+   *           If the Optional Test Child is not present.
+   * @throws ConcurrentModificationException
+   *           If this Test Parent has been removed from the server by
+   *           another client.
+   * @throws AuthorizationException
+   *           If the server refuses to retrieve the Optional Test Child
+   *           because the client does not have the correct privileges.
+   * @throws CommunicationException
+   *           If the client cannot contact the server due to an
+   *           underlying communication problem.
    */
-  int getMaximumLength();
+  TestChildCfgClient getOptionalChild()
+      throws DefinitionDecodingException, ManagedObjectDecodingException,
+      ManagedObjectNotFoundException, ConcurrentModificationException,
+      AuthorizationException, CommunicationException;
 
 
 
   /**
-   * Set the "maximum-length" property.
+   * Creates a new Optional Test Child. The new Optional Test Child will
+   * initially not contain any property values (including mandatory
+   * properties). Once the Optional Test Child has been configured it can be
+   * added to the server using the {@link #commit()} method.
    *
-   * @param value
-   *          The value of the "maximum-length" property.
-   * @throws IllegalPropertyValueException
-   *           If the new value is invalid.
+   * @param <C>
+   *          The type of the Optional Test Child being created.
+   * @param d
+   *          The definition of the Optional Test Child to be created.
+   * @param exceptions
+   *          An optional collection in which to place any {@link
+   *          DefaultBehaviorException}s that occurred whilst
+   *          attempting to determine the default values of the
+   *          Optional Test Child. This argument can be <code>null<code>.
+   * @return Returns a new Optional Test Child configuration instance.
    */
-  void setMaximumLength(Integer value) throws IllegalPropertyValueException;
+  <C extends TestChildCfgClient> C createOptionalTestChild(
+      ManagedObjectDefinition<C, ?> d, Collection<DefaultBehaviorException> exceptions);
 
 
 
   /**
-   * Get the "minimum-length" property.
+   * Removes the Optional Test Child if it exists.
    *
-   * @return Returns the value of the "minimum-length" property.
+   * @throws ManagedObjectNotFoundException
+   *           If the Optional Test Child does not exist.
+   * @throws OperationRejectedException
+   *           If the server refuses to remove the Optional Test Child due
+   *           to some server-side constraint which cannot be satisfied
+   *           (for example, if it is referenced by another managed
+   *           object).
+   * @throws ConcurrentModificationException
+   *           If this Test Parent has been removed from the server by
+   *           another client.
+   * @throws AuthorizationException
+   *           If the server refuses to remove the Optional Test Child
+   *           because the client does not have the correct privileges.
+   * @throws CommunicationException
+   *           If the client cannot contact the server due to an
+   *           underlying communication problem.
    */
-  int getMinimumLength();
+  void removeOptionalTestChild()
+      throws ManagedObjectNotFoundException, OperationRejectedException,
+      ConcurrentModificationException, AuthorizationException,
+      CommunicationException;
 
-
-
-  /**
-   * Set the "minimum-length" property.
-   *
-   * @param value
-   *          The value of the "minimum-length" property.
-   * @throws IllegalPropertyValueException
-   *           If the new value is invalid.
-   */
-  void setMinimumLength(Integer value) throws IllegalPropertyValueException;
 }

--
Gitblit v1.10.0