@Test public void getCredential() throws IOException { gcpBackupUploader = new GcpBackupUploader(UPLOAD_PATH, GCP_PROJECT_ID, OAUTHSCOPES); Credentials creds = gcpBackupUploader.getCredential(OAUTHSCOPES); assertThat(creds).isInstanceOf(Credentials.class); assertThat(creds).isNotNull(); assertThat(creds.getAuthenticationType()).isEqualTo(AUTH_TYPE); }
public Credentials getCredential(String oauthScopes) throws IOException { validatePathParameter(oauthScopes, "oauthScopes"); GoogleCredentials credentials = GoogleCredentials.getApplicationDefault(); if (!oauthScopes.isBlank()) { credentials = credentials.createScoped(Arrays.asList(oauthScopes.split(","))); } return credentials; }
GcpBackupUploader extends AbstractBackupUploader { public Credentials getCredential(String oauthScopes) throws IOException { validatePathParameter(oauthScopes, "oauthScopes"); GoogleCredentials credentials = GoogleCredentials.getApplicationDefault(); if (!oauthScopes.isBlank()) { credentials = credentials.createScoped(Arrays.asList(oauthScopes.split(","))); } return credentials; } }
GcpBackupUploader extends AbstractBackupUploader { public Credentials getCredential(String oauthScopes) throws IOException { validatePathParameter(oauthScopes, "oauthScopes"); GoogleCredentials credentials = GoogleCredentials.getApplicationDefault(); if (!oauthScopes.isBlank()) { credentials = credentials.createScoped(Arrays.asList(oauthScopes.split(","))); } return credentials; } GcpBackupUploader(String uploadFilePath, String gcpProjectId, Storage storage);  GcpBackupUploader(String uploadFilePath, String gcpProjectId, String oauthScopes); }
GcpBackupUploader extends AbstractBackupUploader { public Credentials getCredential(String oauthScopes) throws IOException { validatePathParameter(oauthScopes, "oauthScopes"); GoogleCredentials credentials = GoogleCredentials.getApplicationDefault(); if (!oauthScopes.isBlank()) { credentials = credentials.createScoped(Arrays.asList(oauthScopes.split(","))); } return credentials; } GcpBackupUploader(String uploadFilePath, String gcpProjectId, Storage storage);  GcpBackupUploader(String uploadFilePath, String gcpProjectId, String oauthScopes); @Override void doWriteBackup(InputStream backupData, String uniqueFileName); @Override InputStream doReadBackup(String uniqueFileName); @Override void doRemoveBackup(String uniqueFileName); String getProjectId(); String getBucketName(); String getUploadFolder(); Credentials getCredential(String oauthScopes); }
GcpBackupUploader extends AbstractBackupUploader { public Credentials getCredential(String oauthScopes) throws IOException { validatePathParameter(oauthScopes, "oauthScopes"); GoogleCredentials credentials = GoogleCredentials.getApplicationDefault(); if (!oauthScopes.isBlank()) { credentials = credentials.createScoped(Arrays.asList(oauthScopes.split(","))); } return credentials; } GcpBackupUploader(String uploadFilePath, String gcpProjectId, Storage storage);  GcpBackupUploader(String uploadFilePath, String gcpProjectId, String oauthScopes); @Override void doWriteBackup(InputStream backupData, String uniqueFileName); @Override InputStream doReadBackup(String uniqueFileName); @Override void doRemoveBackup(String uniqueFileName); String getProjectId(); String getBucketName(); String getUploadFolder(); Credentials getCredential(String oauthScopes);  }