harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r409355 - in /incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security: asn1/der/NameDecoderTest.java x501/ x501/NameTest.java
Date Thu, 25 May 2006 10:31:41 GMT
Author: smishura
Date: Thu May 25 03:31:40 2006
New Revision: 409355

URL: http://svn.apache.org/viewvc?rev=409355&view=rev
Log:
Renaming test NameDecoderTest

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/x501/
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/x501/NameTest.java
  (with props)
Removed:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/NameDecoderTest.java

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/x501/NameTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/x501/NameTest.java?rev=409355&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/x501/NameTest.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/x501/NameTest.java
Thu May 25 03:31:40 2006
@@ -0,0 +1,93 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+/**
+* @author Stepan M. Mishura
+* @version $Revision$
+*/
+
+package org.apache.harmony.security.x501;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.harmony.security.x501.Name;
+
+
+import junit.framework.TestCase;
+
+/**
+ * Test Name class
+ * 
+ * @see http://www.ietf.org/rfc/rfc1779.txt
+ * @see http://www.ietf.org/rfc/rfc2253.txt
+ */
+public class NameTest extends TestCase {
+
+    private static final byte [] mess = {
+            0x30, //0 seq of
+            (byte) 0x81,(byte) 0x9A, //1 len = 154
+            0x31, 0x0A, //3,4
+            0x30, 0x08, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x01, 0x5A,
+            0x31, 0x0A, //15,16
+            0x30, 0x08, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x01, 0x45,
+            0x31, 0x0A,
+            0x30, 0x08, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x01, 0x44,
+            0x31, 0x0A,
+            0x30, 0x08, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x01, 0x43,
+            0x31, 0x0A,
+            0x30, 0x08, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x01, 0x42,
+            0x31, 0x15,
+            0x30, 0x08, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x01, 0x41,
+            0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x02, 0x43, 0x41,
+            0x31, 0x0A,
+            0x30, 0x08, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x01, 0x45,
+            0x31, 0x0A,
+            0x30, 0x08, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x01, 0x44,
+            0x31, 0x0A,
+            0x30, 0x08, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x01, 0x43,
+            0x31, 0x0A,
+            0x30, 0x08, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x01, 0x42,
+            0x31, 0x15,
+            0x30, 0x08, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x01, 0x41,
+            0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x02, 0x43, 0x41
+    };
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(NameTest.class);
+    }
+
+    public void testGetName1779() throws Exception {
+
+        Name principal = new Name(mess);
+
+        String s = principal.getName("RFC1779");
+
+        assertEquals(
+                "CN=A + ST=CA, O=B, L=C, C=D, OU=E, CN=A + ST=CA, O=B, L=C, C=D, OU=E, CN=Z",
+                s);
+    }
+
+    public void testStreamGetName1779() throws Exception {
+        ByteArrayInputStream is = new ByteArrayInputStream(mess);
+
+        Name principal = new Name(is);
+
+        String s = principal.getName("RFC1779");
+
+        assertEquals(
+                "CN=A + ST=CA, O=B, L=C, C=D, OU=E, CN=A + ST=CA, O=B, L=C, C=D, OU=E, CN=Z",
+                s);
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/x501/NameTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message