You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/03/24 07:53:47 UTC

svn commit: r388415 [3/3] - in /incubator/harmony/enhanced/classlib/trunk: modules/archive/src/test/java/tests/api/java/util/zip/ modules/beans/src/main/java/java/beans/beancontext/ modules/luni/src/test/java/tests/api/java/lang/ modules/luni/src/test/...

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java?rev=388415&r1=388414&r2=388415&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java Thu Mar 23 22:53:45 2006
@@ -51,11 +51,11 @@
 		public void run() {
 			try {
 				 // Go to sleep so the server can setup and wait for connection
-				Thread.currentThread().sleep(1000);
+				Thread.sleep(1000);
 				cs = new Socket(InetAddress.getLocalHost().getHostName(), port);
 				// Sleep again to allow server side processing. Thread is
 				// stopped by server.
-				Thread.currentThread().sleep(10000);
+				Thread.sleep(10000);
 			} catch (InterruptedException e) {
 				return;
 			} catch (Throwable e) {
@@ -914,7 +914,7 @@
 		t = new Thread(new SSClient(port), "SSClient");
 		t.start();
 		try {
-			Thread.currentThread().sleep(1000);
+			Thread.sleep(1000);
 		} catch (java.lang.InterruptedException e) {
 			System.out.println("Exception during startClinet()" + e.toString());
 		}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLConnectionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLConnectionTest.java?rev=388415&r1=388414&r2=388415&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLConnectionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLConnectionTest.java Thu Mar 23 22:53:45 2006
@@ -221,17 +221,17 @@
 	 * @tests java.net.URLConnection#getFileNameMap()
 	 */
 	public void test_getFileNameMap() {
-		uc.setFileNameMap(new FileNameMap() {
+		URLConnection.setFileNameMap(new FileNameMap() {
 			public String getContentTypeFor(String fileName) {
 				return "Spam!";
 			}
 		});
 		try {
-			assertTrue("Incorrect FileNameMap returned", uc.getFileNameMap()
+			assertTrue("Incorrect FileNameMap returned", URLConnection.getFileNameMap()
 					.getContentTypeFor(null).equals("Spam!"));
 		} finally {
 			// unset the map so other tests don't fail
-			uc.setFileNameMap(null);
+			URLConnection.setFileNameMap(null);
 		}
 	}
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLTest.java?rev=388415&r1=388414&r2=388415&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLTest.java Thu Mar 23 22:53:45 2006
@@ -69,12 +69,12 @@
 		}
 		try {
 			u = new URL("http://www.yahoo.com");
-			u.setURLStreamHandlerFactory(new TestFactory());
+			URL.setURLStreamHandlerFactory(new TestFactory());
 		} catch (Exception e) {
 			fail("Exception during test : " + e.getMessage());
 		}
 		try {
-			u.setURLStreamHandlerFactory(new TestFactory());
+			URL.setURLStreamHandlerFactory(new TestFactory());
 			fail("Can only set Factory once.");
 		} catch (Error e) {
 		}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LocaleTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LocaleTest.java?rev=388415&r1=388414&r2=388415&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LocaleTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LocaleTest.java Thu Mar 23 22:53:45 2006
@@ -73,7 +73,7 @@
 		// java.util.Locale.getAvailableLocales()
 		// Assumes there will generally be about 100+ available locales...
 		try {
-			Locale[] locales = testLocale.getAvailableLocales();
+			Locale[] locales = Locale.getAvailableLocales();
 			assertTrue("Wrong number of locales: ", locales.length > 100);
 		} catch (Exception e) {
 			fail("Exception during test : " + e.getMessage());
@@ -235,7 +235,7 @@
 		// Test for method java.lang.String []
 		// java.util.Locale.getISOLanguages()
 		// Assumes always at least 131 ISOlanguages...
-		String[] isoLang = testLocale.getISOLanguages();
+		String[] isoLang = Locale.getISOLanguages();
 		int length = isoLang.length;
 		assertTrue("Random element in wrong format.", (isoLang[length / 2]
 				.length() == 2)

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServer.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServer.java?rev=388415&r1=388414&r2=388415&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServer.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServer.java Thu Mar 23 22:53:45 2006
@@ -125,8 +125,7 @@
 					// release the lock so the tests will finish running
 					if (!shuttingDown) {
 						e.printStackTrace();
-						testcase
-								.fail("Test server error on HTTP Server on port "
+						TestCase.fail("Test server error on HTTP Server on port "
 										+ port + ": " + e);
 					}
 					synchronized (lock) {
@@ -228,26 +227,25 @@
 					}
 					if (lline.startsWith("content-length")) {
 						if (contentLength)
-							testcase.fail("Duplicate Content-Length: " + line);
+							TestCase.fail("Duplicate Content-Length: " + line);
 						contentLength = true;
 						length = Integer.parseInt(line.substring(line
 								.indexOf(' ') + 1));
 					}
 					if (line.startsWith("transfer-encoding")) {
 						if (chunked)
-							testcase.fail("Duplicate Transfer-Encoding: "
+							TestCase.fail("Duplicate Transfer-Encoding: "
 									+ line);
 						chunked = true;
 						String encoding = line.substring(line.indexOf(' ') + 1);
 						if ("chunked".equals(encoding))
-							testcase.fail("Unknown Transfer-Encoding: "
+							TestCase.fail("Unknown Transfer-Encoding: "
 									+ encoding);
 					}
 
 				}
 				if (contentLength && chunked)
-					testcase
-							.fail("Found both Content-Length and Transfer-Encoding");
+					TestCase.fail("Found both Content-Length and Transfer-Encoding");
 
 				// call the test function based on the requested resource
 				if (resourceName.equals(CHUNKEDTEST))
@@ -407,9 +405,9 @@
 				String header = (String) headers.elementAt(i);
 				if (header.startsWith("header1:")) {
 					found++;
-					testcase.assertTrue("unexpected header: " + header,
+					TestCase.assertTrue("unexpected header: " + header,
 							found == 1);
-					testcase.assertTrue("invalid header: " + header,
+					TestCase.assertTrue("invalid header: " + header,
 							"header1: value2".equals(header));
 				}
 			}

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java?rev=388415&r1=388414&r2=388415&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java Thu Mar 23 22:53:45 2006
@@ -20,6 +20,8 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import junit.framework.TestCase;
+
 /**
  * Performs some basic testing of either HttpConnection or HttpURLConnection
  * depending on the Support_ServerSocket and Support_HttpConnector passed to the
@@ -77,11 +79,11 @@
 			c = is.read();
 			is.close();
 			connector.close();
-			test.assertTrue("Error receiving chunked transfer coded data",
+			TestCase.assertTrue("Error receiving chunked transfer coded data",
 					c == -1);
 		} catch (Exception e) {
 			e.printStackTrace();
-			test.fail("Exception during test a: " + e);
+			TestCase.fail("Exception during test a: " + e);
 		}
 
 		// Content-Length Test
@@ -97,11 +99,11 @@
 			is.close();
 			connector.close();
 			String result = new String(bout.toByteArray(), "ISO8859_1");
-			test.assertTrue("Error receiving content coded data: " + result,
+			TestCase.assertTrue("Error receiving content coded data: " + result,
 					"ABCDE".equals(result));
 		} catch (Exception e) {
 			e.printStackTrace();
-			test.fail("Exception during test b: " + e);
+			TestCase.fail("Exception during test b: " + e);
 		}
 
 		// Headers Test
@@ -117,19 +119,19 @@
 				if (key == null && i > 0)
 					break;
 				if ("Cache-Control".equals(key)) {
-					test.assertTrue("Too many headers at: " + i, found <= 2);
+					TestCase.assertTrue("Too many headers at: " + i, found <= 2);
 					String value = connector.getHeaderField(i);
-					test.assertTrue("Invalid header value: " + found + ": "
+					TestCase.assertTrue("Invalid header value: " + found + ": "
 							+ value, expected[found].equals(value));
 					found++;
 				}
 				i++;
 			}
-			test.assertTrue("Invalid headers: " + found, found == 3);
+			TestCase.assertTrue("Invalid headers: " + found, found == 3);
 			connector.close();
 		} catch (Exception e) {
 			e.printStackTrace();
-			test.fail("Exception during test c: " + e);
+			TestCase.fail("Exception during test c: " + e);
 		}
 
 		// Post Test
@@ -151,11 +153,11 @@
 			is.close();
 			connector.close();
 			String result = new String(bout.toByteArray(), "ISO8859_1");
-			test.assertTrue("Error sending data 1: " + result, toWrite
+			TestCase.assertTrue("Error sending data 1: " + result, toWrite
 					.equals(result));
 		} catch (Exception e) {
 			e.printStackTrace();
-			test.fail("Exception during test d: " + e);
+			TestCase.fail("Exception during test d: " + e);
 		}
 
 		// Post Test chunked
@@ -176,11 +178,11 @@
 			is.close();
 			connector.close();
 			String result = new String(bout.toByteArray(), "ISO8859_1");
-			test.assertTrue("Error sending data 2: " + result, ("C" + toWrite)
+			TestCase.assertTrue("Error sending data 2: " + result, ("C" + toWrite)
 					.equals(result));
 		} catch (Exception e) {
 			e.printStackTrace();
-			test.fail("Exception during test e: " + e);
+			TestCase.fail("Exception during test e: " + e);
 		}
 
 		OutputStream os = null;
@@ -206,11 +208,11 @@
 			is.close();
 			connector.close();
 			String result = new String(data, 0, len, "ISO8859_1");
-			test.assertTrue("Basic port error: " + result, message
+			TestCase.assertTrue("Basic port error: " + result, message
 					.equals(result));
 		} catch (IOException e) {
 			e.printStackTrace();
-			test.fail("Exception during basic post test: " + e);
+			TestCase.fail("Exception during basic post test: " + e);
 		}
 
 		String chunkChar = connector.isChunkedOnFlush() ? "C" : "";
@@ -235,11 +237,11 @@
 			is.close();
 			connector.close();
 			String result = new String(data, 0, len, "ISO8859_1");
-			test.assertTrue("Flushing with post: " + result, (chunkChar
+			TestCase.assertTrue("Flushing with post: " + result, (chunkChar
 					+ message1 + chunkChar + message2).equals(result));
 		} catch (IOException e) {
 			e.printStackTrace();
-			test.fail("Exception during flushing post test: " + e);
+			TestCase.fail("Exception during flushing post test: " + e);
 		}
 
 		// Flushing with post and setting content-length
@@ -263,13 +265,12 @@
 			is.close();
 			connector.close();
 			String result = new String(data, 0, len, "ISO8859_1");
-			test.assertTrue("Flushing with post and setting content-length: "
+			TestCase.assertTrue("Flushing with post and setting content-length: "
 					+ result, (chunkChar + message1 + chunkChar + message2)
 					.equals(result));
 		} catch (IOException e) {
 			e.printStackTrace();
-			test
-					.fail("Exception during flushing with content-length post test: "
+			TestCase.fail("Exception during flushing with content-length post test: "
 							+ e);
 		}
 
@@ -292,11 +293,11 @@
 			is.close();
 			connector.close();
 			String result = new String(data, 0, len, "ISO8859_1");
-			test.assertTrue("Flushing followed immediately by a close(): "
+			TestCase.assertTrue("Flushing followed immediately by a close(): "
 					+ result, (chunkChar + message).equals(result));
 		} catch (IOException e) {
 			e.printStackTrace();
-			test.fail("Exception during flush followed by close post test: "
+			TestCase.fail("Exception during flush followed by close post test: "
 					+ e);
 		}
 
@@ -330,13 +331,11 @@
 					// says there MUST NOT be a message body on 304 responses.
 					// But Java returns the message-body
 					if (!(c == results[i] || c == -1)) {
-						test
-								.fail("Incorrect data returned on test of HTTP response "
+						TestCase.fail("Incorrect data returned on test of HTTP response "
 										+ testCodes[i]);
 					}
 				} else if (c != results[i]) {
-					test
-							.fail("Incorrect data returned on test of HTTP response "
+					TestCase.fail("Incorrect data returned on test of HTTP response "
 									+ testCodes[i]);
 				}
 				while (c > 0)
@@ -345,7 +344,7 @@
 				is.close();
 			} catch (Exception e) {
 				e.printStackTrace();
-				test.fail("Error during redirection test " + i + ": " + e);
+				TestCase.fail("Error during redirection test " + i + ": " + e);
 			}
 		}
 
@@ -376,8 +375,7 @@
 				connector.close();
 
 				c = is.read();
-				test
-						.assertTrue(
+				TestCase.assertTrue(
 								"Incorrect data returned on redirection to a different port.",
 								c == 'A');
 				while (c > 0)
@@ -386,13 +384,13 @@
 				is.close();
 			} catch (Exception e) {
 				e.printStackTrace();
-				test.fail("Exception during test f: " + e);
+				TestCase.fail("Exception during test f: " + e);
 			}
 			server2.stopServer();
 		} catch (IllegalAccessException e) {
-			test.fail("Exception during redirection to a different port:" + e);
+			TestCase.fail("Exception during redirection to a different port:" + e);
 		} catch (InstantiationException e) {
-			test.fail("Exception during redirection to a different port:" + e);
+			TestCase.fail("Exception during redirection to a different port:" + e);
 		}
 
 		// test redirecting to a relative URL on the same host
@@ -404,8 +402,7 @@
 			connector.close();
 
 			c = is.read();
-			test.assertTrue(
-					"Incorrect data returned on redirect to relative URI.",
+			TestCase.assertTrue("Incorrect data returned on redirect to relative URI.",
 					c == 'A');
 			while (c > 0)
 				c = is.read();
@@ -413,8 +410,7 @@
 			is.close();
 		} catch (Exception e) {
 			e.printStackTrace();
-			test.fail("Exception during redirection test to a relative URL: "
-					+ e);
+			TestCase.fail("Exception during redirection test to a relative URL: " + e);
 		}
 		server.stopServer();
 	}