Skip to content

Commit d8d95c1

Browse files
author
w.vela
committed
[code healthy] junit 5.x, code cleanup.
1 parent 6d8ba87 commit d8d95c1

19 files changed

+107
-128
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A local data buffer with customizable data trigger
1313
<dependency>
1414
<groupId>com.github.phantomthief</groupId>
1515
<artifactId>buffer-trigger</artifactId>
16-
<version>0.2.8-SNAPSHOT</version>
16+
<version>0.2.9-SNAPSHOT</version>
1717
</dependency>
1818
```
1919

pom.xml

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@
88
<maven>3.0.4</maven>
99
</prerequisites>
1010

11+
<properties>
12+
<junit-jupiter.version>5.0.1</junit-jupiter.version>
13+
<logback-classic.version>1.1.8</logback-classic.version>
14+
<junit-platform.version>1.0.1</junit-platform.version>
15+
16+
<coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
17+
<jacoco-maven-plugin.version>0.7.9</jacoco-maven-plugin.version>
18+
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
19+
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
20+
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
21+
<maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
22+
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
23+
</properties>
24+
1125
<parent>
1226
<groupId>org.sonatype.oss</groupId>
1327
<artifactId>oss-parent</artifactId>
@@ -58,25 +72,41 @@
5872
</dependency>
5973

6074
<dependency>
61-
<groupId>junit</groupId>
62-
<artifactId>junit</artifactId>
63-
<version>4.12</version>
75+
<groupId>org.junit.jupiter</groupId>
76+
<artifactId>junit-jupiter-api</artifactId>
77+
<version>${junit-jupiter.version}</version>
6478
<scope>test</scope>
6579
</dependency>
6680
<dependency>
6781
<groupId>ch.qos.logback</groupId>
6882
<artifactId>logback-classic</artifactId>
69-
<version>1.1.7</version>
83+
<version>${logback-classic.version}</version>
7084
<scope>test</scope>
7185
</dependency>
7286
</dependencies>
7387

7488
<build>
7589
<plugins>
90+
<plugin>
91+
<artifactId>maven-surefire-plugin</artifactId>
92+
<version>${maven-surefire-plugin.version}</version>
93+
<dependencies>
94+
<dependency>
95+
<groupId>org.junit.platform</groupId>
96+
<artifactId>junit-platform-surefire-provider</artifactId>
97+
<version>${junit-platform.version}</version>
98+
</dependency>
99+
<dependency>
100+
<groupId>org.junit.jupiter</groupId>
101+
<artifactId>junit-jupiter-engine</artifactId>
102+
<version>${junit-jupiter.version}</version>
103+
</dependency>
104+
</dependencies>
105+
</plugin>
76106
<plugin>
77107
<groupId>org.apache.maven.plugins</groupId>
78108
<artifactId>maven-compiler-plugin</artifactId>
79-
<version>3.5.1</version>
109+
<version>${maven-compiler-plugin.version}</version>
80110
<configuration>
81111
<source>1.8</source>
82112
<target>1.8</target>
@@ -92,7 +122,7 @@
92122
<plugin>
93123
<groupId>org.apache.maven.plugins</groupId>
94124
<artifactId>maven-source-plugin</artifactId>
95-
<version>3.0.1</version>
125+
<version>${maven-source-plugin.version}</version>
96126
<executions>
97127
<execution>
98128
<id>attach-sources</id>
@@ -105,7 +135,7 @@
105135
<plugin>
106136
<groupId>org.apache.maven.plugins</groupId>
107137
<artifactId>maven-javadoc-plugin</artifactId>
108-
<version>2.10.4</version>
138+
<version>${maven-javadoc-plugin.version}</version>
109139
<configuration>
110140
<additionalparam>-Xdoclint:none</additionalparam>
111141
</configuration>
@@ -121,7 +151,7 @@
121151
<plugin>
122152
<groupId>org.sonatype.plugins</groupId>
123153
<artifactId>nexus-staging-maven-plugin</artifactId>
124-
<version>1.6.7</version>
154+
<version>${nexus-staging-maven-plugin.version}</version>
125155
<extensions>true</extensions>
126156
<configuration>
127157
<serverId>sonatype-nexus-staging</serverId>
@@ -132,7 +162,7 @@
132162
<plugin>
133163
<groupId>org.jacoco</groupId>
134164
<artifactId>jacoco-maven-plugin</artifactId>
135-
<version>0.7.7.201606060606</version>
165+
<version>${jacoco-maven-plugin.version}</version>
136166
<executions>
137167
<execution>
138168
<id>prepare-agent</id>
@@ -145,7 +175,7 @@
145175
<plugin>
146176
<groupId>org.eluder.coveralls</groupId>
147177
<artifactId>coveralls-maven-plugin</artifactId>
148-
<version>4.2.0</version>
178+
<version>${coveralls-maven-plugin.version}</version>
149179
</plugin>
150180
</plugins>
151181
</build>

src/main/java/com/github/phantomthief/collection/BufferTrigger.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/**
2-
*
3-
*/
41
package com.github.phantomthief.collection;
52

63
import com.github.phantomthief.collection.impl.BatchConsumeBlockingQueueTrigger;

src/main/java/com/github/phantomthief/collection/impl/BatchConsumeBlockingQueueTrigger.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/**
2-
*
3-
*/
41
package com.github.phantomthief.collection.impl;
52

63
import static com.github.phantomthief.util.MoreLocks.runWithLock;

src/main/java/com/github/phantomthief/collection/impl/BatchConsumerTriggerBuilder.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/**
2-
*
3-
*/
41
package com.github.phantomthief.collection.impl;
52

63
import static com.google.common.base.Preconditions.checkNotNull;

src/main/java/com/github/phantomthief/collection/impl/GenericBatchConsumerTriggerBuilder.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/**
2-
*
3-
*/
41
package com.github.phantomthief.collection.impl;
52

63
import java.time.Duration;

src/main/java/com/github/phantomthief/collection/impl/GenericSimpleBufferTriggerBuilder.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/**
2-
*
3-
*/
41
package com.github.phantomthief.collection.impl;
52

63
import java.util.concurrent.ScheduledExecutorService;

src/main/java/com/github/phantomthief/collection/impl/LazyBufferTrigger.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/**
2-
*
3-
*/
41
package com.github.phantomthief.collection.impl;
52

63
import static com.github.phantomthief.util.MoreSuppliers.lazy;

src/main/java/com/github/phantomthief/collection/impl/MultiIntervalTriggerStrategy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static com.google.common.base.Preconditions.checkArgument;
55
import static java.lang.Math.abs;
66
import static java.lang.Math.min;
7+
import static java.lang.System.*;
78

89
import java.util.Map.Entry;
910
import java.util.SortedMap;
@@ -70,7 +71,7 @@ public TriggerResult canTrigger(long lastConsumeTimestamp, long changedCount) {
7071

7172
boolean doConsumer = false;
7273

73-
long now = System.currentTimeMillis();
74+
long now = currentTimeMillis();
7475

7576
for (Entry<Long, Long> entry : triggerMap.entrySet()) {
7677
if (now - lastConsumeTimestamp < entry.getKey()) {

src/main/java/com/github/phantomthief/collection/impl/SimpleBufferTrigger.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/**
2-
*
3-
*/
41
package com.github.phantomthief.collection.impl;
52

63
import static java.lang.System.currentTimeMillis;

0 commit comments

Comments
 (0)