Examples of JacksonFactory


Examples of com.google.api.client.json.jackson2.JacksonFactory

        .build();
    MockGoogleClientRequest<String> jsonHttpRequest1 =
        new MockGoogleClientRequest<String>(client, METHOD1, URI_TEMPLATE1, null, String.class);
    MockGoogleClientRequest<String> jsonHttpRequest2 =
        new MockGoogleClientRequest<String>(client, METHOD2, URI_TEMPLATE2, null, String.class);
    ObjectParser parser = new JsonObjectParser(new JacksonFactory());
    BatchRequest batchRequest =
        new BatchRequest(transport, null).setBatchUrl(new GenericUrl(TEST_BATCH_URL));
    HttpRequest request1 = jsonHttpRequest1.buildHttpRequest();
    request1.setParser(parser);
    HttpRequest request2 = jsonHttpRequest2.buildHttpRequest();
View Full Code Here

Examples of com.google.api.client.json.jackson2.JacksonFactory

    return payload;
  }

  public void testBuilder() throws Exception {
    GoogleIdTokenVerifier.Builder builder = new GoogleIdTokenVerifier.Builder(
        new GooglePublicKeysManagerTest.PublicCertsMockHttpTransport(), new JacksonFactory()).setIssuer(
        ISSUER).setAudience(TRUSTED_CLIENT_IDS);
    assertEquals(Clock.SYSTEM, builder.getClock());
    assertEquals(ISSUER, builder.getIssuer());
    assertTrue(TRUSTED_CLIENT_IDS.equals(builder.getAudience()));
    Clock clock = new FixedClock(4);
View Full Code Here

Examples of com.google.api.client.json.jackson2.JacksonFactory

    assertEquals(TRUSTED_CLIENT_IDS, Lists.newArrayList(verifier.getAudience()));
  }

  public void testVerify() throws Exception {
    GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(
        new GooglePublicKeysManagerTest.PublicCertsMockHttpTransport(), new JacksonFactory()).build();
    Header header = new Header();
    header.setAlgorithm("RS25");
    Payload payload = newPayload(CLIENT_ID);
    Payload payload2 = newPayload(CLIENT_ID + "2");
    GoogleIdToken idToken = new GoogleIdToken(header, payload, new byte[0], new byte[0]);
    GoogleIdToken idToken2 = new GoogleIdToken(header, payload2, new byte[0], new byte[0]);
    assertFalse(verifier.verify(idToken));
    assertFalse(verifier.verify(idToken2));
    verifier = new GoogleIdTokenVerifier(
        new GooglePublicKeysManagerTest.PublicCertsMockHttpTransport(), new JacksonFactory());
    assertFalse(verifier.verify(idToken));
    assertFalse(verifier.verify(idToken2));
    // TODO(yanivi): add a unit test that returns true
  }
View Full Code Here

Examples of com.google.api.client.json.jackson2.JacksonFactory

  private static final String REDIRECT_URI = "https://oauth2-login-demo.appspot.com/code";

  public void test() {
    GoogleAuthorizationCodeTokenRequest request =
        new GoogleAuthorizationCodeTokenRequest(new MockHttpTransport(),
            new JacksonFactory(),
            CLIENT_ID,
            CLIENT_SECRET,
            CODE,
            REDIRECT_URI);
    ClientParametersAuthentication clientAuthentication =
View Full Code Here

Examples of com.google.api.client.json.jackson2.JacksonFactory

  private static final int AGE = 42;

  public void testBuilder() throws Exception {
    HttpTransport transport = new MockHttpTransport();
    JsonFactory jsonFactory = new JacksonFactory();
    GooglePublicKeysManager.Builder builder = new GooglePublicKeysManager.Builder(transport, jsonFactory);

    GooglePublicKeysManager certs = builder.build();
    assertEquals(transport, certs.getTransport());
    assertEquals(jsonFactory, certs.getJsonFactory());
View Full Code Here

Examples of com.google.api.client.json.jackson2.JacksonFactory

    }
  }

  public void testRefresh() throws Exception {
    GooglePublicKeysManager certs = new GooglePublicKeysManager.Builder(
        new PublicCertsMockHttpTransport(), new JacksonFactory()).build();
    certs.refresh();
    assertEquals(2, certs.getPublicKeys().size());
  }
View Full Code Here

Examples of com.google.api.client.json.jackson2.JacksonFactory

  public void testLoadCerts_cache() throws Exception {
    PublicCertsMockHttpTransport transport = new PublicCertsMockHttpTransport();
    transport.useAgeHeader = true;
    GooglePublicKeysManager certs = new GooglePublicKeysManager.Builder(
        transport, new JacksonFactory()).setClock(new FixedClock(100)).build();

    certs.refresh();
    assertEquals(2, certs.getPublicKeys().size());
    assertEquals(100 + (MAX_AGE - AGE) * 1000, certs.getExpirationTimeMilliseconds());
  }
View Full Code Here

Examples of com.google.api.client.json.jackson2.JacksonFactory

    assertEquals(100 + (MAX_AGE - AGE) * 1000, certs.getExpirationTimeMilliseconds());
  }

  public void testGetCacheTimeInSec() throws Exception {
    GooglePublicKeysManager certs =
        new GooglePublicKeysManager.Builder(new MockHttpTransport(), new JacksonFactory()).build();
    assertEquals(12000, certs.getCacheTimeInSec(
        new HttpHeaders().setAge(345L).setCacheControl("max-age=" + MAX_AGE)));
    assertEquals(0, certs.getCacheTimeInSec(new HttpHeaders()));
    assertEquals(0, certs.getCacheTimeInSec(new HttpHeaders().setAge(345L)));
    assertEquals(
View Full Code Here

Examples of com.google.api.client.json.jackson2.JacksonFactory

            return result;
          }
        };
      }
    };
    JsonFactory jsonFactory = new JacksonFactory();
    MockGoogleJsonClient client = new MockGoogleJsonClient.Builder(
        transport, jsonFactory, HttpTesting.SIMPLE_URL, "", null, false).setApplicationName(
        "Test Application").build();
    MockGoogleJsonClientRequest<String> request =
        new MockGoogleJsonClientRequest<String>(client, "GET", "foo", null, String.class);
View Full Code Here

Examples of com.google.api.client.json.jackson2.JacksonFactory

  public void testInitialize() throws Exception {
    CommonGoogleJsonClientRequestInitializer key =
        new CommonGoogleJsonClientRequestInitializer("foo");
    MockGoogleJsonClient client = new MockGoogleJsonClient.Builder(
        new MockHttpTransport(), new JacksonFactory(), HttpTesting.SIMPLE_URL, "test/", null,
        false).setApplicationName("Test Application").build();
    MyRequest request = new MyRequest(client, "GET", "", null, String.class);
    assertNull(request.key);
    key.initialize(request);
    assertEquals("foo", request.key);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.