Exemplo n.º 1
0
  public static XMPPConnection xmppConnection() throws CredentialException, IOException {
    final GoogleOAuth2Credentials creds = TestUtils.getGoogleOauthCreds();
    final int attempts = 2;

    final XMPPConnection conn =
        XmppUtils.persistentXmppConnection(
            creds, attempts, "talk.google.com", 5222, "gmail.com", null);
    return conn;
  }
Exemplo n.º 2
0
  @Test
  public void testLookupService() {
    GeoIpLookupService lookupService = TestUtils.getGeoIpLookupService();
    // check that data loads
    assertEquals("US", lookupService.getGeoData("18.1.1.1").getCountrycode());
    assertEquals("IN", lookupService.getGeoData("223.255.244.1").getCountrycode());

    final GeoData data = lookupService.getGeoData("86.170.128.133");
    assertTrue(data.getLatitude() > 50.0);
    assertTrue(data.getLongitude() < 3.0);
    assertEquals("GB", data.getCountrycode());

    final GeoData data2 = lookupService.getGeoData("87.170.128.133");
    assertTrue(data2.getLatitude() > 50.0);
    assertTrue(data2.getLongitude() > 13.0);
    assertEquals("DE", data2.getCountrycode());
  }