You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by lm...@apache.org on 2014/02/22 04:08:31 UTC
git commit: KNOX-278 added tests for ipv6 addresses
Repository: incubator-knox
Updated Branches:
refs/heads/master 86a6c6085 -> c926db698
KNOX-278 added tests for ipv6 addresses
Project: http://git-wip-us.apache.org/repos/asf/incubator-knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-knox/commit/c926db69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-knox/tree/c926db69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-knox/diff/c926db69
Branch: refs/heads/master
Commit: c926db698b926ed7495684f3d3049fe570749b21
Parents: 86a6c60
Author: Larry McCay <lm...@hortonworks.com>
Authored: Fri Feb 21 22:07:52 2014 -0500
Committer: Larry McCay <lm...@hortonworks.com>
Committed: Fri Feb 21 22:07:52 2014 -0500
----------------------------------------------------------------------
.../apache/hadoop/gateway/util/IpAddressValidatorTest.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/c926db69/gateway-util-common/src/test/java/org/apache/hadoop/gateway/util/IpAddressValidatorTest.java
----------------------------------------------------------------------
diff --git a/gateway-util-common/src/test/java/org/apache/hadoop/gateway/util/IpAddressValidatorTest.java b/gateway-util-common/src/test/java/org/apache/hadoop/gateway/util/IpAddressValidatorTest.java
index 5db9651..ff34dec 100644
--- a/gateway-util-common/src/test/java/org/apache/hadoop/gateway/util/IpAddressValidatorTest.java
+++ b/gateway-util-common/src/test/java/org/apache/hadoop/gateway/util/IpAddressValidatorTest.java
@@ -22,7 +22,7 @@ import org.junit.Test;
import junit.framework.TestCase;
public class IpAddressValidatorTest extends TestCase {
- String test = "127.0.0.1,193.*,192.168.1.*";
+ String test = "127.0.0.1,193.*,192.168.1.*,0:0:0:0:0:0:0:1,0:0:0:0:0:0:*";
String testWeirdConfig = ",127.0.0.1,,193.*,192.168.1.*,29*";
String testNullConfig = null;
@@ -33,6 +33,9 @@ public class IpAddressValidatorTest extends TestCase {
assertTrue("Should have validated 127.0.0.1", ipv.validateIpAddress("127.0.0.1"));
assertFalse("Should not have validated 127.0.0.2", ipv.validateIpAddress("127.0.0.2"));
+ assertTrue("Should have validated 0:0:0:0:0:0:0:1", ipv.validateIpAddress("0:0:0:0:0:0:0:1"));
+ assertFalse("Should not have validated 1:0:0:0:0:0:0:1", ipv.validateIpAddress("1:0:0:0:0:0:0:1"));
+
ipv = new IpAddressValidator(testWeirdConfig);
assertTrue("Should have validated 127.0.0.1", ipv.validateIpAddress("127.0.0.1"));
@@ -61,6 +64,9 @@ public class IpAddressValidatorTest extends TestCase {
assertTrue("Should have validated 192.168.1.1", ipv.validateIpAddress("192.168.1.1"));
assertFalse("Should not have validated 192.168.2.1", ipv.validateIpAddress("192.168.2.1"));
+ assertTrue("Should have validated 0:0:0:0:0:0:0:2", ipv.validateIpAddress("0:0:0:0:0:0:0:2"));
+ assertFalse("Should not have validated 0:0:0:0:0:0:2:2", ipv.validateIpAddress("0:0:0:0:0:2:2:2"));
+
assertTrue("Should have validated 193.168.1.1", ipv.validateIpAddress("193.168.1.1"));
assertFalse("Should not have validated 194.168.2.1", ipv.validateIpAddress("194.168.2.1"));