\rModified JUnit tests to allow IP Address form of 'localhost' to support Windows... 40/23240/1
authorbotte <b.otte@cablelabs.com>
Wed, 24 Jun 2015 18:40:31 +0000 (19:40 +0100)
committerbotte <b.otte@cablelabs.com>
Wed, 24 Jun 2015 18:40:31 +0000 (19:40 +0100)
Change-Id: I9c9ba3937a2608a263a44069888b2d1b2f981d0e
Signed-off-by: botte <b.otte@cablelabs.com>
packetcable-driver/src/test/java/org/umu/cops/stack/COPSIpv4AddressTest.java
packetcable-driver/src/test/java/org/umu/cops/stack/COPSIpv4InInterfaceTest.java
packetcable-driver/src/test/java/org/umu/cops/stack/COPSIpv4LastPdpAddrTest.java
packetcable-driver/src/test/java/org/umu/cops/stack/COPSIpv4OutInterfaceTest.java
packetcable-driver/src/test/java/org/umu/cops/stack/COPSIpv4PdpRedirectAddressTest.java
packetcable-driver/src/test/java/org/umu/cops/stack/COPSIpv6AddressTest.java
packetcable-driver/src/test/java/org/umu/cops/stack/COPSIpv6InInterfaceTest.java
packetcable-driver/src/test/java/org/umu/cops/stack/COPSIpv6LastPdpAddrTest.java
packetcable-driver/src/test/java/org/umu/cops/stack/COPSIpv6OutInterfaceTest.java
packetcable-driver/src/test/java/org/umu/cops/stack/COPSIpv6PdpRedirectAddressTest.java

index 75f8333409a43d14bdc07a84e97abaec012856cc..c11e5438c2fb2c59ccfcdc06764eeca83a14c7e6 100644 (file)
@@ -21,7 +21,7 @@ public class COPSIpv4AddressTest {
         final COPSIpv4Address address = new COPSIpv4Address("localhost");
         Assert.assertEquals(4, address.getDataLength());
         Assert.assertArrayEquals(InetAddress.getByName("localhost").getAddress(), address.getAddressBytes());
-        Assert.assertEquals("localhost", address.getIpName());
+        Assert.assertTrue(address.getIpName().equals("localhost") || address.getIpName().equals("127.0.0.1"));
     }
 
     @Test
@@ -30,7 +30,7 @@ public class COPSIpv4AddressTest {
         final COPSIpv4Address address = new COPSIpv4Address(addr);
         Assert.assertEquals(4, address.getDataLength());
         Assert.assertArrayEquals(addr, address.getAddressBytes());
-        Assert.assertEquals("localhost", address.getIpName());
+        Assert.assertTrue(address.getIpName().equals("localhost") || address.getIpName().equals("127.0.0.1"));
     }
 
 }
index 19c86f5524881000d27429cbe1c7930f9388b8af..b2d7053dd95cec3c832e4a487888d44d824c65d2 100644 (file)
@@ -58,7 +58,7 @@ public class COPSIpv4InInterfaceTest {
         Assert.assertEquals("**In-Interface**", lines[0]);
         Assert.assertEquals("C-num: ININTF", lines[1]);
         Assert.assertEquals("C-type: DEF", lines[2]);
-        Assert.assertEquals("Address: localhost", lines[3]);
+        Assert.assertTrue(lines[3].equals("Address: localhost") || lines[3].equals("Address: 127.0.0.1"));
         Assert.assertEquals("ifindex: 5", lines[4]);
     }
 
index c45ab10730b8ac567e5ceff115546fe9184a493b..ab83593016e6552c1ae64f0d5e206384f45993e1 100644 (file)
@@ -50,7 +50,7 @@ public class COPSIpv4LastPdpAddrTest {
         Assert.assertEquals("C-num: LAST_PDP_ADDR", lines[1]);
         Assert.assertEquals("C-type: DEF", lines[2]);
         Assert.assertEquals("Ipv4LastPdpAddress", lines[3]);
-        Assert.assertEquals("Address: localhost", lines[4]);
+        Assert.assertTrue(lines[4].equals("Address: localhost") || lines[4].equals("Address: 127.0.0.1"));
         Assert.assertEquals("Port: 1234", lines[5]);
     }
 
