directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r733175 - in /directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis: common/ service/ store/derby/
Date Fri, 09 Jan 2009 22:21:05 GMT
Author: elecharny
Date: Fri Jan  9 14:21:05 2009
New Revision: 733175

URL: http://svn.apache.org/viewvc?rev=733175&view=rev
Log:
Switching to junit 4.4 syntax for all tests

Modified:
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/common/CSNFactoryTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java

Modified: directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/common/CSNFactoryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/common/CSNFactoryTest.java?rev=733175&r1=733174&r2=733175&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/common/CSNFactoryTest.java
(original)
+++ directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/common/CSNFactoryTest.java
Fri Jan  9 14:21:05 2009
@@ -21,7 +21,9 @@
 package org.apache.directory.mitosis.common;
 
 
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
 
 
 /**
@@ -29,7 +31,7 @@
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class CSNFactoryTest extends TestCase
+public class CSNFactoryTest
 {
     private static final int NUM_GENERATES = 10;
 
@@ -38,6 +40,7 @@
      * Ensure all CSN's generated by a CSNFactory are unique.
      *
      */
+    @Test
     public void testUnique()
     {
         String replicaID = "test";

Modified: directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java?rev=733175&r1=733174&r2=733175&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java
(original)
+++ directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java
Fri Jan  9 14:21:05 2009
@@ -62,13 +62,15 @@
     protected Map<String, ReplicationInterceptor> replicationServices = new HashMap<String,
ReplicationInterceptor>();
 
 
-    @Before public void setUp() throws Exception
+    @Before 
+    public void setUp() throws Exception
     {
         createReplicas( new String[] { "A", "B", "C" } );
     }
 
 
-    @After public void tearDown() throws Exception
+    @After 
+    public void tearDown() throws Exception
     {
         destroyAllReplicas();
     }

Modified: directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java?rev=733175&r1=733174&r2=733175&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java
(original)
+++ directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java
Fri Jan  9 14:21:05 2009
@@ -43,14 +43,16 @@
  */
 public class DIRSERVER1013ITest extends AbstractReplicationServiceTestCase
 {
-    @Before public void setUp() throws Exception
+    @Before 
+    public void setUp() throws Exception
     {
         // Create two replicas as we currently can't have the
         // replication service enabled without more than one.
         createReplicas( new String[] { "A", "B" } );
     }
     
-    @Test public void testNoRDNOID () throws Exception
+    @Test 
+    public void testNoRDNOID () throws Exception
     {
         LdapContext ctxA = getReplicaContext( "A" );
         

Modified: directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java?rev=733175&r1=733174&r2=733175&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java
(original)
+++ directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java
Fri Jan  9 14:21:05 2009
@@ -52,7 +52,8 @@
 {
     private Map<String, OidNormalizer> oids;
     
-    @Before public void setUp() throws Exception
+    @Before 
+    public void setUp() throws Exception
     {
         createReplicas( new String[] { "A", "B", "C" } );
 
@@ -69,7 +70,8 @@
     }
 
     @Ignore
-    @Test public void testOneWay() throws Exception
+    @Test 
+    public void testOneWay() throws Exception
     {
         String dn1 = "cn=test,ou=system";
         String dn2 = "cn=test2,ou=system";
@@ -80,6 +82,7 @@
         testOneWayUnbind( dn1 );
     }
     
+    
     /**
      * Test that the entry created last will win in the case of a conflict.
      * 

Modified: directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java?rev=733175&r1=733174&r2=733175&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java
(original)
+++ directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java
Fri Jan  9 14:21:05 2009
@@ -34,8 +34,11 @@
 import javax.naming.Name;
 import javax.naming.ldap.LdapName;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.core.DefaultDirectoryService;
@@ -59,9 +62,12 @@
 import org.apache.directory.mitosis.operation.ReplaceAttributeOperation;
 import org.apache.directory.mitosis.store.ReplicationLogIterator;
 import org.apache.directory.mitosis.store.ReplicationStoreException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 
-public class DerbyReplicationStoreTest extends TestCase
+public class DerbyReplicationStoreTest
 {
     private static final String REPLICA_ID =  "TEST_REPLICA";
     private static final String OTHER_REPLICA_ID = "OTHER_REPLICA";
@@ -75,6 +81,7 @@
     private DefaultDirectoryService service;
 
 
+    @Before
     public void setUp() throws Exception
     {
         dropDatabase();
@@ -98,6 +105,7 @@
     }
 
 
+    @After
     public void tearDown() throws Exception
     {
         store.close();
@@ -116,6 +124,7 @@
     }
 
 
+    @Test
     public void testOperations() throws Exception
     {
         subTestReopen();
@@ -139,7 +148,7 @@
         try
         {
             startupDatabase( OTHER_REPLICA_ID );
-            Assert.fail( "Store cannot start up with wrong replica ID." );
+            fail( "Store cannot start up with wrong replica ID." );
         }
         catch ( ReplicationStoreException e )
         {
@@ -152,11 +161,11 @@
     {
         UUID uuid = UUID.randomUUID();
         Name name = new LdapName( "ou=a, ou=b" );
-        Assert.assertTrue( store.putUUID( uuid, name ) );
-        Assert.assertEquals( name, store.getDN( uuid ) );
-        Assert.assertTrue( store.removeUUID( uuid ) );
-        Assert.assertFalse( store.removeUUID( uuid ) );
-        Assert.assertNull( store.getDN( uuid ) );
+        assertTrue( store.putUUID( uuid, name ) );
+        assertEquals( name, store.getDN( uuid ) );
+        assertTrue( store.removeUUID( uuid ) );
+        assertFalse( store.removeUUID( uuid ) );
+        assertNull( store.getDN( uuid ) );
     }
 
 
@@ -165,19 +174,19 @@
         ReplicationLogIterator it;
 
         it = store.getLogs( csnFactory.newInstance( REPLICA_ID ), true );
-        Assert.assertFalse( it.next() );
+        assertFalse( it.next() );
         it.close();
         it = store.getLogs( csnFactory.newInstance( REPLICA_ID ), false );
-        Assert.assertFalse( it.next() );
+        assertFalse( it.next() );
         it.close();
         it = store.getLogs( csnFactory.newInstance( OTHER_REPLICA_ID ), true );
-        Assert.assertFalse( it.next() );
+        assertFalse( it.next() );
         it.close();
         it = store.getLogs( csnFactory.newInstance( OTHER_REPLICA_ID ), false );
-        Assert.assertFalse( it.next() );
+        assertFalse( it.next() );
         it.close();
 
-        Assert.assertEquals( 0, store.getLogSize() );
+        assertEquals( 0, store.getLogSize() );
     }
 
 
@@ -226,9 +235,9 @@
         store.putLog( op2 );
         testGetLogs( csn, op2 );
 
-        Assert.assertEquals( 2, store.getLogSize() );
-        Assert.assertEquals( 1, store.getLogSize( REPLICA_ID ) );
-        Assert.assertEquals( 1, store.getLogSize( OTHER_REPLICA_ID ) );
+        assertEquals( 2, store.getLogSize() );
+        assertEquals( 1, store.getLogSize( REPLICA_ID ) );
+        assertEquals( 1, store.getLogSize( OTHER_REPLICA_ID ) );
 
         // Test getLogs(CSNVector, true)
         List<Operation> expected = new ArrayList<Operation>();
@@ -284,20 +293,20 @@
         csn = it.getOperation( service.getRegistries() ).getCSN();
         it.close();
 
-        Assert.assertEquals( 0, store.removeLogs( csn, false ) );
-        Assert.assertEquals( 1, store.removeLogs( csn, true ) );
-        Assert.assertEquals( 0, store.getLogSize( REPLICA_ID ) );
+        assertEquals( 0, store.removeLogs( csn, false ) );
+        assertEquals( 1, store.removeLogs( csn, true ) );
+        assertEquals( 0, store.getLogSize( REPLICA_ID ) );
 
         it = store.getLogs( csnFactory.newInstance( 0, OTHER_REPLICA_ID, 0 ), false );
-        Assert.assertTrue( it.next() );
+        assertTrue( it.next() );
         csn = it.getOperation( service.getRegistries() ).getCSN();
         it.close();
 
-        Assert.assertEquals( 0, store.removeLogs( csn, false ) );
-        Assert.assertEquals( 1, store.removeLogs( csn, true ) );
-        Assert.assertEquals( 0, store.getLogSize( OTHER_REPLICA_ID ) );
+        assertEquals( 0, store.removeLogs( csn, false ) );
+        assertEquals( 1, store.removeLogs( csn, true ) );
+        assertEquals( 0, store.getLogSize( OTHER_REPLICA_ID ) );
 
-        Assert.assertEquals( 0, store.getLogSize() );
+        assertEquals( 0, store.getLogSize() );
     }
 
 
@@ -319,19 +328,19 @@
         expectedKnownReplicaIds.add( OTHER_REPLICA_ID );
         expectedKnownReplicaIds.add( OTHER_REPLICA_ID_2 );
 
-        Assert.assertEquals( expectedKnownReplicaIds, store.getKnownReplicaIds() );
+        assertEquals( expectedKnownReplicaIds, store.getKnownReplicaIds() );
 
         CSNVector expectedUpdateVector = new CSNVector();
         expectedUpdateVector.setCSN( csnB );
         expectedUpdateVector.setCSN( csnD );
 
-        Assert.assertEquals( expectedUpdateVector, store.getUpdateVector() );
+        assertEquals( expectedUpdateVector, store.getUpdateVector() );
 
         CSNVector expectedPurgeVector = new CSNVector();
         expectedPurgeVector.setCSN( csnA );
         expectedPurgeVector.setCSN( csnC );
 
-        Assert.assertEquals( expectedPurgeVector, store.getPurgeVector() );
+        assertEquals( expectedPurgeVector, store.getPurgeVector() );
     }
 
 
@@ -350,7 +359,7 @@
         testGetLogs( it, rit );
 
         rit = store.getLogs( csn, false );
-        Assert.assertFalse( rit.next() );
+        assertFalse( rit.next() );
         rit.close();
     }
 
@@ -368,13 +377,13 @@
         while ( expectedIt.hasNext() )
         {
             Operation expected = expectedIt.next();
-            Assert.assertTrue( actualIt.next() );
+            assertTrue( actualIt.next() );
 
             Operation actual = actualIt.getOperation( service.getRegistries() );
-            Assert.assertEquals( expected.getCSN(), actual.getCSN() );
-            assertEquals( expected, actual );
+            assertEquals( expected.getCSN(), actual.getCSN() );
+            assertEquals( expected.toString(), actual.toString() );
         }
-        Assert.assertFalse( actualIt.next() );
+        assertFalse( actualIt.next() );
         actualIt.close();
     }
 
@@ -391,10 +400,4 @@
         System.out.println( "Subtest #" + ( ++testCount ) + " [" + testName + "]: " + ( endTime
- startTime ) + " ms" );
         startTime = System.currentTimeMillis();
     }
-
-
-    private static void assertEquals( Operation expected, Operation actual )
-    {
-        Assert.assertEquals( expected.toString(), actual.toString() );
-    }
 }
\ No newline at end of file



Mime
View raw message