directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject directory-kerby git commit: DIRKRB-550 Convert the dos format files to unix format.
Date Tue, 12 Apr 2016 06:48:58 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/kadmin-remote 6b83c7502 -> a608a4606


DIRKRB-550 Convert the dos format files to unix format.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/a608a460
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/a608a460
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/a608a460

Branch: refs/heads/kadmin-remote
Commit: a608a46063dfdf45d9df10ead2c634129e753f89
Parents: 6b83c75
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Tue Apr 12 14:53:59 2016 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Tue Apr 12 14:53:59 2016 +0800

----------------------------------------------------------------------
 .../org/apache/kerby/xdr/type/XdrUnion.java     | 262 +++++++-------
 .../kerby/xdr/type/XdrUnsignedInteger.java      | 200 +++++------
 .../apache/kerby/xdr/XdrEnumeratedInstance.java | 112 +++---
 .../org/apache/kerby/xdr/XdrEnumeratedTest.java | 116 +++----
 .../org/apache/kerby/xdr/XdrIntegerTest.java    | 160 ++++-----
 .../org/apache/kerby/xdr/XdrStringTest.java     | 118 +++----
 .../apache/kerby/xdr/XdrStructTypeInstance.java | 222 ++++++------
 .../org/apache/kerby/xdr/XdrStructTypeTest.java | 166 ++++-----
 .../org/apache/kerby/xdr/XdrUnionInstance.java  | 340 +++++++++----------
 .../java/org/apache/kerby/xdr/XdrUnionTest.java | 134 ++++----
 .../kerby/xdr/XdrUnsignedIntegerTest.java       | 138 ++++----
 11 files changed, 984 insertions(+), 984 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a608a460/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnion.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnion.java b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnion.java
