@Test public void doWriteBackup_Failed_OnInvalidBackupData() throws IBackupUploader.BackupException { exceptionRule.expect(IBackupUploader.BackupException.class); exceptionRule.expectMessage("Backup data is null"); gcpBackupUploader.doWriteBackup(null, UNIQ_NAME); }
@Override public void doWriteBackup(InputStream backupData, String uniqueFileName) throws BackupException { try { if (backupData == null) { throw new BackupException("Backup data is null"); } validatePathParameter(uniqueFileName, "unique file name"); BlobId blobId = BlobId.of(bucketName, getFullUploadObject(uniqueFileName)); BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build(); storage.create(blobInfo, backupData); } catch (Exception e) { throw new BackupException("Error with writing backup file: " + e.getMessage(), e); } }
GcpBackupUploader extends AbstractBackupUploader { @Override public void doWriteBackup(InputStream backupData, String uniqueFileName) throws BackupException { try { if (backupData == null) { throw new BackupException("Backup data is null"); } validatePathParameter(uniqueFileName, "unique file name"); BlobId blobId = BlobId.of(bucketName, getFullUploadObject(uniqueFileName)); BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build(); storage.create(blobInfo, backupData); } catch (Exception e) { throw new BackupException("Error with writing backup file: " + e.getMessage(), e); } } }
GcpBackupUploader extends AbstractBackupUploader { @Override public void doWriteBackup(InputStream backupData, String uniqueFileName) throws BackupException { try { if (backupData == null) { throw new BackupException("Backup data is null"); } validatePathParameter(uniqueFileName, "unique file name"); BlobId blobId = BlobId.of(bucketName, getFullUploadObject(uniqueFileName)); BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build(); storage.create(blobInfo, backupData); } catch (Exception e) { throw new BackupException("Error with writing backup file: " + e.getMessage(), e); } } GcpBackupUploader(String uploadFilePath, String gcpProjectId, Storage storage);  GcpBackupUploader(String uploadFilePath, String gcpProjectId, String oauthScopes); }
GcpBackupUploader extends AbstractBackupUploader { @Override public void doWriteBackup(InputStream backupData, String uniqueFileName) throws BackupException { try { if (backupData == null) { throw new BackupException("Backup data is null"); } validatePathParameter(uniqueFileName, "unique file name"); BlobId blobId = BlobId.of(bucketName, getFullUploadObject(uniqueFileName)); BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build(); storage.create(blobInfo, backupData); } catch (Exception e) { throw new BackupException("Error with writing backup file: " + e.getMessage(), e); } } 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 { @Override public void doWriteBackup(InputStream backupData, String uniqueFileName) throws BackupException { try { if (backupData == null) { throw new BackupException("Backup data is null"); } validatePathParameter(uniqueFileName, "unique file name"); BlobId blobId = BlobId.of(bucketName, getFullUploadObject(uniqueFileName)); BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build(); storage.create(blobInfo, backupData); } catch (Exception e) { throw new BackupException("Error with writing backup file: " + e.getMessage(), e); } } 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);  }