directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r947083 - in /directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core: changelog/ changelog/TagTest.java entry/ClonedServerEntryTest.java
Date Fri, 21 May 2010 17:32:05 GMT
Author: felixk
Date: Fri May 21 17:32:04 2010
New Revision: 947083

URL: http://svn.apache.org/viewvc?rev=947083&view=rev
Log:
Add simple tests, ignore test for hashCode

Added:
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/changelog/
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/changelog/TagTest.java
  (with props)
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ClonedServerEntryTest.java
  (with props)

Added: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/changelog/TagTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/changelog/TagTest.java?rev=947083&view=auto
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/changelog/TagTest.java
(added)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/changelog/TagTest.java
Fri May 21 17:32:04 2010
@@ -0,0 +1,131 @@
+/*
+ *  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.server.core.changelog;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+/**
+ * Unit tests class Tag.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class TagTest
+{
+    Tag tagA;
+    Tag tagACopy;
+    Tag tagANull;
+    Tag tagB;
+    Tag tagC;
+    Tag tagD;
+
+
+    /**
+     * Initialize name instances
+     */
+    @Before
+    public void initNames() throws Exception
+    {
+
+        tagA = new Tag( 1L, "aa", 1L, 1L );
+        tagACopy = new Tag( 1L, "aa", 1L, 1L );
+        tagB = new Tag( 1L, "aa", 2L, 2L );
+        tagC = new Tag( 2L, "aa", 1L, 1L );
+        tagD = new Tag( 1L, "bb", 1L, 1L );
+        tagANull = new Tag( 1L, null, 1L, 1L );
+    }
+
+
+    @Test
+    public void testEqualsNull() throws Exception
+    {
+        assertFalse( tagA.equals( null ) );
+        assertFalse( tagANull.equals( null ) );
+    }
+
+
+    @Test
+    public void testEqualsReflexive() throws Exception
+    {
+        assertEquals( tagA, tagA );
+        assertEquals( tagANull, tagANull );
+    }
+
+
+    @Test
+    public void testHashCodeReflexive() throws Exception
+    {
+        assertEquals( tagA.hashCode(), tagA.hashCode() );
+        assertEquals( tagANull.hashCode(), tagANull.hashCode() );
+    }
+
+
+    @Test
+    public void testEqualsSymmetric() throws Exception
+    {
+        assertEquals( tagA, tagACopy );
+        assertEquals( tagACopy, tagA );
+    }
+
+
+    @Test
+    @Ignore
+    public void testHashCodeSymmetric() throws Exception
+    {
+        assertEquals( tagA.hashCode(), tagACopy.hashCode() );
+        assertEquals( tagACopy.hashCode(), tagA.hashCode() );
+    }
+
+
+    @Test
+    public void testEqualsTransitive() throws Exception
+    {
+        assertEquals( tagA, tagACopy );
+        assertEquals( tagACopy, tagB );
+        assertEquals( tagA, tagB );
+    }
+
+
+    @Test
+    @Ignore
+    public void testHashCodeTransitive() throws Exception
+    {
+        assertEquals( tagA.hashCode(), tagACopy.hashCode() );
+        assertEquals( tagACopy.hashCode(), tagB.hashCode() );
+        assertEquals( tagA.hashCode(), tagB.hashCode() );
+    }
+
+
+    @Test
+    public void testNotEqualDiffValue() throws Exception
+    {
+        assertFalse( tagA.equals( tagC ) );
+        assertFalse( tagC.equals( tagA ) );
+        assertFalse( tagA.equals( tagANull ) );
+        assertFalse( tagANull.equals( tagA ) );
+    }
+}

