New Instance type: Batch Manager
This commit is contained in:
committed by
Arnold Gálovics
parent
67850e3889
commit
ffb9147770
+7
-5
@@ -147,7 +147,7 @@ public class DataSourcePerTenantServiceFactoryTest {
|
||||
void testCreateNewDataSourceFor_ShouldUseNormalConfiguration_WhenInAllMode() {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = createModeProps(MASTER_DB_AUTO_COMMIT_ENABLED,
|
||||
MASTER_DB_AUTO_COMMIT_ENABLED, MASTER_DB_AUTO_COMMIT_ENABLED);
|
||||
MASTER_DB_AUTO_COMMIT_ENABLED, MASTER_DB_AUTO_COMMIT_ENABLED, MASTER_DB_AUTO_COMMIT_ENABLED);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
|
||||
// when
|
||||
@@ -173,7 +173,7 @@ public class DataSourcePerTenantServiceFactoryTest {
|
||||
@Test
|
||||
void testCreateNewDataSourceFor_ShouldUseReadOnlyConfiguration_WhenInReadOnlyMode() {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = createModeProps(true, false, false);
|
||||
FineractProperties.FineractModeProperties modeProperties = createModeProps(true, false, false, false);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
|
||||
// when
|
||||
@@ -199,7 +199,7 @@ public class DataSourcePerTenantServiceFactoryTest {
|
||||
@Test
|
||||
void testCreateNewDataSourceFor_ShouldUseNormalConfiguration_WhenInBatchOnlyMode() {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = createModeProps(false, false, true);
|
||||
FineractProperties.FineractModeProperties modeProperties = createModeProps(false, false, true, true);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
|
||||
// when
|
||||
@@ -222,11 +222,13 @@ public class DataSourcePerTenantServiceFactoryTest {
|
||||
assertEquals(MASTER_DB_AUTO_COMMIT_ENABLED, hikariConfig.isAutoCommit());
|
||||
}
|
||||
|
||||
private FineractProperties.FineractModeProperties createModeProps(boolean readEnabled, boolean writeEnabled, boolean batchEnabled) {
|
||||
private FineractProperties.FineractModeProperties createModeProps(boolean readEnabled, boolean writeEnabled, boolean batchWorkerEnabled,
|
||||
boolean batchManagerEnabled) {
|
||||
FineractProperties.FineractModeProperties modeProperties = new FineractProperties.FineractModeProperties();
|
||||
modeProperties.setReadEnabled(readEnabled);
|
||||
modeProperties.setWriteEnabled(writeEnabled);
|
||||
modeProperties.setBatchEnabled(batchEnabled);
|
||||
modeProperties.setBatchWorkerEnabled(batchWorkerEnabled);
|
||||
modeProperties.setBatchManagerEnabled(batchManagerEnabled);
|
||||
return modeProperties;
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -31,7 +31,8 @@ public class InstanceTypeStepDefinitions implements En {
|
||||
Given("Set every Fineract instance type to false", () -> {
|
||||
fineractProperties.getMode().setWriteEnabled(false);
|
||||
fineractProperties.getMode().setReadEnabled(false);
|
||||
fineractProperties.getMode().setBatchEnabled(false);
|
||||
fineractProperties.getMode().setBatchWorkerEnabled(false);
|
||||
fineractProperties.getMode().setBatchManagerEnabled(false);
|
||||
});
|
||||
Given("Fineract instance is a write instance", () -> {
|
||||
fineractProperties.getMode().setWriteEnabled(true);
|
||||
@@ -39,8 +40,8 @@ public class InstanceTypeStepDefinitions implements En {
|
||||
Given("Fineract instance is a read instance", () -> {
|
||||
fineractProperties.getMode().setReadEnabled(true);
|
||||
});
|
||||
Given("Fineract instance is a batch instance", () -> {
|
||||
fineractProperties.getMode().setBatchEnabled(true);
|
||||
Given("Fineract instance is a batch manager instance", () -> {
|
||||
fineractProperties.getMode().setBatchManagerEnabled(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -27,11 +27,12 @@ public final class InstanceModeMock {
|
||||
}
|
||||
|
||||
public static FineractProperties.FineractModeProperties createModeProps(boolean readEnabled, boolean writeEnabled,
|
||||
boolean batchEnabled) {
|
||||
boolean batchWorkerEnabled, boolean batchManagerEnabled) {
|
||||
FineractProperties.FineractModeProperties modeProperties = new FineractProperties.FineractModeProperties();
|
||||
modeProperties.setReadEnabled(readEnabled);
|
||||
modeProperties.setWriteEnabled(writeEnabled);
|
||||
modeProperties.setBatchEnabled(batchEnabled);
|
||||
modeProperties.setBatchWorkerEnabled(batchWorkerEnabled);
|
||||
modeProperties.setBatchManagerEnabled(batchManagerEnabled);
|
||||
return modeProperties;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -71,7 +71,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
@Test
|
||||
void testDoFilterInternal_ShouldLetReadApisThrough_WhenFineractIsInAllModeAndIsGetApi() throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, true, true);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, true, true, true);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.GET.name());
|
||||
given(request.getPathInfo()).willReturn("/loans");
|
||||
@@ -84,7 +84,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
@Test
|
||||
void testDoFilterInternal_ShouldLetReadApisThrough_WhenFineractIsInReadOnlyModeAndIsGetApi() throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false, false);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.GET.name());
|
||||
given(request.getPathInfo()).willReturn("/loans");
|
||||
@@ -98,7 +98,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
void testDoFilterInternal_ShouldLetActuatorApisThrough_WhenFineractIsInReadOnlyModeAndIsHealthApi()
|
||||
throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false, false);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.GET.name());
|
||||
given(request.getServletPath()).willReturn("/actuator/health");
|
||||
@@ -112,7 +112,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
@Test
|
||||
void testDoFilterInternal_ShouldNotLetWriteApisThrough_WhenFineractIsInReadOnlyModeAndIsPostApi() throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false, false);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.POST.name());
|
||||
given(request.getPathInfo()).willReturn("/loans");
|
||||
@@ -126,7 +126,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
@Test
|
||||
void testDoFilterInternal_ShouldNotLetBatchApisThrough_WhenFineractIsInReadOnlyModeAndIsJobsApi() throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false, false);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.POST.name());
|
||||
given(request.getPathInfo()).willReturn("/jobs/1");
|
||||
@@ -140,7 +140,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
@Test
|
||||
void testDoFilterInternal_ShouldLetReadApisThrough_WhenFineractIsInWriteModeAndIsGetApi() throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false, false);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.GET.name());
|
||||
given(request.getPathInfo()).willReturn("/loans");
|
||||
@@ -153,7 +153,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
@Test
|
||||
void testDoFilterInternal_ShouldLetWriteApisThrough_WhenFineractIsInWriteModeAndIsPostApi() throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false, false);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.POST.name());
|
||||
given(request.getPathInfo()).willReturn("/loans");
|
||||
@@ -166,7 +166,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
@Test
|
||||
void testDoFilterInternal_ShouldLetWriteApisThrough_WhenFineractIsInWriteModeAndIsPutApi() throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false, false);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.PUT.name());
|
||||
given(request.getPathInfo()).willReturn("/loans/1");
|
||||
@@ -179,7 +179,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
@Test
|
||||
void testDoFilterInternal_ShouldLetActuatorApisThrough_WhenFineractIsInWriteModeAndIsHelathApi() throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false, false);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.GET.name());
|
||||
given(request.getServletPath()).willReturn("/actuator/health");
|
||||
@@ -193,7 +193,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
@Test
|
||||
void testDoFilterInternal_ShouldNotLetBatchApisThrough_WhenFineractIsInWriteModeAndIsJobsApi() throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false, false);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.POST.name());
|
||||
given(request.getPathInfo()).willReturn("/jobs/1");
|
||||
@@ -207,7 +207,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
@Test
|
||||
void testDoFilterInternal_ShouldLetBatchApisThrough_WhenFineractIsInBatchModeAndIsJobsApi() throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, true);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, true, true);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.POST.name());
|
||||
given(request.getPathInfo()).willReturn("/jobs/1");
|
||||
@@ -221,7 +221,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
void testDoFilterInternal_ShouldLetBatchApisThrough_WhenFineractIsInBatchModeAndIsListingJobsApi()
|
||||
throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, true);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, true, true);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.GET.name());
|
||||
given(request.getPathInfo()).willReturn("/jobs");
|
||||
@@ -234,7 +234,7 @@ class FineractInstanceModeApiFilterTest {
|
||||
@Test
|
||||
void testDoFilterInternal_ShouldLetActuatorApisThrough_WhenFineractIsInBatchModeAndIsHealthApi() throws ServletException, IOException {
|
||||
// given
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, true);
|
||||
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, true, true);
|
||||
given(fineractProperties.getMode()).willReturn(modeProperties);
|
||||
given(request.getMethod()).willReturn(HttpMethod.GET.name());
|
||||
given(request.getServletPath()).willReturn("/actuator/health");
|
||||
|
||||
Reference in New Issue
Block a user