diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3b51e0600..034da9836 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,8 @@ All notable changes to AET will be documented in this file.
- [PR-461](https://github.com/Cognifide/aet/pull/461) Generating correct correlationId when suite name is overridden([#440](https://github.com/Cognifide/aet/issues/440))
- [PR-413](https://github.com/Cognifide/aet/pull/413) Added ability to show full page source when there has been no difference discovered ([#369](https://github.com/Cognifide/aet/issues/369))
+- [PR-463](https://github.com/Cognifide/aet/pull/463) Removed dependency to Joda time library
+
## Version 3.2.0
diff --git a/core/cleaner/pom.xml b/core/cleaner/pom.xml
index 474ad7972..5726e64b7 100644
--- a/core/cleaner/pom.xml
+++ b/core/cleaner/pom.xml
@@ -87,10 +87,6 @@
org.apache.camel
camel-core
-
- joda-time
- joda-time
-
junit
diff --git a/core/cleaner/src/main/java/com/cognifide/aet/cleaner/processors/filters/SuiteRemoveCondition.java b/core/cleaner/src/main/java/com/cognifide/aet/cleaner/processors/filters/SuiteRemoveCondition.java
index 37506b9d7..7aef9ee8c 100644
--- a/core/cleaner/src/main/java/com/cognifide/aet/cleaner/processors/filters/SuiteRemoveCondition.java
+++ b/core/cleaner/src/main/java/com/cognifide/aet/cleaner/processors/filters/SuiteRemoveCondition.java
@@ -18,10 +18,11 @@
import com.cognifide.aet.cleaner.context.CleanerContext;
import com.cognifide.aet.communication.api.metadata.Suite;
import com.google.common.collect.Ordering;
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
-import org.joda.time.DateTime;
public class SuiteRemoveCondition {
@@ -88,8 +89,10 @@ private Long getMinKeepVersion(final Collection suiteRunVersions,
private Long getRemoveTimestamp(CleanerContext cleanerContext) {
Long removeBeforeTimestamp = null;
if (cleanerContext.getRemoveOlderThan() != null) {
- DateTime dateTime = new DateTime().minusDays(cleanerContext.getRemoveOlderThan().intValue());
- removeBeforeTimestamp = dateTime.getMillis();
+ LocalDateTime now = LocalDateTime.now(ZoneOffset.UTC);
+ int daysToKeep = cleanerContext.getRemoveOlderThan().intValue();
+ LocalDateTime then = now.minusDays(daysToKeep);
+ removeBeforeTimestamp = then.toInstant(ZoneOffset.UTC).toEpochMilli();
}
return removeBeforeTimestamp;
}
diff --git a/core/cleaner/src/test/java/com/cognifide/aet/cleaner/processors/filters/SuiteRemoveConditionTest.java b/core/cleaner/src/test/java/com/cognifide/aet/cleaner/processors/filters/SuiteRemoveConditionTest.java
index 107ff76ab..bc4315b27 100644
--- a/core/cleaner/src/test/java/com/cognifide/aet/cleaner/processors/filters/SuiteRemoveConditionTest.java
+++ b/core/cleaner/src/test/java/com/cognifide/aet/cleaner/processors/filters/SuiteRemoveConditionTest.java
@@ -25,10 +25,11 @@
import com.googlecode.zohhak.api.Configure;
import com.googlecode.zohhak.api.TestWith;
import com.googlecode.zohhak.api.runners.ZohhakRunner;
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
-import org.joda.time.DateTime;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
@@ -38,8 +39,6 @@ public class SuiteRemoveConditionTest {
private static final SuitesListCoercer SUITES_LIST_COERCER = new SuitesListCoercer();
- private static final long ONE_HOUR = 3600000L;
-
@TestWith({
//1 suite, remove all but last version in all cases
"A-1 ; null ; 1 ; A-1 ; 10",
@@ -251,9 +250,13 @@ private static Suite mockSuiteVersion(String input) {
private Suite mockSuiteVersionAndCreatedDate(String input, int createdDaysAgo) {
Suite suite = mockSuiteVersion(input);
Timestamp timestamp = Mockito.mock(Timestamp.class);
- //substract one hour for test purposes accuracy
- when(timestamp.get())
- .thenReturn(new DateTime().minusDays(createdDaysAgo).getMillis() - ONE_HOUR);
+
+ long timestampDaysAgo = LocalDateTime
+ .now(ZoneOffset.UTC)
+ .minusDays(createdDaysAgo)
+ .toInstant(ZoneOffset.UTC).toEpochMilli();
+
+ when(timestamp.get()).thenReturn(timestampDaysAgo);
when(suite.getRunTimestamp()).thenReturn(timestamp);
return suite;
}
diff --git a/osgi-dependencies/aet-features.xml b/osgi-dependencies/aet-features.xml
index 1508cce78..b39c720e5 100644
--- a/osgi-dependencies/aet-features.xml
+++ b/osgi-dependencies/aet-features.xml
@@ -73,7 +73,6 @@
- mvn:joda-time/joda-time/2.10
mvn:org.json/json/20180130
mvn:com.google.code.gson/gson/2.8.5
mvn:com.google.guava/guava/25.1-jre
diff --git a/pom.xml b/pom.xml
index 0ac4c7a7f..01d64e6a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -277,12 +277,6 @@
2.21.1
provided
-
- joda-time
- joda-time
- 2.10
- provided
-
commons-codec
commons-codec