diff options
author | Elliott Hughes <enh@google.com> | 2011-05-25 14:13:56 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2011-05-25 14:13:56 -0700 |
commit | 470c1f75f26d58eb33bbaa0d7e08ed2723f25647 (patch) | |
tree | fc4b50eb64c6a015bc37c4e6c2cdba2aff0286b2 | |
parent | fd7da459fa97998253c82be0132631118fe61b86 (diff) | |
download | apache-harmony-470c1f75f26d58eb33bbaa0d7e08ed2723f25647.tar.gz |
Fix more java.net tests.
Change-Id: Ia305274c67a5b190b225ea84958f31c333834386
9 files changed, 52 insertions, 336 deletions
diff --git a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/SerializationStressTest4.java b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/SerializationStressTest4.java index a0e5521..3b6170d 100644 --- a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/SerializationStressTest4.java +++ b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/SerializationStressTest4.java @@ -70,7 +70,7 @@ public class SerializationStressTest4 extends SerializationStressTest { // Has to have worked boolean equals; - equals = true; + equals = true; // The the only data in EventObject that // differentiates between instantiations is transient assertTrue(MSG_TEST_FAILED + objToSave, equals); @@ -1644,8 +1644,7 @@ public class SerializationStressTest4 extends SerializationStressTest { Object objLoaded = null; try { - objToSave = java.net.InetAddress - .getByName(Support_Configuration.InetTestIP); + objToSave = java.net.InetAddress.getByName("127.0.0.1"); if (DEBUG) System.out.println("Obj = " + objToSave); objLoaded = dumpAndReload(objToSave); @@ -1673,8 +1672,7 @@ public class SerializationStressTest4 extends SerializationStressTest { Object objLoaded = null; try { - objToSave = java.net.Inet6Address - .getByName(Support_Configuration.InetTestIP6); + objToSave = java.net.Inet6Address.getByName("fe80::20d:60ff:fe24:7410"); if (DEBUG) System.out.println("Obj = " + objToSave); objLoaded = dumpAndReload(objToSave); @@ -1800,7 +1798,7 @@ public class SerializationStressTest4 extends SerializationStressTest { try { // Thu Feb 01 01:01:01 EST 2001 - objToSave = new java.util.Date(981007261000L); + objToSave = new java.util.Date(981007261000L); if (DEBUG) System.out.println("Obj = " + objToSave); objLoaded = dumpAndReload(objToSave); @@ -2363,7 +2361,7 @@ public class SerializationStressTest4 extends SerializationStressTest { objToSave = new URI[] { // single arg constructor new URI( - "http://user%60%20info@host/a%20path?qu%60%20ery#fr%5E%20ag"), + "http://user%60%20info@host/a%20path?qu%60%20ery#fr%5E%20ag"), // escaped octets for illegal chars new URI( "http://user%C3%9F%C2%A3info@host:80/a%E2%82%ACpath?qu%C2%A9%C2%AEery#fr%C3%A4%C3%A8g"), @@ -2394,7 +2392,7 @@ public class SerializationStressTest4 extends SerializationStressTest { new URI("news", "comp.infosystems.www.servers.unix", null), new URI(null, null, null, "fragment"), - // only fragment + // only fragment new URI("telnet://server.org"), // only host new URI("http://reg:istry?query"), // malformed hostname, therefore registry-based, diff --git a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramPacketTest.java b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramPacketTest.java index fc3af89..6eaf67a 100644 --- a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramPacketTest.java +++ b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramPacketTest.java @@ -148,8 +148,7 @@ public class DatagramPacketTest extends junit.framework.TestCase { * @tests java.net.DatagramPacket#setAddress(java.net.InetAddress) */ public void test_setAddressLjava_net_InetAddress() throws IOException { - InetAddress ia = InetAddress - .getByName(Support_Configuration.InetTestIP); + InetAddress ia = InetAddress.getByName("127.0.0.1"); DatagramPacket dp = new DatagramPacket("Hello".getBytes(), 5, InetAddress.getLocalHost(), 0); dp.setAddress(ia); diff --git a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ExcludedProxyTest.java b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ExcludedProxyTest.java index 174c58f..d3ca0d0 100644 --- a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ExcludedProxyTest.java +++ b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ExcludedProxyTest.java @@ -35,7 +35,7 @@ import junit.framework.TestCase; * This test is designed for collecting all the testcases which needs a proxy * server. They will be moved to corresponding test class when ProxyHandler of * Jetty is ready in the future. - * + * */ public class ExcludedProxyTest extends TestCase { @@ -54,8 +54,7 @@ public class ExcludedProxyTest extends TestCase { boolean exception = false; try { System.setProperty("http.proxyPort", "81"); - URL u3 = new URL("http://" - + Support_Configuration.InetTestAddress); + URL u3 = new URL("http://localhost"); URLConnection conn3 = u3.openConnection(); conn3.getInputStream(); fail("Should throw IOException"); @@ -112,7 +111,7 @@ public class ExcludedProxyTest extends TestCase { System.setProperties(null); } } - + /** * @tests java.net.SocketImpl#SocketImpl() */ @@ -152,7 +151,7 @@ public class ExcludedProxyTest extends TestCase { System.setProperties(null); } } - + /** * @tests java.net.URL#openConnection(Proxy) */ @@ -189,7 +188,7 @@ public class ExcludedProxyTest extends TestCase { assertTrue("Response to POST method invalid", response .equals(posted)); } - + URL httpUrl = new URL("http://abc.com"); URL jarUrl = new URL("jar:" + Support_Resources.getResourceURL("/JUC/lf.jar!/plus.bmp")); diff --git a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressTest.java b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressTest.java index 084aab4..2fb020b 100644 --- a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressTest.java +++ b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressTest.java @@ -52,17 +52,10 @@ public class InetAddressTest extends junit.framework.TestCase { } } - /** - * @tests java.net.InetAddress#equals(java.lang.Object) - */ public void test_equalsLjava_lang_Object() throws Exception { - // Test for method boolean java.net.InetAddress.equals(java.lang.Object) - InetAddress ia1 = InetAddress - .getByName(Support_Configuration.InetTestAddress); - InetAddress ia2 = InetAddress - .getByName(Support_Configuration.InetTestIP); - assertTrue("Equals returned incorrect result - " + ia1 + " != " - + ia2, ia1.equals(ia2)); + InetAddress ia1 = InetAddress.getByName("localhost"); + InetAddress ia2 = InetAddress.getByName("::1"); + assertEquals(ia2, ia1); } /** @@ -71,9 +64,8 @@ public class InetAddressTest extends junit.framework.TestCase { public void test_getAddress() throws UnknownHostException { // Test for method byte [] java.net.InetAddress.getAddress() try { - InetAddress ia = InetAddress - .getByName(Support_Configuration.InetTestIP); - byte[] caddr = Support_Configuration.InetTestCaddr; + InetAddress ia = InetAddress.getByName("127.0.0.1"); + byte[] caddr = new byte[] { 127, 0, 0, 1 }; byte[] addr = ia.getAddress(); for (int i = 0; i < addr.length; i++) assertTrue("Incorrect address returned", caddr[i] == addr[i]); @@ -94,28 +86,27 @@ public class InetAddressTest extends junit.framework.TestCase { public void test_getAllByNameLjava_lang_String() throws Exception { // Test for method java.net.InetAddress [] // java.net.InetAddress.getAllByName(java.lang.String) - InetAddress[] all = InetAddress - .getAllByName(Support_Configuration.SpecialInetTestAddress); + InetAddress[] all = InetAddress.getAllByName("localhost"); assertNotNull(all); // Number of aliases depends on individual test machine assertTrue(all.length >= 1); for (InetAddress alias : all) { // Check that each alias has the same hostname. Intentionally not // checking for exact string match. - assertTrue(alias.getHostName().startsWith( - Support_Configuration.SpecialInetTestAddress)); + assertTrue(alias.getHostName().startsWith("localhost")); }// end for all aliases //Regression for HARMONY-56 - InetAddress[] ia = InetAddress.getAllByName(null); - assertEquals("Assert 0: No loopback address", 1, ia.length); - assertTrue("Assert 1: getAllByName(null) not loopback", - ia[0].isLoopbackAddress()); - - ia = InetAddress.getAllByName(""); - assertEquals("Assert 2: No loopback address", 1, ia.length); - assertTrue("Assert 3: getAllByName(\"\") not loopback", - ia[0].isLoopbackAddress()); + InetAddress[] ias = InetAddress.getAllByName(null); + assertEquals(2, ias.length); + for (InetAddress ia : ias) { + assertTrue(ia.isLoopbackAddress()); + } + ias = InetAddress.getAllByName(""); + assertEquals(2, ias.length); + for (InetAddress ia : ias) { + assertTrue(ia.isLoopbackAddress()); + } // Check that getting addresses by dotted string distinguish // IPv4 and IPv6 subtypes. @@ -132,17 +123,7 @@ public class InetAddressTest extends junit.framework.TestCase { public void test_getByNameLjava_lang_String() throws Exception { // Test for method java.net.InetAddress // java.net.InetAddress.getByName(java.lang.String) - InetAddress ia2 = InetAddress - .getByName(Support_Configuration.InetTestIP); - - // Intentionally not testing for exact string match - /* FIXME: comment the assertion below because it is platform/configuration dependent - * Please refer to HARMONY-1664 (https://issues.apache.org/jira/browse/HARMONY-1664) - * for details - */ -// assertTrue( -// "Expected " + Support_Configuration.InetTestAddress + "*", -// ia2.getHostName().startsWith(Support_Configuration.InetTestAddress)); + InetAddress ia2 = InetAddress.getByName("127.0.0.1"); // TODO : Test to ensure all the address formats are recognized InetAddress i = InetAddress.getByName("1.2.3"); @@ -151,41 +132,14 @@ public class InetAddressTest extends junit.framework.TestCase { assertEquals("1.0.0.2",i.getHostAddress()); i = InetAddress.getByName(String.valueOf(0xffffffffL)); assertEquals("255.255.255.255",i.getHostAddress()); - String s = "222.222.222.222...."; - i = InetAddress.getByName(s); - assertEquals("222.222.222.222",i.getHostAddress()); } /** * @tests java.net.InetAddress#getHostAddress() */ public void test_getHostAddress() throws Exception { - // Test for method java.lang.String - // java.net.InetAddress.getHostAddress() - InetAddress ia2 = InetAddress - .getByName(Support_Configuration.InetTestAddress); - assertTrue("getHostAddress returned incorrect result: " - + ia2.getHostAddress() + " != " - + Support_Configuration.InetTestIP, ia2.getHostAddress() - .equals(Support_Configuration.InetTestIP)); - } - - /** - * @tests java.net.InetAddress#getHostName() - */ - public void test_getHostName() throws Exception { - // Test for method java.lang.String java.net.InetAddress.getHostName() - InetAddress ia = InetAddress - .getByName(Support_Configuration.InetTestIP); - - // Intentionally not testing for exact string match - /* FIXME: comment the assertion below because it is platform/configuration dependent - * Please refer to HARMONY-1664 (https://issues.apache.org/jira/browse/HARMONY-1664) - * for details - */ -// assertTrue( -// "Expected " + Support_Configuration.InetTestAddress + "*", -// ia.getHostName().startsWith(Support_Configuration.InetTestAddress)); + assertEquals("1.2.3.4", InetAddress.getByName("1.2.3.4").getHostAddress()); + assertEquals("::1", InetAddress.getByName("::1").getHostAddress()); } /** @@ -216,22 +170,6 @@ public class InetAddressTest extends junit.framework.TestCase { } /** - * @tests java.net.InetAddress#hashCode() - */ - public void test_hashCode() { - // Test for method int java.net.InetAddress.hashCode() - try { - InetAddress host = InetAddress - .getByName(Support_Configuration.InetTestAddress); - int hashcode = host.hashCode(); - assertTrue("Incorrect hash returned: " + hashcode + " from host: " - + host, hashcode == Support_Configuration.InetTestHashcode); - } catch (java.net.UnknownHostException e) { - fail("Exception during test : " + e.getMessage()); - } - } - - /** * @tests java.net.InetAddress#isMulticastAddress() */ public void test_isMulticastAddress() throws UnknownHostException { @@ -324,12 +262,9 @@ public class InetAddressTest extends junit.framework.TestCase { */ public void test_toString() throws Exception { // Test for method java.lang.String java.net.InetAddress.toString() - InetAddress ia2 = InetAddress - .getByName(Support_Configuration.InetTestIP); - assertEquals("/" + Support_Configuration.InetTestIP, ia2.toString()); + InetAddress ia2 = InetAddress.getByName("127.0.0.1"); + assertEquals("/127.0.0.1", ia2.toString()); // Regression for HARMONY-84 - InetAddress addr = InetAddress.getByName("localhost"); - assertEquals("Assert 0: wrong string from name", "localhost/127.0.0.1", addr.toString()); InetAddress addr2 = InetAddress.getByAddress(new byte[]{127, 0, 0, 1}); assertEquals("Assert 1: wrong string from address", "/127.0.0.1", addr2.toString()); } @@ -371,19 +306,6 @@ public class InetAddressTest extends junit.framework.TestCase { theAddress.getCanonicalHostName().length() != 0); assertTrue("getCanonicalHostName returned an empty string ", !theAddress.equals("")); - - // test against an expected value - InetAddress ia = InetAddress - .getByName(Support_Configuration.InetTestIP); - - // Intentionally not testing for exact string match - /* FIXME: comment the assertion below because it is platform/configuration dependent - * Please refer to HARMONY-1664 (https://issues.apache.org/jira/browse/HARMONY-1664) - * for details - */ -// assertTrue( -// "Expected " + Support_Configuration.InetTestAddress + "*", -// ia.getCanonicalHostName().startsWith(Support_Configuration.InetTestAddress)); } /** diff --git a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressThreadTest.java b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressThreadTest.java index 7e20463..ac3ffa2 100644 --- a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressThreadTest.java +++ b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressThreadTest.java @@ -22,7 +22,7 @@ import java.net.InetAddress; import tests.support.Support_Configuration; public class InetAddressThreadTest extends junit.framework.TestCase { - + private static boolean someoneDone[] = new boolean[2]; protected static boolean threadedTestSucceeded; @@ -86,8 +86,8 @@ public class InetAddressThreadTest extends junit.framework.TestCase { String hostName = ia.getHostName(); String hostAddress = ia.getHostAddress(); - // Intentionally not looking for exact name match so that - // the test works across different platforms that may or + // Intentionally not looking for exact name match so that + // the test works across different platforms that may or // may not include a domain suffix on the hostname if (!hostName.startsWith(correctName)) { threadedTestSucceeded = false; @@ -117,7 +117,7 @@ public class InetAddressThreadTest extends junit.framework.TestCase { } } } - + /** * @tests java.net.InetAddress#getHostName() */ @@ -131,18 +131,10 @@ public class InetAddressThreadTest extends junit.framework.TestCase { // Test for threadsafety try { - InetAddress lookup1 = InetAddress - .getByName(Support_Configuration.InetTestAddress); - assertTrue(lookup1 + " expected " - + Support_Configuration.InetTestIP, - Support_Configuration.InetTestIP.equals(lookup1 - .getHostAddress())); - InetAddress lookup2 = InetAddress - .getByName(Support_Configuration.InetTestAddress2); - assertTrue(lookup2 + " expected " - + Support_Configuration.InetTestIP2, - Support_Configuration.InetTestIP2.equals(lookup2 - .getHostAddress())); + InetAddress lookup1 = InetAddress.getByName("localhost"); + assertEquals("127.0.0.1", lookup1.getHostAddress()); + InetAddress lookup2 = InetAddress.getByName("localhost"); + assertEquals("127.0.0.1", lookup2.getHostAddress()); threadsafeTestThread thread1 = new threadsafeTestThread("1", lookup1.getHostName(), lookup1, 0); threadsafeTestThread thread2 = new threadsafeTestThread("2", diff --git a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketPermissionTest.java b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketPermissionTest.java index 9cc7951..d6714c5 100644 --- a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketPermissionTest.java +++ b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketPermissionTest.java @@ -97,10 +97,8 @@ public class SocketPermissionTest extends junit.framework.TestCase { sp2 = new SocketPermission("test1.com:444", "resolve"); assertTrue("Different cases should be equal", sp1.equals(sp2)); - sp1 = new SocketPermission(Support_Configuration.InetTestAddress, - "resolve,connect"); - sp2 = new SocketPermission(Support_Configuration.InetTestIP, - "resolve,connect"); + sp1 = new SocketPermission("localhost", "resolve,connect"); + sp2 = new SocketPermission("127.0.0.1", "resolve,connect"); assertEquals("Same IP address should be equal", sp1, sp2); } @@ -200,7 +198,7 @@ public class SocketPermissionTest extends junit.framework.TestCase { assertTrue("A different host should not imply resolve", !pc .implies(star_Resolve)); } - + /** * @tests serialization/deserialization. */ @@ -209,9 +207,9 @@ public class SocketPermissionTest extends junit.framework.TestCase { SerializationTest.verifySelf(permission); } - + public void test_ConstructorLjava_lang_StringLjava_lang_String_subtestIPv6() { - String[] goodTestStrings = { + String[] goodTestStrings = { "12334.0.0.01", "[fe80::1]", "[FE80:0000:0000:0000:0000:0000:0000:0001]:80", "[::ffff]:80-82", "[ffff::]:80-82", "[fe80::1]:80", @@ -221,7 +219,7 @@ public class SocketPermissionTest extends junit.framework.TestCase { String[] badTestStrings = {"someName:withColonInit:80", "fg80::1", "[ffff:::80-82]", ":[:fff]:80", "FE80:0000:0000:0000:0000:0000:0000:0001:80:82", "FE80::1" }; - + for (int i=0; i < goodTestStrings.length; i++) { try { SocketPermission sp = new SocketPermission(goodTestStrings[i], "connect"); @@ -230,7 +228,7 @@ public class SocketPermissionTest extends junit.framework.TestCase { fail("SocketPermission named: " + goodTestStrings[i] + " failed construction: " + e.getMessage()); } } - + for (int i=0; i < badTestStrings.length; i++) { try { SocketPermission sp = new SocketPermission(badTestStrings[i], "connect"); diff --git a/luni/src/test/resources/net.resources/README.txt b/luni/src/test/resources/net.resources/README.txt index 3a22d90..5acf249 100644 --- a/luni/src/test/resources/net.resources/README.txt +++ b/luni/src/test/resources/net.resources/README.txt @@ -95,9 +95,6 @@ The key properties required by the java.net tests are as follows ... * WebName : The unqualified name of the host where the HTTP server is running. -* TestResourcesDir : the name of the folder on the HTTP server beneath the - document root where the web resources have been deployed. - * HomeAddressResponse : the expected response returned from a successful get from the HTTP server. @@ -114,36 +111,6 @@ The key properties required by the java.net tests are as follows ... * UnresolvedIP : an IP address that does not resolve to a host name -* InetTestAddress : the string name of a network host with IP address given - in the corresponding "InetTestIP" property. - -* InetTestIP : the IP address of a network host whose string name is supplied - in the corresponding "InetTestAddress" property. - -* NonLocalAddressBytes : the bytes representing the address of any machine which - cannot be bound to during the tests. Used in the socket - tests to verify we get the expected error when trying - to bind to an address that cannot be reached. - -* InetTestAddress2 : the string name of a network host with IP address given - in the corresponding "InetTestIP" property. - -* InetTestIP2 : the IP address of a network host whose string name is supplied - in the corresponding "InetTestAddress" property. - -* InetTestHashcode : the expected hashcode value of the "InetTestAddress". - -* SpecialInetTestAddress : An address that resolves to more than one IP address. - The expected number of IP addresses that this address - resolves to should be set in the - "SpecialInetTestAddressNumber" property. Used to test - the java.net.InetAddress.getAllByName() method. - -* SpecialInetTestAddressNumber : The number of IP addresses that resolve to the - host named in the property - "SpecialInetTestAddress". Used to test the - java.net.InetAddress.getAllByName() method. - * FTPTestAddress : a string of the form "jcltest:jclpass@<server address>" that points to the network location of the FTP resources. @@ -158,24 +125,10 @@ The key properties required by the java.net tests are as follows ... Any changes to the web resources will affect this value. -* URLConnectionDate : the expected date when the file - "http://<your HTTP host>/testres231/RESOURCE.TXT" was last - modified. Making any changes to the RESOURCE.TXT file will - mean this property value will require updating. - -* InetTestIP6 : an IPv6 address to help test out serialization of the type - java.net.Inet6Address . - * ResolvedNotExistingHost : an IP address that resolves to a host that is not present on the local network. This allows us to check the timeouts for socket connections. -* InetAlias1 : this property and "InetAlias2" should be different host names - that resolve to the same IP address. - -* InetAlias2 : this property and "InetAlias1" should be different host names - that resolve to the same IP address. - * IPv6GlobalAddressJcl4 : the IPv6 address for a host on the network. diff --git a/support/src/test/java/tests/support/Support_Configuration.java b/support/src/test/java/tests/support/Support_Configuration.java index 027486a..be2fc5f 100644 --- a/support/src/test/java/tests/support/Support_Configuration.java +++ b/support/src/test/java/tests/support/Support_Configuration.java @@ -1,13 +1,13 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -61,28 +61,16 @@ public class Support_Configuration { // 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 @@ -95,30 +83,12 @@ public class Support_Configuration { * (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"; @@ -212,80 +182,6 @@ public class Support_Configuration { UnresolvedIP = value; } - value = props.get("InetTestAddress"); - if (value != null) { - InetTestAddress = value; - } - - value = 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 = 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 = props.get("InetTestAddress2"); - if (value != null) { - InetTestAddress2 = value; - } - - value = props.get("InetTestIP2"); - if (value != null) { - InetTestIP2 = value; - } - - value = props.get("InetTestHashcode"); - if (value != null) { - InetTestHashcode = Integer.parseInt(value); - } - - value = props.get("SpecialInetTestAddress"); - if (value != null) { - SpecialInetTestAddress = value; - } - - value = props.get("SpecialInetTestAddressNumber"); - if (value != null) { - SpecialInetTestAddressNumber = Integer.parseInt(value); - } - value = props.get("FTPTestAddress"); if (value != null) { FTPTestAddress = value; @@ -301,11 +197,6 @@ public class Support_Configuration { URLConnectionLastModified = Long.parseLong(value); } - value = props.get("URLConnectionDate"); - if (value != null) { - URLConnectionDate = Long.parseLong(value); - } - value = props.get("Port1"); if (value != null) { Port1 = value; @@ -316,16 +207,6 @@ public class Support_Configuration { Port2 = value; } - value = props.get("InetTestIP6"); - if (value != null) { - InetTestIP6 = value; - } - - value = props.get("InetTestIP6LO"); - if (value != null) { - InetTestIP6LO = value; - } - value = props.get("ProxyServerTestHostIPv6"); if (value != null) { ProxyServerTestHostIPv6 = value; @@ -336,16 +217,6 @@ public class Support_Configuration { ResolvedNotExistingHost = value; } - value = props.get("InetAlias1"); - if (value != null) { - InetAlias1 = value; - } - - value = props.get("InetAlias2"); - if (value != null) { - InetAlias2 = value; - } - value = props.get("IPv6GlobalAddressJcl4"); if (value != null) { IPv6GlobalAddressJcl4 = value; diff --git a/support/src/test/resources/config/localhosttest.ini b/support/src/test/resources/config/localhosttest.ini index 7fb25da..3c78404 100644 --- a/support/src/test/resources/config/localhosttest.ini +++ b/support/src/test/resources/config/localhosttest.ini @@ -7,24 +7,8 @@ ProxyServerTestHost=localhost SocksServerTestHost=localhost SocksServerTestPort=2080 UnresolvedIP=192.168.99.99 -InetTestAddress=localhost -InetTestIP=127.0.0.1 -NonLocalAddressBytes=1.0.0.0 -InetTestAddress2=localhost -InetTestIP2=127.0.0.1 -InetTestHashcode=2130706433 -SpecialInetTestAddress=localhost -SpecialInetTestAddressNumber=1 FTPTestAddress=jcltest:jclpass@localhost URLConnectionLastModifiedString=Sat, 07 Jan 2006 13:50:52 GMT URLConnectionLastModified=1136641852000 -URLConnectionDate=929092440000 -InetTestIP6=fe80::20d:60ff:fe24:7410 ResolvedNotExistingHost=9.26.194.72 -InetAlias1=localhost -InetAlias2=localhost IPv6GlobalAddressJcl4= - - - - |