You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2013/08/02 13:21:42 UTC

svn commit: r1509632 - in /directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry: AttributeTest.java DefaultAttributeTest.java EntryTest.java

Author: elecharny
Date: Fri Aug  2 11:21:42 2013
New Revision: 1509632

URL: http://svn.apache.org/r1509632
Log:
o Renamed the DefaultAttributeTest
o Added an Entry test

Added:
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeTest.java
      - copied, changed from r1507200, directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/DefaultAttributeTest.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryTest.java
Removed:
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/DefaultAttributeTest.java

Copied: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeTest.java (from r1507200, directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/DefaultAttributeTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeTest.java?p2=directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeTest.java&p1=directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/DefaultAttributeTest.java&r1=1507200&r2=1509632&rev=1509632&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/DefaultAttributeTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeTest.java Fri Aug  2 11:21:42 2013
@@ -55,7 +55,7 @@ import com.mycila.junit.concurrent.Concu
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class DefaultAttributeTest
+public class AttributeTest
 {
     private static final Value<String> NULL_STRING_VALUE = new StringValue( ( String ) null );
     private static final Value<byte[]> NULL_BINARY_VALUE = new BinaryValue( ( byte[] ) null );

Added: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryTest.java?rev=1509632&view=auto
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryTest.java (added)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryTest.java Fri Aug  2 11:21:42 2013
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.api.ldap.model.entry;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.junit.Test;
+
+
+/**
+ * Test the Entry class
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EntryTest
+{
+    @Test
+    public void testEntryCreation() throws LdapException
+    {
+        Entry entry = new DefaultEntry();
+
+        entry.setDn( "dc=example, dc=com" );
+        entry.add( "objectClass", "top", "domain" );
+        entry.add( "dc", "example" );
+
+        assertNotNull( entry.getDn() );
+        assertEquals( new Dn( "dc=example, dc=com" ), entry.getDn() );
+        assertNotNull( entry.getAttributes() );
+        assertEquals( 2, entry.size() );
+        assertTrue( entry.contains( "objectClass", "top", "domain" ) );
+        assertTrue( entry.contains( "dc", "example" ) );
+        assertFalse( entry.isSchemaAware() );
+
+        Entry entry2 = new DefaultEntry( "dc=example, dc=com" );
+        entry2.add( "objectClass", "top", "domain" );
+        entry2.add( "dc", "example" );
+
+        assertEquals( entry, entry2 );
+    }
+}