directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r618688 - in /directory/studio/trunk/studio-dsml-parser/src/test/java/org/apache/directory/studio/dsmlv2: modifyRequest/ModifyRequestTest.java searchResponse/searchResultEntry/SearchResultEntryTest.java
Date Tue, 05 Feb 2008 16:17:51 GMT
Author: pamarcelot
Date: Tue Feb  5 08:17:49 2008
New Revision: 618688

URL: http://svn.apache.org/viewvc?rev=618688&view=rev
Log:
Fixed the tests that were failing when running from Maven (but working inside Eclipse).

Modified:
    directory/studio/trunk/studio-dsml-parser/src/test/java/org/apache/directory/studio/dsmlv2/modifyRequest/ModifyRequestTest.java
    directory/studio/trunk/studio-dsml-parser/src/test/java/org/apache/directory/studio/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java

Modified: directory/studio/trunk/studio-dsml-parser/src/test/java/org/apache/directory/studio/dsmlv2/modifyRequest/ModifyRequestTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-dsml-parser/src/test/java/org/apache/directory/studio/dsmlv2/modifyRequest/ModifyRequestTest.java?rev=618688&r1=618687&r2=618688&view=diff
==============================================================================
--- directory/studio/trunk/studio-dsml-parser/src/test/java/org/apache/directory/studio/dsmlv2/modifyRequest/ModifyRequestTest.java
(original)
+++ directory/studio/trunk/studio-dsml-parser/src/test/java/org/apache/directory/studio/dsmlv2/modifyRequest/ModifyRequestTest.java
Tue Feb  5 08:17:49 2008
@@ -21,6 +21,7 @@
 package org.apache.directory.studio.dsmlv2.modifyRequest;
 
 
+import java.io.UnsupportedEncodingException;
 import java.util.List;
 
 import javax.naming.NamingException;
@@ -277,8 +278,9 @@
     /**
      * Test parsing of a request with a Modification element with Base64 Value
      * @throws NamingException 
+     * @throws UnsupportedEncodingException 
      */
-    public void testRequestWith1ModificationBase64Value() throws NamingException
+    public void testRequestWith1ModificationBase64Value() throws NamingException, UnsupportedEncodingException
     {
         Dsmlv2Parser parser = null;
         try
@@ -309,7 +311,12 @@
 
         Attribute attribute = modification.getAttribute();
 
-        assertEquals( "cn=Emmanuel Lécharny, ou=people, dc=example, dc=com", new String(
( byte[] ) attribute.get( 0 ) ) );
+        String expected = new String( new byte[]
+            { 'c', 'n', '=', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', 'L', ( byte ) 0xc3,
( byte ) 0xa9, 'c', 'h',
+                'a', 'r', 'n', 'y', ',', ' ', 'o', 'u', '=', 'p', 'e', 'o', 'p', 'l', 'e',
',', ' ', 'd', 'c', '=',
+                'e', 'x', 'a', 'm', 'p', 'l', 'e', ',', ' ', 'd', 'c', '=', 'c', 'o', 'm'
}, "UTF-8" );
+
+        assertEquals( expected, new String( ( byte[] ) attribute.get( 0 ), "UTF-8" ) );
     }
 
 

Modified: directory/studio/trunk/studio-dsml-parser/src/test/java/org/apache/directory/studio/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-dsml-parser/src/test/java/org/apache/directory/studio/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java?rev=618688&r1=618687&r2=618688&view=diff
==============================================================================
--- directory/studio/trunk/studio-dsml-parser/src/test/java/org/apache/directory/studio/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java
(original)
+++ directory/studio/trunk/studio-dsml-parser/src/test/java/org/apache/directory/studio/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java
Tue Feb  5 08:17:49 2008
@@ -21,6 +21,8 @@
 package org.apache.directory.studio.dsmlv2.searchResponse.searchResultEntry;
 
 
+import java.io.UnsupportedEncodingException;
+
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -74,7 +76,8 @@
 
         assertEquals( "Some text", StringTools.utf8ToString( ( byte[] ) control.getControlValue()
) );
     }
-    
+
+
     /**
      * Test parsing of a response with a (optional) Control element with empty value
      */
@@ -85,7 +88,8 @@
         {
             parser = new Dsmlv2ResponseParser();
 
-            parser.setInputFile( SearchResultEntryTest.class.getResource( "response_with_1_control_empty_value.xml"
).getFile() );
+            parser.setInputFile( SearchResultEntryTest.class.getResource( "response_with_1_control_empty_value.xml"
)
+                .getFile() );
 
             parser.parse();
         }
@@ -97,7 +101,7 @@
         SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
)
             .getCurrentSearchResultEntry();
         Control control = searchResultEntry.getCurrentControl();
-        
+
         assertEquals( 1, searchResultEntry.getControls().size() );
         assertTrue( control.getCriticality() );
         assertEquals( "1.2.840.113556.1.4.643", control.getControlType() );
@@ -243,8 +247,8 @@
 
         assertEquals( 456, searchResultEntry.getMessageId() );
     }
-    
-    
+
+
     /**
      * Test parsing of a Response with the (optional) requestID attribute equals 0
      */
@@ -361,11 +365,13 @@
 
         assertEquals( "example", value );
     }
-    
+
+
     /**
      * Test parsing of a response with 1 Attr 1 Base64 Value
+     * @throws UnsupportedEncodingException 
      */
-    public void testResponseWith1Attr1Base64Value()
+    public void testResponseWith1Attr1Base64Value() throws UnsupportedEncodingException
     {
         Dsmlv2ResponseParser parser = null;
         try
@@ -408,10 +414,15 @@
         }
 
         Object value = ne2.nextElement();
-        assertEquals( "Emmanuel Lécharny", new String( (byte[]) value ) );
+
+        String expected = new String( new byte[]
+            { 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', 'L', ( byte ) 0xc3, ( byte ) 0xa9,
'c', 'h', 'a', 'r', 'n',
+                'y' }, "UTF-8" );
+
+        assertEquals( expected, new String( ( byte[] ) value, "UTF-8" ) );
     }
-    
-    
+
+
     /**
      * Test parsing of a response with 1 Attr 1 empty Value
      */



Mime
View raw message