@Mock NodeProbe instance(IConfiguration config) { return nodeProbe; } };
@Mock public BackupVerificationResult isMetaFileValid(AbstractBackupPath metaBackupPath) { return getBackupVerificationResult(); } }
@Mock public boolean isTruncated() { return truncated; } }
@Mock public BackupVerificationResult isMetaFileValid(AbstractBackupPath metaBackupPath) { return getBackupVerificationResult(); } }
@Mock public void setBucketLifecycleConfiguration( String bucketName, BucketLifecycleConfiguration bucketLifecycleConfiguration) { bconf = bucketLifecycleConfiguration; }
@Mock public void $init(AmazonS3 client, DataPart dp, List<PartETag> partETags) { MockS3PartUploader.partETags = partETags; }
@Mock public List<S3ObjectSummary> getObjectSummaries() { if (firstcall) { firstcall = false; if (simfilter) return getObjectSummaryEmpty(); return getObjectSummary(); } else { if (simfilter) { simfilter = false; // reset return getObjectSummaryEmpty(); } else truncated = false; return getNextObjectSummary(); } }
@Mock public void clearSnapshot(String tag, String... keyspaces) { cleanup(new File("target/data")); } }
@Mock public InitiateMultipartUploadResult initiateMultipartUpload( InitiateMultipartUploadRequest initiateMultipartUploadRequest) throws AmazonClientException { return new InitiateMultipartUploadResult(); }
@Mock public CompleteMultipartUploadResult completeUpload() throws BackupRestoreException { ++compattempts; if (completionFailure) throw new BackupRestoreException("Test exception"); return null; }
@Mock public Void retriableCall() throws AmazonClientException, BackupRestoreException { logger.info("MOCK UPLOADING..."); return uploadPart(); }
@Mock public DeleteObjectsResult deleteObjects(DeleteObjectsRequest var1) throws SdkClientException, AmazonServiceException { if (emulateError) throw new AmazonServiceException("Unable to reach AWS"); return null; } }
@Mock public void takeSnapshot(String snapshotName, String columnFamily, String... keyspaces) { File tmp = new File("target/data/"); if (tmp.exists()) cleanup(tmp); // Setup Set<String> files = new HashSet<>(); files.add( "target/data/Keyspace1/Standard1/snapshots/" + snapshotName + "/Keyspace1-Standard1-ia-5-Data.db"); files.add( "target/data/Keyspace1/Standard1/snapshots/201101081230/Keyspace1-Standard1-ia-6-Data.db"); files.add( "target/data/Keyspace1/Standard1/snapshots/" + snapshotName + "/Keyspace1-Standard1-ia-7-Data.db"); expectedFiles.clear(); for (String filePath : files) { File file = new File(filePath); genTestFile(file); if (!filePath.contains("Keyspace1-Standard1-ia-6-Data.db")) // skip expectedFiles.add(file.getAbsolutePath()); } }
@Mock private Void uploadPart() throws AmazonClientException, BackupRestoreException { ++partAttempts; if (partFailure) throw new BackupRestoreException("Test exception"); partETags.add(new PartETag(0, null)); return null; }
@Mock public Subject getSubject() { return success ? SUBJECT : null; } }
@Mock public BucketLifecycleConfiguration getBucketLifecycleConfiguration(String bucketName) { List<BucketLifecycleConfiguration.Rule> rules = Lists.newArrayList(); if (ruleAvailable) { String clusterPath = "casstestbackup/" + region + "/fake-app/"; BucketLifecycleConfiguration.Rule rule = new BucketLifecycleConfiguration.Rule() .withExpirationInDays(5) .withPrefix(clusterPath); rule.setStatus(BucketLifecycleConfiguration.ENABLED); rule.setId(clusterPath); rules.add(rule); } bconf.setRules(rules); return bconf; }
@Mock public ObjectListing listObjects(ListObjectsRequest listObjectsRequest) throws AmazonClientException { ObjectListing listing = new ObjectListing(); listing.setBucketName(listObjectsRequest.getBucketName()); listing.setPrefix(listObjectsRequest.getPrefix()); return listing; }
@Mock public List<Handler> getOrCreate(String name) { return Collections.emptyList(); } };
@Mock public List<Handler> getOrCreate(String name) { return Collections.emptyList(); } };
@Mock public void login() throws LoginException { if (!success) { throw new LoginException("Failed"); } }