@@ -104,7 +104,7 @@ public class COPSIpv4LastPdpAddrTest {
         Assert.assertEquals("C-num: LAST_PDP_ADDR", lines[1]);
         Assert.assertEquals("C-type: DEF", lines[2]);
         Assert.assertEquals("Ipv4LastPdpAddress", lines[3]);
-        Assert.assertEquals("Address: localhost", lines[4]);
+        Assert.assertTrue(lines[4].equals("Address: localhost") || lines[4].equals("Address: 127.0.0.1"));
         Assert.assertEquals("Port: 1234", lines[5]);
     }
 
index dd56ecc9d4b6eb131cdfef9518ee2d01070aeeaf..1635ab9bb5500c6821d962675d9fa5618c33c62b 100644 (file)
@@ -58,7 +58,7 @@ public class COPSIpv4OutInterfaceTest {
         Assert.assertEquals("**Out-Interface**", lines[0]);
         Assert.assertEquals("C-num: OUTINTF", lines[1]);
         Assert.assertEquals("C-type: DEF", lines[2]);
-        Assert.assertEquals("Address: localhost", lines[3]);
+        Assert.assertTrue(lines[3].equals("Address: localhost") || lines[3].equals("Address: 127.0.0.1"));
         Assert.assertEquals("ifindex: 5", lines[4]);
     }
 
index 30f6e1154cf32bf9ca45273ef181d27b59a34267..bb61c0705724d39c369aab1108a83671e52b1a97 100644 (file)
@@ -50,7 +50,7 @@ public class COPSIpv4PdpRedirectAddressTest {
         Assert.assertEquals("C-num: PDP_REDIR", lines[1]);
         Assert.assertEquals("C-type: DEF", lines[2]);
         Assert.assertEquals("Ipv4PdpRedirectAddress", lines[3]);
-        Assert.assertEquals("Address: localhost", lines[4]);
+        Assert.assertTrue(lines[4].equals("Address: localhost") || lines[4].equals("Address: 127.0.0.1"));
         Assert.assertEquals("Port: 1234", lines[5]);
     }
 
@@ -104,7 +104,7 @@ public class COPSIpv4PdpRedirectAddressTest {
         Assert.assertEquals("C-num: PDP_REDIR", lines[1]);
         Assert.assertEquals("C-type: DEF", lines[2]);
         Assert.assertEquals("Ipv4PdpRedirectAddress", lines[3]);
-        Assert.assertEquals("Address: localhost", lines[4]);
+        Assert.assertTrue(lines[4].equals("Address: localhost") || lines[4].equals("Address: 127.0.0.1"));
         Assert.assertEquals("Port: 1234", lines[5]);
     }
 
index 7c8fefa643f24189b122b89445ee2316098a3d05..4c1220bb0c7b2458361bba828d873014e646b31d 100644 (file)
@@ -23,7 +23,7 @@ public class COPSIpv6AddressTest {
         final COPSIpv6Address address = new COPSIpv6Address("localhost");
         Assert.assertEquals(16, address.getDataLength());
         Assert.assertArrayEquals(getLocalhostIpv6Address(), address.getAddressBytes());
-        Assert.assertEquals("localhost", address.getIpName());
+        Assert.assertNotNull(address.getIpName());
     }
 
     @Test
