harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r440340 [1/5] - /incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/
Date Tue, 05 Sep 2006 13:39:20 GMT
Author: smishura
Date: Tue Sep  5 06:39:17 2006
New Revision: 440340

URL: http://svn.apache.org/viewvc?view=rev&rev=440340
Log:
Set eol-style=native

Modified:
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_AvailTest.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_BitSet.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_CollectionTest.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Configuration.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DecimalFormat.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DeleteOnExitTest.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DummyPKCS12Keystore.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Exec.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Field.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Format.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetLocal.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetResource.java   (props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpConnector.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServer.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServerSocket.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpSocket.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ListTest.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MapTest2.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MessageFormat.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_NetworkInterface.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PermissionCollection.java   (props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PlatformFile.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PortManager.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProcessReadWriteTest.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderJCE.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderRSA.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderTrust.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_I1.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_I2.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_ParentException.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_SubException.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ServerSocket.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SetTest.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SimpleDateFormat.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Socket.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringReader.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringWriter.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestProvider.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en_US.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR_VAR.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TimeZone.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_URLConnector.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableCollectionTest.java   (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableMapTest.java   (contents, props changed)

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_AvailTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_AvailTest.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_AvailTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_AvailTest.java Tue Sep  5 06:39:17 2006
@@ -1,104 +1,104 @@
-/* Copyright 2002, 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.support;
-
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-public class Support_AvailTest {
-
-	public static void main(String[] args) {
-		// This test is for:
-
-		// This program accepts from stdin a
-		// string of the form '<int1> <int2> <data>'
-		// where data is some bytes, <int1> is the length of the whole string
-		// and <int2> is the length in bytes of <data> (all bytes until the end
-		// of
-		// the input)
-
-		// If the string is formatted correctly, and the available method works
-		// the string "true" will be sent to stdout, otherwise "false"
-		String output = "true";
-		try {
-			FileInputStream myin = new FileInputStream(FileDescriptor.in);
-			StringBuffer input = new StringBuffer("");
-
-			try {
-				Thread.sleep(500);
-			} catch (Exception sleepException) {
-			}
-
-			int real = myin.available();
-			int expected;
-			int c = 0;
-			while (true) {
-				c = myin.read();
-				if (c == ' ' || c == -1)
-					break;
-				input.append((char) c);
-			}
-			expected = Integer.parseInt(input.toString());
-			// Verify correct value at start of read
-			if (real != expected)
-				output = "Failed avail test1 - " + real + "!=" + expected;
-
-			c = 0;
-			input = new StringBuffer("");
-			while (true) {
-				c = myin.read();
-				if (c == ' ' || c == -1)
-					break;
-				input.append((char) c);
-			}
-			expected = Integer.parseInt(input.toString());
-			real = myin.available();
-			// Verify value at middle of reading
-			// This test doesn't work on Windows, at present 
-			// if(real != expected) output = "Failed avail test2 - " + real +
-			// "!=" + expected;
-
-			// Verify value at end of reading
-			// loop to EOF, then check if available = 0
-			// replace this:
-			for (int i = 0; i < 5; i++)
-				myin.read();
-			// with:
-			// while(myin.read() != -1);
-
-			// The current for loop reads exactly to the end
-			// of the data, but is dependent on knowing the length of the data
-			// sent to it, which isn't nice
-
-			expected = 0;
-			real = myin.available();
-			if (real != 0)
-				output = "Failed avail test3 - " + real + "!=" + expected;
-
-		} catch (IOException e) {
-			output = "IOException during available() testing";
-		}
-
-		try {
-			FileOutputStream myout = new FileOutputStream(FileDescriptor.out);
-			myout.write(output.getBytes());
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-	}
-}
+/* Copyright 2002, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+public class Support_AvailTest {
+
+	public static void main(String[] args) {
+		// This test is for:
+
+		// This program accepts from stdin a
+		// string of the form '<int1> <int2> <data>'
+		// where data is some bytes, <int1> is the length of the whole string
+		// and <int2> is the length in bytes of <data> (all bytes until the end
+		// of
+		// the input)
+
+		// If the string is formatted correctly, and the available method works
+		// the string "true" will be sent to stdout, otherwise "false"
+		String output = "true";
+		try {
+			FileInputStream myin = new FileInputStream(FileDescriptor.in);
+			StringBuffer input = new StringBuffer("");
+
+			try {
+				Thread.sleep(500);
+			} catch (Exception sleepException) {
+			}
+
+			int real = myin.available();
+			int expected;
+			int c = 0;
+			while (true) {
+				c = myin.read();
+				if (c == ' ' || c == -1)
+					break;
+				input.append((char) c);
+			}
+			expected = Integer.parseInt(input.toString());
+			// Verify correct value at start of read
+			if (real != expected)
+				output = "Failed avail test1 - " + real + "!=" + expected;
+
+			c = 0;
+			input = new StringBuffer("");
+			while (true) {
+				c = myin.read();
+				if (c == ' ' || c == -1)
+					break;
+				input.append((char) c);
+			}
+			expected = Integer.parseInt(input.toString());
+			real = myin.available();
+			// Verify value at middle of reading
+			// This test doesn't work on Windows, at present 
+			// if(real != expected) output = "Failed avail test2 - " + real +
+			// "!=" + expected;
+
+			// Verify value at end of reading
+			// loop to EOF, then check if available = 0
+			// replace this:
+			for (int i = 0; i < 5; i++)
+				myin.read();
+			// with:
+			// while(myin.read() != -1);
+
+			// The current for loop reads exactly to the end
+			// of the data, but is dependent on knowing the length of the data
+			// sent to it, which isn't nice
+
+			expected = 0;
+			real = myin.available();
+			if (real != 0)
+				output = "Failed avail test3 - " + real + "!=" + expected;
+
+		} catch (IOException e) {
+			output = "IOException during available() testing";
+		}
+
+		try {
+			FileOutputStream myout = new FileOutputStream(FileDescriptor.out);
+			myout.write(output.getBytes());
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_AvailTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_BitSet.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_BitSet.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_BitSet.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_BitSet.java Tue Sep  5 06:39:17 2006
@@ -1,189 +1,189 @@
-/* Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.support;
-
-public class Support_BitSet {
-	private long[] bits;
-
-	private static final int ELM_SIZE = 64; // Size in bits of the data type
-
-	// being used in the bits array
-
-	/**
-	 * Create a new BitSet with size equal to 64 bits
-	 * 
-	 * @return The number of bits contained in this BitSet.
-	 * 
-	 * @see #clear
-	 * @see #set
-	 */
-	public Support_BitSet() {
-		this(64);
-	}
-
-	/**
-	 * Create a new BitSet with size equal to nbits. If nbits is not a multiple
-	 * of 64, then create a BitSet with size nbits rounded to the next closest
-	 * multiple of 64.
-	 * 
-	 * @exception NegativeArraySizeException
-	 *                if nbits < 0.
-	 * @see #clear
-	 * @see #set
-	 */
-	public Support_BitSet(int nbits) {
-		if (nbits >= 0)
-			bits = new long[(nbits / ELM_SIZE) + (nbits % ELM_SIZE > 0 ? 1 : 0)];
-		else
-			throw new NegativeArraySizeException();
-	}
-
-	/**
-	 * Clears the bit at index pos. Grows the BitSet if pos > size.
-	 * 
-	 * @param pos
-	 *            int
-	 * 
-	 * @exception IndexOutOfBoundsException
-	 *                when pos < 0
-	 * @see #set
-	 */
-	public void clear(int pos) {
-		if (pos >= 0) {
-			if (pos < bits.length * ELM_SIZE)
-				bits[pos / ELM_SIZE] &= ~(1L << (pos % ELM_SIZE));
-			else
-				growBits(pos); // Bit is cleared for free if we have to grow
-		} else
-			throw new IndexOutOfBoundsException("Negative index specified");
-	}
-
-	/**
-	 * Retrieve the bit at index pos. Grows the BitSet if pos > size.
-	 * 
-	 * @param pos
-	 *            int
-	 * @return A boolean value indicating whether the bit at pos has been set.
-	 *         Answers false if pos > size().
-	 * 
-	 * @exception IndexOutOfBoundsException
-	 *                when pos < 0
-	 * @see #set
-	 * @see #clear
-	 */
-	public boolean get(int pos) {
-		if (pos >= 0) {
-			if (pos < bits.length * ELM_SIZE)
-				return (bits[pos / ELM_SIZE] & (1L << (pos % ELM_SIZE))) != 0;
-			return false;
-		} else
-			throw new IndexOutOfBoundsException("Negative index specified");
-	}
-
-	/**
-	 * Increase the size of the internal array to accomodate pos bits. The new
-	 * array max index will be a multiple of 64
-	 * 
-	 * @param pos
-	 *            int The index the new array needs to be able to access
-	 */
-	private void growBits(int pos) {
-		pos++; // Inc to get correct bit count
-		long[] tempBits = new long[(pos / ELM_SIZE)
-				+ (pos % ELM_SIZE > 0 ? 1 : 0)];
-		System.arraycopy(bits, 0, tempBits, 0, bits.length);
-		bits = tempBits;
-	}
-
-	/**
-	 * Sets the bit at index pos to 1. Grows the BitSet if pos > size.
-	 * 
-	 * @param pos
-	 *            int
-	 * 
-	 * @exception IndexOutOfBoundsException
-	 *                when pos < 0
-	 * @see #clear
-	 */
-	public void set(int pos) {
-		if (pos >= 0) {
-			if (pos >= bits.length * ELM_SIZE)
-				growBits(pos);
-			bits[pos / ELM_SIZE] |= 1L << (pos % ELM_SIZE);
-		} else
-			throw new IndexOutOfBoundsException("Negative index specified");
-	}
-
-	/**
-	 * Clears the bit at index pos.
-	 * 
-	 * @return The number of bits contained in this BitSet.
-	 * 
-	 * @see #BitSet
-	 * @see #clear
-	 * @see #set
-	 */
-	public int size() {
-		return bits.length * ELM_SIZE;
-	}
-
-	/**
-	 * Answers a string containing a concise, human-readable description of the
-	 * receiver.
-	 * 
-	 * @return A comma delimited list of the indices of all bits that are set.
-	 */
-	public String toString() {
-		StringBuffer sb = new StringBuffer(bits.length / 2);
-		int bitCount = 0;
-		sb.append('{');
-		boolean comma = false;
-		for (int i = 0; i < bits.length; i++) {
-			if (bits[i] == 0) {
-				bitCount += ELM_SIZE;
-				continue;
-			}
-			for (int j = 0; j < ELM_SIZE; j++) {
-				if (((bits[i] & (1L << j)) != 0)) {
-					if (comma)
-						sb.append(", ");
-					sb.append(bitCount);
-					comma = true;
-				}
-				bitCount++;
-			}
-		}
-		sb.append('}');
-		return sb.toString();
-	}
-
-	/**
-	 * Returns the number of bits up to and including the highest bit set.
-	 * 
-	 */
-	public int length() {
-		int idx = bits.length - 1;
-		while (idx >= 0 && bits[idx] == 0)
-			--idx;
-		if (idx == -1)
-			return 0;
-		int i = ELM_SIZE - 1;
-		long val = bits[idx];
-		while ((val & (1L << i)) == 0 && i > 0)
-			i--;
-		return idx * ELM_SIZE + i + 1;
-	}
-}
+/* Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+public class Support_BitSet {
+	private long[] bits;
+
+	private static final int ELM_SIZE = 64; // Size in bits of the data type
+
+	// being used in the bits array
+
+	/**
+	 * Create a new BitSet with size equal to 64 bits
+	 * 
+	 * @return The number of bits contained in this BitSet.
+	 * 
+	 * @see #clear
+	 * @see #set
+	 */
+	public Support_BitSet() {
+		this(64);
+	}
+
+	/**
+	 * Create a new BitSet with size equal to nbits. If nbits is not a multiple
+	 * of 64, then create a BitSet with size nbits rounded to the next closest
+	 * multiple of 64.
+	 * 
+	 * @exception NegativeArraySizeException
+	 *                if nbits < 0.
+	 * @see #clear
+	 * @see #set
+	 */
+	public Support_BitSet(int nbits) {
+		if (nbits >= 0)
+			bits = new long[(nbits / ELM_SIZE) + (nbits % ELM_SIZE > 0 ? 1 : 0)];
+		else
+			throw new NegativeArraySizeException();
+	}
+
+	/**
+	 * Clears the bit at index pos. Grows the BitSet if pos > size.
+	 * 
+	 * @param pos
+	 *            int
+	 * 
+	 * @exception IndexOutOfBoundsException
+	 *                when pos < 0
+	 * @see #set
+	 */
+	public void clear(int pos) {
+		if (pos >= 0) {
+			if (pos < bits.length * ELM_SIZE)
+				bits[pos / ELM_SIZE] &= ~(1L << (pos % ELM_SIZE));
+			else
+				growBits(pos); // Bit is cleared for free if we have to grow
+		} else
+			throw new IndexOutOfBoundsException("Negative index specified");
+	}
+
+	/**
+	 * Retrieve the bit at index pos. Grows the BitSet if pos > size.
+	 * 
+	 * @param pos
+	 *            int
+	 * @return A boolean value indicating whether the bit at pos has been set.
+	 *         Answers false if pos > size().
+	 * 
+	 * @exception IndexOutOfBoundsException
+	 *                when pos < 0
+	 * @see #set
+	 * @see #clear
+	 */
+	public boolean get(int pos) {
+		if (pos >= 0) {
+			if (pos < bits.length * ELM_SIZE)
+				return (bits[pos / ELM_SIZE] & (1L << (pos % ELM_SIZE))) != 0;
+			return false;
+		} else
+			throw new IndexOutOfBoundsException("Negative index specified");
+	}
+
+	/**
+	 * Increase the size of the internal array to accomodate pos bits. The new
+	 * array max index will be a multiple of 64
+	 * 
+	 * @param pos
+	 *            int The index the new array needs to be able to access
+	 */
+	private void growBits(int pos) {
+		pos++; // Inc to get correct bit count
+		long[] tempBits = new long[(pos / ELM_SIZE)
+				+ (pos % ELM_SIZE > 0 ? 1 : 0)];
+		System.arraycopy(bits, 0, tempBits, 0, bits.length);
+		bits = tempBits;
+	}
+
+	/**
+	 * Sets the bit at index pos to 1. Grows the BitSet if pos > size.
+	 * 
+	 * @param pos
+	 *            int
+	 * 
+	 * @exception IndexOutOfBoundsException
+	 *                when pos < 0
+	 * @see #clear
+	 */
+	public void set(int pos) {
+		if (pos >= 0) {
+			if (pos >= bits.length * ELM_SIZE)
+				growBits(pos);
+			bits[pos / ELM_SIZE] |= 1L << (pos % ELM_SIZE);
+		} else
+			throw new IndexOutOfBoundsException("Negative index specified");
+	}
+
+	/**
+	 * Clears the bit at index pos.
+	 * 
+	 * @return The number of bits contained in this BitSet.
+	 * 
+	 * @see #BitSet
+	 * @see #clear
+	 * @see #set
+	 */
+	public int size() {
+		return bits.length * ELM_SIZE;
+	}
+
+	/**
+	 * Answers a string containing a concise, human-readable description of the
+	 * receiver.
+	 * 
+	 * @return A comma delimited list of the indices of all bits that are set.
+	 */
+	public String toString() {
+		StringBuffer sb = new StringBuffer(bits.length / 2);
+		int bitCount = 0;
+		sb.append('{');
+		boolean comma = false;
+		for (int i = 0; i < bits.length; i++) {
+			if (bits[i] == 0) {
+				bitCount += ELM_SIZE;
+				continue;
+			}
+			for (int j = 0; j < ELM_SIZE; j++) {
+				if (((bits[i] & (1L << j)) != 0)) {
+					if (comma)
+						sb.append(", ");
+					sb.append(bitCount);
+					comma = true;
+				}
+				bitCount++;
+			}
+		}
+		sb.append('}');
+		return sb.toString();
+	}
+
+	/**
+	 * Returns the number of bits up to and including the highest bit set.
+	 * 
+	 */
+	public int length() {
+		int idx = bits.length - 1;
+		while (idx >= 0 && bits[idx] == 0)
+			--idx;
+		if (idx == -1)
+			return 0;
+		int i = ELM_SIZE - 1;
+		long val = bits[idx];
+		while ((val & (1L << i)) == 0 && i > 0)
+			i--;
+		return idx * ELM_SIZE + i + 1;
+	}
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_BitSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_CollectionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_CollectionTest.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_CollectionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_CollectionTest.java Tue Sep  5 06:39:17 2006
@@ -1,104 +1,104 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.support;
-
-import java.util.Collection;
-import java.util.TreeSet;
-
-/**
- * @tests java.util.Collection
- */
-public class Support_CollectionTest extends junit.framework.TestCase {
-
-	Collection col; // must contain the Integers 0 to 99
-
-	public Support_CollectionTest(String p1) {
-		super(p1);
-	}
-
-	public Support_CollectionTest(String p1, Collection c) {
-		super(p1);
-		col = c;
-	}
-
-	public void runTest() {
-		new Support_UnmodifiableCollectionTest("", col).runTest();
-
-		// setup
-		Collection myCollection = new TreeSet();
-		myCollection.add(new Integer(101));
-		myCollection.add(new Integer(102));
-		myCollection.add(new Integer(103));
-
-		// add
-		assertTrue("CollectionTest - a) add did not work", col.add(new Integer(
-				101)));
-		assertTrue("CollectionTest - b) add did not work", col
-				.contains(new Integer(101)));
-
-		// remove
-		assertTrue("CollectionTest - a) remove did not work", col
-				.remove(new Integer(101)));
-		assertTrue("CollectionTest - b) remove did not work", !col
-				.contains(new Integer(101)));
-
-		// addAll
-		assertTrue("CollectionTest - a) addAll failed", col
-				.addAll(myCollection));
-		assertTrue("CollectionTest - b) addAll failed", col
-				.containsAll(myCollection));
-
-		// containsAll
-		assertTrue("CollectionTest - a) containsAll failed", col
-				.containsAll(myCollection));
-		col.remove(new Integer(101));
-		assertTrue("CollectionTest - b) containsAll failed", !col
-				.containsAll(myCollection));
-
-		// removeAll
-		assertTrue("CollectionTest - a) removeAll failed", col
-				.removeAll(myCollection));
-		assertTrue("CollectionTest - b) removeAll failed", !col
-				.removeAll(myCollection)); // should not change the colletion
-											// the 2nd time around
-		assertTrue("CollectionTest - c) removeAll failed", !col
-				.contains(new Integer(102)));
-		assertTrue("CollectionTest - d) removeAll failed", !col
-				.contains(new Integer(103)));
-
-		// retianAll
-		col.addAll(myCollection);
-		assertTrue("CollectionTest - a) retainAll failed", col
-				.retainAll(myCollection));
-		assertTrue("CollectionTest - b) retainAll failed", !col
-				.retainAll(myCollection)); // should not change the colletion
-											// the 2nd time around
-		assertTrue("CollectionTest - c) retainAll failed", col
-				.containsAll(myCollection));
-		assertTrue("CollectionTest - d) retainAll failed", !col
-				.contains(new Integer(0)));
-		assertTrue("CollectionTest - e) retainAll failed", !col
-				.contains(new Integer(50)));
-
-		// clear
-		col.clear();
-		assertTrue("CollectionTest - a) clear failed", col.isEmpty());
-		assertTrue("CollectionTest - b) clear failed", !col
-				.contains(new Integer(101)));
-
-	}
-
-}
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.util.Collection;
+import java.util.TreeSet;
+
+/**
+ * @tests java.util.Collection
+ */
+public class Support_CollectionTest extends junit.framework.TestCase {
+
+	Collection col; // must contain the Integers 0 to 99
+
+	public Support_CollectionTest(String p1) {
+		super(p1);
+	}
+
+	public Support_CollectionTest(String p1, Collection c) {
+		super(p1);
+		col = c;
+	}
+
+	public void runTest() {
+		new Support_UnmodifiableCollectionTest("", col).runTest();
+
+		// setup
+		Collection myCollection = new TreeSet();
+		myCollection.add(new Integer(101));
+		myCollection.add(new Integer(102));
+		myCollection.add(new Integer(103));
+
+		// add
+		assertTrue("CollectionTest - a) add did not work", col.add(new Integer(
+				101)));
+		assertTrue("CollectionTest - b) add did not work", col
+				.contains(new Integer(101)));
+
+		// remove
+		assertTrue("CollectionTest - a) remove did not work", col
+				.remove(new Integer(101)));
+		assertTrue("CollectionTest - b) remove did not work", !col
+				.contains(new Integer(101)));
+
+		// addAll
+		assertTrue("CollectionTest - a) addAll failed", col
+				.addAll(myCollection));
+		assertTrue("CollectionTest - b) addAll failed", col
+				.containsAll(myCollection));
+
+		// containsAll
+		assertTrue("CollectionTest - a) containsAll failed", col
+				.containsAll(myCollection));
+		col.remove(new Integer(101));
+		assertTrue("CollectionTest - b) containsAll failed", !col
+				.containsAll(myCollection));
+
+		// removeAll
+		assertTrue("CollectionTest - a) removeAll failed", col
+				.removeAll(myCollection));
+		assertTrue("CollectionTest - b) removeAll failed", !col
+				.removeAll(myCollection)); // should not change the colletion
+											// the 2nd time around
+		assertTrue("CollectionTest - c) removeAll failed", !col
+				.contains(new Integer(102)));
+		assertTrue("CollectionTest - d) removeAll failed", !col
+				.contains(new Integer(103)));
+
+		// retianAll
+		col.addAll(myCollection);
+		assertTrue("CollectionTest - a) retainAll failed", col
+				.retainAll(myCollection));
+		assertTrue("CollectionTest - b) retainAll failed", !col
+				.retainAll(myCollection)); // should not change the colletion
+											// the 2nd time around
+		assertTrue("CollectionTest - c) retainAll failed", col
+				.containsAll(myCollection));
+		assertTrue("CollectionTest - d) retainAll failed", !col
+				.contains(new Integer(0)));
+		assertTrue("CollectionTest - e) retainAll failed", !col
+				.contains(new Integer(50)));
+
+		// clear
+		col.clear();
+		assertTrue("CollectionTest - a) clear failed", col.isEmpty());
+		assertTrue("CollectionTest - b) clear failed", !col
+				.contains(new Integer(101)));
+
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_CollectionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Configuration.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Configuration.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Configuration.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Configuration.java Tue Sep  5 06:39:17 2006
@@ -1,435 +1,435 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.support;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Hashtable;
-
-/**
- * This class is responsible for providing the dynamic names and addresses for
- * the java.net classes. There are two directories which need to be placed on an
- * ftp server and an http server which should accompany this source. The
- * ftp-files have to be placed on an ftp server and have to be the root of a
- * user jcltest with password jclpass. The testres files must be available on an
- * HTTP server and the name and location can be configured below.
- */
-public class Support_Configuration {
-
-	public static String DomainAddress = "apache.org";
-
-	public static String WebName = "jcltest.";
-
-	public static final String HomeAddress;
-
-	public static String TestResourcesDir = "/testres231";
-
-	public static final String TestResources;
-
-	public static String HomeAddressResponse = "HTTP/1.1 200 OK";
-
-	public static String HomeAddressSoftware = "Apache/1.3.33 (Win32)";
-
-	public static String ProxyServerTestHost = "jcltest.apache.org";
-
-	public static String SocksServerTestHost = "jcltest.apache.org";
-
-	public static int SocksServerTestPort = 1080;
-
-	// Need an IP address that does not resolve to a host name
-	public static String UnresolvedIP = "192.168.99.99";
-
-	// the bytes for an address which represents an address which is not
-	// one of the addresses for any of our machines on which tests will run
-	// it is used to verify we get the expected error when we try to bind
-	// to an address that is not one of the machines local addresses
-	public static byte nonLocalAddressBytes[] = { 1, 0, 0, 0 };
-
-	public static String InetTestAddress = "localhost";
-
-	public static String InetTestIP = "127.0.0.1";
-
-	public static String InetTestAddress2 = "localhost";
-
-	public static String InetTestIP2 = "127.0.0.1";
-
-	public static byte[] InetTestCaddr = { 9, 26, -56, -111 };
-
-	public static int InetTestHashcode = 2130706433;
-
-	public static final String HomeAddress6 = "jcltest6.apache.org";
-
-	public static String IPv6GlobalAddressJcl4 = "FE80:0000:0000:0000:020D:60FF:FE0F:A776%4"; // this
-
-	public static String ProxyServerTestHostIPv6 = "jcltest6.apache.org";
-
-	public static String InetTestIP6 = "fe80::20d:60ff:fe24:7410";
-
-	public static String InetTestIP6LO = "::1";
-
-	// ip address that resolves to a host that is not present on the local
-	// network
-	// this allows us to check the timeouts for connect
-	public static String ResolvedNotExistingHost = "9.26.194.72";
-
-	/**
-	 * You can compute the hash code with the following code: try { String name =
-	 * "whatever.xxx.com";
-	 * System.out.println(InetAddress.getByName(name).hashCode()); } catch
-	 * (UnknownHostException e) {}
-	 */
-
-	/**
-	 * An address that resolves to more than one IP address so that the
-	 * getAllByName test has something to test.
-	 */
-	public static String SpecialInetTestAddress = "jcltestmultiple.apache.org";
-
-	public static int SpecialInetTestAddressNumber = 4;
-
-	/**
-	 * InetAlias1 and InetAlias2 must be different host names that resolve to
-	 * the same IP address.
-	 */
-	public static String InetAlias1 = "alias1.apache.org";
-
-	public static String InetAlias2 = "alias2.apache.org";
-
-	public static String FTPTestAddress = "jcltest:jclpass@localhost";
-
-	public static String URLConnectionLastModifiedString = "Mon, 14 Jun 1999 21:06:22 GMT";
-
-	public static long URLConnectionLastModified = 929394382000L;
-
-	public static long URLConnectionDate = 929106872000L;
-
-	public static boolean RunCommTests = false;
-
-	public static String Port1 = "COM1";
-
-	public static String Port2 = "COM2";
-
-	static Hashtable props = null;
-	static {
-		loadProperties();
-		HomeAddress = WebName + DomainAddress;
-		TestResources = HomeAddress + TestResourcesDir;
-	}
-
-	static void loadProperties() {
-		InputStream in = null;
-		Hashtable props = new Hashtable();
-
-		String iniName = System.getProperty("test.ini.file", "JCLAuto.ini");
-		if (System.getProperty("test.comm") != null) {
-			RunCommTests = true;
-		}
-
-		try {
-			in = new FileInputStream(iniName);
-		} catch (IOException e) {
-		} catch (Exception e) {
-			System.out.println("SupportConfiguration.loadProperties()");
-			System.out.println(e);
-			e.printStackTrace();
-		}
-		if (in == null) {
-			try {
-				Class cl = Class
-						.forName("com.ibm.support.Support_Configuration");
-				in = cl.getResourceAsStream(iniName);
-			} catch (ClassNotFoundException e) {
-			}
-		}
-		try {
-			if (in != null) {
-				load(in, props);
-			}
-		} catch (IOException e) {
-		}
-		if (props.size() == 0)
-			return;
-		String value;
-
-		value = (String) props.get("DomainAddress");
-		if (value != null)
-			DomainAddress = value;
-
-		value = (String) props.get("WebName");
-		if (value != null)
-			WebName = value;
-
-		value = (String) props.get("TestResourcesDir");
-		if (value != null)
-			TestResourcesDir = value;
-		value = (String) props.get("HomeAddressResponse");
-		if (value != null)
-			HomeAddressResponse = value;
-
-		value = (String) props.get("HomeAddressSoftware");
-		if (value != null)
-			HomeAddressSoftware = value;
-
-		value = (String) props.get("ProxyServerTestHost");
-		if (value != null)
-			ProxyServerTestHost = value;
-
-		value = (String) props.get("SocksServerTestHost");
-		if (value != null)
-			SocksServerTestHost = value;
-
-		value = (String) props.get("SocksServerTestPort");
-		if (value != null)
-			SocksServerTestPort = Integer.parseInt(value);
-
-		value = (String) props.get("UnresolvedIP");
-		if (value != null)
-			UnresolvedIP = value;
-
-		value = (String) props.get("InetTestAddress");
-		if (value != null)
-			InetTestAddress = value;
-
-		value = (String) props.get("InetTestIP");
-		if (value != null) {
-			InetTestIP = value;
-			byte[] addr = new byte[4];
-			int last = 0;
-			try {
-				for (int i = 0; i < 3; i++) {
-					int dot = InetTestIP.indexOf('.', last);
-					addr[i] = (byte) Integer.parseInt(InetTestIP.substring(
-							last, dot));
-					last = dot + 1;
-				}
-				addr[3] = (byte) Integer.parseInt(InetTestIP.substring(last));
-				InetTestCaddr = addr;
-			} catch (RuntimeException e) {
-				System.out.println("Error parsing InetTestIP (" + InetTestIP
-						+ ")");
-				System.out.println(e);
-			}
-		}
-
-		value = (String) props.get("NonLocalAddressBytes");
-		if (value != null) {
-			String nonLocalAddressBytesString = value;
-			byte[] addr = new byte[4];
-			int last = 0;
-			try {
-				for (int i = 0; i < 3; i++) {
-					int dot = nonLocalAddressBytesString.indexOf('.', last);
-					addr[i] = (byte) Integer
-							.parseInt(nonLocalAddressBytesString.substring(
-									last, dot));
-					last = dot + 1;
-				}
-				addr[3] = (byte) Integer.parseInt(nonLocalAddressBytesString
-						.substring(last));
-				nonLocalAddressBytes = addr;
-			} catch (RuntimeException e) {
-				System.out.println("Error parsing NonLocalAddressBytes ("
-						+ nonLocalAddressBytesString + ")");
-				System.out.println(e);
-			}
-		}
-
-		value = (String) props.get("InetTestAddress2");
-		if (value != null)
-			InetTestAddress2 = value;
-
-		value = (String) props.get("InetTestIP2");
-		if (value != null)
-			InetTestIP2 = value;
-
-		value = (String) props.get("InetTestHashcode");
-		if (value != null)
-			InetTestHashcode = Integer.parseInt(value);
-
-		value = (String) props.get("SpecialInetTestAddress");
-		if (value != null)
-			SpecialInetTestAddress = value;
-
-		value = (String) props.get("SpecialInetTestAddressNumber");
-		if (value != null)
-			SpecialInetTestAddressNumber = Integer.parseInt(value);
-
-		value = (String) props.get("FTPTestAddress");
-		if (value != null)
-			FTPTestAddress = value;
-
-		value = (String) props.get("URLConnectionLastModifiedString");
-		if (value != null)
-			URLConnectionLastModifiedString = value;
-
-		value = (String) props.get("URLConnectionLastModified");
-		if (value != null)
-			URLConnectionLastModified = Long.parseLong(value);
-
-		value = (String) props.get("URLConnectionDate");
-		if (value != null)
-			URLConnectionDate = Long.parseLong(value);
-
-		value = (String) props.get("Port1");
-		if (value != null)
-			Port1 = value;
-
-		value = (String) props.get("Port2");
-		if (value != null)
-			Port2 = value;
-
-		value = (String) props.get("InetTestIP6");
-		if (value != null)
-			InetTestIP6 = value;
-
-		value = (String) props.get("InetTestIP6LO");
-		if (value != null)
-			InetTestIP6LO = value;
-
-		value = (String) props.get("ProxyServerTestHostIPv6");
-		if (value != null)
-			ProxyServerTestHostIPv6 = value;
-
-		value = (String) props.get("ResolvedNotExistingHost");
-		if (value != null)
-			ResolvedNotExistingHost = value;
-
-		value = (String) props.get("InetAlias1");
-		if (value != null)
-			InetAlias1 = value;
-
-		value = (String) props.get("InetAlias2");
-		if (value != null)
-			InetAlias2 = value;
-
-		value = (String) props.get("IPv6GlobalAddressJcl4");
-		if (value != null)
-			IPv6GlobalAddressJcl4 = value;
-
-	}
-
-	static void load(InputStream in, Hashtable result) throws IOException {
-		int NONE = 0, SLASH = 1, UNICODE = 2, CONTINUE = 3, DONE = 4, IGNORE = 5;
-		int mode = NONE, unicode = 0, count = 0, nextChar;
-		StringBuffer key = new StringBuffer(), value = new StringBuffer(), buffer = key;
-		boolean firstChar = true;
-
-		while ((nextChar = in.read()) != -1) {
-			if (mode == UNICODE) {
-				int digit = Character.digit((char) nextChar, 16);
-				if (digit >= 0) {
-					unicode = (unicode << 4) + digit;
-					if (++count < 4)
-						continue;
-				}
-				mode = NONE;
-				buffer.append((char) unicode);
-				if (nextChar != '\n')
-					continue;
-			}
-			if (mode == SLASH) {
-				mode = NONE;
-				switch (nextChar) {
-				case '\r':
-					mode = CONTINUE; // Look for a following \n
-					continue;
-				case '\n':
-					mode = IGNORE; // Ignore whitespace on the next line
-					continue;
-				case 'b':
-					nextChar = '\b';
-					break;
-				case 'f':
-					nextChar = '\f';
-					break;
-				case 'n':
-					nextChar = '\n';
-					break;
-				case 'r':
-					nextChar = '\r';
-					break;
-				case 't':
-					nextChar = '\t';
-					break;
-				case 'u':
-					mode = UNICODE;
-					unicode = count = 0;
-					continue;
-				}
-			} else {
-				switch (nextChar) {
-				case '#':
-				case '!':
-					if (firstChar) {
-						while ((nextChar = in.read()) != -1)
-							if (nextChar == '\r' || nextChar == '\n')
-								break;
-						continue;
-					}
-					break;
-				case '\n':
-					if (mode == CONTINUE) { // Part of a \r\n sequence
-						mode = IGNORE; // Ignore whitespace on the next line
-						continue;
-					}
-					// fall into the next case
-				case '\r':
-					mode = NONE;
-					firstChar = true;
-					if (key.length() > 0 || buffer == value)
-						result.put(key.toString(), value.toString());
-					key.setLength(0);
-					value.setLength(0);
-					buffer = key;
-					continue;
-				case '\\':
-					mode = SLASH;
-					continue;
-				case ':':
-				case '=':
-					if (buffer == key) {
-						buffer = value;
-						continue;
-					}
-					break;
-				}
-				char c = (char) nextChar;
-				if ((c >= 0x1c && c <= 0x20) || (c >= 0x9 && c <= 0xd)) {
-					if (mode == CONTINUE)
-						mode = IGNORE;
-					if (buffer.length() == 0 || mode == IGNORE)
-						continue;
-					if (buffer == key) {
-						mode = DONE;
-						continue;
-					}
-				}
-				if (mode == IGNORE || mode == CONTINUE)
-					mode = NONE;
-			}
-			firstChar = false;
-			if (mode == DONE) {
-				buffer = value;
-				mode = NONE;
-			}
-			buffer.append((char) nextChar);
-		}
-		if (key.length() > 0 || buffer == value)
-			result.put(key.toString(), value.toString());
-	}
-
-}
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Hashtable;
+
+/**
+ * This class is responsible for providing the dynamic names and addresses for
+ * the java.net classes. There are two directories which need to be placed on an
+ * ftp server and an http server which should accompany this source. The
+ * ftp-files have to be placed on an ftp server and have to be the root of a
+ * user jcltest with password jclpass. The testres files must be available on an
+ * HTTP server and the name and location can be configured below.
+ */
+public class Support_Configuration {
+
+	public static String DomainAddress = "apache.org";
+
+	public static String WebName = "jcltest.";
+
+	public static final String HomeAddress;
+
+	public static String TestResourcesDir = "/testres231";
+
+	public static final String TestResources;
+
+	public static String HomeAddressResponse = "HTTP/1.1 200 OK";
+
+	public static String HomeAddressSoftware = "Apache/1.3.33 (Win32)";
+
+	public static String ProxyServerTestHost = "jcltest.apache.org";
+
+	public static String SocksServerTestHost = "jcltest.apache.org";
+
+	public static int SocksServerTestPort = 1080;
+
+	// Need an IP address that does not resolve to a host name
+	public static String UnresolvedIP = "192.168.99.99";
+
+	// the bytes for an address which represents an address which is not
+	// one of the addresses for any of our machines on which tests will run
+	// it is used to verify we get the expected error when we try to bind
+	// to an address that is not one of the machines local addresses
+	public static byte nonLocalAddressBytes[] = { 1, 0, 0, 0 };
+
+	public static String InetTestAddress = "localhost";
+
+	public static String InetTestIP = "127.0.0.1";
+
+	public static String InetTestAddress2 = "localhost";
+
+	public static String InetTestIP2 = "127.0.0.1";
+
+	public static byte[] InetTestCaddr = { 9, 26, -56, -111 };
+
+	public static int InetTestHashcode = 2130706433;
+
+	public static final String HomeAddress6 = "jcltest6.apache.org";
+
+	public static String IPv6GlobalAddressJcl4 = "FE80:0000:0000:0000:020D:60FF:FE0F:A776%4"; // this
+
+	public static String ProxyServerTestHostIPv6 = "jcltest6.apache.org";
+
+	public static String InetTestIP6 = "fe80::20d:60ff:fe24:7410";
+
+	public static String InetTestIP6LO = "::1";
+
+	// ip address that resolves to a host that is not present on the local
+	// network
+	// this allows us to check the timeouts for connect
+	public static String ResolvedNotExistingHost = "9.26.194.72";
+
+	/**
+	 * You can compute the hash code with the following code: try { String name =
+	 * "whatever.xxx.com";
+	 * System.out.println(InetAddress.getByName(name).hashCode()); } catch
+	 * (UnknownHostException e) {}
+	 */
+
+	/**
+	 * An address that resolves to more than one IP address so that the
+	 * getAllByName test has something to test.
+	 */
+	public static String SpecialInetTestAddress = "jcltestmultiple.apache.org";
+
+	public static int SpecialInetTestAddressNumber = 4;
+
+	/**
+	 * InetAlias1 and InetAlias2 must be different host names that resolve to
+	 * the same IP address.
+	 */
+	public static String InetAlias1 = "alias1.apache.org";
+
+	public static String InetAlias2 = "alias2.apache.org";
+
+	public static String FTPTestAddress = "jcltest:jclpass@localhost";
+
+	public static String URLConnectionLastModifiedString = "Mon, 14 Jun 1999 21:06:22 GMT";
+
+	public static long URLConnectionLastModified = 929394382000L;
+
+	public static long URLConnectionDate = 929106872000L;
+
+	public static boolean RunCommTests = false;
+
+	public static String Port1 = "COM1";
+
+	public static String Port2 = "COM2";
+
+	static Hashtable props = null;
+	static {
+		loadProperties();
+		HomeAddress = WebName + DomainAddress;
+		TestResources = HomeAddress + TestResourcesDir;
+	}
+
+	static void loadProperties() {
+		InputStream in = null;
+		Hashtable props = new Hashtable();
+
+		String iniName = System.getProperty("test.ini.file", "JCLAuto.ini");
+		if (System.getProperty("test.comm") != null) {
+			RunCommTests = true;
+		}
+
+		try {
+			in = new FileInputStream(iniName);
+		} catch (IOException e) {
+		} catch (Exception e) {
+			System.out.println("SupportConfiguration.loadProperties()");
+			System.out.println(e);
+			e.printStackTrace();
+		}
+		if (in == null) {
+			try {
+				Class cl = Class
+						.forName("com.ibm.support.Support_Configuration");
+				in = cl.getResourceAsStream(iniName);
+			} catch (ClassNotFoundException e) {
+			}
+		}
+		try {
+			if (in != null) {
+				load(in, props);
+			}
+		} catch (IOException e) {
+		}
+		if (props.size() == 0)
+			return;
+		String value;
+
+		value = (String) props.get("DomainAddress");
+		if (value != null)
+			DomainAddress = value;
+
+		value = (String) props.get("WebName");
+		if (value != null)
+			WebName = value;
+
+		value = (String) props.get("TestResourcesDir");
+		if (value != null)
+			TestResourcesDir = value;
+		value = (String) props.get("HomeAddressResponse");
+		if (value != null)
+			HomeAddressResponse = value;
+
+		value = (String) props.get("HomeAddressSoftware");
+		if (value != null)
+			HomeAddressSoftware = value;
+
+		value = (String) props.get("ProxyServerTestHost");
+		if (value != null)
+			ProxyServerTestHost = value;
+
+		value = (String) props.get("SocksServerTestHost");
+		if (value != null)
+			SocksServerTestHost = value;
+
+		value = (String) props.get("SocksServerTestPort");
+		if (value != null)
+			SocksServerTestPort = Integer.parseInt(value);
+
+		value = (String) props.get("UnresolvedIP");
+		if (value != null)
+			UnresolvedIP = value;
+
+		value = (String) props.get("InetTestAddress");
+		if (value != null)
+			InetTestAddress = value;
+
+		value = (String) props.get("InetTestIP");
+		if (value != null) {
+			InetTestIP = value;
+			byte[] addr = new byte[4];
+			int last = 0;
+			try {
+				for (int i = 0; i < 3; i++) {
+					int dot = InetTestIP.indexOf('.', last);
+					addr[i] = (byte) Integer.parseInt(InetTestIP.substring(
+							last, dot));
+					last = dot + 1;
+				}
+				addr[3] = (byte) Integer.parseInt(InetTestIP.substring(last));
+				InetTestCaddr = addr;
+			} catch (RuntimeException e) {
+				System.out.println("Error parsing InetTestIP (" + InetTestIP
+						+ ")");
+				System.out.println(e);
+			}
+		}
+
+		value = (String) props.get("NonLocalAddressBytes");
+		if (value != null) {
+			String nonLocalAddressBytesString = value;
+			byte[] addr = new byte[4];
+			int last = 0;
+			try {
+				for (int i = 0; i < 3; i++) {
+					int dot = nonLocalAddressBytesString.indexOf('.', last);
+					addr[i] = (byte) Integer
+							.parseInt(nonLocalAddressBytesString.substring(
+									last, dot));
+					last = dot + 1;
+				}
+				addr[3] = (byte) Integer.parseInt(nonLocalAddressBytesString
+						.substring(last));
+				nonLocalAddressBytes = addr;
+			} catch (RuntimeException e) {
+				System.out.println("Error parsing NonLocalAddressBytes ("
+						+ nonLocalAddressBytesString + ")");
+				System.out.println(e);
+			}
+		}
+
+		value = (String) props.get("InetTestAddress2");
+		if (value != null)
+			InetTestAddress2 = value;
+
+		value = (String) props.get("InetTestIP2");
+		if (value != null)
+			InetTestIP2 = value;
+
+		value = (String) props.get("InetTestHashcode");
+		if (value != null)
+			InetTestHashcode = Integer.parseInt(value);
+
+		value = (String) props.get("SpecialInetTestAddress");
+		if (value != null)
+			SpecialInetTestAddress = value;
+
+		value = (String) props.get("SpecialInetTestAddressNumber");
+		if (value != null)
+			SpecialInetTestAddressNumber = Integer.parseInt(value);
+
+		value = (String) props.get("FTPTestAddress");
+		if (value != null)
+			FTPTestAddress = value;
+
+		value = (String) props.get("URLConnectionLastModifiedString");
+		if (value != null)
+			URLConnectionLastModifiedString = value;
+
+		value = (String) props.get("URLConnectionLastModified");
+		if (value != null)
+			URLConnectionLastModified = Long.parseLong(value);
+
+		value = (String) props.get("URLConnectionDate");
+		if (value != null)
+			URLConnectionDate = Long.parseLong(value);
+
+		value = (String) props.get("Port1");
+		if (value != null)
+			Port1 = value;
+
+		value = (String) props.get("Port2");
+		if (value != null)
+			Port2 = value;
+
+		value = (String) props.get("InetTestIP6");
+		if (value != null)
+			InetTestIP6 = value;
+
+		value = (String) props.get("InetTestIP6LO");
+		if (value != null)
+			InetTestIP6LO = value;
+
+		value = (String) props.get("ProxyServerTestHostIPv6");
+		if (value != null)
+			ProxyServerTestHostIPv6 = value;
+
+		value = (String) props.get("ResolvedNotExistingHost");
+		if (value != null)
+			ResolvedNotExistingHost = value;
+
+		value = (String) props.get("InetAlias1");
+		if (value != null)
+			InetAlias1 = value;
+
+		value = (String) props.get("InetAlias2");
+		if (value != null)
+			InetAlias2 = value;
+
+		value = (String) props.get("IPv6GlobalAddressJcl4");
+		if (value != null)
+			IPv6GlobalAddressJcl4 = value;
+
+	}
+
+	static void load(InputStream in, Hashtable result) throws IOException {
+		int NONE = 0, SLASH = 1, UNICODE = 2, CONTINUE = 3, DONE = 4, IGNORE = 5;
+		int mode = NONE, unicode = 0, count = 0, nextChar;
+		StringBuffer key = new StringBuffer(), value = new StringBuffer(), buffer = key;
+		boolean firstChar = true;
+
+		while ((nextChar = in.read()) != -1) {
+			if (mode == UNICODE) {
+				int digit = Character.digit((char) nextChar, 16);
+				if (digit >= 0) {
+					unicode = (unicode << 4) + digit;
+					if (++count < 4)
+						continue;
+				}
+				mode = NONE;
+				buffer.append((char) unicode);
+				if (nextChar != '\n')
+					continue;
+			}
+			if (mode == SLASH) {
+				mode = NONE;
+				switch (nextChar) {
+				case '\r':
+					mode = CONTINUE; // Look for a following \n
+					continue;
+				case '\n':
+					mode = IGNORE; // Ignore whitespace on the next line
+					continue;
+				case 'b':
+					nextChar = '\b';
+					break;
+				case 'f':
+					nextChar = '\f';
+					break;
+				case 'n':
+					nextChar = '\n';
+					break;
+				case 'r':
+					nextChar = '\r';
+					break;
+				case 't':
+					nextChar = '\t';
+					break;
+				case 'u':
+					mode = UNICODE;
+					unicode = count = 0;
+					continue;
+				}
+			} else {
+				switch (nextChar) {
+				case '#':
+				case '!':
+					if (firstChar) {
+						while ((nextChar = in.read()) != -1)
+							if (nextChar == '\r' || nextChar == '\n')
+								break;
+						continue;
+					}
+					break;
+				case '\n':
+					if (mode == CONTINUE) { // Part of a \r\n sequence
+						mode = IGNORE; // Ignore whitespace on the next line
+						continue;
+					}
+					// fall into the next case
+				case '\r':
+					mode = NONE;
+					firstChar = true;
+					if (key.length() > 0 || buffer == value)
+						result.put(key.toString(), value.toString());
+					key.setLength(0);
+					value.setLength(0);
+					buffer = key;
+					continue;
+				case '\\':
+					mode = SLASH;
+					continue;
+				case ':':
+				case '=':
+					if (buffer == key) {
+						buffer = value;
+						continue;
+					}
+					break;
+				}
+				char c = (char) nextChar;
+				if ((c >= 0x1c && c <= 0x20) || (c >= 0x9 && c <= 0xd)) {
+					if (mode == CONTINUE)
+						mode = IGNORE;
+					if (buffer.length() == 0 || mode == IGNORE)
+						continue;
+					if (buffer == key) {
+						mode = DONE;
+						continue;
+					}
+				}
+				if (mode == IGNORE || mode == CONTINUE)
+					mode = NONE;
+			}
+			firstChar = false;
+			if (mode == DONE) {
+				buffer = value;
+				mode = NONE;
+			}
+			buffer.append((char) nextChar);
+		}
+		if (key.length() > 0 || buffer == value)
+			result.put(key.toString(), value.toString());
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Configuration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DecimalFormat.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DecimalFormat.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DecimalFormat.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DecimalFormat.java Tue Sep  5 06:39:17 2006
@@ -1,283 +1,283 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.support;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.util.Locale;
-import java.util.Vector;
-
-public class Support_DecimalFormat extends Support_Format {
-
-	public Support_DecimalFormat(String p1) {
-		super(p1);
-	}
-
-	public void runTest() {
-		t_formatToCharacterIterator();
-		t_format_with_FieldPosition();
-	}
-
-	public static void main(String[] args) {
-		new Support_DecimalFormat("").runTest();
-	}
-
-	public void t_format_with_FieldPosition() {
-		DecimalFormat format = (DecimalFormat) NumberFormat
-				.getCurrencyInstance(Locale.US);
-		Number number = new Double(10000000.76);
-		String text = "$10,000,000.76";
-
-		t_FormatWithField(0, format, number, text, NumberFormat.Field.CURRENCY,
-				0, 1);
-		t_FormatWithField(1, format, number, text, NumberFormat.Field.INTEGER,
-				1, 11);
-		t_FormatWithField(2, format, number, text,
-				NumberFormat.Field.GROUPING_SEPARATOR, 3, 4);
-		t_FormatWithField(3, format, number, text,
-				NumberFormat.Field.DECIMAL_SEPARATOR, 11, 12);
-		t_FormatWithField(4, format, number, text, NumberFormat.Field.FRACTION,
-				12, 14);
-
-		// test fields that are not included in the formatted text
-		t_FormatWithField(5, format, number, text, NumberFormat.Field.SIGN, 0,
-				0);
-		t_FormatWithField(6, format, number, text, NumberFormat.Field.EXPONENT,
-				0, 0);
-		t_FormatWithField(7, format, number, text,
-				NumberFormat.Field.EXPONENT_SIGN, 0, 0);
-		t_FormatWithField(8, format, number, text,
-				NumberFormat.Field.EXPONENT_SYMBOL, 0, 0);
-		t_FormatWithField(9, format, number, text, NumberFormat.Field.PERCENT,
-				0, 0);
-		t_FormatWithField(10, format, number, text,
-				NumberFormat.Field.PERMILLE, 0, 0);
-
-		// test Exponential
-		format = new DecimalFormat("000000000.0#E0");
-		text = "100000007.6E-1";
-		t_FormatWithField(11, format, number, text, NumberFormat.Field.INTEGER,
-				0, 9);
-		t_FormatWithField(12, format, number, text,
-				NumberFormat.Field.DECIMAL_SEPARATOR, 9, 10);
-		t_FormatWithField(13, format, number, text,
-				NumberFormat.Field.FRACTION, 10, 11);
-		t_FormatWithField(14, format, number, text,
-				NumberFormat.Field.EXPONENT_SYMBOL, 11, 12);
-		t_FormatWithField(15, format, number, text,
-				NumberFormat.Field.EXPONENT_SIGN, 12, 13);
-		t_FormatWithField(16, format, number, text,
-				NumberFormat.Field.EXPONENT, 13, 14);
-
-		// test fields that are not included in the formatted text
-		t_FormatWithField(17, format, number, text,
-				NumberFormat.Field.GROUPING_SEPARATOR, 0, 0);
-		t_FormatWithField(18, format, number, text, NumberFormat.Field.SIGN, 0,
-				0);
-		t_FormatWithField(19, format, number, text,
-				NumberFormat.Field.CURRENCY, 0, 0);
-		t_FormatWithField(20, format, number, text, NumberFormat.Field.PERCENT,
-				0, 0);
-		t_FormatWithField(21, format, number, text,
-				NumberFormat.Field.PERMILLE, 0, 0);
-
-		// test currency instance with TR Locale
-		number = new Double(350.76);
-		format = (DecimalFormat) NumberFormat.getCurrencyInstance(new Locale(
-				"tr", "TR"));
-		text = "351 TL";
-		t_FormatWithField(22, format, number, text, NumberFormat.Field.INTEGER,
-				0, 3);
-		t_FormatWithField(23, format, number, text,
-				NumberFormat.Field.CURRENCY, 4, 6);
-
-		// test fields that are not included in the formatted text
-		t_FormatWithField(25, format, number, text,
-				NumberFormat.Field.GROUPING_SEPARATOR, 0, 0);
-		t_FormatWithField(26, format, number, text,
-				NumberFormat.Field.DECIMAL_SEPARATOR, 0, 0);
-		t_FormatWithField(27, format, number, text, NumberFormat.Field.SIGN, 0,
-				0);
-		t_FormatWithField(28, format, number, text,
-				NumberFormat.Field.EXPONENT, 0, 0);
-		t_FormatWithField(29, format, number, text,
-				NumberFormat.Field.EXPONENT_SIGN, 0, 0);
-		t_FormatWithField(30, format, number, text,
-				NumberFormat.Field.EXPONENT_SYMBOL, 0, 0);
-		t_FormatWithField(31, format, number, text, NumberFormat.Field.PERCENT,
-				0, 0);
-		t_FormatWithField(32, format, number, text,
-				NumberFormat.Field.PERMILLE, 0, 0);
-
-	}
-
-	public void t_formatToCharacterIterator() {
-
-		Number number = new Double(350.76);
-		Number negativeNumber = new Double(-350.76);
-
-		Locale us = Locale.US;
-		Locale tr = new Locale("tr", "TR");
-
-		// test number instance
-		t_Format(1, number, NumberFormat.getNumberInstance(us),
-				getNumberVectorUS());
-
-		// test integer instance
-		// testFormat(2, number, NumberFormat.getIntegerInstance(us),
-		// getPercentVectorUS());
-
-		// test percent instance
-		t_Format(3, number, NumberFormat.getPercentInstance(us),
-				getPercentVectorUS());
-
-		// test permille pattern
-		DecimalFormat format = new DecimalFormat("###0.##\u2030");
-		t_Format(4, number, format, getPermilleVector());
-
-		// test exponential pattern with positive exponent
-		format = new DecimalFormat("00.0#E0");
-		t_Format(5, number, format, getPositiveExponentVector());
-
-		// test exponential pattern with negative exponent
-		format = new DecimalFormat("0000.0#E0");
-		t_Format(6, number, format, getNegativeExponentVector());
-
-		// test currency instance with US Locale
-		t_Format(7, number, NumberFormat.getCurrencyInstance(us),
-				getPositiveCurrencyVectorUS());
-
-		// test negative currency instance with US Locale
-		t_Format(8, negativeNumber, NumberFormat.getCurrencyInstance(us),
-				getNegativeCurrencyVectorUS());
-
-		// test currency instance with TR Locale
-		t_Format(9, number, NumberFormat.getCurrencyInstance(tr),
-				getPositiveCurrencyVectorTR());
-
-		// test negative currency instance with TR Locale
-		t_Format(10, negativeNumber, NumberFormat.getCurrencyInstance(tr),
-				getNegativeCurrencyVectorTR());
-
-		// test multiple grouping seperators
-		number = new Long(100300400);
-		t_Format(11, number, NumberFormat.getNumberInstance(us),
-				getNumberVector2US());
-
-		// test 0
-		number = new Long(0);
-		t_Format(12, number, NumberFormat.getNumberInstance(us),
-				getZeroVector());
-	}
-
-	private static Vector getNumberVectorUS() {
-		Vector v = new Vector();
-		v.add(new FieldContainer(0, 3, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(3, 4, NumberFormat.Field.DECIMAL_SEPARATOR));
-		v.add(new FieldContainer(4, 6, NumberFormat.Field.FRACTION));
-		return v;
-	}
-
-	private static Vector getPositiveCurrencyVectorTR() {
-		Vector v = new Vector();
-		v.add(new FieldContainer(0, 3, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(4, 6, NumberFormat.Field.CURRENCY));
-		return v;
-	}
-
-	private static Vector getNegativeCurrencyVectorTR() {
-		Vector v = new Vector();
-		v.add(new FieldContainer(0, 1, NumberFormat.Field.SIGN));
-		v.add(new FieldContainer(1, 4, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(5, 7, NumberFormat.Field.CURRENCY));
-		return v;
-	}
-
-	private static Vector getPositiveCurrencyVectorUS() {
-		Vector v = new Vector();
-		v.add(new FieldContainer(0, 1, NumberFormat.Field.CURRENCY));
-		v.add(new FieldContainer(1, 4, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(4, 5, NumberFormat.Field.DECIMAL_SEPARATOR));
-		v.add(new FieldContainer(5, 7, NumberFormat.Field.FRACTION));
-		return v;
-	}
-
-	private static Vector getNegativeCurrencyVectorUS() {
-		Vector v = new Vector();
-		v.add(new FieldContainer(1, 2, NumberFormat.Field.CURRENCY));
-		v.add(new FieldContainer(2, 5, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(5, 6, NumberFormat.Field.DECIMAL_SEPARATOR));
-		v.add(new FieldContainer(6, 8, NumberFormat.Field.FRACTION));
-		return v;
-	}
-
-	private static Vector getPercentVectorUS() {
-		Vector v = new Vector();
-		v.add(new FieldContainer(0, 2, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(2, 3, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(2, 3, NumberFormat.Field.GROUPING_SEPARATOR));
-		v.add(new FieldContainer(3, 6, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(6, 7, NumberFormat.Field.PERCENT));
-		return v;
-	}
-
-	private static Vector getPermilleVector() {
-		Vector v = new Vector();
-		v.add(new FieldContainer(0, 6, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(6, 7, NumberFormat.Field.PERMILLE));
-		return v;
-	}
-
-	private static Vector getNegativeExponentVector() {
-		Vector v = new Vector();
-		v.add(new FieldContainer(0, 4, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(4, 5, NumberFormat.Field.DECIMAL_SEPARATOR));
-		v.add(new FieldContainer(5, 6, NumberFormat.Field.FRACTION));
-		v.add(new FieldContainer(6, 7, NumberFormat.Field.EXPONENT_SYMBOL));
-		v.add(new FieldContainer(7, 8, NumberFormat.Field.EXPONENT_SIGN));
-		v.add(new FieldContainer(8, 9, NumberFormat.Field.EXPONENT));
-		return v;
-	}
-
-	private static Vector getPositiveExponentVector() {
-		Vector v = new Vector();
-		v.add(new FieldContainer(0, 2, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(2, 3, NumberFormat.Field.DECIMAL_SEPARATOR));
-		v.add(new FieldContainer(3, 5, NumberFormat.Field.FRACTION));
-		v.add(new FieldContainer(5, 6, NumberFormat.Field.EXPONENT_SYMBOL));
-		v.add(new FieldContainer(6, 7, NumberFormat.Field.EXPONENT));
-		return v;
-	}
-
-	private static Vector getNumberVector2US() {
-		Vector v = new Vector();
-		v.add(new FieldContainer(0, 3, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(3, 4, NumberFormat.Field.GROUPING_SEPARATOR));
-		v.add(new FieldContainer(3, 4, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(4, 7, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(7, 8, NumberFormat.Field.GROUPING_SEPARATOR));
-		v.add(new FieldContainer(7, 8, NumberFormat.Field.INTEGER));
-		v.add(new FieldContainer(8, 11, NumberFormat.Field.INTEGER));
-		return v;
-	}
-
-	private static Vector getZeroVector() {
-		Vector v = new Vector();
-		v.add(new FieldContainer(0, 1, NumberFormat.Field.INTEGER));
-		return v;
-	}
-
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.util.Locale;
+import java.util.Vector;
+
+public class Support_DecimalFormat extends Support_Format {
+
+	public Support_DecimalFormat(String p1) {
+		super(p1);
+	}
+
+	public void runTest() {
+		t_formatToCharacterIterator();
+		t_format_with_FieldPosition();
+	}
+
+	public static void main(String[] args) {
+		new Support_DecimalFormat("").runTest();
+	}
+
+	public void t_format_with_FieldPosition() {
+		DecimalFormat format = (DecimalFormat) NumberFormat
+				.getCurrencyInstance(Locale.US);
+		Number number = new Double(10000000.76);
+		String text = "$10,000,000.76";
+
+		t_FormatWithField(0, format, number, text, NumberFormat.Field.CURRENCY,
+				0, 1);
+		t_FormatWithField(1, format, number, text, NumberFormat.Field.INTEGER,
+				1, 11);
+		t_FormatWithField(2, format, number, text,
+				NumberFormat.Field.GROUPING_SEPARATOR, 3, 4);
+		t_FormatWithField(3, format, number, text,
+				NumberFormat.Field.DECIMAL_SEPARATOR, 11, 12);
+		t_FormatWithField(4, format, number, text, NumberFormat.Field.FRACTION,
+				12, 14);
+
+		// test fields that are not included in the formatted text
+		t_FormatWithField(5, format, number, text, NumberFormat.Field.SIGN, 0,
+				0);
+		t_FormatWithField(6, format, number, text, NumberFormat.Field.EXPONENT,
+				0, 0);
+		t_FormatWithField(7, format, number, text,
+				NumberFormat.Field.EXPONENT_SIGN, 0, 0);
+		t_FormatWithField(8, format, number, text,
+				NumberFormat.Field.EXPONENT_SYMBOL, 0, 0);
+		t_FormatWithField(9, format, number, text, NumberFormat.Field.PERCENT,
+				0, 0);
+		t_FormatWithField(10, format, number, text,
+				NumberFormat.Field.PERMILLE, 0, 0);
+
+		// test Exponential
+		format = new DecimalFormat("000000000.0#E0");
+		text = "100000007.6E-1";
+		t_FormatWithField(11, format, number, text, NumberFormat.Field.INTEGER,
+				0, 9);
+		t_FormatWithField(12, format, number, text,
+				NumberFormat.Field.DECIMAL_SEPARATOR, 9, 10);
+		t_FormatWithField(13, format, number, text,
+				NumberFormat.Field.FRACTION, 10, 11);
+		t_FormatWithField(14, format, number, text,
+				NumberFormat.Field.EXPONENT_SYMBOL, 11, 12);
+		t_FormatWithField(15, format, number, text,
+				NumberFormat.Field.EXPONENT_SIGN, 12, 13);
+		t_FormatWithField(16, format, number, text,
+				NumberFormat.Field.EXPONENT, 13, 14);
+
+		// test fields that are not included in the formatted text
+		t_FormatWithField(17, format, number, text,
+				NumberFormat.Field.GROUPING_SEPARATOR, 0, 0);
+		t_FormatWithField(18, format, number, text, NumberFormat.Field.SIGN, 0,
+				0);
+		t_FormatWithField(19, format, number, text,
+				NumberFormat.Field.CURRENCY, 0, 0);
+		t_FormatWithField(20, format, number, text, NumberFormat.Field.PERCENT,
+				0, 0);
+		t_FormatWithField(21, format, number, text,
+				NumberFormat.Field.PERMILLE, 0, 0);
+
+		// test currency instance with TR Locale
+		number = new Double(350.76);
+		format = (DecimalFormat) NumberFormat.getCurrencyInstance(new Locale(
+				"tr", "TR"));
+		text = "351 TL";
+		t_FormatWithField(22, format, number, text, NumberFormat.Field.INTEGER,
+				0, 3);
+		t_FormatWithField(23, format, number, text,
+				NumberFormat.Field.CURRENCY, 4, 6);
+
+		// test fields that are not included in the formatted text
+		t_FormatWithField(25, format, number, text,
+				NumberFormat.Field.GROUPING_SEPARATOR, 0, 0);
+		t_FormatWithField(26, format, number, text,
+				NumberFormat.Field.DECIMAL_SEPARATOR, 0, 0);
+		t_FormatWithField(27, format, number, text, NumberFormat.Field.SIGN, 0,
+				0);
+		t_FormatWithField(28, format, number, text,
+				NumberFormat.Field.EXPONENT, 0, 0);
+		t_FormatWithField(29, format, number, text,
+				NumberFormat.Field.EXPONENT_SIGN, 0, 0);
+		t_FormatWithField(30, format, number, text,
+				NumberFormat.Field.EXPONENT_SYMBOL, 0, 0);
+		t_FormatWithField(31, format, number, text, NumberFormat.Field.PERCENT,
+				0, 0);
+		t_FormatWithField(32, format, number, text,
+				NumberFormat.Field.PERMILLE, 0, 0);
+
+	}
+
+	public void t_formatToCharacterIterator() {
+
+		Number number = new Double(350.76);
+		Number negativeNumber = new Double(-350.76);
+
+		Locale us = Locale.US;
+		Locale tr = new Locale("tr", "TR");
+
+		// test number instance
+		t_Format(1, number, NumberFormat.getNumberInstance(us),
+				getNumberVectorUS());
+
+		// test integer instance
+		// testFormat(2, number, NumberFormat.getIntegerInstance(us),
+		// getPercentVectorUS());
+
+		// test percent instance
+		t_Format(3, number, NumberFormat.getPercentInstance(us),
+				getPercentVectorUS());
+
+		// test permille pattern
+		DecimalFormat format = new DecimalFormat("###0.##\u2030");
+		t_Format(4, number, format, getPermilleVector());
+
+		// test exponential pattern with positive exponent
+		format = new DecimalFormat("00.0#E0");
+		t_Format(5, number, format, getPositiveExponentVector());
+
+		// test exponential pattern with negative exponent
+		format = new DecimalFormat("0000.0#E0");
+		t_Format(6, number, format, getNegativeExponentVector());
+
+		// test currency instance with US Locale
+		t_Format(7, number, NumberFormat.getCurrencyInstance(us),
+				getPositiveCurrencyVectorUS());
+
+		// test negative currency instance with US Locale
+		t_Format(8, negativeNumber, NumberFormat.getCurrencyInstance(us),
+				getNegativeCurrencyVectorUS());
+
+		// test currency instance with TR Locale
+		t_Format(9, number, NumberFormat.getCurrencyInstance(tr),
+				getPositiveCurrencyVectorTR());
+
+		// test negative currency instance with TR Locale
+		t_Format(10, negativeNumber, NumberFormat.getCurrencyInstance(tr),
+				getNegativeCurrencyVectorTR());
+
+		// test multiple grouping seperators
+		number = new Long(100300400);
+		t_Format(11, number, NumberFormat.getNumberInstance(us),
+				getNumberVector2US());
+
+		// test 0
+		number = new Long(0);
+		t_Format(12, number, NumberFormat.getNumberInstance(us),
+				getZeroVector());
+	}
+
+	private static Vector getNumberVectorUS() {
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 3, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(3, 4, NumberFormat.Field.DECIMAL_SEPARATOR));
+		v.add(new FieldContainer(4, 6, NumberFormat.Field.FRACTION));
+		return v;
+	}
+
+	private static Vector getPositiveCurrencyVectorTR() {
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 3, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(4, 6, NumberFormat.Field.CURRENCY));
+		return v;
+	}
+
+	private static Vector getNegativeCurrencyVectorTR() {
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 1, NumberFormat.Field.SIGN));
+		v.add(new FieldContainer(1, 4, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(5, 7, NumberFormat.Field.CURRENCY));
+		return v;
+	}
+
+	private static Vector getPositiveCurrencyVectorUS() {
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 1, NumberFormat.Field.CURRENCY));
+		v.add(new FieldContainer(1, 4, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(4, 5, NumberFormat.Field.DECIMAL_SEPARATOR));
+		v.add(new FieldContainer(5, 7, NumberFormat.Field.FRACTION));
+		return v;
+	}
+
+	private static Vector getNegativeCurrencyVectorUS() {
+		Vector v = new Vector();
+		v.add(new FieldContainer(1, 2, NumberFormat.Field.CURRENCY));
+		v.add(new FieldContainer(2, 5, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(5, 6, NumberFormat.Field.DECIMAL_SEPARATOR));
+		v.add(new FieldContainer(6, 8, NumberFormat.Field.FRACTION));
+		return v;
+	}
+
+	private static Vector getPercentVectorUS() {
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 2, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(2, 3, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(2, 3, NumberFormat.Field.GROUPING_SEPARATOR));
+		v.add(new FieldContainer(3, 6, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(6, 7, NumberFormat.Field.PERCENT));
+		return v;
+	}
+
+	private static Vector getPermilleVector() {
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 6, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(6, 7, NumberFormat.Field.PERMILLE));
+		return v;
+	}
+
+	private static Vector getNegativeExponentVector() {
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 4, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(4, 5, NumberFormat.Field.DECIMAL_SEPARATOR));
+		v.add(new FieldContainer(5, 6, NumberFormat.Field.FRACTION));
+		v.add(new FieldContainer(6, 7, NumberFormat.Field.EXPONENT_SYMBOL));
+		v.add(new FieldContainer(7, 8, NumberFormat.Field.EXPONENT_SIGN));
+		v.add(new FieldContainer(8, 9, NumberFormat.Field.EXPONENT));
+		return v;
+	}
+
+	private static Vector getPositiveExponentVector() {
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 2, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(2, 3, NumberFormat.Field.DECIMAL_SEPARATOR));
+		v.add(new FieldContainer(3, 5, NumberFormat.Field.FRACTION));
+		v.add(new FieldContainer(5, 6, NumberFormat.Field.EXPONENT_SYMBOL));
+		v.add(new FieldContainer(6, 7, NumberFormat.Field.EXPONENT));
+		return v;
+	}
+
+	private static Vector getNumberVector2US() {
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 3, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(3, 4, NumberFormat.Field.GROUPING_SEPARATOR));
+		v.add(new FieldContainer(3, 4, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(4, 7, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(7, 8, NumberFormat.Field.GROUPING_SEPARATOR));
+		v.add(new FieldContainer(7, 8, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(8, 11, NumberFormat.Field.INTEGER));
+		return v;
+	}
+
+	private static Vector getZeroVector() {
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 1, NumberFormat.Field.INTEGER));
+		return v;
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DecimalFormat.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DeleteOnExitTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DeleteOnExitTest.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DeleteOnExitTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DeleteOnExitTest.java Tue Sep  5 06:39:17 2006
@@ -1,26 +1,26 @@
-/* Copyright 2001, 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.support;
-
-import java.io.File;
-
-public class Support_DeleteOnExitTest {
-
-	public static void main(java.lang.String[] args) {
-		File f1 = new File(args[0]);
-		f1.deleteOnExit();
-	}
-}
+/* Copyright 2001, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.File;
+
+public class Support_DeleteOnExitTest {
+
+	public static void main(java.lang.String[] args) {
+		File f1 = new File(args[0]);
+		f1.deleteOnExit();
+	}
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DeleteOnExitTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message