You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2011/02/28 14:44:54 UTC
svn commit: r1075323 -
/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
Author: pamarcelot
Date: Mon Feb 28 13:44:54 2011
New Revision: 1075323
URL: http://svn.apache.org/viewvc?rev=1075323&view=rev
Log:
Fixed the test case (ignored for now) for DIRSERVER-1610 (No error is reported when adding an entry with a non-existing attribute).
Added another one (active) to test the addition of an entry with a non existing object class (the test pass).
Modified:
directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java?rev=1075323&r1=1075322&r2=1075323&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java Mon Feb 28 13:44:54 2011
@@ -91,8 +91,8 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.entry.EntryAttribute;
import org.apache.directory.shared.ldap.model.entry.Modification;
import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.model.exception.LdapException;
import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
+import org.apache.directory.shared.ldap.model.message.AddResponse;
import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.util.Strings;
@@ -1400,19 +1400,40 @@ public class AddIT extends AbstractLdapT
personEntry.add( "nonExistingAttribute", "value" );
personEntry.setDn( dn );
- boolean exceptionThrown = false;
+ AddResponse response = connection.add( personEntry );
- try
- {
- connection.add( personEntry );
- }
- catch ( LdapException e )
- {
- // Should happen
- exceptionThrown = true;
- }
+ assertNotNull( response );
+ assertTrue( !ResultCodeEnum.SUCCESS.equals( response.getLdapResult().getResultCode() ) );
+
+ Entry entry = connection.lookup( dn );
+ assertNull( entry );
+
+ connection.close();
+ }
+
+
+ /**
+ * Adding an entry with a non existing attribute type.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testAddEntryNonExistingOC() throws Exception
+ {
+ LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+
+ Dn dn = new Dn( "cn=Kate Bush," + BASE );
+
+ Entry personEntry = new DefaultEntry();
+ personEntry.add( SchemaConstants.OBJECT_CLASS_AT, "nonexistingOC" );
+ personEntry.add( SchemaConstants.CN_AT, "Kate Bush" );
+ personEntry.add( SchemaConstants.SN_AT, "Bush" );
+ personEntry.setDn( dn );
+
+ AddResponse response = connection.add( personEntry );
- assertTrue( exceptionThrown );
+ assertNotNull( response );
+ assertTrue( !ResultCodeEnum.SUCCESS.equals( response.getLdapResult().getResultCode() ) );
Entry entry = connection.lookup( dn );
assertNull( entry );