directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r239371 - in /directory/protocol-providers/kerberos/branches/refactor-to-chain/src/test/org/apache/kerberos: kdc/TestUtils.java messages/value/OptionsTest.java
Date Tue, 23 Aug 2005 07:18:04 GMT
Author: erodriguez
Date: Tue Aug 23 00:17:58 2005
New Revision: 239371

URL: http://svn.apache.org/viewcvs?rev=239371&view=rev
Log:
Reformatting:  imports, whitespace, line breaks, or code convention.

Modified:
    directory/protocol-providers/kerberos/branches/refactor-to-chain/src/test/org/apache/kerberos/kdc/TestUtils.java
    directory/protocol-providers/kerberos/branches/refactor-to-chain/src/test/org/apache/kerberos/messages/value/OptionsTest.java

Modified: directory/protocol-providers/kerberos/branches/refactor-to-chain/src/test/org/apache/kerberos/kdc/TestUtils.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/kerberos/branches/refactor-to-chain/src/test/org/apache/kerberos/kdc/TestUtils.java?rev=239371&r1=239370&r2=239371&view=diff
==============================================================================
--- directory/protocol-providers/kerberos/branches/refactor-to-chain/src/test/org/apache/kerberos/kdc/TestUtils.java
(original)
+++ directory/protocol-providers/kerberos/branches/refactor-to-chain/src/test/org/apache/kerberos/kdc/TestUtils.java
Tue Aug 23 00:17:58 2005
@@ -16,150 +16,191 @@
  */
 package org.apache.kerberos.kdc;
 
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+public class TestUtils
+{
+    public static char[] getControlDocument( String resource ) throws IOException
+    {
+        InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream( resource
);
+
+        Reader reader = new InputStreamReader( new BufferedInputStream( is ) );
+
+        CharArrayWriter writer = new CharArrayWriter();
+
+        try
+        {
+            char[] buf = new char[ 2048 ];
+            int len = 0;
+            while ( len >= 0 )
+            {
+                len = reader.read( buf );
+                if ( len > 0 )
+                {
+                    writer.write( buf, 0, len );
+                }
+            }
+        }
+        finally
+        {
+            try
+            {
+                reader.close();
+            }
+            catch ( IOException ioe )
+            {
+            }
+        }
+
+        char[] isca = writer.toCharArray();
+        return isca;
+    }
+
+    public static byte[] getBytesFromResource( String resource ) throws IOException
+    {
+        InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream( resource
);
+
+        BufferedInputStream stream = new BufferedInputStream( is );
+        int len = stream.available();
+        byte[] bytes = new byte[ len ];
+        stream.read( bytes, 0, len );
+
+        return bytes;
+    }
+
+    public static void hexdump( byte[] data )
+    {
+        hexdump( data, true );
+    }
+
+    public static void hexdump( byte[] data, boolean delimit )
+    {
+        String delimiter = new String( "-------------------------------------------------"
);
+
+        if ( delimit )
+        {
+            System.out.println( delimiter );
+        }
+
+        int lineLength = 0;
+        for ( int ii = 0; ii < data.length; ii++ )
+        {
+            System.out.print( byte2hexString( data[ ii ] ) + " " );
+            lineLength++;
+            
+            if ( lineLength == 8 )
+            {
+                System.out.print( "  " );
+            }
+            
+            if ( lineLength == 16 )
+            {
+                System.out.println();
+                lineLength = 0;
+            }
+        }
+
+        if ( delimit )
+        {
+            System.out.println();
+            System.out.println( delimiter );
+        }
+    }
+
+    public static final String[] hex_digit = { "0", "1", "2", "3", "4", "5", "6", "7", "8",
"9",
+            "a", "b", "c", "d", "e", "f" };
+
+    public static String byte2hexString( byte x )
+    {
+        String s = "";
+        for ( int ii = 0; ii < 2; ii++ )
+        {
+            s = hex_digit[ ( ( ( x ) & 0xff ) & ( 15 << ( ii * 4 ) ) ) >>>
( ii * 4 ) ] + s;
+        }
+
+        return s;
+    }
+
+    public static String int2hexString( int x )
+    {
+        String s = "";
+        for ( int ii = 0; ii < 8; ii++ )
+        {
+            s = hex_digit[ ( x & ( 15 << ( ii * 4 ) ) ) >>> ( ii * 4 )
] + s;
+        }
+
+        return s;
+    }
+
+    public static String int2binString( int x )
+    {
+        String s = "";
+        for ( int ii = 0; ii < 32; ii++ )
+        {
+            if ( ( ii > 0 ) && ( ii % 4 == 0 ) ) 
+            {
+                s = " " + s;
+            }
+
+            s = hex_digit[ ( x & ( 1 << ii ) ) >>> ii ] + s;
+        }
+
+        return s;
+    }
+
+    public static String long2hexString( long x )
+    {
+        String s = "";
+        for ( int ii = 0; ii < 16; ii++ )
+        {
+            s = hex_digit[ (int) ( ( x & ( 15L << ( ii * 4 ) ) ) >>> (
ii * 4 ) ) ] + s;
+        }
+
+        return s;
+    }
+
+    public static String long2binString( long x )
+    {
+        String s = "";
+        for ( int ii = 0; ii < 64; ii++ )
+        {
+            if ( ( ii > 0 ) && ( ii % 4 == 0 ) )
+            {
+                s = " " + s;
+            }
+
+            s = hex_digit[ (int) ( ( x & ( 1L << ii ) ) >>> ii ) ] + s;
+        }
+
+        return s;
+    }
+
+    public static String byte2hexString( byte[] input )
+    {
+        return byte2hexString( input, 0, input.length );
+    }
+
+    public static String byte2hexString( byte[] input, int offset )
+    {
+        return byte2hexString( input, offset, input.length );
+    }
+
+    public static String byte2hexString( byte[] input, int offset, int length )
+    {
+        String result = "";
+        for ( int ii = 0; ii < length; ii++ )
+        {
+            if ( ii + offset < input.length )
+            {
+                result += byte2hexString( input[ ii + offset ] );
+            }
+        }
 
-public class TestUtils {
-
-	public static char[] getControlDocument(String resource) throws IOException
-    {
-		InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream(resource);
-
-		Reader reader = new InputStreamReader(new BufferedInputStream(is));
-
-		CharArrayWriter writer = new CharArrayWriter();
-
-		try {
-			char[] buf = new char[2048];
-			int len = 0;
-			while (len >= 0) {
-				len = reader.read(buf);
-				if (len > 0)
-					writer.write(buf, 0, len);
-			}
-		} finally {
-			try {
-				reader.close();
-			} catch (IOException ioe) {
-			}
-		}
-
-		char[] isca = writer.toCharArray();
-		return isca;
-	}
-
-	public static byte[] getBytesFromResource(String resource) throws IOException
-    {
-		InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream(resource);
-		
-		BufferedInputStream stream = new BufferedInputStream(is);
-		int len = stream.available();
-		byte[] bytes = new byte[len];
-		stream.read(bytes, 0, len);
-		return bytes;
-	}
-	
-	public static void hexdump(byte[] data)
-    {
-		hexdump(data, true);
-	}
-	
-	public static void hexdump(byte[] data, boolean delimit)
-    {
-		String delimiter = new String("-------------------------------------------------");
-		
-		if (delimit)
-			System.out.println(delimiter);
-		
-		int lineLength = 0;
-		for (int i = 0;i < data.length; i++) {
-			System.out.print(byte2hexString(data[i]) + " ");
-			lineLength++;
-			if (lineLength == 8) {
-				System.out.print("  ");
-			}
-			if (lineLength == 16) {
-				System.out.println();
-				lineLength = 0;
-			}
-		}
-		if (delimit) {
-			System.out.println();
-			System.out.println(delimiter);
-		}
-	}
-
-	public static final String[] hex_digit =
-    {
-		"0", "1", "2", "3", "4", "5", "6", "7",
-		"8", "9", "a", "b", "c", "d", "e", "f"
-	};
-
-	public static String byte2hexString(byte x)
-    {
-		String s = "";
-		for (int i = 0; i < 2; i++) {
-			s = hex_digit[(((x) & 0xff) & (15 << (i * 4))) >>> (i * 4)] + s;
-		}
-		return s;
-	}
-
-	public static String int2hexString(int x)
-    {
-		String s = "";
-		for (int i = 0; i < 8; i++) {
-			s = hex_digit[(x & (15 << (i * 4))) >>> (i * 4)] + s;
-		}
-		return s;
-	}
-
-	public static String int2binString(int x)
-    {
-		String s = "";
-		for (int i = 0; i < 32; i++) {
-			if ((i > 0) && (i % 4 == 0)) s = " " + s;
-			s = hex_digit[(x & (1 << i)) >>> i] + s;
-		}
-		return s;
-	}
-
-	public static String long2hexString(long x)
-    {
-		String s = "";
-		for (int i = 0; i < 16; i++) {
-			s = hex_digit[(int)((x & (15L << (i * 4))) >>> (i * 4))] + s;
-		}
-		return s;
-	}
-
-	public static String long2binString(long x)
-    {
-		String s = "";
-		for (int i = 0; i < 64; i++) {
-			if ((i > 0) && (i % 4 == 0)) s = " " + s;
-			s = hex_digit[(int)((x & (1L << i)) >>> i)] + s;
-		}
-		return s;
-	}
-
-	public static String byte2hexString(byte[] input)
-    {
-		return byte2hexString(input, 0, input.length);
-	}
-
-	public static String byte2hexString(byte[] input, int offset)
-    {
-		return byte2hexString(input, offset, input.length);
-	}
-
-	public static String byte2hexString(byte[] input, int offset, int length)
-    {
-		String result = "";
-		for (int i = 0; i < length; i++) {
-			if (i + offset < input.length) {
-				result += byte2hexString(input[i + offset]);
-			}
-		}
-		return result;
-	}
+        return result;
+    }
 }
-

Modified: directory/protocol-providers/kerberos/branches/refactor-to-chain/src/test/org/apache/kerberos/messages/value/OptionsTest.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/kerberos/branches/refactor-to-chain/src/test/org/apache/kerberos/messages/value/OptionsTest.java?rev=239371&r1=239370&r2=239371&view=diff
==============================================================================
--- directory/protocol-providers/kerberos/branches/refactor-to-chain/src/test/org/apache/kerberos/messages/value/OptionsTest.java
(original)
+++ directory/protocol-providers/kerberos/branches/refactor-to-chain/src/test/org/apache/kerberos/messages/value/OptionsTest.java
Tue Aug 23 00:17:58 2005
@@ -16,39 +16,38 @@
  */
 package org.apache.kerberos.messages.value;
 
-import junit.framework.TestCase;
-
 import java.util.Arrays;
 
+import junit.framework.TestCase;
+
 public class OptionsTest extends TestCase
- {
-    private byte[] fpriOptions = {(byte) 0x50, (byte)0x00, (byte)0x00, (byte)0x10};
+{
+    private byte[] fpriOptions = { (byte) 0x50, (byte) 0x00, (byte) 0x00, (byte) 0x10 };
 
     public void testToString()
     {
         TicketFlags flags = new TicketFlags();
-		flags.set(TicketFlags.FORWARDABLE);
-		flags.set(TicketFlags.PROXIABLE);
-		flags.set(TicketFlags.RENEWABLE);
-		flags.set(TicketFlags.INITIAL);
-        assertEquals(flags.toString(), "FORWARDABLE PROXIABLE RENEWABLE INITIAL");
+        flags.set( TicketFlags.FORWARDABLE );
+        flags.set( TicketFlags.PROXIABLE );
+        flags.set( TicketFlags.RENEWABLE );
+        flags.set( TicketFlags.INITIAL );
+        assertEquals( flags.toString(), "FORWARDABLE PROXIABLE RENEWABLE INITIAL" );
     }
 
-	public void testDuplicateSetting()
+    public void testDuplicateSetting()
     {
-		TicketFlags flags = new TicketFlags();
-        flags.set(TicketFlags.MAY_POSTDATE);
-		flags.set(TicketFlags.FORWARDABLE);
-		flags.set(TicketFlags.PROXIABLE);
-        flags.set(TicketFlags.MAY_POSTDATE);
-		flags.set(TicketFlags.RENEWABLE);
-        assertEquals(flags.toString(), "FORWARDABLE PROXIABLE MAY_POSTDATE RENEWABLE");
-	}
+        TicketFlags flags = new TicketFlags();
+        flags.set( TicketFlags.MAY_POSTDATE );
+        flags.set( TicketFlags.FORWARDABLE );
+        flags.set( TicketFlags.PROXIABLE );
+        flags.set( TicketFlags.MAY_POSTDATE );
+        flags.set( TicketFlags.RENEWABLE );
+        assertEquals( flags.toString(), "FORWARDABLE PROXIABLE MAY_POSTDATE RENEWABLE" );
+    }
 
     public void testConstruction()
     {
-		KdcOptions options = new KdcOptions(fpriOptions);
-        assertTrue(Arrays.equals(options.getBytes(), fpriOptions));
+        KdcOptions options = new KdcOptions( fpriOptions );
+        assertTrue( Arrays.equals( options.getBytes(), fpriOptions ) );
     }
 }
-



Mime
View raw message