/** * Returns the credentials instance from the given access token. * * @param accessToken the access token * @return the credentials instance */ public static GoogleCredentials create(AccessToken accessToken) { return GoogleCredentials.newBuilder().setAccessToken(accessToken).build(); }
public Builder toBuilder() { return new Builder(this); }
public GoogleCredentials build() { return new GoogleCredentials(getAccessToken()); }
protected Builder(GoogleCredentials credentials) { setAccessToken(credentials.getAccessToken()); }
public GoogleCredentials build() { return new GoogleCredentials(getAccessToken()); }
protected Builder(GoogleCredentials credentials) { setAccessToken(credentials.getAccessToken()); }
public static Builder newBuilder() { return new Builder(); }
public Builder setAccessToken(AccessToken token) { super.setAccessToken(token); return this; }
public Builder setAccessToken(AccessToken token) { super.setAccessToken(token); return this; }
public static Builder newBuilder() { return new Builder(); }
public Builder toBuilder() { return new Builder(this); }
@Test @SuppressWarnings("deprecation") public void createWithNullProjectId() throws IOException { thrown.expect(NullPointerException.class); thrown.expectMessage("projectId"); StackdriverStatsExporter.createAndRegisterWithCredentialsAndProjectId( GoogleCredentials.newBuilder().build(), null, ONE_SECOND); }
@Test @SuppressWarnings("deprecation") public void createWithNegativeDuration() throws IOException { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Export interval must be positive"); StackdriverStatsExporter.createAndRegisterWithCredentialsAndProjectId( GoogleCredentials.newBuilder().build(), PROJECT_ID, NEG_ONE_SECOND); }
/** * Returns the credentials instance from the given access token. * * @param accessToken the access token * @return the credentials instance */ public static GoogleCredentials create(AccessToken accessToken) { return GoogleCredentials.newBuilder().setAccessToken(accessToken).build(); }
@Test @SuppressWarnings("deprecation") public void createWithNullDuration() throws IOException { thrown.expect(NullPointerException.class); thrown.expectMessage("exportInterval"); StackdriverStatsExporter.createAndRegisterWithCredentialsAndProjectId( GoogleCredentials.newBuilder().build(), PROJECT_ID, null); }