File tree Expand file tree Collapse file tree 2 files changed +19
-8
lines changed
main/java/com/aliyun/oss/model
test/java/com/aliyun/oss/integrationtests Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,6 @@ public void setLifecycleRules(List<LifecycleRule> lifecycleRules) {
4444 throw new IllegalArgumentException ("lifecycleRules should not be null or empty." );
4545 }
4646
47- if (lifecycleRules .size () > MAX_LIFECYCLE_RULE_LIMIT ) {
48- throw new IllegalArgumentException ("One bucket not allow exceed one thousand items of LifecycleRules." );
49- }
50-
5147 this .lifecycleRules .clear ();
5248 this .lifecycleRules .addAll (lifecycleRules );
5349 }
@@ -61,10 +57,6 @@ public void AddLifecycleRule(LifecycleRule lifecycleRule) {
6157 throw new IllegalArgumentException ("lifecycleRule should not be null or empty." );
6258 }
6359
64- if (this .lifecycleRules .size () >= MAX_LIFECYCLE_RULE_LIMIT ) {
65- throw new IllegalArgumentException ("One bucket not allow exceed one thousand items of LifecycleRules." );
66- }
67-
6860 if (lifecycleRule .getId () != null && lifecycleRule .getId ().length () > MAX_RULE_ID_LENGTH ) {
6961 throw new IllegalArgumentException ("Length of lifecycle rule id exceeds max limit " + MAX_RULE_ID_LENGTH );
7062 }
Original file line number Diff line number Diff line change @@ -898,4 +898,23 @@ public void testNormalSetBucketLifecycleWithNot() throws ParseException {
898898 ossClient .deleteBucket (bucketName );
899899 }
900900 }
901+
902+ @ Test
903+ public void testVerificationLifecycleRulesLimit () throws ParseException {
904+ final String matchPrefix0 = "prefix/" ;
905+ final int maxLimit = 2000 ;
906+
907+ try {
908+ SetBucketLifecycleRequest request = new SetBucketLifecycleRequest (bucketName );
909+ for (int i = 0 ; i < (maxLimit + 1 ) ; i ++) {
910+ LifecycleRule rule = new LifecycleRule ("ruleId" +i , matchPrefix0 +i , RuleStatus .Enabled );
911+ rule .setCreatedBeforeDate (DateUtil .parseIso8601Date ("2023-10-12T00:00:00.000Z" ));
912+ request .AddLifecycleRule (rule );
913+ }
914+
915+ Assert .assertTrue (true );
916+ } catch (Exception e ) {
917+ Assert .fail (e .getMessage ());
918+ }
919+ }
901920}
You can’t perform that action at this time.
0 commit comments