Merge branch 'eugenp:master' into master
This commit is contained in:
@@ -12,7 +12,8 @@ This module contains articles about Apache Kafka.
|
||||
- [Kafka Connect Example with MQTT and MongoDB](https://www.baeldung.com/kafka-connect-mqtt-mongodb)
|
||||
- [Building a Data Pipeline with Flink and Kafka](https://www.baeldung.com/kafka-flink-data-pipeline)
|
||||
- [Exactly Once Processing in Kafka with Java](https://www.baeldung.com/kafka-exactly-once)
|
||||
- [Custom Serializers in Apache Kafka](https://www.baeldung.com/kafka-custom-serializer)
|
||||
|
||||
|
||||
##### Building the project
|
||||
You can build the project from the command line using: *mvn clean install*, or in an IDE.
|
||||
You can build the project from the command line using: *mvn clean install*, or in an IDE.
|
||||
|
||||
@@ -133,6 +133,11 @@
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,6 @@ import com.baeldung.apache.beam.intro.WordCount;
|
||||
public class WordCountUnitTest {
|
||||
|
||||
@Test
|
||||
// @Ignore
|
||||
public void givenInputFile_whenWordCountRuns_thenJobFinishWithoutError() {
|
||||
boolean jobDone = WordCount.wordCount("src/test/resources/wordcount.txt", "target/output");
|
||||
assertTrue(jobDone);
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
|
||||
- [String API Updates in Java 12](https://www.baeldung.com/java12-string-api)
|
||||
- [New Features in Java 12](https://www.baeldung.com/java-12-new-features)
|
||||
- [Compare the Content of Two Files in Java](https://www.baeldung.com/java-compare-files)
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.baeldung.java_16_features.mapmulti;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class Album {
|
||||
|
||||
private String albumName;
|
||||
private int albumCost;
|
||||
private List<Artist> artists;
|
||||
|
||||
Album(String name, int albumCost, List<Artist> artists) {
|
||||
this.albumName = name;
|
||||
this.artists = artists;
|
||||
this.albumCost = albumCost;
|
||||
}
|
||||
|
||||
public void artistAlbumPairsToMajorLabels(Consumer<Pair<String, String>> consumer) {
|
||||
|
||||
for (Artist artist : artists) {
|
||||
if (artist.isAssociatedMajorLabels()) {
|
||||
String concatLabels = artist.getMajorLabels()
|
||||
.stream()
|
||||
.collect(Collectors.joining(","));
|
||||
consumer.accept(new ImmutablePair<>(artist.getName() + ":" + albumName, concatLabels));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getAlbumName() {
|
||||
return albumName;
|
||||
}
|
||||
|
||||
public int getAlbumCost() {
|
||||
return albumCost;
|
||||
}
|
||||
|
||||
List<Artist> getArtists() {
|
||||
return artists;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return albumName;
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.baeldung.java_16_features.mapmulti;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Artist {
|
||||
|
||||
private final String name;
|
||||
private boolean associatedMajorLabels;
|
||||
private List<String> majorLabels;
|
||||
|
||||
Artist(String name, boolean associatedMajorLabels, List<String> majorLabels) {
|
||||
this.name = name;
|
||||
this.associatedMajorLabels = associatedMajorLabels;
|
||||
this.majorLabels = majorLabels;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public boolean isAssociatedMajorLabels() {
|
||||
return associatedMajorLabels;
|
||||
}
|
||||
|
||||
public List<String> getMajorLabels() {
|
||||
return majorLabels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Artist other = (Artist) obj;
|
||||
return Objects.equals(name, other.name);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
package com.baeldung.java_16_features.mapmulti;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.offset;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class JavaStreamMapMultiUnitTest {
|
||||
|
||||
private static final List<Album> albums = Arrays.asList(new Album("album1", 10, Arrays.asList(new Artist("bob", true, Arrays.asList("label1", "label3")), new Artist("tom", true, Arrays.asList("label2", "label3")))),
|
||||
new Album("album2", 20, Arrays.asList(new Artist("bill", true, Arrays.asList("label2", "label3")), new Artist("tom", true, Arrays.asList("label2", "label4")))));
|
||||
|
||||
@Test
|
||||
public void givenAListOfintegers_whenMapMulti_thenGetListOfOfEvenDoublesPlusPercentage() {
|
||||
|
||||
List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5);
|
||||
double percentage = .01;
|
||||
List<Double> evenDoubles = integers.stream()
|
||||
.<Double> mapMulti((integer, consumer) -> {
|
||||
if (integer % 2 == 0) {
|
||||
consumer.accept((double) integer * (1 + percentage));
|
||||
}
|
||||
})
|
||||
.collect(toList());
|
||||
|
||||
assertThat(evenDoubles).containsAll(Arrays.asList(2.02D, 4.04D));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfintegers_whenFilterMap_thenGetListOfOfEvenDoublesPlusPercentage() {
|
||||
|
||||
List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5);
|
||||
double percentage = .01;
|
||||
List<Double> evenDoubles = integers.stream()
|
||||
.filter(integer -> integer % 2 == 0)
|
||||
.<Double> map(integer -> ((double) integer * (1 + percentage)))
|
||||
.collect(toList());
|
||||
|
||||
assertThat(evenDoubles).containsAll(Arrays.asList(2.02D, 4.04D));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfintegers_whenMapMultiToDouble_thenGetSumOfEvenNumbersAfterApplyPercentage() {
|
||||
|
||||
List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5, 6, 7);
|
||||
double percentage = .01;
|
||||
double sum = integers.stream()
|
||||
.mapMultiToDouble((integer, consumer) -> {
|
||||
if (integer % 2 == 0) {
|
||||
consumer.accept(integer * (1 + percentage));
|
||||
}
|
||||
})
|
||||
.sum();
|
||||
|
||||
assertThat(sum).isEqualTo(12.12, offset(0.001d));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfAlbums_whenFlatMap_thenGetListOfArtistAlbumPairs() {
|
||||
|
||||
List<Pair<String, String>> artistAlbum = albums.stream()
|
||||
.flatMap(album -> album.getArtists()
|
||||
.stream()
|
||||
.map(artist -> new ImmutablePair<String, String>(artist.getName(), album.getAlbumName())))
|
||||
.collect(toList());
|
||||
|
||||
assertThat(artistAlbum).contains(new ImmutablePair<String, String>("bob", "album1"), new ImmutablePair<String,
|
||||
String>("tom", "album1"), new ImmutablePair<String, String>("bill", "album2"), new ImmutablePair<String, String>("tom", "album2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfAlbums_whenMapMulti_thenGetListOfPairsOfArtistAlbum() {
|
||||
|
||||
List<Pair<String, String>> artistAlbum = albums.stream()
|
||||
.<Pair<String, String>> mapMulti((album, consumer) -> {
|
||||
for (Artist artist : album.getArtists()) {
|
||||
consumer.accept(new ImmutablePair<String, String>(artist.getName(), album.getAlbumName()));
|
||||
}
|
||||
})
|
||||
.collect(toList());
|
||||
|
||||
assertThat(artistAlbum).contains(new ImmutablePair<String, String>("bob", "album1"), new ImmutablePair<String, String>("tom", "album1"),
|
||||
new ImmutablePair<String, String>("bill", "album2"), new ImmutablePair<String, String>("tom", "album2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfAlbums_whenFlatMap_thenGetListOfArtistAlbumjPairsBelowGivenCost() {
|
||||
|
||||
int upperCost = 9;
|
||||
List<Pair<String, String>> artistAlbum = albums.stream()
|
||||
.flatMap(album -> album.getArtists()
|
||||
.stream()
|
||||
.filter(artist -> upperCost > album.getAlbumCost())
|
||||
.map(artist -> new ImmutablePair<String, String>(artist.getName(), album.getAlbumName())))
|
||||
.collect(toList());
|
||||
|
||||
assertTrue(artistAlbum.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfAlbums_whenMapMulti_thenGetListOfArtistAlbumPairsBelowGivenCost() {
|
||||
|
||||
int upperCost = 9;
|
||||
List<Pair<String, String>> artistAlbum = albums.stream()
|
||||
.<Pair<String, String>> mapMulti((album, consumer) -> {
|
||||
if (album.getAlbumCost() < upperCost) {
|
||||
for (Artist artist : album.getArtists()) {
|
||||
consumer.accept(new ImmutablePair<String, String>(artist.getName(), album.getAlbumName()));
|
||||
}
|
||||
}
|
||||
})
|
||||
.collect(toList());
|
||||
|
||||
assertTrue(artistAlbum.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfAlbums_whenMapMulti_thenGetPairsOfArtistMajorLabelsUsingMethodReference() {
|
||||
|
||||
List<Pair<String, String>> artistLabels = albums.stream()
|
||||
.mapMulti(Album::artistAlbumPairsToMajorLabels)
|
||||
.collect(toList());
|
||||
|
||||
assertThat(artistLabels).contains(new ImmutablePair<String, String>("bob:album1", "label1,label3"), new ImmutablePair<String, String>("tom:album1", "label2,label3"),
|
||||
new ImmutablePair<String, String>("bill:album2", "label2,label3"), new ImmutablePair<String, String>("tom:album2", "label2,label4"));
|
||||
}
|
||||
}
|
||||
@@ -11,3 +11,4 @@ This module contains articles about parsing and formatting Java date and time ob
|
||||
- [Display All Time Zones With GMT And UTC in Java](http://www.baeldung.com/java-time-zones)
|
||||
- [Convert between String and Timestamp](https://www.baeldung.com/java-string-to-timestamp)
|
||||
- [Convert String to Date in Java](http://www.baeldung.com/java-string-to-date)
|
||||
- [Format a Milliseconds Duration to HH:MM:SS](https://www.baeldung.com/java-ms-to-hhmmss)
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
<properties>
|
||||
<commons-validator.version>1.6</commons-validator.version>
|
||||
<joda-time.version>2.10</joda-time.version>
|
||||
<joda-time.version>2.10.10</joda-time.version>
|
||||
<!-- testing -->
|
||||
<assertj.version>3.6.1</assertj.version>
|
||||
<maven.compiler.source>1.9</maven.compiler.source>
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.baeldung.formatduration;
|
||||
|
||||
import org.apache.commons.lang3.time.DurationFormatUtils;
|
||||
import org.joda.time.Period;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class FormatDurationUnitTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void givenInterval_WhenFormatInterval_formatDuration() {
|
||||
long HH = TimeUnit.MILLISECONDS.toHours(38114000);
|
||||
long MM = TimeUnit.MILLISECONDS.toMinutes(38114000) % 60;
|
||||
long SS = TimeUnit.MILLISECONDS.toSeconds(38114000) % 60;
|
||||
String timeInHHMMSS = String.format("%02d:%02d:%02d", HH, MM, SS);
|
||||
|
||||
assertThat(timeInHHMMSS).isEqualTo("10:35:14");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenInterval_WhenFormatUsingDuration_formatDuration() {
|
||||
Duration duration = Duration.ofMillis(38114000);
|
||||
long seconds = duration.getSeconds();
|
||||
long HH = seconds / 3600;
|
||||
long MM = (seconds % 3600) / 60;
|
||||
long SS = seconds % 60;
|
||||
String timeInHHMMSS = String.format("%02d:%02d:%02d", HH, MM, SS);
|
||||
assertThat(timeInHHMMSS).isEqualTo("10:35:14");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void givenInterval_WhenFormatDurationUsingApacheCommons_formatDuration() {
|
||||
assertThat(DurationFormatUtils.formatDuration(38114000, "HH:mm:ss"))
|
||||
.isEqualTo("10:35:14");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenInterval_WhenFormatDurationUsingJodaTime_formatDuration() {
|
||||
org.joda.time.Duration duration = new org.joda.time.Duration(38114000);
|
||||
Period period = duration.toPeriod();
|
||||
long HH = period.getHours();
|
||||
long MM = period.getMinutes();
|
||||
long SS = period.getSeconds();
|
||||
|
||||
String timeInHHMMSS = String.format("%02d:%02d:%02d", HH, MM, SS);
|
||||
assertThat(timeInHHMMSS).isEqualTo("10:35:14");
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,5 @@ This module contains articles about networking in Java
|
||||
- [Downloading Email Attachments in Java](https://www.baeldung.com/java-download-email-attachments)
|
||||
- [Connection Timeout vs. Read Timeout for Java Sockets](https://www.baeldung.com/java-socket-connection-read-timeout)
|
||||
- [Find Whether an IP Address Is in the Specified Range or Not in Java](https://www.baeldung.com/java-check-ip-address-range)
|
||||
- [Find the IP Address of a Client Connected to a Server](https://www.baeldung.com/java-client-get-ip-address)
|
||||
- [[<-- Prev]](/core-java-modules/core-java-networking-2)
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.baeldung.clientaddress;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.Socket;
|
||||
|
||||
public class ApplicationClient {
|
||||
|
||||
private Socket clientSocket;
|
||||
private PrintWriter out;
|
||||
private BufferedReader in;
|
||||
|
||||
public void connect(String ip, int port) throws IOException {
|
||||
clientSocket = new Socket(ip, port);
|
||||
out = new PrintWriter(clientSocket.getOutputStream(), true);
|
||||
in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
|
||||
}
|
||||
|
||||
public void sendGreetings(String msg) throws IOException {
|
||||
out.println(msg);
|
||||
String reply = in.readLine();
|
||||
System.out.println("Reply received from the server :: " + reply);
|
||||
}
|
||||
|
||||
public void disconnect() throws IOException {
|
||||
in.close();
|
||||
out.close();
|
||||
clientSocket.close();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
ApplicationClient client = new ApplicationClient();
|
||||
client.connect(args[0], Integer.parseInt(args[1])); // IP address and port number of the server
|
||||
client.sendGreetings(args[2]); // greetings message
|
||||
client.disconnect();
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.baeldung.clientaddress;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
public class ApplicationServer {
|
||||
|
||||
private ServerSocket serverSocket;
|
||||
private Socket connectedSocket;
|
||||
private PrintWriter out;
|
||||
private BufferedReader in;
|
||||
|
||||
public void startServer(int port) throws IOException {
|
||||
serverSocket = new ServerSocket(port);
|
||||
connectedSocket = serverSocket.accept();
|
||||
|
||||
InetSocketAddress socketAddress = (InetSocketAddress) connectedSocket.getRemoteSocketAddress();
|
||||
String clientIpAddress = socketAddress.getAddress()
|
||||
.getHostAddress();
|
||||
System.out.println("IP address of the connected client :: " + clientIpAddress);
|
||||
|
||||
out = new PrintWriter(connectedSocket.getOutputStream(), true);
|
||||
in = new BufferedReader(new InputStreamReader(connectedSocket.getInputStream()));
|
||||
String msg = in.readLine();
|
||||
System.out.println("Message received from the client :: " + msg);
|
||||
out.println("Hello Client !!");
|
||||
|
||||
closeIO();
|
||||
stopServer();
|
||||
}
|
||||
|
||||
private void closeIO() throws IOException {
|
||||
in.close();
|
||||
out.close();
|
||||
}
|
||||
|
||||
private void stopServer() throws IOException {
|
||||
connectedSocket.close();
|
||||
serverSocket.close();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
ApplicationServer server = new ApplicationServer();
|
||||
server.startServer(5000);
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package com.baeldung.java9.process;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ProcessAPIEnhancements {
|
||||
|
||||
static Logger log = LoggerFactory.getLogger(ProcessAPIEnhancements.class);
|
||||
|
||||
public static void main(String[] args) throws IOException, InterruptedException, ExecutionException {
|
||||
infoOfCurrentProcess();
|
||||
infoOfLiveProcesses();
|
||||
infoOfSpawnProcess();
|
||||
infoOfExitCallback();
|
||||
infoOfChildProcess();
|
||||
}
|
||||
|
||||
private static void infoOfCurrentProcess() {
|
||||
ProcessHandle processHandle = ProcessHandle.current();
|
||||
ProcessHandle.Info processInfo = processHandle.info();
|
||||
|
||||
log.info("PID: " + processHandle.pid());
|
||||
log.info("Arguments: " + processInfo.arguments());
|
||||
log.info("Command: " + processInfo.command());
|
||||
log.info("Instant: " + processInfo.startInstant());
|
||||
log.info("Total CPU duration: " + processInfo.totalCpuDuration());
|
||||
log.info("User: " + processInfo.user());
|
||||
}
|
||||
|
||||
private static void infoOfSpawnProcess() throws IOException {
|
||||
|
||||
String javaCmd = ProcessUtils.getJavaCmd().getAbsolutePath();
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(javaCmd, "-version");
|
||||
Process process = processBuilder.inheritIO().start();
|
||||
ProcessHandle processHandle = process.toHandle();
|
||||
ProcessHandle.Info processInfo = processHandle.info();
|
||||
|
||||
log.info("PID: " + processHandle.pid());
|
||||
log.info("Arguments: " + processInfo.arguments());
|
||||
log.info("Command: " + processInfo.command());
|
||||
log.info("Instant: " + processInfo.startInstant());
|
||||
log.info("Total CPU duration: " + processInfo.totalCpuDuration());
|
||||
log.info("User: " + processInfo.user());
|
||||
}
|
||||
|
||||
private static void infoOfLiveProcesses() {
|
||||
Stream<ProcessHandle> liveProcesses = ProcessHandle.allProcesses();
|
||||
liveProcesses.filter(ProcessHandle::isAlive)
|
||||
.forEach(ph -> {
|
||||
log.info("PID: " + ph.pid());
|
||||
log.info("Instance: " + ph.info().startInstant());
|
||||
log.info("User: " + ph.info().user());
|
||||
});
|
||||
}
|
||||
|
||||
private static void infoOfChildProcess() throws IOException {
|
||||
int childProcessCount = 5;
|
||||
for (int i = 0; i < childProcessCount; i++) {
|
||||
String javaCmd = ProcessUtils.getJavaCmd()
|
||||
.getAbsolutePath();
|
||||
ProcessBuilder processBuilder
|
||||
= new ProcessBuilder(javaCmd, "-version");
|
||||
processBuilder.inheritIO().start();
|
||||
}
|
||||
|
||||
Stream<ProcessHandle> children = ProcessHandle.current()
|
||||
.children();
|
||||
children.filter(ProcessHandle::isAlive)
|
||||
.forEach(ph -> log.info("PID: {}, Cmd: {}", ph.pid(), ph.info()
|
||||
.command()));
|
||||
Stream<ProcessHandle> descendants = ProcessHandle.current()
|
||||
.descendants();
|
||||
descendants.filter(ProcessHandle::isAlive)
|
||||
.forEach(ph -> log.info("PID: {}, Cmd: {}", ph.pid(), ph.info()
|
||||
.command()));
|
||||
}
|
||||
|
||||
private static void infoOfExitCallback() throws IOException, InterruptedException, ExecutionException {
|
||||
String javaCmd = ProcessUtils.getJavaCmd()
|
||||
.getAbsolutePath();
|
||||
ProcessBuilder processBuilder
|
||||
= new ProcessBuilder(javaCmd, "-version");
|
||||
Process process = processBuilder.inheritIO()
|
||||
.start();
|
||||
ProcessHandle processHandle = process.toHandle();
|
||||
|
||||
log.info("PID: {} has started", processHandle.pid());
|
||||
CompletableFuture<ProcessHandle> onProcessExit = processHandle.onExit();
|
||||
onProcessExit.get();
|
||||
log.info("Alive: " + processHandle.isAlive());
|
||||
onProcessExit.thenAccept(ph -> {
|
||||
log.info("PID: {} has stopped", ph.pid());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-132
@@ -1,132 +0,0 @@
|
||||
package com.baeldung.java9.process;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Created by sanaulla on 2/23/2017.
|
||||
*/
|
||||
|
||||
public class ProcessAPIEnhancementsUnitTest {
|
||||
|
||||
Logger log = LoggerFactory.getLogger(ProcessAPIEnhancementsUnitTest.class);
|
||||
|
||||
// @Test
|
||||
// OS / Java version dependent
|
||||
public void givenCurrentProcess_whenInvokeGetInfo_thenSuccess() throws IOException {
|
||||
ProcessHandle processHandle = ProcessHandle.current();
|
||||
ProcessHandle.Info processInfo = processHandle.info();
|
||||
assertNotNull(processHandle.pid());
|
||||
assertEquals(true, processInfo.arguments()
|
||||
.isPresent());
|
||||
assertEquals(true, processInfo.command()
|
||||
.isPresent());
|
||||
assertTrue(processInfo.command()
|
||||
.get()
|
||||
.contains("java"));
|
||||
|
||||
assertEquals(true, processInfo.startInstant()
|
||||
.isPresent());
|
||||
assertEquals(true, processInfo.totalCpuDuration()
|
||||
.isPresent());
|
||||
assertEquals(true, processInfo.user()
|
||||
.isPresent());
|
||||
}
|
||||
|
||||
// @Test
|
||||
// OS / Java version dependent
|
||||
public void givenSpawnProcess_whenInvokeGetInfo_thenSuccess() throws IOException {
|
||||
|
||||
String javaCmd = ProcessUtils.getJavaCmd()
|
||||
.getAbsolutePath();
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(javaCmd, "-version");
|
||||
Process process = processBuilder.inheritIO()
|
||||
.start();
|
||||
ProcessHandle processHandle = process.toHandle();
|
||||
ProcessHandle.Info processInfo = processHandle.info();
|
||||
assertNotNull(processHandle.pid());
|
||||
assertEquals(true, processInfo.arguments()
|
||||
.isPresent());
|
||||
assertEquals(true, processInfo.command()
|
||||
.isPresent());
|
||||
assertTrue(processInfo.command()
|
||||
.get()
|
||||
.contains("java"));
|
||||
assertEquals(true, processInfo.startInstant()
|
||||
.isPresent());
|
||||
assertEquals(false, processInfo.totalCpuDuration()
|
||||
.isPresent());
|
||||
assertEquals(true, processInfo.user()
|
||||
.isPresent());
|
||||
}
|
||||
|
||||
// @Test
|
||||
// OS / Java version dependent
|
||||
public void givenLiveProcesses_whenInvokeGetInfo_thenSuccess() {
|
||||
Stream<ProcessHandle> liveProcesses = ProcessHandle.allProcesses();
|
||||
liveProcesses.filter(ProcessHandle::isAlive)
|
||||
.forEach(ph -> {
|
||||
assertNotNull(ph.pid());
|
||||
assertEquals(true, ph.info()
|
||||
.startInstant()
|
||||
.isPresent());
|
||||
assertEquals(true, ph.info()
|
||||
.user()
|
||||
.isPresent());
|
||||
});
|
||||
}
|
||||
|
||||
// @Test
|
||||
// OS / Java version dependent
|
||||
public void givenProcess_whenGetChildProcess_thenSuccess() throws IOException {
|
||||
int childProcessCount = 5;
|
||||
for (int i = 0; i < childProcessCount; i++) {
|
||||
String javaCmd = ProcessUtils.getJavaCmd()
|
||||
.getAbsolutePath();
|
||||
ProcessBuilder processBuilder
|
||||
= new ProcessBuilder(javaCmd, "-version");
|
||||
processBuilder.inheritIO().start();
|
||||
}
|
||||
|
||||
Stream<ProcessHandle> children = ProcessHandle.current()
|
||||
.children();
|
||||
children.filter(ProcessHandle::isAlive)
|
||||
.forEach(ph -> log.info("PID: {}, Cmd: {}", ph.pid(), ph.info()
|
||||
.command()));
|
||||
Stream<ProcessHandle> descendants = ProcessHandle.current()
|
||||
.descendants();
|
||||
descendants.filter(ProcessHandle::isAlive)
|
||||
.forEach(ph -> log.info("PID: {}, Cmd: {}", ph.pid(), ph.info()
|
||||
.command()));
|
||||
}
|
||||
|
||||
// @Test
|
||||
// OS / Java version dependent
|
||||
public void givenProcess_whenAddExitCallback_thenSuccess() throws Exception {
|
||||
String javaCmd = ProcessUtils.getJavaCmd()
|
||||
.getAbsolutePath();
|
||||
ProcessBuilder processBuilder
|
||||
= new ProcessBuilder(javaCmd, "-version");
|
||||
Process process = processBuilder.inheritIO()
|
||||
.start();
|
||||
ProcessHandle processHandle = process.toHandle();
|
||||
|
||||
log.info("PID: {} has started", processHandle.pid());
|
||||
CompletableFuture<ProcessHandle> onProcessExit = processHandle.onExit();
|
||||
onProcessExit.get();
|
||||
assertEquals(false, processHandle.isAlive());
|
||||
onProcessExit.thenAccept(ph -> {
|
||||
log.info("PID: {} has stopped", ph.pid());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.baeldung.cryptography;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class CryptographyStrengthUnitTest {
|
||||
private static final int UNLIMITED_KEY_SIZE = 2147483647;
|
||||
|
||||
@Test
|
||||
public void whenDefaultCheck_thenUnlimitedReturned() throws NoSuchAlgorithmException {
|
||||
int maxKeySize = javax.crypto.Cipher.getMaxAllowedKeyLength("AES");
|
||||
assertThat(maxKeySize).isEqualTo(UNLIMITED_KEY_SIZE);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-datatype.version}</version>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<!-- CSV -->
|
||||
<dependency>
|
||||
@@ -52,7 +52,6 @@
|
||||
|
||||
<properties>
|
||||
<assertj.version>3.11.0</assertj.version>
|
||||
<jackson-datatype.version>2.9.8</jackson-datatype.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
+2
-1
@@ -3,5 +3,6 @@
|
||||
This module contains articles about JavaFX.
|
||||
|
||||
### Relevant Articles:
|
||||
-[Introduction to JavaFX](https://www.baeldung.com/javafx)
|
||||
- [Introduction to JavaFX](https://www.baeldung.com/javafx)
|
||||
- [Display Custom Items in JavaFX ListView](https://www.baeldung.com/javafx-listview-display-custom-items)
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
<argLine>-Djava.security.egd=file:/dev/./urandom -Xmx256m</argLine>
|
||||
<assertj.version>3.6.2</assertj.version>
|
||||
<awaitility.version>2.0.0</awaitility.version>
|
||||
@@ -31,6 +30,7 @@
|
||||
<jcache.version>1.0.0</jcache.version>
|
||||
<jhipster.server.version>1.1.0</jhipster.server.version>
|
||||
<jjwt.version>0.7.0</jjwt.version>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
<liquibase-hibernate5.version>3.6</liquibase-hibernate5.version>
|
||||
<liquibase-slf4j.version>2.0.0</liquibase-slf4j.version>
|
||||
<liquibase.version>3.6.2</liquibase.version>
|
||||
@@ -59,14 +59,14 @@
|
||||
|
||||
<sonar.issue.ignore.multicriteria>S3437,UndocumentedApi,BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria>
|
||||
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
recommended by http://fontawesome.io/examples/ -->
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>src/main/webapp/app/**/*.*</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>Web:BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=squid%3AS3437 is ignored, as a JPA-managed field cannot be transient -->
|
||||
<sonar.issue.ignore.multicriteria.S3437.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.S3437.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.S3437.ruleKey>squid:S3437</sonar.issue.ignore.multicriteria.S3437.ruleKey>
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
should be self-explanatory -->
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>squid:UndocumentedApi</sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>
|
||||
@@ -349,7 +349,6 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -365,11 +364,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Spring Cloud -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
@@ -427,7 +421,7 @@
|
||||
<defaultGoal>spring-boot:run</defaultGoal>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
bind to Maven lifecycle -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
@@ -580,14 +574,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Force alphabetical order to have a reproducible build -->
|
||||
<runOrder>alphabetical</runOrder>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
@@ -768,8 +754,8 @@
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
should hot reload automatically! -->
|
||||
<id>cc</id>
|
||||
<build>
|
||||
|
||||
@@ -21,6 +21,8 @@ eureka:
|
||||
instanceId: carapp:${spring.application.instance_id:${random.value}}
|
||||
|
||||
spring:
|
||||
main:
|
||||
banner-mode: "off"
|
||||
application:
|
||||
name: carapp
|
||||
jackson:
|
||||
@@ -37,7 +39,7 @@ spring:
|
||||
database-platform: io.github.jhipster.domain.util.FixedH2Dialect
|
||||
database: H2
|
||||
open-in-view: false
|
||||
show-sql: true
|
||||
show-sql: false
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
naming:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<configuration scan="true">
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
|
||||
<logger name="com.car.app" level="DEBUG"/>
|
||||
<logger name="com.car.app" level="INFO"/>
|
||||
<logger name="org.hibernate" level="WARN"/>
|
||||
<logger name="org.hibernate.ejb.HibernatePersistence" level="OFF"/>
|
||||
<logger name="org.apache.catalina.startup.DigesterFactory" level="OFF"/>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<jcache.version>1.0.0</jcache.version>
|
||||
<jhipster.server.version>1.1.0</jhipster.server.version>
|
||||
<jjwt.version>0.7.0</jjwt.version>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
<liquibase-hibernate5.version>3.6</liquibase-hibernate5.version>
|
||||
<liquibase-slf4j.version>2.0.0</liquibase-slf4j.version>
|
||||
<liquibase.version>3.6.2</liquibase.version>
|
||||
@@ -57,14 +58,14 @@
|
||||
|
||||
<sonar.issue.ignore.multicriteria>S3437,UndocumentedApi,BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria>
|
||||
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
recommended by http://fontawesome.io/examples/ -->
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>src/main/webapp/app/**/*.*</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>Web:BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=squid%3AS3437 is ignored, as a JPA-managed field cannot be transient -->
|
||||
<sonar.issue.ignore.multicriteria.S3437.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.S3437.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.S3437.ruleKey>squid:S3437</sonar.issue.ignore.multicriteria.S3437.ruleKey>
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
should be self-explanatory -->
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>squid:UndocumentedApi</sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>
|
||||
@@ -90,7 +91,6 @@
|
||||
<undertow.version>1.4.10.Final</undertow.version>
|
||||
<validation-api.version>1.1.0.Final</validation-api.version>
|
||||
<yarn.version>v0.21.3</yarn.version>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
@@ -345,6 +345,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
@@ -359,11 +363,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Spring Cloud -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
@@ -421,7 +420,7 @@
|
||||
<defaultGoal>spring-boot:run</defaultGoal>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
bind to Maven lifecycle -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
@@ -574,14 +573,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Force alphabetical order to have a reproducible build -->
|
||||
<runOrder>alphabetical</runOrder>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
@@ -762,8 +753,8 @@
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
should hot reload automatically! -->
|
||||
<id>cc</id>
|
||||
<build>
|
||||
|
||||
@@ -21,6 +21,8 @@ eureka:
|
||||
instanceId: dealerapp:${spring.application.instance_id:${random.value}}
|
||||
|
||||
spring:
|
||||
main:
|
||||
banner-mode: "off"
|
||||
application:
|
||||
name: dealerapp
|
||||
jackson:
|
||||
@@ -37,7 +39,7 @@ spring:
|
||||
database-platform: io.github.jhipster.domain.util.FixedH2Dialect
|
||||
database: H2
|
||||
open-in-view: false
|
||||
show-sql: true
|
||||
show-sql: false
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
naming:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<configuration scan="true">
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
|
||||
<logger name="com.dealer.app" level="DEBUG"/>
|
||||
<logger name="com.dealer.app" level="INFO"/>
|
||||
<logger name="org.hibernate" level="WARN"/>
|
||||
<logger name="org.hibernate.ejb.HibernatePersistence" level="OFF"/>
|
||||
<logger name="org.apache.catalina.startup.DigesterFactory" level="OFF"/>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<jcache.version>1.0.0</jcache.version>
|
||||
<jhipster.server.version>1.1.0</jhipster.server.version>
|
||||
<jjwt.version>0.7.0</jjwt.version>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
<liquibase-hibernate5.version>3.6</liquibase-hibernate5.version>
|
||||
<liquibase-slf4j.version>2.0.0</liquibase-slf4j.version>
|
||||
<liquibase.version>3.6.2</liquibase.version>
|
||||
@@ -61,14 +62,14 @@
|
||||
|
||||
<sonar.issue.ignore.multicriteria>S3437,UndocumentedApi,BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria>
|
||||
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
recommended by http://fontawesome.io/examples/ -->
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>src/main/webapp/app/**/*.*</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>Web:BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=squid%3AS3437 is ignored, as a JPA-managed field cannot be transient -->
|
||||
<sonar.issue.ignore.multicriteria.S3437.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.S3437.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.S3437.ruleKey>squid:S3437</sonar.issue.ignore.multicriteria.S3437.ruleKey>
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
should be self-explanatory -->
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>squid:UndocumentedApi</sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>
|
||||
@@ -94,7 +95,6 @@
|
||||
<undertow.version>1.4.10.Final</undertow.version>
|
||||
<validation-api.version>1.1.0.Final</validation-api.version>
|
||||
<yarn.version>v0.21.3</yarn.version>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
@@ -383,6 +383,10 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
@@ -397,11 +401,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter</artifactId>
|
||||
@@ -463,7 +462,7 @@
|
||||
<defaultGoal>spring-boot:run</defaultGoal>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
bind to Maven lifecycle -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
@@ -632,14 +631,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Force alphabetical order to have a reproducible build -->
|
||||
<runOrder>alphabetical</runOrder>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
@@ -878,8 +869,8 @@
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
should hot reload automatically! -->
|
||||
<id>cc</id>
|
||||
<build>
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class LogsResourceIntegrationTest {
|
||||
public void changeLogs()throws Exception {
|
||||
LoggerVM logger = new LoggerVM();
|
||||
logger.setLevel("INFO");
|
||||
logger.setName("ROOT");
|
||||
logger.setName("some.test.logger");
|
||||
|
||||
restLogsMockMvc.perform(put("/management/logs")
|
||||
.contentType(TestUtil.APPLICATION_JSON_UTF8)
|
||||
|
||||
+3
-1
@@ -21,6 +21,8 @@ eureka:
|
||||
instanceId: gateway:${spring.application.instance_id:${random.value}}
|
||||
|
||||
spring:
|
||||
main:
|
||||
banner-mode: "off"
|
||||
application:
|
||||
name: gateway
|
||||
autoconfigure:
|
||||
@@ -39,7 +41,7 @@ spring:
|
||||
database-platform: io.github.jhipster.domain.util.FixedH2Dialect
|
||||
database: H2
|
||||
open-in-view: false
|
||||
show-sql: true
|
||||
show-sql: false
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
naming:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<configuration scan="true">
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
|
||||
<logger name="com.gateway" level="DEBUG"/>
|
||||
<logger name="com.gateway" level="INFO"/>
|
||||
<logger name="org.hibernate" level="WARN"/>
|
||||
<logger name="org.hibernate.ejb.HibernatePersistence" level="OFF"/>
|
||||
<logger name="org.apache.catalina.startup.DigesterFactory" level="OFF"/>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<groupId>com.baeldung.jhipster</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<modules>
|
||||
<module>car-app</module>
|
||||
<module>dealer-app</module>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user