index 2210669..b7dc59c 100644
--- a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnion.java
+++ b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnion.java
@@ -1,131 +1,131 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- */
-package org.apache.kerby.xdr.type;
-
-import org.apache.kerby.xdr.XdrDataType;
-import org.apache.kerby.xdr.XdrFieldInfo;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-/**
- * A discriminated union is a type composed of a discriminant followed
- * by a type selected from a set of prearranged types according to the
- * value of the discriminant.  The type of discriminant is either "int",
- * "unsigned int", or an enumerated type, such as "bool".  The component
- * types are called "arms" of the union and are preceded by the value of
- * the discriminant that implies their encoding.  Discriminated unions
- * are declared as follows:
- *
- *  union switch (discriminant-declaration) {
- *      case discriminant-value-A:
- *          arm-declaration-A;
- *      case discriminant-value-B:
- *          arm-declaration-B;
- *      ...
- *      default: default-declaration;
- *  } identifier;
- * Each "case" keyword is followed by a legal value of the discriminant.
- * The default arm is optional.  If it is not specified, then a valid
- * encoding of the union cannot take on unspecified discriminant values.
- * The size of the implied arm is always a multiple of four bytes.
- *
- * The discriminated union is encoded as its discriminant followed by
- * the encoding of the implied arm.
- *                  0   1   2   3
- *                  +---+---+---+---+---+---+---+---+
- *                  |  discriminant |  implied arm  |
- *                  +---+---+---+---+---+---+---+---+
- *                  |<---4 bytes--->|
- */
-public abstract class XdrUnion extends AbstractXdrType<XdrUnion> {
-    /**
-     * [0] is the discriminant
-     *      index, XdrDataType, value;
-     * [1] is the implied arm
-     */
-    private XdrFieldInfo[] fieldInfos;
-    private XdrType[] fields;
-
-    public XdrUnion(XdrDataType xdrDataType) {
-        super(xdrDataType);
-        this.fieldInfos = null;
-        this.fields = null;
-    }
-
-    public XdrUnion(XdrDataType xdrDataType,
-                         final XdrFieldInfo[] fieldInfos) {
-        super(xdrDataType);
-        this.fieldInfos = fieldInfos;
-        this.fields = new XdrType[fieldInfos.length];
-
-        getUnionInstance(this.fields, fieldInfos);
-    }
-
-    protected abstract void getUnionInstance(final XdrType[] fields, final XdrFieldInfo[] fieldInfos);
-
-    public XdrFieldInfo[] getXdrFieldInfos() {
-        return fieldInfos;
-    }
-
-    @Override
-    protected int encodingBodyLength() throws IOException {
-        int allLen = 0;
-        for (int i = 0; i < fields.length; i++) {
-            AbstractXdrType field = (AbstractXdrType) fields[i];
-            if (field != null) {
-                allLen += field.encodingLength();
-            }
-        }
-        return allLen;
-    }
-
-    @Override
-    protected void encodeBody(ByteBuffer buffer) throws IOException {
-        for (int i = 0; i < fields.length; ++i) {
-            XdrType field = fields[i];
-            if (field != null) {
-                field.encode(buffer);
-            }
-        }
-    }
-
-    @Override
-    public void decode(ByteBuffer content) throws IOException {
-        AbstractXdrType[] fields = getAllFields();
-        Object[] value;
-        for (int i = 0; i < fields.length; i++) {
-            if (fields[i] != null) {
-                fields[i].decode(content);
-                int length = fields[i].encodingLength();
-                byte[] array = content.array();
-                byte[] newArray = new byte[array.length - length];
-                System.arraycopy(array, length, newArray, 0, array.length - length);
-                content = ByteBuffer.wrap(newArray);
-            }
-        }
-        this.fields = fields;
-        setValue(fieldsToValues(fields));
-    }
-
-    protected abstract XdrUnion fieldsToValues(AbstractXdrType[] fields);
-
-    protected abstract AbstractXdrType[] getAllFields();
-}
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.kerby.xdr.type;
+
+import org.apache.kerby.xdr.XdrDataType;
+import org.apache.kerby.xdr.XdrFieldInfo;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * A discriminated union is a type composed of a discriminant followed
+ * by a type selected from a set of prearranged types according to the
+ * value of the discriminant.  The type of discriminant is either "int",
+ * "unsigned int", or an enumerated type, such as "bool".  The component
+ * types are called "arms" of the union and are preceded by the value of
+ * the discriminant that implies their encoding.  Discriminated unions
+ * are declared as follows:
+ *
+ *  union switch (discriminant-declaration) {
+ *      case discriminant-value-A:
+ *          arm-declaration-A;
+ *      case discriminant-value-B:
+ *          arm-declaration-B;
+ *      ...
+ *      default: default-declaration;
+ *  } identifier;
+ * Each "case" keyword is followed by a legal value of the discriminant.
+ * The default arm is optional.  If it is not specified, then a valid
+ * encoding of the union cannot take on unspecified discriminant values.
+ * The size of the implied arm is always a multiple of four bytes.
+ *
+ * The discriminated union is encoded as its discriminant followed by
+ * the encoding of the implied arm.
+ *                  0   1   2   3
+ *                  +---+---+---+---+---+---+---+---+
+ *                  |  discriminant |  implied arm  |
+ *                  +---+---+---+---+---+---+---+---+
+ *                  |<---4 bytes--->|
+ */
+public abstract class XdrUnion extends AbstractXdrType<XdrUnion> {
+    /**
+     * [0] is the discriminant
+     *      index, XdrDataType, value;
+     * [1] is the implied arm
+     */
+    private XdrFieldInfo[] fieldInfos;
+    private XdrType[] fields;
+
+    public XdrUnion(XdrDataType xdrDataType) {
+        super(xdrDataType);
+        this.fieldInfos = null;
+        this.fields = null;
+    }
+
+    public XdrUnion(XdrDataType xdrDataType,
+                         final XdrFieldInfo[] fieldInfos) {
+        super(xdrDataType);
+        this.fieldInfos = fieldInfos;
+        this.fields = new XdrType[fieldInfos.length];
+
+        getUnionInstance(this.fields, fieldInfos);
+    }
+
+    protected abstract void getUnionInstance(final XdrType[] fields, final XdrFieldInfo[] fieldInfos);
+
+    public XdrFieldInfo[] getXdrFieldInfos() {
+        return fieldInfos;
+    }
+
+    @Override
+    protected int encodingBodyLength() throws IOException {
+        int allLen = 0;
+        for (int i = 0; i < fields.length; i++) {
+            AbstractXdrType field = (AbstractXdrType) fields[i];
+            if (field != null) {
+                allLen += field.encodingLength();
+            }
+        }
+        return allLen;
+    }
+
+    @Override
+    protected void encodeBody(ByteBuffer buffer) throws IOException {
+        for (int i = 0; i < fields.length; ++i) {
+            XdrType field = fields[i];
+            if (field != null) {
+                field.encode(buffer);
+            }
+        }
+    }
+
+    @Override
+    public void decode(ByteBuffer content) throws IOException {
+        AbstractXdrType[] fields = getAllFields();
+        Object[] value;
+        for (int i = 0; i < fields.length; i++) {
+            if (fields[i] != null) {
+                fields[i].decode(content);
+                int length = fields[i].encodingLength();
+                byte[] array = content.array();
+                byte[] newArray = new byte[array.length - length];
+                System.arraycopy(array, length, newArray, 0, array.length - length);
+                content = ByteBuffer.wrap(newArray);
+            }
+        }
+        this.fields = fields;
+        setValue(fieldsToValues(fields));
+    }
+
+    protected abstract XdrUnion fieldsToValues(AbstractXdrType[] fields);
+
+    protected abstract AbstractXdrType[] getAllFields();
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a608a460/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnsignedInteger.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnsignedInteger.java b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnsignedInteger.java
index 9b1b5d8..ad1df69 100644
--- a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnsignedInteger.java
+++ b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnsignedInteger.java
@@ -1,100 +1,100 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- */
-package org.apache.kerby.xdr.type;
-
-import org.apache.kerby.xdr.XdrDataType;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-/**
- * Xdr Unsigned Integer type from RFC 4506
- * An XDR unsigned integer is a 32-bit datum that encodes
- * a non-negative integer in the range [0,4294967295].
- * It is represented by an unsigned binary number whose most
- * and least significant bytes are 0 and 3, respectively.
- * An unsigned integer is declared as follows:
- * unsigned int identifier;
- *
- *      (MSB)                   (LSB)
- *      +-------+-------+-------+-------+
- *      |byte 0 |byte 1 |byte 2 |byte 3 |
- *      +-------+-------+-------+-------+
- *      <------------32 bits------------>
- */
-public class XdrUnsignedInteger extends XdrSimple<Long> {
-    public XdrUnsignedInteger() {
-        this((Long) null);
-    }
-
-    public XdrUnsignedInteger(String value) {
-        this(Long.valueOf(value));
-    }
-
-    public XdrUnsignedInteger(Long value) {
-        super(XdrDataType.UNSIGNED_INTEGER, value);
-    }
-
-    /**
-     * The length of an unsigned integer is 4.
-     * @return Length of a unsigned integer type.
-     */
-    @Override
-    protected int encodingBodyLength() {
-        return 4; /**Length of XdrInteger is fixed as 4 bytes*/
-    }
-
-    /**
-     * Encode Unsigned Integer type to bytes.
-     */
-    @Override
-    protected void toBytes() throws IOException {
-        Long value = getValue();
-        validateUnsignedInteger(value); /**Check whether the long value is valid unsigned int*/
-        ByteBuffer buffer = ByteBuffer.allocate(8);
-        buffer.putLong(value);
-        byte[] bytes = new byte[4]; /**The encoding length is 4*/
-        System.arraycopy(buffer.array(), 4, bytes, 0, 4);
-        setBytes(bytes);
-    }
-
-    private void validateUnsignedInteger(Long value) throws IOException {
-        if (value < 0 || value > 4294967295L) {
-            throw new IOException("Invalid unsigned integer: " + value);
-        }
-    }
-
-    /**
-     * Decode bytes to Unsigned Integer value.
-     */
-    @Override
-    protected void toValue() {
-        if (getBytes().length != 4) {
-            byte[] bytes = ByteBuffer.allocate(4).put(getBytes(), 0, 4).array();
-            setBytes(bytes); /**reset bytes in case the enum type is in a struct or union*/
-        }
-
-        byte[] longBytes = {(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-                (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00};
-        System.arraycopy(getBytes(), 0, longBytes, 4, 4);
-        ByteBuffer buffer = ByteBuffer.wrap(longBytes);
-        setValue(buffer.getLong());
-    }
-}
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.kerby.xdr.type;
+
+import org.apache.kerby.xdr.XdrDataType;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * Xdr Unsigned Integer type from RFC 4506
+ * An XDR unsigned integer is a 32-bit datum that encodes
+ * a non-negative integer in the range [0,4294967295].
+ * It is represented by an unsigned binary number whose most
+ * and least significant bytes are 0 and 3, respectively.
+ * An unsigned integer is declared as follows:
+ * unsigned int identifier;
+ *
+ *      (MSB)                   (LSB)
+ *      +-------+-------+-------+-------+
+ *      |byte 0 |byte 1 |byte 2 |byte 3 |
+ *      +-------+-------+-------+-------+
+ *      <------------32 bits------------>
+ */
+public class XdrUnsignedInteger extends XdrSimple<Long> {
+    public XdrUnsignedInteger() {
+        this((Long) null);
+    }
+
+    public XdrUnsignedInteger(String value) {
+        this(Long.valueOf(value));
+    }
+
+    public XdrUnsignedInteger(Long value) {
+        super(XdrDataType.UNSIGNED_INTEGER, value);
+    }
+
+    /**
+     * The length of an unsigned integer is 4.
+     * @return Length of a unsigned integer type.
+     */
+    @Override
+    protected int encodingBodyLength() {
+        return 4; /**Length of XdrInteger is fixed as 4 bytes*/
+    }
+
+    /**
+     * Encode Unsigned Integer type to bytes.
+     */
+    @Override
+    protected void toBytes() throws IOException {
+        Long value = getValue();
+        validateUnsignedInteger(value); /**Check whether the long value is valid unsigned int*/
+        ByteBuffer buffer = ByteBuffer.allocate(8);
+        buffer.putLong(value);
+        byte[] bytes = new byte[4]; /**The encoding length is 4*/
+        System.arraycopy(buffer.array(), 4, bytes, 0, 4);
+        setBytes(bytes);
+    }
+
+    private void validateUnsignedInteger(Long value) throws IOException {
+        if (value < 0 || value > 4294967295L) {
+            throw new IOException("Invalid unsigned integer: " + value);
+        }
+    }
+
+    /**
+     * Decode bytes to Unsigned Integer value.
+     */
+    @Override
+    protected void toValue() {
+        if (getBytes().length != 4) {
+            byte[] bytes = ByteBuffer.allocate(4).put(getBytes(), 0, 4).array();
+            setBytes(bytes); /**reset bytes in case the enum type is in a struct or union*/
+        }
+
+        byte[] longBytes = {(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+                (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00};
+        System.arraycopy(getBytes(), 0, longBytes, 4, 4);
+        ByteBuffer buffer = ByteBuffer.wrap(longBytes);
+        setValue(buffer.getLong());
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a608a460/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedInstance.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedInstance.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedInstance.java
index 4713e59..e35d03c 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedInstance.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedInstance.java
@@ -1,56 +1,56 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- */
-package org.apache.kerby.xdr;
-
-import org.apache.kerby.xdr.type.XdrEnumerated;
-
-enum Color implements EnumType {
-    RED(2),
-    YELLOW(3),
-    BLUE(5);
-    int value;
-    Color(int value) {
-        this.value = value;
-    }
-
-    public int getValue() {
-        return value;
-    }
-
-    public String getName() {
-        return name();
-    }
-}
-
-public class XdrEnumeratedInstance extends XdrEnumerated<Color> {
-
-    public XdrEnumeratedInstance() {
-        super(null);
-    }
-
-    public XdrEnumeratedInstance(Color value) {
-        super(value);
-    }
-    @Override
-    protected EnumType[] getAllEnumValues() {
-        return Color.values();
-    }
-
-}
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.kerby.xdr;
+
+import org.apache.kerby.xdr.type.XdrEnumerated;
+
+enum Color implements EnumType {
+    RED(2),
+    YELLOW(3),
+    BLUE(5);
+    int value;
+    Color(int value) {
+        this.value = value;
+    }
+
+    public int getValue() {
+        return value;
+    }
+
+    public String getName() {
+        return name();
+    }
+}
+
+public class XdrEnumeratedInstance extends XdrEnumerated<Color> {
+
+    public XdrEnumeratedInstance() {
+        super(null);
+    }
+
+    public XdrEnumeratedInstance(Color value) {
+        super(value);
+    }
+    @Override
+    protected EnumType[] getAllEnumValues() {
+        return Color.values();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a608a460/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedTest.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedTest.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedTest.java
index 788cd3f..2a3096a 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedTest.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedTest.java
@@ -1,58 +1,58 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- */
-package org.apache.kerby.xdr;
-
-import org.apache.kerby.xdr.type.XdrEnumerated;
-import org.apache.kerby.xdr.util.HexUtil;
-import org.junit.Test;
-import java.io.IOException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class XdrEnumeratedTest {
-    @Test
-    public void testEncoding() throws IOException {
-        testEncodingWith(Color.RED, "0x00 00 00 02");
-        testEncodingWith(Color.YELLOW, "0x00 00 00 03");
-        testEncodingWith(Color.BLUE, "0x00 00 00 05");
-    }
-
-    private void testEncodingWith(Color value, String expectedEncoding) throws IOException {
-        byte[] expected = HexUtil.hex2bytesFriendly(expectedEncoding);
-        XdrEnumerated aValue = new XdrEnumeratedInstance(value);
-
-        byte[] encodingBytes = aValue.encode();
-        assertThat(encodingBytes).isEqualTo(expected);
-    }
-
-
-    @Test
-    public void testDecoding() throws IOException {
-        testDecodingWith(Color.RED, "0x00 00 00 02");
-        testDecodingWith(Color.YELLOW, "0x00 00 00 03");
-        testDecodingWith(Color.BLUE, "0x00 00 00 05");
-    }
-
-    private void testDecodingWith(Color expectedValue, String content) throws IOException {
-        XdrEnumerated decoded = new XdrEnumeratedInstance();
-        decoded.decode(HexUtil.hex2bytesFriendly(content));
-        assertThat(decoded.getValue()).isEqualTo(expectedValue);
-    }
-}
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.kerby.xdr;
+
+import org.apache.kerby.xdr.type.XdrEnumerated;
+import org.apache.kerby.xdr.util.HexUtil;
+import org.junit.Test;
+import java.io.IOException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class XdrEnumeratedTest {
+    @Test
+    public void testEncoding() throws IOException {
+        testEncodingWith(Color.RED, "0x00 00 00 02");
+        testEncodingWith(Color.YELLOW, "0x00 00 00 03");
+        testEncodingWith(Color.BLUE, "0x00 00 00 05");
+    }
+
+    private void testEncodingWith(Color value, String expectedEncoding) throws IOException {
+        byte[] expected = HexUtil.hex2bytesFriendly(expectedEncoding);
+        XdrEnumerated aValue = new XdrEnumeratedInstance(value);
+
+        byte[] encodingBytes = aValue.encode();
+        assertThat(encodingBytes).isEqualTo(expected);
+    }
+
+
+    @Test
+    public void testDecoding() throws IOException {
+        testDecodingWith(Color.RED, "0x00 00 00 02");
+        testDecodingWith(Color.YELLOW, "0x00 00 00 03");
+        testDecodingWith(Color.BLUE, "0x00 00 00 05");
+    }
+
+    private void testDecodingWith(Color expectedValue, String content) throws IOException {
+        XdrEnumerated decoded = new XdrEnumeratedInstance();
+        decoded.decode(HexUtil.hex2bytesFriendly(content));
+        assertThat(decoded.getValue()).isEqualTo(expectedValue);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a608a460/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrIntegerTest.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrIntegerTest.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrIntegerTest.java
index 6bbabc6..9246f12 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrIntegerTest.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrIntegerTest.java
@@ -1,80 +1,80 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- */
-package org.apache.kerby.xdr;
-
-import org.apache.kerby.xdr.type.XdrInteger;
-import org.apache.kerby.xdr.util.HexUtil;
-import org.junit.Test;
-
-import java.io.IOException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class XdrIntegerTest {
-    @Test
-    public void testEncoding() throws IOException {
-        testEncodingWith(0, "0x00 00 00 00");
-        testEncodingWith(1, "0x00 00 00 01");
-        testEncodingWith(2, "0x00 00 00 02");
-        testEncodingWith(127, "0x00 00 00 7F");
-        testEncodingWith(128, "0x00 00 00 80");
-        testEncodingWith(-1, "0xFF FF FF FF");
-        testEncodingWith(-127, "0xFF FF FF 81");
-        testEncodingWith(-255, "0xFF FF FF 01");
-        testEncodingWith(-32768, "0xFF FF 80 00");
-        testEncodingWith(1234567890, "0x49 96 02 D2");
-        testEncodingWith(2147483647, "0x7F FF FF FF");
-        testEncodingWith(-2147483647, "0x80 00 00 01");
-        testEncodingWith(-2147483648, "0x80 00 00 00");
-    }
-
-    private void testEncodingWith(int value, String expectedEncoding) throws IOException {
-        byte[] expected = HexUtil.hex2bytesFriendly(expectedEncoding);
-        XdrInteger aValue = new XdrInteger(value);
-
-        byte[] encodingBytes = aValue.encode();
-        assertThat(encodingBytes).isEqualTo(expected);
-    }
-
-
-    @Test
-    public void testDecoding() throws IOException {
-        testDecodingWith(0, "0x00 00 00 00");
-        testDecodingWith(1, "0x00 00 00 01");
-        testDecodingWith(2, "0x00 00 00 02");
-        testDecodingWith(127, "0x00 00 00 7F");
-        testDecodingWith(128, "0x00 00 00 80");
-        testDecodingWith(-1, "0xFF FF FF FF");
-        testDecodingWith(-127, "0xFF FF FF 81");
-        testDecodingWith(-255, "0xFF FF FF 01");
-        testDecodingWith(-32768, "0xFF FF 80 00");
-        testDecodingWith(1234567890, "0x49 96 02 D2");
-        testDecodingWith(2147483647, "0x7F FF FF FF");
-        testDecodingWith(-2147483647, "0x80 00 00 01");
-        testDecodingWith(-2147483648, "0x80 00 00 00");
-    }
-
-    private void testDecodingWith(int expectedValue, String content) throws IOException {
-        XdrInteger decoded = new XdrInteger();
-
-        decoded.decode(HexUtil.hex2bytesFriendly(content));
-        assertThat(decoded.getValue().intValue()).isEqualTo(expectedValue);
-    }
-}
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.kerby.xdr;
+
+import org.apache.kerby.xdr.type.XdrInteger;
+import org.apache.kerby.xdr.util.HexUtil;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class XdrIntegerTest {
+    @Test
+    public void testEncoding() throws IOException {
+        testEncodingWith(0, "0x00 00 00 00");
+        testEncodingWith(1, "0x00 00 00 01");
+        testEncodingWith(2, "0x00 00 00 02");
+        testEncodingWith(127, "0x00 00 00 7F");
+        testEncodingWith(128, "0x00 00 00 80");
+        testEncodingWith(-1, "0xFF FF FF FF");
+        testEncodingWith(-127, "0xFF FF FF 81");
+        testEncodingWith(-255, "0xFF FF FF 01");
+        testEncodingWith(-32768, "0xFF FF 80 00");
+        testEncodingWith(1234567890, "0x49 96 02 D2");
+        testEncodingWith(2147483647, "0x7F FF FF FF");
+        testEncodingWith(-2147483647, "0x80 00 00 01");
+        testEncodingWith(-2147483648, "0x80 00 00 00");
+    }
+
+    private void testEncodingWith(int value, String expectedEncoding) throws IOException {
+        byte[] expected = HexUtil.hex2bytesFriendly(expectedEncoding);
+        XdrInteger aValue = new XdrInteger(value);
+
+        byte[] encodingBytes = aValue.encode();
+        assertThat(encodingBytes).isEqualTo(expected);
+    }
+
+
+    @Test
+    public void testDecoding() throws IOException {
+        testDecodingWith(0, "0x00 00 00 00");
+        testDecodingWith(1, "0x00 00 00 01");
+        testDecodingWith(2, "0x00 00 00 02");
+        testDecodingWith(127, "0x00 00 00 7F");
+        testDecodingWith(128, "0x00 00 00 80");
+        testDecodingWith(-1, "0xFF FF FF FF");
+        testDecodingWith(-127, "0xFF FF FF 81");
+        testDecodingWith(-255, "0xFF FF FF 01");
+        testDecodingWith(-32768, "0xFF FF 80 00");
+        testDecodingWith(1234567890, "0x49 96 02 D2");
+        testDecodingWith(2147483647, "0x7F FF FF FF");
+        testDecodingWith(-2147483647, "0x80 00 00 01");
+        testDecodingWith(-2147483648, "0x80 00 00 00");
+    }
+
+    private void testDecodingWith(int expectedValue, String content) throws IOException {
+        XdrInteger decoded = new XdrInteger();
+
+        decoded.decode(HexUtil.hex2bytesFriendly(content));
+        assertThat(decoded.getValue().intValue()).isEqualTo(expectedValue);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a608a460/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStringTest.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStringTest.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStringTest.java
index f09c6db..8bb30a4 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStringTest.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStringTest.java
@@ -1,59 +1,59 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- */
-package org.apache.kerby.xdr;
-
-import org.apache.kerby.xdr.type.XdrString;
-import org.apache.kerby.xdr.util.HexUtil;
-import org.junit.Test;
-
-import java.io.IOException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class XdrStringTest {
-        @Test
-        public void testEncoding() throws IOException {
-            testEncodingWith("Hello, Kerby!", "0X00 00 00 0D 48 65 6C 6C 6F 2C 20 4B 65 72 62 79 21 00 00 00");
-            testEncodingWith("sillyprog", "0X00 00 00 09 73 69 6C 6C 79 70 72 6F 67 00 00 00");
-            testEncodingWith("(quit)", "0X00 00 00 06 28 71 75 69 74 29 00 00");
-        }
-
-        private void testEncodingWith(String value, String expectedEncoding) throws IOException {
-            byte[] expected = HexUtil.hex2bytesFriendly(expectedEncoding);
-            XdrString aValue = new XdrString(value);
-
-            byte[] encodingBytes = aValue.encode();
-            assertThat(encodingBytes).isEqualTo(expected);
-        }
-
-
-        @Test
-        public void testDecoding() throws IOException {
-            testDecodingWith("Hello, Kerby!", "0X00 00 00 0D 48 65 6C 6C 6F 2C 20 4B 65 72 62 79 21 00 00 00");
-            testDecodingWith("sillyprog", "0X00 00 00 09 73 69 6c 6c 79 70 72 6f 67 00 00 00");
-            testDecodingWith("(quit)", "0X00 00 00 06 28 71 75 69 74 29 00 00");
-        }
-
-        private void testDecodingWith(String expectedValue, String content) throws IOException {
-            XdrString decoded = new XdrString();
-            decoded.decode(HexUtil.hex2bytesFriendly(content));
-            assertThat(decoded.getValue()).isEqualTo(expectedValue);
-        }
-}
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.kerby.xdr;
+
+import org.apache.kerby.xdr.type.XdrString;
+import org.apache.kerby.xdr.util.HexUtil;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class XdrStringTest {
+        @Test
+        public void testEncoding() throws IOException {
+            testEncodingWith("Hello, Kerby!", "0X00 00 00 0D 48 65 6C 6C 6F 2C 20 4B 65 72 62 79 21 00 00 00");
+            testEncodingWith("sillyprog", "0X00 00 00 09 73 69 6C 6C 79 70 72 6F 67 00 00 00");
+            testEncodingWith("(quit)", "0X00 00 00 06 28 71 75 69 74 29 00 00");
+        }
+
+        private void testEncodingWith(String value, String expectedEncoding) throws IOException {
+            byte[] expected = HexUtil.hex2bytesFriendly(expectedEncoding);
+            XdrString aValue = new XdrString(value);
+
+            byte[] encodingBytes = aValue.encode();
+            assertThat(encodingBytes).isEqualTo(expected);
+        }
+
+
+        @Test
+        public void testDecoding() throws IOException {
+            testDecodingWith("Hello, Kerby!", "0X00 00 00 0D 48 65 6C 6C 6F 2C 20 4B 65 72 62 79 21 00 00 00");
+            testDecodingWith("sillyprog", "0X00 00 00 09 73 69 6c 6c 79 70 72 6f 67 00 00 00");
+            testDecodingWith("(quit)", "0X00 00 00 06 28 71 75 69 74 29 00 00");
+        }
+
+        private void testDecodingWith(String expectedValue, String content) throws IOException {
+            XdrString decoded = new XdrString();
+            decoded.decode(HexUtil.hex2bytesFriendly(content));
+            assertThat(decoded.getValue()).isEqualTo(expectedValue);
+        }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a608a460/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
index 65b8e1e..37c5196 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
@@ -1,111 +1,111 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- */
-package org.apache.kerby.xdr;
-
-import org.apache.kerby.xdr.type.AbstractXdrType;
-import org.apache.kerby.xdr.type.XdrBoolean;
-import org.apache.kerby.xdr.type.XdrInteger;
-import org.apache.kerby.xdr.type.XdrString;
-import org.apache.kerby.xdr.type.XdrStructType;
-import org.apache.kerby.xdr.type.XdrType;
-import org.apache.kerby.xdr.type.XdrUnion;
-import org.apache.kerby.xdr.type.XdrUnsignedInteger;
-
-class MyFile {
-    String fileName;
-    UnionFileTypeSwitch fileType;
-    String owner;
-
-    MyFile(String name, UnionFileTypeSwitch fileType, String owner) {
-        this.fileName = name;
-        this.fileType = fileType;
-        this.owner = owner;
-    }
-
-    public String getFileName() {
-        return fileName;
-    }
-
-    public UnionFileTypeSwitch getFileType() {
-        return fileType;
-    }
-
-    public String getOwner() {
-        return owner;
-    }
-
-}
-
-public class XdrStructTypeInstance extends XdrStructType {
-    public XdrStructTypeInstance() {
-        super(XdrDataType.STRUCT);
-    }
-
-    public XdrStructTypeInstance(XdrFieldInfo[] fieldInfos) {
-        super(XdrDataType.STRUCT, fieldInfos);
-    }
-
-    protected  void getStructTypeInstance(final XdrType[] fields, final XdrFieldInfo[] fieldInfos) {
-        for (int i = 0; i < fieldInfos.length; i++) {
-            switch (fieldInfos[i].getDataType()) {
-                case INTEGER:
-                    fields[i] = new XdrInteger((Integer) fieldInfos[i].getValue());
-                    break;
-                case UNSIGNED_INTEGER:
-                    fields[i] = new XdrUnsignedInteger((Long) fieldInfos[i].getValue());
-                    break;
-                case BOOLEAN:
-                    fields[i] = new XdrBoolean((Boolean) fieldInfos[i].getValue());
-                    break;
-                case ENUM:
-                    fields[i] = new FileKindEnumeratedInstance((FileKind) fieldInfos[i].getValue());
-                    break;
-                case UNION:
-                    fields[i] = (XdrUnion) fieldInfos[i].getValue();
-                    break;
-                case STRING:
-                    fields[i] = new XdrString((String) fieldInfos[i].getValue());
-                    break;
-                case STRUCT:
-                    fields[i] = new XdrStructTypeInstance((XdrFieldInfo[]) fieldInfos[i].getValue());
-                default:
-                    fields[i] = null;
-            }
-        }
-
-    }
-
-    @Override
-    protected XdrStructType fieldsToValues(AbstractXdrType[] fields) {
-        XdrFieldInfo[] fieldInfos = {new XdrFieldInfo(0, XdrDataType.STRING, fields[0].getValue()),
-                new XdrFieldInfo(1, XdrDataType.UNION, fields[1].getValue()),
-                new XdrFieldInfo(2, XdrDataType.STRING, fields[2].getValue())};
-        return new XdrStructTypeInstance(fieldInfos);
-    }
-
-    @Override
-    protected AbstractXdrType[] getAllFields() {
-        AbstractXdrType[] fields = new AbstractXdrType[3];
-        fields[0] = new XdrString();
-        fields[1] = new XdrUnionInstance();
-        fields[2] = new XdrString();
-        return fields;
-    }
-}
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.kerby.xdr;
+
+import org.apache.kerby.xdr.type.AbstractXdrType;
+import org.apache.kerby.xdr.type.XdrBoolean;
+import org.apache.kerby.xdr.type.XdrInteger;
+import org.apache.kerby.xdr.type.XdrString;
+import org.apache.kerby.xdr.type.XdrStructType;
+import org.apache.kerby.xdr.type.XdrType;
+import org.apache.kerby.xdr.type.XdrUnion;
+import org.apache.kerby.xdr.type.XdrUnsignedInteger;
+
+class MyFile {
+    String fileName;
+    UnionFileTypeSwitch fileType;
+    String owner;
+
+    MyFile(String name, UnionFileTypeSwitch fileType, String owner) {
+        this.fileName = name;
+        this.fileType = fileType;
+        this.owner = owner;
+    }
+
+    public String getFileName() {
+        return fileName;
+    }
+
+    public UnionFileTypeSwitch getFileType() {
+        return fileType;
+    }
+
+    public String getOwner() {
+        return owner;
+    }
+
+}
+
+public class XdrStructTypeInstance extends XdrStructType {
+    public XdrStructTypeInstance() {
+        super(XdrDataType.STRUCT);
+    }
+
+    public XdrStructTypeInstance(XdrFieldInfo[] fieldInfos) {
+        super(XdrDataType.STRUCT, fieldInfos);
+    }
+
+    protected  void getStructTypeInstance(final XdrType[] fields, final XdrFieldInfo[] fieldInfos) {
+        for (int i = 0; i < fieldInfos.length; i++) {
+            switch (fieldInfos[i].getDataType()) {
+                case INTEGER:
+                    fields[i] = new XdrInteger((Integer) fieldInfos[i].getValue());
+                    break;
+                case UNSIGNED_INTEGER:
+                    fields[i] = new XdrUnsignedInteger((Long) fieldInfos[i].getValue());
+                    break;
+                case BOOLEAN:
+                    fields[i] = new XdrBoolean((Boolean) fieldInfos[i].getValue());
+                    break;
+                case ENUM:
+                    fields[i] = new FileKindEnumeratedInstance((FileKind) fieldInfos[i].getValue());
+                    break;
+                case UNION:
+                    fields[i] = (XdrUnion) fieldInfos[i].getValue();
+                    break;
+                case STRING:
+                    fields[i] = new XdrString((String) fieldInfos[i].getValue());
+                    break;
+                case STRUCT:
+                    fields[i] = new XdrStructTypeInstance((XdrFieldInfo[]) fieldInfos[i].getValue());
+                default:
+                    fields[i] = null;
+            }
+        }
+
+    }
+
+    @Override
+    protected XdrStructType fieldsToValues(AbstractXdrType[] fields) {
+        XdrFieldInfo[] fieldInfos = {new XdrFieldInfo(0, XdrDataType.STRING, fields[0].getValue()),
+                new XdrFieldInfo(1, XdrDataType.UNION, fields[1].getValue()),
+                new XdrFieldInfo(2, XdrDataType.STRING, fields[2].getValue())};
+        return new XdrStructTypeInstance(fieldInfos);
+    }
+
+    @Override
+    protected AbstractXdrType[] getAllFields() {
+        AbstractXdrType[] fields = new AbstractXdrType[3];
+        fields[0] = new XdrString();
+        fields[1] = new XdrUnionInstance();
+        fields[2] = new XdrString();
+        return fields;
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a608a460/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeTest.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeTest.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeTest.java
index ca9d86f..c41a20b 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeTest.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeTest.java
@@ -1,83 +1,83 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- */
-package org.apache.kerby.xdr;
-
-import org.apache.kerby.xdr.type.XdrStructType;
-import org.apache.kerby.xdr.type.XdrUnion;
-import org.apache.kerby.xdr.util.HexUtil;
-import org.junit.Test;
-
-import java.io.IOException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class XdrStructTypeTest {
-    @Test
-    public void testEncoding() throws IOException {
-        MyFile file = new MyFile("sillyprog", new UnionFileTypeSwitch(FileKind.EXEC), "john");
-        testEncodingWith(file, "0x00 00 00 09 73 69 6c 6c 79 70 72 6f 67 00 00 00 00 00 00 02 "
-                + "00 00 00 04 6c 69 73 70 00 00 00 04 6a 6f 68 6e");
-    }
-
-    private void testEncodingWith(MyFile value, String expectedEncoding) throws IOException {
-        byte[] expected = HexUtil.hex2bytesFriendly(expectedEncoding);
-        UnionFileTypeSwitch fileType = value.getFileType();
-        XdrFieldInfo[] unionFieldInfo = {new XdrFieldInfo(0, fileType.getFileKind(), fileType.getFileValue()),
-                new XdrFieldInfo(1, fileType.getArmKind(), fileType.getArmValue())};
-        XdrFieldInfo[] fieldInfos = {new XdrFieldInfo(0, XdrDataType.STRING, value.getFileName()),
-                new XdrFieldInfo(1, XdrDataType.UNION, new XdrUnionInstance(unionFieldInfo)),
-                new XdrFieldInfo(2, XdrDataType.STRING, value.getOwner())};
-
-        XdrStructType aValue = new XdrStructTypeInstance(fieldInfos);
-
-        byte[] encodingBytes = aValue.encode();
-        assertThat(encodingBytes).isEqualTo(expected);
-    }
-
-
-    @Test
-    public void testDecoding() throws IOException {
-        MyFile file = new MyFile("sillyprog", new UnionFileTypeSwitch(FileKind.EXEC), "john");
-        testDecodingWith(file, "0x00 00 00 09 73 69 6c 6c 79 70 72 6f 67 00 00 00 00 00 00 02 "
-                + "00 00 00 04 6c 69 73 70 00 00 00 04 6a 6f 68 6e");
-    }
-
-    private void testDecodingWith(MyFile expectedValue, String content) throws IOException {
-        XdrStructType decoded = new XdrStructTypeInstance();
-
-        decoded.decode(HexUtil.hex2bytesFriendly(content));
-
-        XdrFieldInfo[] fieldInfos = decoded.getValue().getXdrFieldInfos();
-        assertThat(fieldInfos.length).isEqualTo(3);
-        assertThat(fieldInfos[0].getDataType()).isEqualTo(XdrDataType.STRING);
-        assertThat((String) fieldInfos[0].getValue()).isEqualTo(expectedValue.getFileName());
-
-        assertThat(fieldInfos[1].getDataType()).isEqualTo(XdrDataType.UNION);
-        XdrFieldInfo[] unionFieldInfo = ((XdrUnion) fieldInfos[1].getValue()).getXdrFieldInfos();
-        assertThat(unionFieldInfo[0].getDataType()).isEqualTo(expectedValue.getFileType().getFileKind());
-        assertThat(unionFieldInfo[0].getValue()).isEqualTo(expectedValue.getFileType().getFileValue());
-        assertThat(unionFieldInfo[1].getDataType()).isEqualTo(expectedValue.getFileType().getArmKind());
-        assertThat((String) unionFieldInfo[1].getValue()).isEqualTo(expectedValue.getFileType().getArmValue());
-
-        assertThat(fieldInfos[2].getDataType()).isEqualTo(XdrDataType.STRING);
-        assertThat((String) fieldInfos[2].getValue()).isEqualTo(expectedValue.getOwner());
-    }
-
-}
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.kerby.xdr;
+
+import org.apache.kerby.xdr.type.XdrStructType;
+import org.apache.kerby.xdr.type.XdrUnion;
+import org.apache.kerby.xdr.util.HexUtil;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class XdrStructTypeTest {
+    @Test
+    public void testEncoding() throws IOException {
+        MyFile file = new MyFile("sillyprog", new UnionFileTypeSwitch(FileKind.EXEC), "john");
+        testEncodingWith(file, "0x00 00 00 09 73 69 6c 6c 79 70 72 6f 67 00 00 00 00 00 00 02 "
+                + "00 00 00 04 6c 69 73 70 00 00 00 04 6a 6f 68 6e");
+    }
+
+    private void testEncodingWith(MyFile value, String expectedEncoding) throws IOException {
+        byte[] expected = HexUtil.hex2bytesFriendly(expectedEncoding);
+        UnionFileTypeSwitch fileType = value.getFileType();
+        XdrFieldInfo[] unionFieldInfo = {new XdrFieldInfo(0, fileType.getFileKind(), fileType.getFileValue()),
+                new XdrFieldInfo(1, fileType.getArmKind(), fileType.getArmValue())};
+        XdrFieldInfo[] fieldInfos = {new XdrFieldInfo(0, XdrDataType.STRING, value.getFileName()),
+                new XdrFieldInfo(1, XdrDataType.UNION, new XdrUnionInstance(unionFieldInfo)),
+                new XdrFieldInfo(2, XdrDataType.STRING, value.getOwner())};
+
+        XdrStructType aValue = new XdrStructTypeInstance(fieldInfos);
+
+        byte[] encodingBytes = aValue.encode();
+        assertThat(encodingBytes).isEqualTo(expected);
+    }
+
+
+    @Test
+    public void testDecoding() throws IOException {
+        MyFile file = new MyFile("sillyprog", new UnionFileTypeSwitch(FileKind.EXEC), "john");
+        testDecodingWith(file, "0x00 00 00 09 73 69 6c 6c 79 70 72 6f 67 00 00 00 00 00 00 02 "
+                + "00 00 00 04 6c 69 73 70 00 00 00 04 6a 6f 68 6e");
+    }
+
+    private void testDecodingWith(MyFile expectedValue, String content) throws IOException {
+        XdrStructType decoded = new XdrStructTypeInstance();
+
+        decoded.decode(HexUtil.hex2bytesFriendly(content));
+
+        XdrFieldInfo[] fieldInfos = decoded.getValue().getXdrFieldInfos();
+        assertThat(fieldInfos.length).isEqualTo(3);
+        assertThat(fieldInfos[0].getDataType()).isEqualTo(XdrDataType.STRING);
+        assertThat((String) fieldInfos[0].getValue()).isEqualTo(expectedValue.getFileName());
+
+        assertThat(fieldInfos[1].getDataType()).isEqualTo(XdrDataType.UNION);
+        XdrFieldInfo[] unionFieldInfo = ((XdrUnion) fieldInfos[1].getValue()).getXdrFieldInfos();
+        assertThat(unionFieldInfo[0].getDataType()).isEqualTo(expectedValue.getFileType().getFileKind());
+        assertThat(unionFieldInfo[0].getValue()).isEqualTo(expectedValue.getFileType().getFileValue());
+        assertThat(unionFieldInfo[1].getDataType()).isEqualTo(expectedValue.getFileType().getArmKind());
+        assertThat((String) unionFieldInfo[1].getValue()).isEqualTo(expectedValue.getFileType().getArmValue());
+
+        assertThat(fieldInfos[2].getDataType()).isEqualTo(XdrDataType.STRING);
+        assertThat((String) fieldInfos[2].getValue()).isEqualTo(expectedValue.getOwner());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a608a460/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionInstance.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionInstance.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionInstance.java
index 3adbfdc..fbc13b7 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionInstance.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionInstance.java
@@ -1,170 +1,170 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- */
-package org.apache.kerby.xdr;
-
-import org.apache.kerby.xdr.type.AbstractXdrType;
-import org.apache.kerby.xdr.type.XdrBoolean;
-import org.apache.kerby.xdr.type.XdrEnumerated;
-import org.apache.kerby.xdr.type.XdrInteger;
-import org.apache.kerby.xdr.type.XdrString;
-import org.apache.kerby.xdr.type.XdrType;
-import org.apache.kerby.xdr.type.XdrUnion;
-import org.apache.kerby.xdr.type.XdrUnsignedInteger;
-
-enum FileKind implements EnumType {
-    TEXT,
-    DATA,
-    EXEC;
-
-    public int getValue() {
-        return ordinal();
-    }
-
-    public String getName() {
-        return name();
-    }
-}
-
-class FileKindEnumeratedInstance extends XdrEnumerated<FileKind> {
-
-    FileKindEnumeratedInstance() {
-        super(null);
-    }
-
-    FileKindEnumeratedInstance(FileKind value) {
-        super(value);
-    }
-    @Override
-    protected EnumType[] getAllEnumValues() {
-        return FileKind.values();
-    }
-
-}
-
-class UnionFileTypeSwitch {
-    FileKind fileKind;
-    Object arm;
-    UnionFileTypeSwitch(FileKind fileKind) {
-        this.fileKind = fileKind;
-        switch (fileKind) {
-            case TEXT:
-                arm = null;
-                break;
-            case DATA:
-                arm = "creator";
-                break;
-            case EXEC:
-                arm = "lisp";
-                break;
-        }
-    }
-
-    XdrDataType getFileKind() {
-        return XdrDataType.ENUM;
-    }
-
-    FileKind getFileValue() {
-        return fileKind;
-    }
-
-    XdrDataType getArmKind() {
-        XdrDataType xdrDataType = XdrDataType.UNKNOWN;
-        switch (fileKind) {
-            case TEXT:
-                xdrDataType = XdrDataType.UNKNOWN;
-                break;
-            case DATA:
-                xdrDataType = XdrDataType.STRING;
-                break;
-            case EXEC:
-                xdrDataType = XdrDataType.STRING;
-                break;
-        }
-        return xdrDataType;
-    }
-
-    Object getArmValue() {
-        return arm;
-    }
-}
-
-public class XdrUnionInstance extends XdrUnion {
-
-    public XdrUnionInstance() {
-        super(XdrDataType.UNION);
-    }
-
-    public XdrUnionInstance(XdrFieldInfo[] fieldInfos) {
-        super(XdrDataType.UNION, fieldInfos);
-    }
-
-
-    @Override
-    protected void getUnionInstance(XdrType[] fields, XdrFieldInfo[] fieldInfos) {
-        switch (fieldInfos[0].getDataType()) {
-            case INTEGER:
-                fields[0] = new XdrInteger((Integer) fieldInfos[0].getValue());
-                break;
-            case UNSIGNED_INTEGER:
-                fields[0] = new XdrUnsignedInteger((Long) fieldInfos[0].getValue());
-                break;
-            case BOOLEAN:
-                fields[0] = new XdrBoolean((Boolean) fieldInfos[0].getValue());
-                break;
-            case ENUM:
-                fields[0] = new FileKindEnumeratedInstance((FileKind) fieldInfos[0].getValue());
-                break;
-            default:
-                throw new RuntimeException("Wrong discriminant type for union: " + fieldInfos[0].getDataType());
-        }
-
-        switch (fieldInfos[1].getDataType()) {
-            case INTEGER:
-                fields[1] = new XdrInteger((Integer) fieldInfos[1].getValue());
-                break;
-            case UNSIGNED_INTEGER:
-                fields[1] = new XdrUnsignedInteger((Long) fieldInfos[1].getValue());
-                break;
-            case BOOLEAN:
-                fields[1] = new XdrBoolean((Boolean) fieldInfos[1].getValue());
-                break;
-            case STRING:
-                fields[1] = new XdrString((String) fieldInfos[1].getValue());
-                break;
-            default:
-                fields[1] = null;
-        }
-    }
-
-    @Override
-    protected XdrUnion fieldsToValues(AbstractXdrType[] fields) {
-        XdrFieldInfo[] fieldInfos = {new XdrFieldInfo(0, XdrDataType.ENUM, fields[0].getValue()),
-                new XdrFieldInfo(1, XdrDataType.STRING, fields[1].getValue())};
-        return new XdrUnionInstance(fieldInfos);
-    }
-
-    @Override
-    protected AbstractXdrType[] getAllFields() {
-        AbstractXdrType[] fields = new AbstractXdrType[2];
-        fields[0] = new FileKindEnumeratedInstance();
-        fields[1] = new XdrString();
-        return fields;
-    }
-}
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.kerby.xdr;
+
+import org.apache.kerby.xdr.type.AbstractXdrType;
+import org.apache.kerby.xdr.type.XdrBoolean;
+import org.apache.kerby.xdr.type.XdrEnumerated;
+import org.apache.kerby.xdr.type.XdrInteger;
+import org.apache.kerby.xdr.type.XdrString;
+import org.apache.kerby.xdr.type.XdrType;
+import org.apache.kerby.xdr.type.XdrUnion;
+import org.apache.kerby.xdr.type.XdrUnsignedInteger;
+
+enum FileKind implements EnumType {
+    TEXT,
+    DATA,
+    EXEC;
+
+    public int getValue() {
+        return ordinal();
+    }
+
+    public String getName() {
+        return name();
+    }
+}
+
+class FileKindEnumeratedInstance extends XdrEnumerated<FileKind> {
+
+    FileKindEnumeratedInstance() {
+        super(null);
+    }
+
+    FileKindEnumeratedInstance(FileKind value) {
+        super(value);
+    }
+    @Override
+    protected EnumType[] getAllEnumValues() {
+        return FileKind.values();
+    }
+
+}
+
+class UnionFileTypeSwitch {
+    FileKind fileKind;
+    Object arm;
+    UnionFileTypeSwitch(FileKind fileKind) {
+        this.fileKind = fileKind;
+        switch (fileKind) {
+            case TEXT:
+                arm = null;
+                break;
+            case DATA:
+                arm = "creator";
+                break;
+            case EXEC:
+                arm = "lisp";
+                break;
+        }
+    }
+
+    XdrDataType getFileKind() {
+        return XdrDataType.ENUM;
+    }
+
+    FileKind getFileValue() {
+        return fileKind;
+    }
+
+    XdrDataType getArmKind() {
+        XdrDataType xdrDataType = XdrDataType.UNKNOWN;
+        switch (fileKind) {
+            case TEXT:
+                xdrDataType = XdrDataType.UNKNOWN;
+                break;
+            case DATA:
+                xdrDataType = XdrDataType.STRING;
+                break;
+            case EXEC:
+                xdrDataType = XdrDataType.STRING;
+                break;
+        }
+        return xdrDataType;
+    }
+
+    Object getArmValue() {
+        return arm;
+    }
+}
+
+public class XdrUnionInstance extends XdrUnion {
+
+    public XdrUnionInstance() {
+        super(XdrDataType.UNION);
+    }
+
+    public XdrUnionInstance(XdrFieldInfo[] fieldInfos) {
+        super(XdrDataType.UNION, fieldInfos);
+    }
+
+
+    @Override
+    protected void getUnionInstance(XdrType[] fields, XdrFieldInfo[] fieldInfos) {
+        switch (fieldInfos[0].getDataType()) {
+            case INTEGER:
+                fields[0] = new XdrInteger((Integer) fieldInfos[0].getValue());
+                break;
+            case UNSIGNED_INTEGER:
+                fields[0] = new XdrUnsignedInteger((Long) fieldInfos[0].getValue());
+                break;
+            case BOOLEAN:
+                fields[0] = new XdrBoolean((Boolean) fieldInfos[0].getValue());
+                break;
+            case ENUM:
+                fields[0] = new FileKindEnumeratedInstance((FileKind) fieldInfos[0].getValue());
+                break;
+            default:
+                throw new RuntimeException("Wrong discriminant type for union: " + fieldInfos[0].getDataType());
+        }
+
+        switch (fieldInfos[1].getDataType()) {
+            case INTEGER:
+                fields[1] = new XdrInteger((Integer) fieldInfos[1].getValue());
+                break;
+            case UNSIGNED_INTEGER:
+                fields[1] = new XdrUnsignedInteger((Long) fieldInfos[1].getValue());
+                break;
+            case BOOLEAN:
+                fields[1] = new XdrBoolean((Boolean) fieldInfos[1].getValue());
+                break;
+            case STRING:
+                fields[1] = new XdrString((String) fieldInfos[1].getValue());
+                break;
+            default:
+                fields[1] = null;
+        }
+    }
+
+    @Override
+    protected XdrUnion fieldsToValues(AbstractXdrType[] fields) {
+        XdrFieldInfo[] fieldInfos = {new XdrFieldInfo(0, XdrDataType.ENUM, fields[0].getValue()),
+                new XdrFieldInfo(1, XdrDataType.STRING, fields[1].getValue())};
+        return new XdrUnionInstance(fieldInfos);
+    }
+
+    @Override
+    protected AbstractXdrType[] getAllFields() {
+        AbstractXdrType[] fields = new AbstractXdrType[2];
+        fields[0] = new FileKindEnumeratedInstance();
+        fields[1] = new XdrString();
+        return fields;
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a608a460/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionTest.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionTest.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionTest.java
index 31883ee..e9b9275 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionTest.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionTest.java
@@ -1,67 +1,67 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- */
-package org.apache.kerby.xdr;
-
-import org.apache.kerby.xdr.type.XdrUnion;
-import org.apache.kerby.xdr.util.HexUtil;
-import org.junit.Test;
-
-import java.io.IOException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class XdrUnionTest {
-    @Test
-    public void testEncoding() throws IOException {
-        UnionFileTypeSwitch fileType = new UnionFileTypeSwitch(FileKind.EXEC);
-        testEncodingWith(fileType, "0x00 00 00 02 00 00 00 04 6c 69 73 70");
-    }
-
-    private void testEncodingWith(UnionFileTypeSwitch value, String expectedEncoding) throws IOException {
-        byte[] expected = HexUtil.hex2bytesFriendly(expectedEncoding);
-        XdrFieldInfo[] fieldInfos = {new XdrFieldInfo(0, value.getFileKind(), value.getFileValue()),
-                new XdrFieldInfo(1, value.getArmKind(), value.getArmValue())};
-
-        XdrUnion aValue = new XdrUnionInstance(fieldInfos);
-
-        byte[] encodingBytes = aValue.encode();
-        assertThat(encodingBytes).isEqualTo(expected);
-    }
-
-
-    @Test
-    public void testDecoding() throws IOException {
-        UnionFileTypeSwitch fileType = new UnionFileTypeSwitch(FileKind.EXEC);
-        testDecodingWith(fileType, "0x00 00 00 02 00 00 00 04 6c 69 73 70");
-    }
-
-    private void testDecodingWith(UnionFileTypeSwitch expectedValue, String content) throws IOException {
-        XdrUnion decoded = new XdrUnionInstance();
-
-        decoded.decode(HexUtil.hex2bytesFriendly(content));
-
-        XdrFieldInfo[] fieldInfos = decoded.getValue().getXdrFieldInfos();
-        assertThat(fieldInfos.length).isEqualTo(2);
-        assertThat(fieldInfos[0].getDataType()).isEqualTo(expectedValue.getFileKind());
-        assertThat((FileKind) fieldInfos[0].getValue()).isEqualTo(expectedValue.getFileValue());
-        assertThat(fieldInfos[1].getDataType()).isEqualTo(expectedValue.getArmKind());
-        assertThat((String) fieldInfos[1].getValue()).isEqualTo(expectedValue.getArmValue());
-    }
-}
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.kerby.xdr;
+
+import org.apache.kerby.xdr.type.XdrUnion;
+import org.apache.kerby.xdr.util.HexUtil;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class XdrUnionTest {
+    @Test
+    public void testEncoding() throws IOException {
+        UnionFileTypeSwitch fileType = new UnionFileTypeSwitch(FileKind.EXEC);
+        testEncodingWith(fileType, "0x00 00 00 02 00 00 00 04 6c 69 73 70");
+    }
+
+    private void testEncodingWith(UnionFileTypeSwitch value, String expectedEncoding) throws IOException {
+        byte[] expected = HexUtil.hex2bytesFriendly(expectedEncoding);
+        XdrFieldInfo[] fieldInfos = {new XdrFieldInfo(0, value.getFileKind(), value.getFileValue()),
+                new XdrFieldInfo(1, value.getArmKind(), value.getArmValue())};
+
+        XdrUnion aValue = new XdrUnionInstance(fieldInfos);
+
+        byte[] encodingBytes = aValue.encode();
+        assertThat(encodingBytes).isEqualTo(expected);
+    }
+
+
+    @Test
+    public void testDecoding() throws IOException {
+        UnionFileTypeSwitch fileType = new UnionFileTypeSwitch(FileKind.EXEC);
+        testDecodingWith(fileType, "0x00 00 00 02 00 00 00 04 6c 69 73 70");
+    }
+
+    private void testDecodingWith(UnionFileTypeSwitch expectedValue, String content) throws IOException {
+        XdrUnion decoded = new XdrUnionInstance();
+
+        decoded.decode(HexUtil.hex2bytesFriendly(content));
+
+        XdrFieldInfo[] fieldInfos = decoded.getValue().getXdrFieldInfos();
+        assertThat(fieldInfos.length).isEqualTo(2);
+        assertThat(fieldInfos[0].getDataType()).isEqualTo(expectedValue.getFileKind());
+        assertThat((FileKind) fieldInfos[0].getValue()).isEqualTo(expectedValue.getFileValue());
+        assertThat(fieldInfos[1].getDataType()).isEqualTo(expectedValue.getArmKind());
+        assertThat((String) fieldInfos[1].getValue()).isEqualTo(expectedValue.getArmValue());
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a608a460/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnsignedIntegerTest.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnsignedIntegerTest.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnsignedIntegerTest.java
index 5b9c9b6..118f094 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnsignedIntegerTest.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnsignedIntegerTest.java
@@ -1,69 +1,69 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- */
-package org.apache.kerby.xdr;
-
-import org.apache.kerby.xdr.type.XdrUnsignedInteger;
-import org.apache.kerby.xdr.util.HexUtil;
-import org.junit.Test;
-
-import java.io.IOException;
-
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class XdrUnsignedIntegerTest {
-    @Test
-    public void testEncoding() throws IOException {
-        testEncodingWith("0", "0x00 00 00 00");
-        testEncodingWith("1", "0x00 00 00 01");
-        testEncodingWith("2", "0x00 00 00 02");
-        testEncodingWith("1234567890", "0x49 96 02 D2");
-        testEncodingWith("2147483647", "0x7F FF FF FF");
-        testEncodingWith("2147483648", "0x80 00 00 00");
-        testEncodingWith("4294967295", "0xFF FF FF FF");
-    }
-
-    private void testEncodingWith(String value, String expectedEncoding) throws IOException {
-        byte[] expected = HexUtil.hex2bytesFriendly(expectedEncoding);
-        XdrUnsignedInteger aValue = new XdrUnsignedInteger(value);
-
-        byte[] encodingBytes = aValue.encode();
-        assertThat(encodingBytes).isEqualTo(expected);
-    }
-
-
-    @Test
-    public void testDecoding() throws IOException {
-        testDecodingWith("0", "0x00 00 00 00");
-        testDecodingWith("1", "0x00 00 00 01");
-        testDecodingWith("2", "0x00 00 00 02");
-        testDecodingWith("1234567890", "0x49 96 02 D2");
-        testDecodingWith("2147483647", "0x7F FF FF FF");
-        testDecodingWith("2147483648", "0x80 00 00 00");
-        testDecodingWith("4294967295", "0xFF FF FF FF");
-    }
-
-    private void testDecodingWith(String expectedValue, String content) throws IOException {
-        XdrUnsignedInteger decoded = new XdrUnsignedInteger();
-
-        decoded.decode(HexUtil.hex2bytesFriendly(content));
-        assertThat(decoded.getValue().toString()).isEqualTo(expectedValue);
-    }
-}
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.kerby.xdr;
+
+import org.apache.kerby.xdr.type.XdrUnsignedInteger;
+import org.apache.kerby.xdr.util.HexUtil;
+import org.junit.Test;
+
+import java.io.IOException;
+
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class XdrUnsignedIntegerTest {
+    @Test
+    public void testEncoding() throws IOException {
+        testEncodingWith("0", "0x00 00 00 00");
+        testEncodingWith("1", "0x00 00 00 01");
+        testEncodingWith("2", "0x00 00 00 02");
+        testEncodingWith("1234567890", "0x49 96 02 D2");
+        testEncodingWith("2147483647", "0x7F FF FF FF");
+        testEncodingWith("2147483648", "0x80 00 00 00");
+        testEncodingWith("4294967295", "0xFF FF FF FF");
+    }
+
+    private void testEncodingWith(String value, String expectedEncoding) throws IOException {
+        byte[] expected = HexUtil.hex2bytesFriendly(expectedEncoding);
+        XdrUnsignedInteger aValue = new XdrUnsignedInteger(value);
+
+        byte[] encodingBytes = aValue.encode();
+        assertThat(encodingBytes).isEqualTo(expected);
+    }
+
+
+    @Test
+    public void testDecoding() throws IOException {
+        testDecodingWith("0", "0x00 00 00 00");
+        testDecodingWith("1", "0x00 00 00 01");
+        testDecodingWith("2", "0x00 00 00 02");
+        testDecodingWith("1234567890", "0x49 96 02 D2");
+        testDecodingWith("2147483647", "0x7F FF FF FF");
+        testDecodingWith("2147483648", "0x80 00 00 00");
+        testDecodingWith("4294967295", "0xFF FF FF FF");
+    }
+
+    private void testDecodingWith(String expectedValue, String content) throws IOException {
+        XdrUnsignedInteger decoded = new XdrUnsignedInteger();
+
+        decoded.decode(HexUtil.hex2bytesFriendly(content));
+        assertThat(decoded.getValue().toString()).isEqualTo(expectedValue);
+    }
+}


Mime
View raw message