Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing Joda from codebase #463

Merged
merged 4 commits into from
Feb 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 0 additions & 4 deletions core/cleaner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -88,8 +89,10 @@ private Long getMinKeepVersion(final Collection<Suite> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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",
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion osgi-dependencies/aet-features.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
</feature>

<feature name="aet-standalone-dependencies" version="0.6.0" description="Set of simple dependencies for AET" install="auto">
<bundle>mvn:joda-time/joda-time/2.10</bundle>
<bundle>mvn:org.json/json/20180130</bundle>
<bundle>mvn:com.google.code.gson/gson/2.8.5</bundle>
<bundle>mvn:com.google.guava/guava/25.1-jre</bundle>
Expand Down
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,6 @@
<version>2.21.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
Expand Down