From af54f0ee97b1630b0c03ee0493fe5f1994f73927 Mon Sep 17 00:00:00 2001 From: jomu Date: Sat, 27 Apr 2013 19:49:33 +0000 Subject: [PATCH] added tests --- .../shared/network/ArinWhoisParserTest.java | 14 +++ .../muehlencord/shared/network/WhoisTest.java | 12 +- .../shared/network/74.95.241.217.txt | 116 ++++++++++++++++++ 3 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 network/src/test/resources/de/muehlencord/shared/network/74.95.241.217.txt diff --git a/network/src/test/java/de/muehlencord/shared/network/ArinWhoisParserTest.java b/network/src/test/java/de/muehlencord/shared/network/ArinWhoisParserTest.java index e01da19..0dd0f2d 100644 --- a/network/src/test/java/de/muehlencord/shared/network/ArinWhoisParserTest.java +++ b/network/src/test/java/de/muehlencord/shared/network/ArinWhoisParserTest.java @@ -31,6 +31,7 @@ public class ArinWhoisParserTest extends BaseTest { } @Test + @Ignore public void testParseArinDoubleIp() throws IOException, WhoisException { String whoisInformation = this.readContentFromFile("108.166.92.167.txt"); ArinWhoisParser parser = new ArinWhoisParser(); @@ -42,4 +43,17 @@ public class ArinWhoisParserTest extends BaseTest { System.out.println (information.getNetwork().toString()); System.out.println (information.getRootNetwork().toString()); } + + @Test + public void testParseArinUnknown() throws IOException, WhoisException { + String whoisInformation = this.readContentFromFile("74.95.241.217.txt"); + ArinWhoisParser parser = new ArinWhoisParser(); + WhoisInformation information = parser.parseWhoIsString(whoisInformation); + assertNotNull (information); + information.validate(); + System.out.println ("testParseArinDoubleIp"); + System.out.println (information.getNetworkInformation().toString()); + System.out.println (information.getNetwork().toString()); + System.out.println (information.getRootNetwork().toString()); + } } \ No newline at end of file diff --git a/network/src/test/java/de/muehlencord/shared/network/WhoisTest.java b/network/src/test/java/de/muehlencord/shared/network/WhoisTest.java index 9444bb2..3653bb5 100644 --- a/network/src/test/java/de/muehlencord/shared/network/WhoisTest.java +++ b/network/src/test/java/de/muehlencord/shared/network/WhoisTest.java @@ -31,22 +31,28 @@ public class WhoisTest extends BaseTest { } @Test - @Ignore + // @Ignore // TODO 184.173.67.10 whois with referal public void testArin() throws WhoisException { Whois whoIsClient = new Whois(); - WhoisInformation whoisInformation = whoIsClient.execute ("whois.arin.net", "204.232.209.184"); + // WhoisInformation whoisInformation = whoIsClient.execute ("whois.arin.net", "204.232.209.184"); + WhoisInformation whoisInformation = whoIsClient.execute ("whois.arin.net", "74.95.241.217"); assertNotNull (whoisInformation); + whoisInformation.validate(); + assertEquals ("Country", "US", whoisInformation.getNetworkInformation().getCountry()); + System.out.println ("Network: "+whoisInformation.getNetwork()); + assertTrue ("Network", whoisInformation.getNetwork().contains("74.95.224.0/19")); } @Test @Ignore public void testApnic() throws WhoisException { Whois whoIsClient = new Whois(); - whoIsClient.execute ("whois.apnic.net", "60.247.69.45"); + whoIsClient.execute ("whois.apnic.net", "60.247.69.45"); } @Test + @Ignore public void testLacnic() throws WhoisException { Whois whoIsClient = new Whois(); WhoisInformation whoisInformation = whoIsClient.execute ("whois.lacnic.net", "200.29.132.82"); diff --git a/network/src/test/resources/de/muehlencord/shared/network/74.95.241.217.txt b/network/src/test/resources/de/muehlencord/shared/network/74.95.241.217.txt new file mode 100644 index 0000000..cd7b012 --- /dev/null +++ b/network/src/test/resources/de/muehlencord/shared/network/74.95.241.217.txt @@ -0,0 +1,116 @@ + +# +# ARIN WHOIS data and services are subject to the Terms of Use +# available at: https://www.arin.net/whois_tou.html +# + + +# +# The following results may also be obtained via: +# http://whois.arin.net/rest/nets;q=74.95.241.217?showDetails=true&showARIN=false&ext=netref2 +# + + +# start + +NetRange: 74.95.224.0 - 74.95.255.255 +CIDR: 74.95.224.0/19 +OriginAS: +NetName: HOUSTON-CBC-2 +NetHandle: NET-74-95-224-0-1 +Parent: NET-74-92-0-0-1 +NetType: Reallocated +RegDate: 2007-11-13 +Updated: 2007-11-13 +Ref: http://whois.arin.net/rest/net/NET-74-95-224-0-1 + +OrgName: Comcast Business Communications, LLC +OrgId: CBCI +Address: 1800 Bishops Gate Blvd. +City: Mount Laurel +StateProv: NJ +PostalCode: 08054-4628 +Country: US +RegDate: 2001-12-21 +Updated: 2011-01-06 +Ref: http://whois.arin.net/rest/org/CBCI + +OrgTechHandle: IC161-ARIN +OrgTechName: Comcast Cable Communications Inc +OrgTechPhone: +1-856-317-7200 +OrgTechEmail: CNIPEO-Ip-registration@cable.comcast.com +OrgTechRef: http://whois.arin.net/rest/poc/IC161-ARIN + +OrgAbuseHandle: NAPO-ARIN +OrgAbuseName: Network Abuse and Policy Observance +OrgAbusePhone: +1-856-317-7272 +OrgAbuseEmail: abuse@comcast.net +OrgAbuseRef: http://whois.arin.net/rest/poc/NAPO-ARIN + +RAbuseHandle: NAPO-ARIN +RAbuseName: Network Abuse and Policy Observance +RAbusePhone: +1-856-317-7272 +RAbuseEmail: abuse@comcast.net +RAbuseRef: http://whois.arin.net/rest/poc/NAPO-ARIN + +# end + + +# start + +NetRange: 74.92.0.0 - 74.95.255.255 +CIDR: 74.92.0.0/14 +OriginAS: +NetName: CBC-CM-4 +NetHandle: NET-74-92-0-0-1 +Parent: NET-74-0-0-0-0 +NetType: Direct Allocation +RegDate: 2006-05-18 +Updated: 2013-01-07 +Ref: http://whois.arin.net/rest/net/NET-74-92-0-0-1 + + +OrgName: Comcast Business Communications, LLC +OrgId: CBCI +Address: 1800 Bishops Gate Blvd. +City: Mount Laurel +StateProv: NJ +PostalCode: 08054-4628 +Country: US +RegDate: 2001-12-21 +Updated: 2011-01-06 +Ref: http://whois.arin.net/rest/org/CBCI + +OrgTechHandle: IC161-ARIN +OrgTechName: Comcast Cable Communications Inc +OrgTechPhone: +1-856-317-7200 +OrgTechEmail: CNIPEO-Ip-registration@cable.comcast.com +OrgTechRef: http://whois.arin.net/rest/poc/IC161-ARIN + +OrgAbuseHandle: NAPO-ARIN +OrgAbuseName: Network Abuse and Policy Observance +OrgAbusePhone: +1-856-317-7272 +OrgAbuseEmail: abuse@comcast.net +OrgAbuseRef: http://whois.arin.net/rest/poc/NAPO-ARIN + +RAbuseHandle: NAPO-ARIN +RAbuseName: Network Abuse and Policy Observance +RAbusePhone: +1-856-317-7272 +RAbuseEmail: abuse@comcast.net +RAbuseRef: http://whois.arin.net/rest/poc/NAPO-ARIN + +RTechHandle: IC161-ARIN +RTechName: Comcast Cable Communications Inc +RTechPhone: +1-856-317-7200 +RTechEmail: CNIPEO-Ip-registration@cable.comcast.com +RTechRef: http://whois.arin.net/rest/poc/IC161-ARIN + +# end + + + +# +# ARIN WHOIS data and services are subject to the Terms of Use +# available at: https://www.arin.net/whois_tou.html +# +