Propchange: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/changelog/TagTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/changelog/TagTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ClonedServerEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ClonedServerEntryTest.java?rev=947083&view=auto
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ClonedServerEntryTest.java
(added)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ClonedServerEntryTest.java
Fri May 21 17:32:04 2010
@@ -0,0 +1,148 @@
+/*
+ *  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.server.core.entry;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import org.apache.directory.shared.ldap.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.name.DN;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+/**
+ * Unit tests class ClonedServerEntry.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ClonedServerEntryTest
+{
+    ClonedServerEntry clonedServerEntryA;
+    ClonedServerEntry clonedServerEntryACopy;
+    ClonedServerEntry clonedServerEntryB;
+    ClonedServerEntry clonedServerEntryC;
+    ClonedServerEntry clonedServerEntryA1;
+    ClonedServerEntry clonedServerEntryACopy1;
+    ClonedServerEntry clonedServerEntryB1;
+    ClonedServerEntry clonedServerEntryC1;
+
+    /**
+     * Initialize name instances
+     */
+    @Before
+    public void initNames() throws Exception
+    {
+        Entry eA = new DefaultEntry(new DN( "dc=example,dc=com" ));
+        Entry eB = new DefaultEntry(new DN( "dc=example,dc=com" ));
+        Entry eC = new DefaultEntry(new DN( "dc=test,dc=org" ));
+
+        clonedServerEntryA = new ClonedServerEntry();
+        clonedServerEntryACopy = new ClonedServerEntry();
+        clonedServerEntryB = new ClonedServerEntry();
+        clonedServerEntryC = new ClonedServerEntry();
+        clonedServerEntryA1 = new ClonedServerEntry( eA );
+        clonedServerEntryACopy1 = new ClonedServerEntry( eA );
+        clonedServerEntryB1 = new ClonedServerEntry( eB );
+        clonedServerEntryC1 = new ClonedServerEntry( eC );
+    }
+
+
+    @Test
+    public void testEqualsNull() throws Exception
+    {
+        assertFalse( clonedServerEntryA.equals( null ) );
+        assertFalse( clonedServerEntryA1.equals( null ) );
+    }
+
+
+    @Test
+    public void testEqualsReflexive() throws Exception
+    {
+        assertEquals( clonedServerEntryA, clonedServerEntryA );
+        assertEquals( clonedServerEntryA1, clonedServerEntryA1 );
+    }
+
+
+    @Test
+    public void testHashCodeReflexive() throws Exception
+    {
+        assertEquals( clonedServerEntryA.hashCode(), clonedServerEntryA.hashCode() );
+        assertEquals( clonedServerEntryA1.hashCode(), clonedServerEntryA1.hashCode() );
+    }
+
+
+    @Test
+    public void testEqualsSymmetric() throws Exception
+    {
+        assertEquals( clonedServerEntryA, clonedServerEntryACopy );
+        assertEquals( clonedServerEntryACopy, clonedServerEntryA );
+        assertEquals( clonedServerEntryA1, clonedServerEntryACopy1 );
+        assertEquals( clonedServerEntryACopy1, clonedServerEntryA1 );
+    }
+
+
+    @Test
+    @Ignore
+    public void testHashCodeSymmetric() throws Exception
+    {
+        assertEquals( clonedServerEntryA.hashCode(), clonedServerEntryACopy.hashCode() );
+        assertEquals( clonedServerEntryACopy.hashCode(), clonedServerEntryA.hashCode() );
+        assertEquals( clonedServerEntryA1.hashCode(), clonedServerEntryACopy1.hashCode()
);
+        assertEquals( clonedServerEntryACopy1.hashCode(), clonedServerEntryA1.hashCode()
);
+    }
+
+
+    @Test
+    public void testEqualsTransitive() throws Exception
+    {
+        assertEquals( clonedServerEntryA, clonedServerEntryACopy );
+        assertEquals( clonedServerEntryACopy, clonedServerEntryB );
+        assertEquals( clonedServerEntryA, clonedServerEntryB );
+        assertEquals( clonedServerEntryA1, clonedServerEntryACopy1 );
+        assertEquals( clonedServerEntryACopy1, clonedServerEntryB1 );
+        assertEquals( clonedServerEntryA1, clonedServerEntryB1 );
+    }
+
+
+    @Test
+    @Ignore
+    public void testHashCodeTransitive() throws Exception
+    {
+        assertEquals( clonedServerEntryA.hashCode(), clonedServerEntryACopy.hashCode() );
+        assertEquals( clonedServerEntryACopy.hashCode(), clonedServerEntryB.hashCode() );
+        assertEquals( clonedServerEntryA.hashCode(), clonedServerEntryB.hashCode() );
+        assertEquals( clonedServerEntryA1.hashCode(), clonedServerEntryACopy1.hashCode()
);
+        assertEquals( clonedServerEntryACopy1.hashCode(), clonedServerEntryB1.hashCode()
);
+        assertEquals( clonedServerEntryA1.hashCode(), clonedServerEntryB1.hashCode() );
+    }
+
+
+    @Test
+    public void testNotEqualDiffValue() throws Exception
+    {
+        assertFalse( clonedServerEntryA1.equals( clonedServerEntryC1 ) );
+        assertFalse( clonedServerEntryC1.equals( clonedServerEntryA1 ) );
+    }
+}

Propchange: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ClonedServerEntryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ClonedServerEntryTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message