FINERACT-1678: Add retry limit to COB

This commit is contained in:
Adam Saghy
2023-05-10 07:51:10 +02:00
committed by Arnold Gálovics
parent b86a70397f
commit 70c93484f4
8 changed files with 123 additions and 1 deletions
@@ -0,0 +1,65 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.infrastructure.springbatch;
import static org.assertj.core.api.Assertions.assertThat;
import io.cucumber.java8.En;
import org.apache.fineract.infrastructure.core.config.FineractProperties;
import org.springframework.beans.factory.annotation.Autowired;
public class SpringBatchPropertyServiceDefinitions implements En {
@Autowired
private FineractProperties fineractProperties;
private PropertyService propertyService;
private int partitionSize;
private int chunkSize;
private int retryLimit;
public SpringBatchPropertyServiceDefinitions() {
Given("Property Service is initialized", () -> {
propertyService = new PropertyServiceImpl(fineractProperties);
});
When("partition size is fetched for {string}", (String jobName) -> {
partitionSize = propertyService.getPartitionSize(jobName);
});
When("chunk size is fetched for {string}", (String jobName) -> {
chunkSize = propertyService.getChunkSize(jobName);
});
When("retry limit is fetched for {string}", (String jobName) -> {
retryLimit = propertyService.getRetryLimit(jobName);
});
Then("partition size is {int}", (Integer value) -> {
assertThat(partitionSize).isEqualTo(value);
});
Then("chunk size is {int}", (Integer value) -> {
assertThat(chunkSize).isEqualTo(value);
});
Then("retry limit is {int}", (Integer value) -> {
assertThat(retryLimit).isEqualTo(value);
});
}
}
@@ -43,6 +43,7 @@ fineract.partitioned-job.partitioned-job-properties[0].job-name=LOAN_COB
fineract.partitioned-job.partitioned-job-properties[0].chunk-size=100
fineract.partitioned-job.partitioned-job-properties[0].partition-size=100
fineract.partitioned-job.partitioned-job-properties[0].thread-count=1
fineract.partitioned-job.partitioned-job-properties[0].retry-limit=5
fineract.remote-job-message-handler.spring-events.enabled=${FINERACT_REMOTE_JOB_MESSAGE_HANDLER_SPRING_EVENTS_ENABLED:true}
fineract.remote-job-message-handler.jms.enabled=${FINERACT_REMOTE_JOB_MESSAGE_HANDLER_JMS_ENABLED:false}
@@ -0,0 +1,40 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
Feature: SpringBatch Infrastructure
@springbatch
Scenario: Verify that spring batch properties are read correctly for LOAN_COB
Given Property Service is initialized
When partition size is fetched for "LOAN_COB"
When chunk size is fetched for "LOAN_COB"
When retry limit is fetched for "LOAN_COB"
Then partition size is 100
Then chunk size is 100
Then retry limit is 5
@springbatch
Scenario: Verify that spring batch default properties are read correctly for non-existing job
Given Property Service is initialized
When partition size is fetched for "INVALID_JOB"
When chunk size is fetched for "INVALID_JOB"
When retry limit is fetched for "INVALID_JOB"
Then partition size is 1
Then chunk size is 1
Then retry limit is 1