directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1424921 - /directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchWithReferralsTest.java
Date Fri, 21 Dec 2012 13:56:22 GMT
Author: elecharny
Date: Fri Dec 21 13:56:22 2012
New Revision: 1424921

URL: http://svn.apache.org/viewvc?rev=1424921&view=rev
Log:
Removed some sysout

Modified:
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchWithReferralsTest.java

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchWithReferralsTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchWithReferralsTest.java?rev=1424921&r1=1424920&r2=1424921&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchWithReferralsTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchWithReferralsTest.java
Fri Dec 21 13:56:22 2012
@@ -113,81 +113,78 @@ import org.junit.runner.RunWith;
 })
 public class SearchWithReferralsTest extends AbstractLdapTestUnit
 {
-private LdapNetworkConnection connection;
-
-
-@Before
-public void setupReferrals() throws Exception
-{
-    String ldif =
-        "dn: c=europ,ou=Countries,ou=system\n" +
-            "objectClass: top\n" +
-            "objectClass: referral\n" +
-            "objectClass: extensibleObject\n" +
-            "c: europ\n" +
-            "ref: ldap://localhost:52489/c=france,ou=system\n\n" +
-
-            "dn: c=america,ou=Countries,ou=system\n" +
-            "objectClass: top\n" +
-            "objectClass: referral\n" +
-            "objectClass: extensibleObject\n" +
-            "c: america\n" +
-            "ref: ldap://localhost:52489/c=usa,ou=system\n\n";
-
-    LdifReader reader = new LdifReader( new StringReader( ldif ) );
-
-    while ( reader.hasNext() )
+    private LdapNetworkConnection connection;
+    
+    
+    @Before
+    public void setupReferrals() throws Exception
     {
-        LdifEntry entry = reader.next();
-        getLdapServer().getDirectoryService().getAdminSession().add(
-            new DefaultEntry( getLdapServer().getDirectoryService().getSchemaManager(), entry.getEntry()
) );
+        String ldif =
+            "dn: c=europ,ou=Countries,ou=system\n" +
+                "objectClass: top\n" +
+                "objectClass: referral\n" +
+                "objectClass: extensibleObject\n" +
+                "c: europ\n" +
+                "ref: ldap://localhost:52489/c=france,ou=system\n\n" +
+    
+                "dn: c=america,ou=Countries,ou=system\n" +
+                "objectClass: top\n" +
+                "objectClass: referral\n" +
+                "objectClass: extensibleObject\n" +
+                "c: america\n" +
+                "ref: ldap://localhost:52489/c=usa,ou=system\n\n";
+    
+        LdifReader reader = new LdifReader( new StringReader( ldif ) );
+    
+        while ( reader.hasNext() )
+        {
+            LdifEntry entry = reader.next();
+            getLdapServer().getDirectoryService().getAdminSession().add(
+                new DefaultEntry( getLdapServer().getDirectoryService().getSchemaManager(),
entry.getEntry() ) );
+        }
+    
+        reader.close();
+    
+        connection = ( LdapNetworkConnection ) LdapApiIntegrationUtils.getPooledAdminConnection(
getLdapServer() );
     }
-
-    reader.close();
-
-    connection = ( LdapNetworkConnection ) LdapApiIntegrationUtils.getPooledAdminConnection(
getLdapServer() );
-}
-
-
-@After
-public void shutdown() throws Exception
-{
-    LdapApiIntegrationUtils.releasePooledAdminConnection( connection, getLdapServer() );
-}
-
-
-/**
- * Test of an search operation with a referral
- *
- * search for "cn=alex karasulu" on "c=america, ou=system"
- * we should get a referral URL thrown, which point to
- * "c=usa, ou=system", and ask for a subtree search
- */
-@Test
-public void testSearchWithReferralThrow() throws Exception
-{
-    try
+    
+    
+    @After
+    public void shutdown() throws Exception
+    {
+        LdapApiIntegrationUtils.releasePooledAdminConnection( connection, getLdapServer()
);
+    }
+    
+    
+    /**
+     * Test of an search operation with a referral
+     *
+     * search for "cn=alex karasulu" on "c=america, ou=system"
+     * we should get a referral URL thrown, which point to
+     * "c=usa, ou=system", and ask for a subtree search
+     */
+    @Test
+    public void testSearchWithReferralThrow() throws Exception
     {
         EntryCursor cursor = connection.search( "ou=Countries,ou=system", "(objectClass=*)",
             SearchScope.SUBTREE, "*", "+" );
         int count = 0;
         Entry entry = null;
         List<String> refs = new ArrayList<String>();
-
+    
         while ( cursor.next() )
         {
             try
             {
                 entry = cursor.get();
-
+    
                 assertNotNull( entry );
                 count++;
-                System.out.println( entry );
             }
             catch ( CursorLdapReferralException clre )
             {
                 count++;
-
+    
                 do
                 {
                     String ref = clre.getReferralInfo();
@@ -196,17 +193,11 @@ public void testSearchWithReferralThrow(
                 while ( clre.skipReferral() );
             }
         }
-
+    
         assertEquals( 3, count );
         assertEquals( 2, refs.size() );
         assertTrue( refs.contains( "ldap://localhost:52489/c=usa,ou=system??sub" ) );
         assertTrue( refs.contains( "ldap://localhost:52489/c=france,ou=system??sub" ) );
         cursor.close();
     }
-    catch ( LdapException le )
-    {
-        String referral = le.getMessage();
-        assertEquals( "ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system??sub",
referral );
-    }
-}
 }



Mime
View raw message