directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1762164 - /directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ValueEditorTest.java
Date Sun, 25 Sep 2016 08:29:16 GMT
Author: seelmann
Date: Sun Sep 25 08:29:16 2016
New Revision: 1762164

URL: http://svn.apache.org/viewvc?rev=1762164&view=rev
Log:
Additional tests with ISO-8859-1 encoding

Modified:
    directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ValueEditorTest.java

Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ValueEditorTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ValueEditorTest.java?rev=1762164&r1=1762163&r2=1762164&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ValueEditorTest.java
(original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ValueEditorTest.java
Sun Sep 25 08:29:16 2016
@@ -22,6 +22,7 @@ package org.apache.directory.studio.test
 
 
 import static java.nio.charset.StandardCharsets.UTF_8;
+import static java.nio.charset.StandardCharsets.ISO_8859_1;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
@@ -67,6 +68,7 @@ public class ValueEditorTest
     private static final String UNICODE = "a-z\nA+Z\r0.9\t\u00e4\u00f6\u00fc\u00df \u2000\u3000\u5047";
 
     private static final byte[] EMPTY_BYTES = new byte[0];
+    private static final byte[] ISO88591 = "\u00e4\u00f6\u00fc\u00df".getBytes( ISO_8859_1
);
     private static final byte[] UTF8 = UNICODE.getBytes( UTF_8 );
     private static final byte[] PNG = new byte[]
         { ( byte ) 0x89, 0x50, 0x4E, 0x47 };
@@ -82,7 +84,9 @@ public class ValueEditorTest
     {
         return new Object[][]
             {
-                // InPlaceTextValueEditor 
+                /*
+                 * InPlaceTextValueEditor can handle string values and binary values that
can be decoded as UTF-8.
+                 */
 
                 { "InPlaceTextValueEditor - empty value",
                     Data.data().valueEditorClass( InPlaceTextValueEditor.class ).attribute(
CN )
@@ -110,12 +114,21 @@ public class ValueEditorTest
                         .expectedRawValue( UNICODE ).expectedDisplayValue( UNICODE ).expectedHasValue(
true )
                         .expectedStringOrBinaryValue( UNICODE ) },
 
+                // text editor always tries to decode byte[] as UTF-8, so it can not handle
ISO-8859-1 encoded byte[] 
+                { "InPlaceTextValueEditor - bytearray ISO-8859-1",
+                    Data.data().valueEditorClass( InPlaceTextValueEditor.class ).attribute(
USER_PWD )
+                        .rawValue( ISO88591 ).expectedRawValue( null ).expectedDisplayValue(
IValueEditor.NULL )
+                        .expectedHasValue( true ).expectedStringOrBinaryValue( null ) },
+
+                // text editor always tries to decode byte[] as UTF-8, so it can not handle
arbitrary byte[] 
                 { "InPlaceTextValueEditor - bytearray PNG",
                     Data.data().valueEditorClass( InPlaceTextValueEditor.class ).attribute(
USER_PWD ).rawValue( PNG )
                         .expectedRawValue( null ).expectedDisplayValue( IValueEditor.NULL
).expectedHasValue( true )
                         .expectedStringOrBinaryValue( null ) },
 
-                // InPlaceBooleanValueEditor 
+                /*
+                 * InPlaceBooleanValueEditor can only handle TRUE or FALSE values.
+                 */
 
                 { "InPlaceBooleanValueEditor - TRUE",
                     Data.data().valueEditorClass( InPlaceBooleanValueEditor.class ).attribute(
CN ).rawValue( TRUE )
@@ -148,7 +161,9 @@ public class ValueEditorTest
                         .expectedDisplayValue( IValueEditor.NULL ).expectedHasValue( true
)
                         .expectedStringOrBinaryValue( null ) },
 
-                // InPlaceOidValueEditor 
+                /*
+                 * InPlaceOidValueEditor can only handle numeric OIDs
+                 */
 
                 { "InPlaceOidValueEditor - 1.3.6.1.4.1.1466.20037",
                     Data.data().valueEditorClass( InPlaceOidValueEditor.class ).attribute(
CN ).rawValue( OID )
@@ -172,7 +187,9 @@ public class ValueEditorTest
                         .expectedDisplayValue( IValueEditor.NULL ).expectedHasValue( true
)
                         .expectedStringOrBinaryValue( null ) },
 
-                // TextValueEditor
+                /*
+                 * TextValueEditor can handle string values and binary values that can be
decoded as UTF-8.
+                 */
 
                 { "TextValueEditor - empty string value",
                     Data.data().valueEditorClass( TextValueEditor.class ).attribute( CN )
@@ -211,12 +228,21 @@ public class ValueEditorTest
                         .expectedRawValue( UNICODE ).expectedDisplayValue( UNICODE ).expectedHasValue(
true )
                         .expectedStringOrBinaryValue( UNICODE ) },
 
+                // text editor always tries to decode byte[] as UTF-8, so it can not handle
ISO-8859-1 encoded byte[] 
+                { "TextValueEditor - bytearray ISO-8859-1",
+                    Data.data().valueEditorClass( TextValueEditor.class ).attribute( USER_PWD
).rawValue( ISO88591 )
+                        .expectedRawValue( null ).expectedDisplayValue( IValueEditor.NULL
).expectedHasValue( true )
+                        .expectedStringOrBinaryValue( null ) },
+
+                // text editor always tries to decode byte[] as UTF-8, so it can not handle
arbitrary byte[]
                 { "TextValueEditor - bytearray PNG",
                     Data.data().valueEditorClass( InPlaceTextValueEditor.class ).attribute(
USER_PWD ).rawValue( PNG )
                         .expectedRawValue( null ).expectedDisplayValue( IValueEditor.NULL
).expectedHasValue( true )
                         .expectedStringOrBinaryValue( null ) },
 
-                // HexValueEditor
+                /*
+                 * HexValueEditor can handle all string or binary values.
+                 */
 
                 { "HexValueEditor - empty string value",
                     Data.data().valueEditorClass( HexValueEditor.class ).attribute( CN )
@@ -251,6 +277,11 @@ public class ValueEditorTest
                         .expectedRawValue( UTF8 ).expectedDisplayValue( "Binary Data (30
Bytes)" )
                         .expectedHasValue( true ).expectedStringOrBinaryValue( UTF8 ) },
 
+                { "HexValueEditor - bytearray ISO-8859-1",
+                    Data.data().valueEditorClass( HexValueEditor.class ).attribute( USER_PWD
).rawValue( ISO88591 )
+                        .expectedRawValue( ISO88591 ).expectedDisplayValue( "Binary Data
(4 Bytes)" )
+                        .expectedHasValue( true ).expectedStringOrBinaryValue( ISO88591 )
},
+
                 { "HexValueEditor - bytearray PNG",
                     Data.data().valueEditorClass( HexValueEditor.class ).attribute( USER_PWD
).rawValue( PNG )
                         .expectedRawValue( PNG ).expectedDisplayValue( "Binary Data (4 Bytes)"
)



Mime
View raw message