@@ -0,0 +1,3147 @@
+/*%0A *  Licensed to the Apache Software Foundation (ASF) under one%0A *  or more contributor license agreements.  See the NOTICE file%0A *  distributed with this work for additional information%0A *  regarding copyright ownership.  The ASF licenses this file%0A *  to you under the Apache License, Version 2.0 (the%0A *  %22License%22); you may not use this file except in compliance%0A *  with the License.  You may obtain a copy of the License at%0A *  %0A *    http://www.apache.org/licenses/LICENSE-2.0%0A *  %0A *  Unless required by applicable law or agreed to in writing,%0A *  software distributed under the License is distributed on an%0A *  %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A *  KIND, either express or implied.  See the License for the%0A *  specific language governing permissions and limitations%0A *  under the License. %0A *  %0A */%0Apackage org.apache.directory.shared.client.api.operations;%0A%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport org.apache.directory.server.core.CoreSession;%0Aimport org.apache.directory.server.core.integ.Level;%0Aimport org.apache.directory.server.core.integ.annotations.CleanupLevel;%0Aimport org.apache.directory.server.integ.SiRunner;%0Aimport org.apache.directory.server.ldap.LdapService;%0Aimport org.apache.directory.shared.ldap.client.api.LdapConnection;%0Aimport org.apache.directory.shared.ldap.client.api.messages.AddResponse;%0Aimport org.apache.directory.shared.ldap.constants.SchemaConstants;%0Aimport org.apache.directory.shared.ldap.entry.Entry;%0Aimport org.apache.directory.shared.ldap.entry.client.DefaultClientEntry;%0Aimport org.apache.directory.shared.ldap.message.ResultCodeEnum;%0Aimport org.apache.directory.shared.ldap.name.LdapDN;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0A%0A/**%0A * Tests the add operation%0A *%0A * @author %3Ca href=%22mailto:dev@directory.apache.org%22%3EApache Directory Project%3C/a%3E%0A * @version $Rev$, $Date$%0A */%0A@RunWith(SiRunner.class)%0A@CleanupLevel(Level.CLASS)%0Apublic class ClientAddRequestTest%0A%7B%0A    /** The server instance */%0A    public static LdapService ldapService;%0A%0A    @Test%0A    public void testModify() throws Exception%0A    %7B%0A        LdapConnection connection = new LdapConnection( %22localhost%22, ldapService.getPort() );%0A%0A        LdapDN bindDn = new LdapDN( %22uid=admin,ou=system%22 );%0A        connection.bind( bindDn.getUpName(), %22secret%22 );%0A%0A        LdapDN dn = new LdapDN( %22cn=testadd,ou=system%22 );%0A        Entry entry = new DefaultClientEntry( dn ); %0A        entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC );%0A        entry.add( SchemaConstants.CN_AT, %22testadd_cn%22 );%0A        entry.add( SchemaConstants.SN_AT, %22testadd_sn%22 );%0A        %0A        CoreSession session = ldapService.getDirectoryService().getSession();%0A        %0A        assertFalse( session.exists( dn ) );%0A        %0A        AddResponse response = connection.add( entry );%0A        assertNotNull( response );%0A        assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );%0A        %0A        assertTrue( session.exists( dn ) );%0A    %7D%0A%0A%7D%0A

test case for add operation