diff --git a/pom.xml b/pom.xml index ec62245..a0e842d 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ This tool helps to control the retry-behaviour in external-task-handlers based on the official java-client provided by Camunda BPM - 1.1.6 + 1.2.0 2021 diff --git a/src/main/java/de/viadee/bpm/camunda/externaltask/retry/aspect/config/ExternalTaskRetryAspectProperties.java b/src/main/java/de/viadee/bpm/camunda/externaltask/retry/aspect/config/ExternalTaskRetryAspectProperties.java index f8f1657..a84e3ed 100644 --- a/src/main/java/de/viadee/bpm/camunda/externaltask/retry/aspect/config/ExternalTaskRetryAspectProperties.java +++ b/src/main/java/de/viadee/bpm/camunda/externaltask/retry/aspect/config/ExternalTaskRetryAspectProperties.java @@ -36,31 +36,31 @@ import java.util.Objects; -@ConfigurationProperties(prefix = "de.viadee.bpm.camunda.external-task") +@ConfigurationProperties(prefix = "de.viadee.bpm.camunda.external-task.retry-config") public class ExternalTaskRetryAspectProperties { //@formatter:off - private String defaultRetryConfig = "R3/PT5M"; - private String retryConfigName = "RETRY_CONFIG"; + private String defaultBehavior = "R3/PT5M"; + private String identifier = "RETRY_CONFIG"; //@formatter:on - public String getDefaultRetryConfig() { - return this.defaultRetryConfig; + public String getDefaultBehavior() { + return this.defaultBehavior; } - public void setDefaultRetryConfig(final String defaultRetryConfig) { - if (Objects.isNull(defaultRetryConfig) || defaultRetryConfig.trim().isEmpty()) return; - this.defaultRetryConfig = defaultRetryConfig.replace(" ", "").toUpperCase(); + public void setDefaultBehavior(final String defaultBehavior) { + if (Objects.isNull(defaultBehavior) || defaultBehavior.trim().isEmpty()) return; + this.defaultBehavior = defaultBehavior.replace(" ", "").toUpperCase(); } - public String getRetryConfigName() { - return this.retryConfigName; + public String getIdentifier() { + return this.identifier; } - public void setRetryConfigName(final String retryConfigName) { - if (Objects.isNull(retryConfigName) || retryConfigName.trim().isEmpty()) return; - this.retryConfigName = retryConfigName; + public void setIdentifier(final String identifier) { + if (Objects.isNull(identifier) || identifier.trim().isEmpty()) return; + this.identifier = identifier; } } diff --git a/src/main/java/de/viadee/bpm/camunda/externaltask/retry/aspect/model/RetryConfigValues.java b/src/main/java/de/viadee/bpm/camunda/externaltask/retry/aspect/model/RetryConfigValues.java index b6ba907..da4a85f 100644 --- a/src/main/java/de/viadee/bpm/camunda/externaltask/retry/aspect/model/RetryConfigValues.java +++ b/src/main/java/de/viadee/bpm/camunda/externaltask/retry/aspect/model/RetryConfigValues.java @@ -57,11 +57,11 @@ public RetryConfigValues(final ExternalTaskRetryAspectProperties properties) { } public String getRetryConfigName() { - return this.properties.getRetryConfigName(); + return this.properties.getIdentifier(); } public String getDefaultRetryConfig() { - return this.properties.getDefaultRetryConfig(); + return this.properties.getDefaultBehavior(); } public Pattern getRetryListPattern() { diff --git a/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/ExternalTaskRetryAspectPropertiesTest.java b/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/ExternalTaskRetryAspectPropertiesTest.java index f2964d8..dba1de4 100644 --- a/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/ExternalTaskRetryAspectPropertiesTest.java +++ b/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/ExternalTaskRetryAspectPropertiesTest.java @@ -41,19 +41,19 @@ public class ExternalTaskRetryAspectPropertiesTest { @Test public void propertiesShouldNotBeNullTest() { ExternalTaskRetryAspectProperties properties = new ExternalTaskRetryAspectProperties(); - properties.setRetryConfigName(null); - properties.setDefaultRetryConfig(null); - assertEquals("R3/PT5M", properties.getDefaultRetryConfig()); - assertEquals("RETRY_CONFIG", properties.getRetryConfigName()); + properties.setIdentifier(null); + properties.setDefaultBehavior(null); + assertEquals("R3/PT5M", properties.getDefaultBehavior()); + assertEquals("RETRY_CONFIG", properties.getIdentifier()); } @Test public void propertiesShouldNotBeEmptyTest() { ExternalTaskRetryAspectProperties properties = new ExternalTaskRetryAspectProperties(); - properties.setRetryConfigName(" "); - properties.setDefaultRetryConfig(" "); - assertEquals("R3/PT5M", properties.getDefaultRetryConfig()); - assertEquals("RETRY_CONFIG", properties.getRetryConfigName()); + properties.setIdentifier(" "); + properties.setDefaultBehavior(" "); + assertEquals("R3/PT5M", properties.getDefaultBehavior()); + assertEquals("RETRY_CONFIG", properties.getIdentifier()); } } diff --git a/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/CustomRetryTimeCycleIdentifierTest.java b/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/CustomRetryTimeCycleIdentifierTest.java index 53dd2aa..49ed646 100644 --- a/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/CustomRetryTimeCycleIdentifierTest.java +++ b/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/CustomRetryTimeCycleIdentifierTest.java @@ -38,12 +38,12 @@ import static org.junit.Assert.assertEquals; -@TestPropertySource(properties = "de.viadee.bpm.camunda.external-task.retry-config-name=CUSTOM_SOMETHING") +@TestPropertySource(properties = "de.viadee.bpm.camunda.external-task.retry-config.identifier=CUSTOM_SOMETHING") public class CustomRetryTimeCycleIdentifierTest extends BaseTest { @Test public void customRetryTimeCycleIdentifier() { - assertEquals("CUSTOM_SOMETHING", this.properties.getRetryConfigName()); + assertEquals("CUSTOM_SOMETHING", this.properties.getIdentifier()); } } diff --git a/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/EdgeCaseTest.java b/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/EdgeCaseTest.java index b940ada..5909306 100644 --- a/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/EdgeCaseTest.java +++ b/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/EdgeCaseTest.java @@ -73,7 +73,7 @@ public void runtimeException() { // prepare when(this.externalTask.getRetries()).thenReturn(null); when(this.externalTask - .getExtensionProperty(this.properties.getRetryConfigName())) + .getExtensionProperty(this.properties.getIdentifier())) .thenReturn("P,P,P"); // sadly, 'P' is matched by the used regex currently -> use hard-wired Fallback 'PT10M' then // test diff --git a/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/InvalidDefaultBehaviourTest.java b/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/InvalidDefaultBehaviourTest.java index f5040a7..2942fa1 100644 --- a/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/InvalidDefaultBehaviourTest.java +++ b/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/InvalidDefaultBehaviourTest.java @@ -37,7 +37,7 @@ import static org.mockito.Mockito.when; -@TestPropertySource(properties = "de.viadee.bpm.camunda.external-task.default-retry-time-cycle=R3/PT1D") +@TestPropertySource(properties = "de.viadee.bpm.camunda.external-task.retry-config.defaults=R3/PT1D") public class InvalidDefaultBehaviourTest extends BaseTest { diff --git a/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/InvalidRetryTimeCycleValuesTest.java b/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/InvalidRetryTimeCycleValuesTest.java index 888e96d..2d6672e 100644 --- a/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/InvalidRetryTimeCycleValuesTest.java +++ b/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/InvalidRetryTimeCycleValuesTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.when; -@TestPropertySource(properties = "de.viadee.bpm.camunda.external-task.default-retry-config=R3/PT37M") +@TestPropertySource(properties = "de.viadee.bpm.camunda.external-task.retry-config.default-behavior=R3/PT37M") public class InvalidRetryTimeCycleValuesTest extends BaseTest { @@ -59,7 +59,7 @@ public void invalidRetryTimeCycleList() { public void invalidTimeCycleDetectedByRegularExpression(final String retryTimeCycle) { // prepare when(this.externalTask.getRetries()).thenReturn(3); - when(this.externalTask.getExtensionProperty(this.properties.getRetryConfigName())).thenReturn(retryTimeCycle); + when(this.externalTask.getExtensionProperty(this.properties.getIdentifier())).thenReturn(retryTimeCycle); // test this.externalTaskRetryAspect.handleErrorAfterThrown(this.joinPoint, new RuntimeException(), this.externalTask, this.externalTaskService); diff --git a/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/RetryTimeCycleListTest.java b/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/RetryTimeCycleListTest.java index ed04277..71fb997 100644 --- a/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/RetryTimeCycleListTest.java +++ b/src/test/java/de/viadee/bpm/camunda/externaltask/retry/aspect/behaviour/RetryTimeCycleListTest.java @@ -120,7 +120,7 @@ public void retryTimeCycleList1Test() { public void runTestAndReturnNextInterval(final Integer retries) { // prepare when(this.externalTask.getRetries()).thenReturn(retries); // 1. retry - when(this.externalTask.getExtensionProperty(this.properties.getRetryConfigName())).thenReturn(RETRY_CYCLE_LIST); + when(this.externalTask.getExtensionProperty(this.properties.getIdentifier())).thenReturn(RETRY_CYCLE_LIST); // test this.externalTaskRetryAspect.handleErrorAfterThrown(this.joinPoint, new RuntimeException(), this.externalTask, this.externalTaskService);