@@ -32,7 +32,7 @@ public class COPSIpv6AddressTest {
         final COPSIpv6Address address = new COPSIpv6Address(addr);
         Assert.assertEquals(16, address.getDataLength());
         Assert.assertArrayEquals(addr, address.getAddressBytes());
-        Assert.assertEquals("localhost", address.getIpName());
+        Assert.assertNotNull(address.getIpName());
     }
 
     private byte[] getLocalhostIpv6Address() throws UnknownHostException {
index afa9c85b06f064c7a3347379a59264cfe0d2f5ef..972db1a01bd4c832f387dcf9cb73ced878f97d3d 100644 (file)
@@ -58,7 +58,7 @@ public class COPSIpv6InInterfaceTest {
         Assert.assertEquals("**In-Interface**", lines[0]);
         Assert.assertEquals("C-num: ININTF", lines[1]);
         Assert.assertEquals("C-type: STATELESS", lines[2]);
-        Assert.assertEquals("Address: localhost", lines[3]);
+        Assert.assertTrue(lines[3].equals("Address: localhost") || lines[3].equals("Address: 0:0:0:0:0:0:0:1"));
         Assert.assertEquals("ifindex: 5", lines[4]);
     }
 
index 494635e84b484bbb338544b2d29c498e5973e9a9..9058f9ea8ab596b945c51da0a5958c6c98ed6311 100644 (file)
@@ -52,7 +52,7 @@ public class COPSIpv6LastPdpAddrTest {
         Assert.assertEquals("C-num: LAST_PDP_ADDR", lines[1]);
         Assert.assertEquals("C-type: STATELESS", lines[2]);
         Assert.assertEquals("Ipv6LastPdpAddr", lines[3]);
-        Assert.assertEquals("Address: localhost", lines[4]);
+        Assert.assertTrue(lines[4].equals("Address: localhost") || lines[4].equals("Address: 0:0:0:0:0:0:0:1"));
         Assert.assertEquals("Port: 1234", lines[5]);
     }
 
@@ -112,7 +112,7 @@ public class COPSIpv6LastPdpAddrTest {
         Assert.assertEquals("C-num: LAST_PDP_ADDR", lines[1]);
         Assert.assertEquals("C-type: STATELESS", lines[2]);
         Assert.assertEquals("Ipv6LastPdpAddr", lines[3]);
-        Assert.assertEquals("Address: localhost", lines[4]);
+        Assert.assertTrue(lines[4].equals("Address: localhost") || lines[4].equals("Address: 0:0:0:0:0:0:0:1"));
         Assert.assertEquals("Port: 1234", lines[5]);
     }
 
index e6181cf2975a99279e3429a3cac70aec74703a18..3e0d1b906cb4e7c16dfd59233ffae39a1735fd4f 100644 (file)
@@ -58,7 +58,7 @@ public class COPSIpv6OutInterfaceTest {
         Assert.assertEquals("**Out-Interface**", lines[0]);
         Assert.assertEquals("C-num: OUTINTF", lines[1]);
         Assert.assertEquals("C-type: STATELESS", lines[2]);
-        Assert.assertEquals("Address: localhost", lines[3]);
+        Assert.assertTrue(lines[3].equals("Address: localhost") || lines[3].equals("Address: 0:0:0:0:0:0:0:1"));
         Assert.assertEquals("ifindex: 5", lines[4]);
     }
 
index e6c8a42a32140039cfa6c08957645f9a6d1ad1ac..735ed055a06af435a0d19c02d2a539918f613b8a 100644 (file)
@@ -52,7 +52,7 @@ public class COPSIpv6PdpRedirectAddressTest {
         Assert.assertEquals("C-num: PDP_REDIR", lines[1]);
         Assert.assertEquals("C-type: STATELESS", lines[2]);
         Assert.assertEquals("Ipv6PdpRedirectAddress", lines[3]);
-        Assert.assertEquals("Address: localhost", lines[4]);
+        Assert.assertTrue(lines[4].equals("Address: localhost") || lines[4].equals("Address: 0:0:0:0:0:0:0:1"));
         Assert.assertEquals("Port: 1234", lines[5]);
     }
 
@@ -112,7 +112,7 @@ public class COPSIpv6PdpRedirectAddressTest {
         Assert.assertEquals("C-num: PDP_REDIR", lines[1]);
         Assert.assertEquals("C-type: STATELESS", lines[2]);
         Assert.assertEquals("Ipv6PdpRedirectAddress", lines[3]);
-        Assert.assertEquals("Address: localhost", lines[4]);
+        Assert.assertTrue(lines[4].equals("Address: localhost") || lines[4].equals("Address: 0:0:0:0:0:0:0:1"));
         Assert.assertEquals("Port: 1234", lines[5]);
     }