Skip to content

Commit

Permalink
🦉 Updates from OwlBot post-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] committed Apr 14, 2022
1 parent 8276600 commit f4c3f59
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
Expand Up @@ -849,10 +849,9 @@ public static SetStorageClassLifecycleAction newSetStorageClassAction(
}

/**
* Create a new {@code AbortIncompleteMPUAction}. An incomplete multipart upload
* will be aborted when the multipart upload meets the specified condition. Age is the
* only condition supported for this action.
* See: https://cloud.google.com/storage/docs/lifecycle##abort-mpu
* Create a new {@code AbortIncompleteMPUAction}. An incomplete multipart upload will be
* aborted when the multipart upload meets the specified condition. Age is the only condition
* supported for this action. See: https://cloud.google.com/storage/docs/lifecycle##abort-mpu
*/
public static LifecycleAction newAbortIncompleteMPUploadAction() {
return new AbortIncompleteMPUAction();
Expand Down Expand Up @@ -906,7 +905,9 @@ public static class AbortIncompleteMPUAction extends LifecycleAction {
public static final String TYPE = "AbortIncompleteMultipartUpload";
private static final long serialVersionUID = -1072182310389348060L;

private AbortIncompleteMPUAction() { super(TYPE); }
private AbortIncompleteMPUAction() {
super(TYPE);
}
}
}

Expand Down
Expand Up @@ -334,8 +334,8 @@ public void testLifecycleRules() {
assertEquals(
LifecycleRule.DeleteLifecycleAction.TYPE, deleteLifecycleRule.getAction().getType());
assertEquals(10, deleteLifecycleRule.getCondition().getAge().intValue());
assertTrue(LifecycleRule.fromPb(deleteLifecycleRule).getAction()
instanceof DeleteLifecycleAction);
assertTrue(
LifecycleRule.fromPb(deleteLifecycleRule).getAction() instanceof DeleteLifecycleAction);

Rule setStorageClassLifecycleRule =
new LifecycleRule(
Expand All @@ -351,8 +351,9 @@ public void testLifecycleRules() {
setStorageClassLifecycleRule.getAction().getStorageClass());
assertTrue(setStorageClassLifecycleRule.getCondition().getIsLive());
assertEquals(10, setStorageClassLifecycleRule.getCondition().getNumNewerVersions().intValue());
assertTrue(LifecycleRule.fromPb(setStorageClassLifecycleRule).getAction()
instanceof SetStorageClassLifecycleAction);
assertTrue(
LifecycleRule.fromPb(setStorageClassLifecycleRule).getAction()
instanceof SetStorageClassLifecycleAction);

Rule lifecycleRule =
new LifecycleRule(
Expand All @@ -374,19 +375,19 @@ public void testLifecycleRules() {
assertEquals(StorageClass.COLDLINE.toString(), lifecycleRule.getAction().getStorageClass());
assertEquals(30, lifecycleRule.getCondition().getDaysSinceCustomTime().intValue());
assertNotNull(lifecycleRule.getCondition().getCustomTimeBefore());
assertTrue(LifecycleRule.fromPb(lifecycleRule).getAction()
instanceof SetStorageClassLifecycleAction);
assertTrue(
LifecycleRule.fromPb(lifecycleRule).getAction() instanceof SetStorageClassLifecycleAction);

Rule abortMpuLifecycleRule =
new LifecycleRule(LifecycleAction.newAbortIncompleteMPUploadAction(),
LifecycleCondition.newBuilder()
.setAge(10)
.build())
new LifecycleRule(
LifecycleAction.newAbortIncompleteMPUploadAction(),
LifecycleCondition.newBuilder().setAge(10).build())
.toPb();
assertEquals(AbortIncompleteMPUAction.TYPE, abortMpuLifecycleRule.getAction().getType());
assertEquals(10, abortMpuLifecycleRule.getCondition().getAge().intValue());
assertTrue(LifecycleRule.fromPb(abortMpuLifecycleRule).getAction()
instanceof AbortIncompleteMPUAction);
assertTrue(
LifecycleRule.fromPb(abortMpuLifecycleRule).getAction()
instanceof AbortIncompleteMPUAction);

Rule unsupportedRule =
new LifecycleRule(
Expand Down
Expand Up @@ -564,8 +564,7 @@ public void testGetBucketAbortMPULifecycle() {
storage.get(lifecycleTestBucketName, Storage.BucketGetOption.fields(BucketField.LIFECYCLE));
LifecycleRule lifecycleRule = remoteBucket.getLifecycleRules().get(0);
try {
assertEquals(
AbortIncompleteMPUAction.TYPE, lifecycleRule.getAction().getActionType());
assertEquals(AbortIncompleteMPUAction.TYPE, lifecycleRule.getAction().getActionType());
assertEquals(1, lifecycleRule.getCondition().getAge().intValue());
} finally {
storage.delete(lifecycleTestBucketName);
Expand Down

0 comments on commit f4c3f59

Please sign in to comment.