Batch system config update (#1402)
* Added an endpoint for batch update of system configurations Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * batch db save Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * Review changes and added tests Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * Evict cache only if transaction is commited - such as @CacheEvict Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * refactoring Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * Using AfterTransactionCommitExecutor for cache eviction Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * Change request body Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> --------- Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>
This commit is contained in:
@@ -32,6 +32,14 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
private static final String KEY_MULTI_ASSIGNMENTS = "multi.assignments.enabled";
|
||||
|
||||
private static final String KEY_AUTO_CLOSE = "repository.actions.autoclose.enabled";
|
||||
private static final String ROLLOUT_APPROVAL_ENABLED = "rollout.approval.enabled";
|
||||
|
||||
private static final String AUTHENTICATION_GATEWAYTOKEN_ENABLED = "authentication.gatewaytoken.enabled";
|
||||
|
||||
private static final String AUTHENTICATION_GATEWAYTOKEN_KEY = "authentication.gatewaytoken.key";
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
@Description("The 'multi.assignments.enabled' property must not be changed to false.")
|
||||
@@ -48,6 +56,36 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
.andExpect(status().isForbidden());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("The Batch configuration should be applied")
|
||||
public void changeBatchConfiguration() throws Exception {
|
||||
JSONObject configuration = new JSONObject();
|
||||
configuration.put(ROLLOUT_APPROVAL_ENABLED, true);
|
||||
configuration.put(AUTHENTICATION_GATEWAYTOKEN_ENABLED, true);
|
||||
configuration.put(AUTHENTICATION_GATEWAYTOKEN_KEY, "1234");
|
||||
|
||||
String body = configuration.toString();
|
||||
|
||||
mvc.perform(put(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs")
|
||||
.content(body).contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("The Batch configuration should not be applied")
|
||||
public void changeBatchConfigurationFail() throws Exception {
|
||||
JSONObject configuration = new JSONObject();
|
||||
configuration.put(ROLLOUT_APPROVAL_ENABLED, true);
|
||||
configuration.put(AUTHENTICATION_GATEWAYTOKEN_ENABLED, "wrong");
|
||||
configuration.put(AUTHENTICATION_GATEWAYTOKEN_KEY, "1234");
|
||||
|
||||
String body = configuration.toString();
|
||||
|
||||
mvc.perform(put(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs")
|
||||
.content(body).contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("The 'repository.actions.autoclose.enabled' property must not be modified if Multi-Assignments is enabled.")
|
||||
public void autoCloseCannotBeModifiedIfMultiAssignmentIsEnabled() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user