Skip to content

Commit 5d0884f

Browse files
authored
Reformating (#649)
1 parent a2b7681 commit 5d0884f

File tree

238 files changed

+3113
-2470
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+3113
-2470
lines changed

RELEASE-NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 4.2.0
2+
* Activating Config v3 for beta testing
3+
14
## 4.1.0
25
* Refactoring config module to support config v3
36
* Commited Arc Drawio to the source code

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ dependencies {
8686
stressTestCompileOnly('org.projectlombok:lombok:1.18.+')
8787
stressTestAnnotationProcessor('org.projectlombok:lombok:1.18.+')
8888

89-
testImplementation("org.junit.jupiter:junit-jupiter:5.11.3")
90-
testImplementation("org.mockito:mockito-junit-jupiter:5.11.0")
89+
testImplementation("org.junit.jupiter:junit-jupiter:5.10.+")
90+
testImplementation('org.mockito:mockito-junit-jupiter:5.12.+')
9191
testImplementation('org.hamcrest:hamcrest:3.0')
9292
testImplementation('org.assertj:assertj-core:3.27.6')
9393
testImplementation('io.rest-assured:rest-assured:5.5.0')

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=4.1.0-snapshot
1+
version=4.2.0-snapshot

src/main/java/com/mageddo/circuitbreaker/failsafe/CircuitStatusRefresh.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public static boolean refresh(CircuitBreaker<?> circuitBreaker) {
1515
}
1616

1717
private static boolean readyToChangeToHalOpen(CircuitBreaker<?> circuitBreaker) {
18-
return circuitBreaker.isOpen() && circuitBreaker.getRemainingDelay().isZero();
18+
return circuitBreaker.isOpen() && circuitBreaker.getRemainingDelay()
19+
.isZero();
1920
}
2021

2122
}

src/main/java/com/mageddo/commons/exec/CommandLines.java

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
package com.mageddo.commons.exec;
22

3-
import lombok.extern.slf4j.Slf4j;
3+
import java.io.IOException;
4+
import java.io.UncheckedIOException;
5+
import java.time.Duration;
6+
47
import org.apache.commons.exec.CommandLine;
58
import org.apache.commons.exec.ExecuteException;
69
import org.apache.commons.exec.ExecuteResultHandler;
710
import org.apache.commons.exec.ExecuteWatchdog;
811

9-
import java.io.IOException;
10-
import java.io.UncheckedIOException;
11-
import java.time.Duration;
12+
import lombok.extern.slf4j.Slf4j;
1213

1314
@Slf4j
1415
public class CommandLines {
1516

1617
public static Result exec(String commandLine, Object... args) {
1718
return exec(CommandLine.parse(String.format(commandLine, args)),
18-
ExecuteWatchdog.INFINITE_TIMEOUT
19+
ExecuteWatchdog.INFINITE_TIMEOUT
1920
);
2021
}
2122

@@ -29,25 +30,25 @@ public static Result exec(CommandLine commandLine) {
2930

3031
public static Result exec(CommandLine commandLine, long timeout) {
3132
return exec(
32-
Request.builder()
33-
.commandLine(commandLine)
34-
.timeout(Duration.ofMillis(timeout))
35-
.build()
33+
Request.builder()
34+
.commandLine(commandLine)
35+
.timeout(Duration.ofMillis(timeout))
36+
.build()
3637
);
3738
}
3839

3940
private static void registerProcessWatch(ProcessAccessibleDaemonExecutor executor) {
4041
ProcessesWatchDog.instance()
41-
.watch(executor::getProcess)
42+
.watch(executor::getProcess)
4243
;
4344
}
4445

4546
public static Result exec(CommandLine commandLine, ExecuteResultHandler handler) {
4647
return exec(Request
47-
.builder()
48-
.commandLine(commandLine)
49-
.handler(handler)
50-
.build()
48+
.builder()
49+
.commandLine(commandLine)
50+
.handler(handler)
51+
.build()
5152
);
5253
}
5354

@@ -65,21 +66,22 @@ public static Result exec(Request request) {
6566
}
6667
} catch (ExecuteException e) {
6768
if (request.getHandler() != null) {
68-
request.getHandler().onProcessFailed(e);
69+
request.getHandler()
70+
.onProcessFailed(e);
6971
} else {
7072
exitCode = e.getExitValue();
7173
}
7274
} catch (IOException e) {
7375
throw new UncheckedIOException(e);
7476
}
7577
return Result
76-
.builder()
77-
.executor(executor)
78-
.processSupplier(executor::getProcess)
79-
.out(request.getBestOut())
80-
.exitCode(exitCode)
81-
.request(request)
82-
.build();
78+
.builder()
79+
.executor(executor)
80+
.processSupplier(executor::getProcess)
81+
.out(request.getBestOut())
82+
.exitCode(exitCode)
83+
.request(request)
84+
.build();
8385
}
8486

8587
private static ProcessAccessibleDaemonExecutor createExecutor() {

src/main/java/com/mageddo/commons/exec/DelegateOutputStream.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ public class DelegateOutputStream extends OutputStream {
1010
private final List<OutputStream> delegateOuts;
1111

1212
public DelegateOutputStream(OutputStream... delegateOuts) {
13-
this.delegateOuts = Stream.of(delegateOuts).toList();
13+
this.delegateOuts = Stream.of(delegateOuts)
14+
.toList();
1415
}
1516

1617
public DelegateOutputStream(List<OutputStream> delegateOuts) {

src/main/java/com/mageddo/commons/exec/PipedStream.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package com.mageddo.commons.exec;
22

3-
import lombok.Getter;
4-
53
import java.io.IOException;
64
import java.io.OutputStream;
75
import java.io.PipedInputStream;
86
import java.io.PipedOutputStream;
97
import java.io.UncheckedIOException;
108

9+
import lombok.Getter;
10+
1111
public class PipedStream extends OutputStream {
1212

1313
@Getter
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
package com.mageddo.commons.exec;
22

3-
import lombok.Getter;
4-
import org.apache.commons.exec.CommandLine;
5-
import org.apache.commons.exec.DaemonExecutor;
6-
73
import java.io.File;
84
import java.io.IOException;
95
import java.util.Map;
106

7+
import org.apache.commons.exec.CommandLine;
8+
import org.apache.commons.exec.DaemonExecutor;
9+
10+
import lombok.Getter;
11+
1112
@Getter
1213
class ProcessAccessibleDaemonExecutor extends DaemonExecutor {
1314

1415
private Process process = null;
1516

1617
@Override
17-
protected Process launch(CommandLine command, Map<String, String> env, File dir) throws IOException {
18+
protected Process launch(CommandLine command, Map<String, String> env, File dir)
19+
throws IOException {
1820
return this.process = super.launch(command, env, dir);
1921
}
2022
}

src/main/java/com/mageddo/commons/exec/ProcessesWatchDog.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package com.mageddo.commons.exec;
22

3-
import com.mageddo.commons.lang.Singletons;
4-
import lombok.extern.slf4j.Slf4j;
5-
63
import java.util.ArrayList;
74
import java.util.List;
85
import java.util.Objects;
96
import java.util.function.Supplier;
107

8+
import com.mageddo.commons.lang.Singletons;
9+
10+
import lombok.extern.slf4j.Slf4j;
11+
1112
@Slf4j
1213
public class ProcessesWatchDog {
1314

@@ -28,22 +29,26 @@ public void watch(Process process) {
2829
public void killAllProcesses() {
2930
final var validProcesses = this.findValidProcesses();
3031

31-
log.debug("status=killing all processes, processes={}, valid={}", this.processes.size(), validProcesses.size());
32+
log.debug("status=killing all processes, processes={}, valid={}", this.processes.size(),
33+
validProcesses.size()
34+
);
3235

3336
validProcesses.forEach(process -> {
3437
try {
3538
process.destroy();
3639
log.trace("status=killed, pid={}", process.pid());
3740
} catch (Exception e) {
38-
log.warn("status=unable to destroy, processId={}, msg={}", process.pid(), e.getMessage(), e);
41+
log.warn("status=unable to destroy, processId={}, msg={}", process.pid(), e.getMessage(),
42+
e
43+
);
3944
}
4045
});
4146
}
4247

4348
private List<Process> findValidProcesses() {
4449
return this.processes.stream()
45-
.map(Supplier::get)
46-
.filter(Objects::nonNull)
47-
.toList();
50+
.map(Supplier::get)
51+
.filter(Objects::nonNull)
52+
.toList();
4853
}
4954
}

src/main/java/com/mageddo/commons/exec/Request.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
package com.mageddo.commons.exec;
22

3+
import java.io.ByteArrayOutputStream;
4+
import java.io.InputStream;
5+
import java.io.OutputStream;
6+
import java.time.Duration;
7+
import java.util.Map;
8+
39
import com.mageddo.io.LogPrinter;
4-
import lombok.Builder;
5-
import lombok.NonNull;
6-
import lombok.Value;
7-
import lombok.experimental.NonFinal;
10+
811
import org.apache.commons.exec.CommandLine;
912
import org.apache.commons.exec.ExecuteResultHandler;
1013
import org.apache.commons.exec.ExecuteStreamHandler;
1114
import org.apache.commons.exec.ExecuteWatchdog;
1215
import org.apache.commons.exec.PumpStreamHandler;
1316

14-
import java.io.ByteArrayOutputStream;
15-
import java.io.InputStream;
16-
import java.io.OutputStream;
17-
import java.time.Duration;
18-
import java.util.Map;
17+
import lombok.Builder;
18+
import lombok.NonNull;
19+
import lombok.Value;
20+
import lombok.experimental.NonFinal;
1921

2022
@Value
2123
@Builder(toBuilder = true, builderClassName = "RequestBuilder", buildMethodName = "build0")
@@ -34,8 +36,8 @@ public class Request {
3436

3537
@Builder.Default
3638
private final Streams streams = Streams.builder()
37-
.outAndErr(new ByteArrayOutputStream())
38-
.build();
39+
.outAndErr(new ByteArrayOutputStream())
40+
.build();
3941

4042
public ExecuteStreamHandler getStreamHandler() {
4143
return this.streams.toStreamHandler();
@@ -97,7 +99,8 @@ public PipedStream getBestOut() {
9799
}
98100

99101
public OutputStream getBestOriginalOutput() {
100-
return this.getBestOut().getOriginalOut();
102+
return this.getBestOut()
103+
.getOriginalOut();
101104
}
102105

103106
public static class StreamsBuilder {

0 commit comments

Comments
 (0)