1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.mitosis.service; 21 22 import javax.naming.directory.Attributes; 23 import javax.naming.directory.BasicAttributes; 24 import javax.naming.ldap.LdapContext; 25 26 import org.apache.directory.shared.ldap.constants.SchemaConstants; 27 import org.junit.Before; 28 import org.junit.Test; 29 30 import static org.junit.Assert.assertNull; 31 32 33 /** 34 * A test case for DIRSERVER-1013: "Extra RDN attribute created". 35 * 36 * When mitosis is enabled and an entry is added the OID of the RDN 37 * attribute is added as an extra attribute. As an example, if an 38 * entry ou=test,ou=system is added then it will have attributes 39 * ou=test and 2.5.4.11=test. 40 * 41 * @author The Apache Directory Project Team (dev@directory.apache.org) 42 * @version $Rev$, $Date$ 43 */ 44 public class DIRSERVER1013ITest extends AbstractReplicationServiceTestCase 45 { 46 @Before public void setUp() throws Exception 47 { 48 // Create two replicas as we currently can't have the 49 // replication service enabled without more than one. 50 createReplicas( new String[] { "A", "B" } ); 51 } 52 53 @Test public void testNoRDNOID () throws Exception 54 { 55 LdapContext ctxA = getReplicaContext( "A" ); 56 57 Attributes entry = new BasicAttributes( true ); 58 entry.put( "cn", "test" ); 59 60 // We add the 'room' OC to have at least a STRUCTURAL OC 61 entry.put( "objectClass", "top" ); 62 entry.get( "objectClass" ).add( "room" ); 63 ctxA.createSubcontext( "cn=test,ou=system", entry ); 64 65 Attributes attributes = ctxA.getAttributes( "cn=test,ou=system" ); 66 assertNull( attributes.get( SchemaConstants.CN_AT_OID ) ); 67 } 68 }