added tests

This commit is contained in:
jomu
2013-04-27 19:49:33 +00:00
parent fe2ae1eb6f
commit af54f0ee97
3 changed files with 139 additions and 3 deletions

View File

@ -31,6 +31,7 @@ public class ArinWhoisParserTest extends BaseTest {
} }
@Test @Test
@Ignore
public void testParseArinDoubleIp() throws IOException, WhoisException { public void testParseArinDoubleIp() throws IOException, WhoisException {
String whoisInformation = this.readContentFromFile("108.166.92.167.txt"); String whoisInformation = this.readContentFromFile("108.166.92.167.txt");
ArinWhoisParser parser = new ArinWhoisParser(); ArinWhoisParser parser = new ArinWhoisParser();
@ -42,4 +43,17 @@ public class ArinWhoisParserTest extends BaseTest {
System.out.println (information.getNetwork().toString()); System.out.println (information.getNetwork().toString());
System.out.println (information.getRootNetwork().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());
}
} }

View File

@ -31,22 +31,28 @@ public class WhoisTest extends BaseTest {
} }
@Test @Test
@Ignore // @Ignore
// TODO 184.173.67.10 whois with referal // TODO 184.173.67.10 whois with referal
public void testArin() throws WhoisException { public void testArin() throws WhoisException {
Whois whoIsClient = new Whois(); 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); 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 @Test
@Ignore @Ignore
public void testApnic() throws WhoisException { public void testApnic() throws WhoisException {
Whois whoIsClient = new Whois(); Whois whoIsClient = new Whois();
whoIsClient.execute ("whois.apnic.net", "60.247.69.45"); whoIsClient.execute ("whois.apnic.net", "60.247.69.45");
} }
@Test @Test
@Ignore
public void testLacnic() throws WhoisException { public void testLacnic() throws WhoisException {
Whois whoIsClient = new Whois(); Whois whoIsClient = new Whois();
WhoisInformation whoisInformation = whoIsClient.execute ("whois.lacnic.net", "200.29.132.82"); WhoisInformation whoisInformation = whoIsClient.execute ("whois.lacnic.net", "200.29.132.82");

View File

@ -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
#