From c1d7b27f244b355da11a4aa562002d2b94bfd953 Mon Sep 17 00:00:00 2001 From: Rafael Zucareli Date: Wed, 1 Aug 2018 20:14:08 -0300 Subject: [PATCH 001/271] Add Subject alternative name I add a Subject alternative name (SAN) parameter in all commands. This make the generated certificate work in Google Chrome. Before that change Chrome presents a ERR_CERT_COMMON_NAME_INVALID even when you had add the certificate as a know Authority. --- spring-security-x509/keystore/Makefile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/spring-security-x509/keystore/Makefile b/spring-security-x509/keystore/Makefile index 63498fea76..2b5b5e8abe 100644 --- a/spring-security-x509/keystore/Makefile +++ b/spring-security-x509/keystore/Makefile @@ -20,65 +20,65 @@ all: clean create-keystore add-host create-truststore add-client create-keystore: # Generate a certificate authority (CA) - keytool -genkey -alias ca -ext BC=ca:true \ + keytool -genkey -alias ca -ext san=dns:localhost,ip:127.0.0.1 -ext BC=ca:true \ -keyalg RSA -keysize 4096 -sigalg SHA512withRSA -keypass $(PASSWORD) \ -validity 3650 -dname $(DNAME_CA) \ -keystore $(KEYSTORE) -storepass $(PASSWORD) add-host: # Generate a host certificate - keytool -genkey -alias $(HOSTNAME) \ + keytool -genkey -alias $(HOSTNAME) -ext san=dns:localhost,ip:127.0.0.1 \ -keyalg RSA -keysize 4096 -sigalg SHA512withRSA -keypass $(PASSWORD) \ -validity 3650 -dname $(DNAME_HOST) \ -keystore $(KEYSTORE) -storepass $(PASSWORD) # Generate a host certificate signing request - keytool -certreq -alias $(HOSTNAME) -ext BC=ca:true \ + keytool -certreq -alias $(HOSTNAME) -ext san=dns:localhost,ip:127.0.0.1 -ext BC=ca:true \ -keyalg RSA -keysize 4096 -sigalg SHA512withRSA \ -validity 3650 -file "$(HOSTNAME).csr" \ -keystore $(KEYSTORE) -storepass $(PASSWORD) # Generate signed certificate with the certificate authority - keytool -gencert -alias ca \ + keytool -gencert -alias ca -ext san=dns:localhost,ip:127.0.0.1 \ -validity 3650 -sigalg SHA512withRSA \ -infile "$(HOSTNAME).csr" -outfile "$(HOSTNAME).crt" -rfc \ -keystore $(KEYSTORE) -storepass $(PASSWORD) # Import signed certificate into the keystore - keytool -import -trustcacerts -alias $(HOSTNAME) \ + keytool -import -trustcacerts -alias $(HOSTNAME) -ext san=dns:localhost,ip:127.0.0.1 \ -file "$(HOSTNAME).crt" \ -keystore $(KEYSTORE) -storepass $(PASSWORD) export-authority: # Export certificate authority - keytool -export -alias ca -file ca.crt -rfc \ + keytool -export -alias ca -ext san=dns:localhost,ip:127.0.0.1 -file ca.crt -rfc \ -keystore $(KEYSTORE) -storepass $(PASSWORD) create-truststore: export-authority # Import certificate authority into a new truststore - keytool -import -trustcacerts -noprompt -alias ca -file ca.crt \ + keytool -import -trustcacerts -noprompt -alias ca -ext san=dns:localhost,ip:127.0.0.1 -file ca.crt \ -keystore $(TRUSTSTORE) -storepass $(PASSWORD) add-client: # Generate client certificate - keytool -genkey -alias $(CLIENTNAME) \ + keytool -genkey -alias $(CLIENTNAME) -ext san=dns:localhost,ip:127.0.0.1 \ -keyalg RSA -keysize 4096 -sigalg SHA512withRSA -keypass $(PASSWORD) \ -validity 3650 -dname $(DNAME_CLIENT) \ -keystore $(TRUSTSTORE) -storepass $(PASSWORD) # Generate a host certificate signing request - keytool -certreq -alias $(CLIENTNAME) -ext BC=ca:true \ + keytool -certreq -alias $(CLIENTNAME) -ext san=dns:localhost,ip:127.0.0.1 -ext BC=ca:true \ -keyalg RSA -keysize 4096 -sigalg SHA512withRSA \ -validity 3650 -file "$(CLIENTNAME).csr" \ -keystore $(TRUSTSTORE) -storepass $(PASSWORD) # Generate signed certificate with the certificate authority - keytool -gencert -alias ca \ + keytool -gencert -alias ca -ext san=dns:localhost,ip:127.0.0.1 \ -validity 3650 -sigalg SHA512withRSA \ -infile "$(CLIENTNAME).csr" -outfile "$(CLIENTNAME).crt" -rfc \ -keystore $(KEYSTORE) -storepass $(PASSWORD) # Import signed certificate into the truststore - keytool -import -trustcacerts -alias $(CLIENTNAME) \ + keytool -import -trustcacerts -alias $(CLIENTNAME) -ext san=dns:localhost,ip:127.0.0.1 \ -file "$(CLIENTNAME).crt" \ -keystore $(TRUSTSTORE) -storepass $(PASSWORD) # Export private certificate for importing into a browser - keytool -importkeystore -srcalias $(CLIENTNAME) \ + keytool -importkeystore -srcalias $(CLIENTNAME) -ext san=dns:localhost,ip:127.0.0.1 \ -srckeystore $(TRUSTSTORE) -srcstorepass $(PASSWORD) \ -destkeystore "$(CLIENTNAME).p12" -deststorepass $(PASSWORD) \ -deststoretype PKCS12 From 69c160aab9963e0fdd649719a16003c7e16e865a Mon Sep 17 00:00:00 2001 From: Yatendra Goel Date: Sun, 21 Oct 2018 07:27:01 +0530 Subject: [PATCH 002/271] BAEL-2203 - Convert java.time.Instant to java.sql.Timestamp and vice-versa --- .../datetime/ConvertInstantToTimestamp.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java diff --git a/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java b/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java new file mode 100644 index 0000000000..b2f18fd3bf --- /dev/null +++ b/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java @@ -0,0 +1,36 @@ +package com.baeldung.datetime; + +import java.sql.Timestamp; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.time.Instant; +import java.time.ZoneId; +import java.util.TimeZone; + +public class ConvertInstantToTimestamp { + + public static void main(String[] args) { + run(); + } + + public static void run() { + Instant instant = Instant.now(); + Timestamp timestamp = Timestamp.from(instant); // same point on the time-line as Instant + + System.out.println("Instant (milliseconds from epoch)" + instant.toEpochMilli()); + System.out.println("Timestamp (milliseconds from epoch): " + timestamp.getTime()); + System.out.print("\n"); + + // Local TimeZone of the machine at the time of running this code is GMT +5:30 a.k.a IST + ZoneId zoneId = ZoneId.of(ZoneId.SHORT_IDS.get("IST")); + + DateFormat df = DateFormat.getDateTimeInstance(); + df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss:SS'Z'"); + df.setTimeZone(TimeZone.getTimeZone("UTC")); + + System.out.println("Instant (in UTC): " + instant); + System.out.println("Timestamp (in UTC): " + df.format(timestamp)); + System.out.println("Instant (in GMT +05:30): " + instant.atZone(zoneId)); + System.out.println("Timestamp (in GMT +05:30): " + timestamp); + } +} \ No newline at end of file From 8696022889af03d5af7594e79c3927c840025830 Mon Sep 17 00:00:00 2001 From: Kotharu Date: Sun, 21 Oct 2018 18:19:00 +0530 Subject: [PATCH 003/271] BAEL-1724 Akka HTTP Initial Commit --- akka-http/pom.xml | 48 +++++++++ .../com/baeldung/akkahttp/AkkaHttpServer.java | 39 ++++++++ .../main/java/com/baeldung/akkahttp/User.java | 30 ++++++ .../java/com/baeldung/akkahttp/UserActor.java | 60 ++++++++++++ .../akkahttp/UserRegistryMessages.java | 70 +++++++++++++ .../com/baeldung/akkahttp/UserRoutes.java | 98 +++++++++++++++++++ .../java/com/baeldung/akkahttp/Users.java | 25 +++++ pom.xml | 1 + 8 files changed, 371 insertions(+) create mode 100644 akka-http/pom.xml create mode 100644 akka-http/src/main/java/com/baeldung/akkahttp/AkkaHttpServer.java create mode 100644 akka-http/src/main/java/com/baeldung/akkahttp/User.java create mode 100644 akka-http/src/main/java/com/baeldung/akkahttp/UserActor.java create mode 100644 akka-http/src/main/java/com/baeldung/akkahttp/UserRegistryMessages.java create mode 100644 akka-http/src/main/java/com/baeldung/akkahttp/UserRoutes.java create mode 100644 akka-http/src/main/java/com/baeldung/akkahttp/Users.java diff --git a/akka-http/pom.xml b/akka-http/pom.xml new file mode 100644 index 0000000000..05e50d2229 --- /dev/null +++ b/akka-http/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + akka-http + akka-http + + + parent-modules + com.baeldung + 1.0.0-SNAPSHOT + + + + + com.typesafe.akka + akka-http_2.12 + ${akka.http.version} + + + com.typesafe.akka + akka-stream_2.12 + ${akka.stream.version} + + + com.typesafe.akka + akka-http-jackson_2.12 + ${akka.http.version} + + + com.typesafe.akka + akka-http-testkit_2.12 + ${akka.http.version} + test + + + + + UTF-8 + UTF-8 + 1.8 + 10.0.11 + 2.5.11 + + diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/AkkaHttpServer.java b/akka-http/src/main/java/com/baeldung/akkahttp/AkkaHttpServer.java new file mode 100644 index 0000000000..03992b6a36 --- /dev/null +++ b/akka-http/src/main/java/com/baeldung/akkahttp/AkkaHttpServer.java @@ -0,0 +1,39 @@ +package com.baeldung.akkahttp; + +import java.util.concurrent.CompletionStage; + +import akka.NotUsed; +import akka.actor.ActorRef; +import akka.actor.ActorSystem; +import akka.http.javadsl.ConnectHttp; +import akka.http.javadsl.Http; +import akka.http.javadsl.ServerBinding; +import akka.http.javadsl.model.HttpRequest; +import akka.http.javadsl.model.HttpResponse; +import akka.http.javadsl.server.AllDirectives; +import akka.stream.ActorMaterializer; +import akka.stream.javadsl.Flow; + +public class AkkaHttpServer extends AllDirectives { + + private final UserRoutes userRoutes; + + public AkkaHttpServer(ActorSystem system, ActorRef userRegistryActor) { + userRoutes = new UserRoutes(system, userRegistryActor); + } + + public static void main(String[] args) throws Exception { + ActorSystem system = ActorSystem.create("helloAkkaHttpServer"); + final ActorMaterializer materializer = ActorMaterializer.create(system); + + ActorRef userActorRef = system.actorOf(UserActor.props(), "userActor"); + + AkkaHttpServer app = new AkkaHttpServer(system, userActorRef); + + final Flow routeFlow = app.userRoutes.routes().flow(system, materializer); + + final CompletionStage binding = Http.get(system).bindAndHandle(routeFlow, + ConnectHttp.toHost("localhost", 8080), materializer); + + System.out.println("Server is online at http://localhost:8080/"); + } \ No newline at end of file diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/User.java b/akka-http/src/main/java/com/baeldung/akkahttp/User.java new file mode 100644 index 0000000000..9b5b95ebc1 --- /dev/null +++ b/akka-http/src/main/java/com/baeldung/akkahttp/User.java @@ -0,0 +1,30 @@ +package com.baeldung.akkahttp; + +/** + * User Entity + * + */ +public class User { + + private final String name; + private final String address; + + public User() { + this.name = ""; + this.address = ""; + } + + public User(String name, String address) { + this.name = name; + this.address = address; + } + + public String getName() { + return name; + } + + public String getAddress() { + return address; + } + +} \ No newline at end of file diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/UserActor.java b/akka-http/src/main/java/com/baeldung/akkahttp/UserActor.java new file mode 100644 index 0000000000..f6c7015070 --- /dev/null +++ b/akka-http/src/main/java/com/baeldung/akkahttp/UserActor.java @@ -0,0 +1,60 @@ +package com.baeldung.akkahttp; + +import java.util.ArrayList; +import java.util.List; + +import akka.actor.AbstractActor; +import akka.actor.Props; +import akka.event.Logging; +import akka.event.LoggingAdapter; + +/** + * User Actor + * + */ +public class UserActor extends AbstractActor { + + LoggingAdapter log = Logging.getLogger(getContext().getSystem(), this); + + /** + * In memory List to hold the users added via POST operation. + */ + private final List users = new ArrayList<>(); + + /** + * To define UserActor Props. + * + * @return Props + */ + static Props props() { + return Props.create(UserActor.class); + } + + /** + * createReveive() implementation + */ + @Override + public Receive createReceive() { + return receiveBuilder().match(UserRegistryMessages.GetUsers.class, getUsers -> getSender().tell(new Users(users), getSelf())) + .match(UserRegistryMessages.CreateUser.class, createUser -> { + users.add(createUser.getUser()); + getSender().tell(new UserRegistryMessages.ActionPerformed(String.format("User %s created.", createUser.getUser() + .getName())), getSelf()); + }) + .match(UserRegistryMessages.GetUser.class, getUser -> { + getSender().tell(users.stream() + .filter(user -> user.getName() + .equals(getUser.getName())) + .findFirst(), getSelf()); + }) + .match(UserRegistryMessages.DeleteUser.class, deleteUser -> { + users.removeIf(user -> user.getName() + .equals(deleteUser.getName())); + getSender().tell(new UserRegistryMessages.ActionPerformed(String.format("User %s deleted.", deleteUser.getName())), getSelf()); + + }) + .matchAny(o -> log.info("received unknown message")) + .build(); + } + +} diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/UserRegistryMessages.java b/akka-http/src/main/java/com/baeldung/akkahttp/UserRegistryMessages.java new file mode 100644 index 0000000000..831819849a --- /dev/null +++ b/akka-http/src/main/java/com/baeldung/akkahttp/UserRegistryMessages.java @@ -0,0 +1,70 @@ +package com.baeldung.akkahttp; + +/** + * Defines all messages related to User Actor + * + */ +public interface UserRegistryMessages { + + class GetUsers implements Serializable { + + private static final long serialVersionUID = 1L; + } + + class ActionPerformed implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String description; + + public ActionPerformed(String description) { + this.description = description; + } + + public String getDescription() { + return description; + } + } + + class CreateUser implements Serializable { + + private static final long serialVersionUID = 1L; + private final User user; + + public CreateUser(User user) { + this.user = user; + } + + public User getUser() { + return user; + } + } + + class GetUser implements Serializable { + + private static final long serialVersionUID = 1L; + private final String name; + + public GetUser(String name) { + this.name = name; + } + + public String getName() { + return name; + } + } + + class DeleteUser implements Serializable { + + private static final long serialVersionUID = 1L; + private final String name; + + public DeleteUser(String name) { + this.name = name; + } + + public String getName() { + return name; + } + } +} diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/UserRoutes.java b/akka-http/src/main/java/com/baeldung/akkahttp/UserRoutes.java new file mode 100644 index 0000000000..aa3c9b612f --- /dev/null +++ b/akka-http/src/main/java/com/baeldung/akkahttp/UserRoutes.java @@ -0,0 +1,98 @@ +package com.baeldung.akkahttp; + +import java.time.Duration; +import java.util.Optional; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.TimeUnit; + +import akka.actor.ActorRef; +import akka.actor.ActorSystem; +import akka.event.Logging; +import akka.event.LoggingAdapter; +import akka.http.javadsl.marshallers.jackson.Jackson; +import akka.http.javadsl.model.StatusCodes; +import akka.http.javadsl.server.AllDirectives; +import akka.http.javadsl.server.PathMatchers; +import akka.http.javadsl.server.Route; +import akka.pattern.PatternsCS; +import akka.util.Timeout; + +public class UserRoutes extends AllDirectives { + + private final ActorRef userActorRef; + private final LoggingAdapter log; + Timeout timeout = new Timeout(Duration.create(5, TimeUnit.SECONDS)); + + public UserRoutes(ActorSystem system, ActorRef userActorRef) { + this.userActorRef = userActorRef; + log = Logging.getLogger(system, this); + } + + public Route routes() { + return pathPrefix("users", () -> route(getOrPostUsers(), path(PathMatchers.segment(), name -> route(getUser(name), deleteUser(name))))); + } + + /** + * Defines and returns a route to get the user by name + * + * @param name + * @return Route + */ + private Route getUser(String name) { + + Route getRoute = get(() -> { + CompletionStage> user = PatternsCS.ask(userActorRef, new UserRegistryMessages.GetUser(name), timeout) + .thenApply(obj -> (Optional) obj); + + return onSuccess(() -> user, performed -> { + if (performed.isPresent()) + return complete(StatusCodes.OK, performed.get(), Jackson.marshaller()); + else + return complete(StatusCodes.NOT_FOUND); + }); + }); + return getRoute; + } + + /** + * Defines and returns a Route to delete the user by name. + * + * @param name + * @return Route + */ + private Route deleteUser(String name) { + + Route deleteRoute = delete(() -> { + CompletionStage userDeleted = PatternsCS.ask(userActorRef, new UserRegistryMessages.DeleteUser(name), timeout) + .thenApply(obj -> (ActionPerformed) obj); + + return onSuccess(() -> userDeleted, performed -> { + log.info("Deleted user [{}]: {}", name, performed.getDescription()); + return complete(StatusCodes.OK, performed, Jackson.marshaller()); + }); + }); + + return deleteRoute; + } + + /** + * Defines two routes, one to get all users and the other is to post users. + * + * @return + */ + private Route getOrPostUsers() { + return pathEnd(() -> route(get(() -> { + CompletionStage futureUsers = PatternsCS.ask(userActorRef, new UserRegistryMessages.GetUsers(), timeout) + .thenApply(obj -> (Users) obj); + return onSuccess(() -> futureUsers, users -> complete(StatusCodes.OK, users, Jackson.marshaller())); + }), post(() -> entity(Jackson.unmarshaller(User.class), user -> { + CompletionStage userCreated = PatternsCS.ask(userActorRef, new CreateUser(user), timeout) + .thenApply(obj -> (ActionPerformed) obj); + return onSuccess(() -> userCreated, performed -> { + log.info("Created user [{}]: {}", user.getName(), performed.getDescription()); + return complete(StatusCodes.CREATED, performed, Jackson.marshaller()); + }); + })))); + } + +} diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/Users.java b/akka-http/src/main/java/com/baeldung/akkahttp/Users.java new file mode 100644 index 0000000000..e5e6c62c06 --- /dev/null +++ b/akka-http/src/main/java/com/baeldung/akkahttp/Users.java @@ -0,0 +1,25 @@ +package com.baeldung.akkahttp; + +import java.util.ArrayList; +import java.util.List; + +/** + * This class is used to send the response enclosed by Users. + * + */ +public class Users { + + private final List users; + + public Users() { + this.users = new ArrayList<>(); + } + + public Users(List users) { + this.users = users; + } + + public List getUsers() { + return users; + } +} diff --git a/pom.xml b/pom.xml index 302530fd24..d0d0fa7049 100644 --- a/pom.xml +++ b/pom.xml @@ -1254,6 +1254,7 @@ aws aws-lambda akka-streams + akka-http algorithms annotations apache-cxf From 632e46c2a0bcde213e278f738879639752d01f9a Mon Sep 17 00:00:00 2001 From: Kotharu Date: Sun, 21 Oct 2018 18:40:44 +0530 Subject: [PATCH 004/271] Initial Commit --- .../com/baeldung/akkahttp/AkkaHttpServer.java | 20 ++++++++++--------- .../akkahttp/UserRegistryMessages.java | 2 ++ .../com/baeldung/akkahttp/UserRoutes.java | 5 ++++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/AkkaHttpServer.java b/akka-http/src/main/java/com/baeldung/akkahttp/AkkaHttpServer.java index 03992b6a36..d4c859891a 100644 --- a/akka-http/src/main/java/com/baeldung/akkahttp/AkkaHttpServer.java +++ b/akka-http/src/main/java/com/baeldung/akkahttp/AkkaHttpServer.java @@ -23,17 +23,19 @@ public class AkkaHttpServer extends AllDirectives { } public static void main(String[] args) throws Exception { - ActorSystem system = ActorSystem.create("helloAkkaHttpServer"); - final ActorMaterializer materializer = ActorMaterializer.create(system); + ActorSystem system = ActorSystem.create("helloAkkaHttpServer"); + final ActorMaterializer materializer = ActorMaterializer.create(system); - ActorRef userActorRef = system.actorOf(UserActor.props(), "userActor"); + ActorRef userActorRef = system.actorOf(UserActor.props(), "userActor"); - AkkaHttpServer app = new AkkaHttpServer(system, userActorRef); + AkkaHttpServer app = new AkkaHttpServer(system, userActorRef); - final Flow routeFlow = app.userRoutes.routes().flow(system, materializer); + final Flow routeFlow = app.userRoutes.routes() + .flow(system, materializer); - final CompletionStage binding = Http.get(system).bindAndHandle(routeFlow, - ConnectHttp.toHost("localhost", 8080), materializer); + final CompletionStage binding = Http.get(system) + .bindAndHandle(routeFlow, ConnectHttp.toHost("localhost", 8080), materializer); - System.out.println("Server is online at http://localhost:8080/"); - } \ No newline at end of file + System.out.println("Server is online at http://localhost:8080/"); + } +} \ No newline at end of file diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/UserRegistryMessages.java b/akka-http/src/main/java/com/baeldung/akkahttp/UserRegistryMessages.java index 831819849a..1f88e5f646 100644 --- a/akka-http/src/main/java/com/baeldung/akkahttp/UserRegistryMessages.java +++ b/akka-http/src/main/java/com/baeldung/akkahttp/UserRegistryMessages.java @@ -1,5 +1,7 @@ package com.baeldung.akkahttp; +import java.io.Serializable; + /** * Defines all messages related to User Actor * diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/UserRoutes.java b/akka-http/src/main/java/com/baeldung/akkahttp/UserRoutes.java index aa3c9b612f..aeddf9224d 100644 --- a/akka-http/src/main/java/com/baeldung/akkahttp/UserRoutes.java +++ b/akka-http/src/main/java/com/baeldung/akkahttp/UserRoutes.java @@ -1,10 +1,12 @@ package com.baeldung.akkahttp; -import java.time.Duration; import java.util.Optional; import java.util.concurrent.CompletionStage; import java.util.concurrent.TimeUnit; +import com.baeldung.akkahttp.UserRegistryMessages.ActionPerformed; +import com.baeldung.akkahttp.UserRegistryMessages.CreateUser; + import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.event.Logging; @@ -16,6 +18,7 @@ import akka.http.javadsl.server.PathMatchers; import akka.http.javadsl.server.Route; import akka.pattern.PatternsCS; import akka.util.Timeout; +import scala.concurrent.duration.Duration; public class UserRoutes extends AllDirectives { From 91cc2514b2a1cdf12c9d6747d3dfa16c192d332f Mon Sep 17 00:00:00 2001 From: Kotharu Date: Sun, 21 Oct 2018 19:32:08 +0530 Subject: [PATCH 005/271] Added Route Test --- .../com/baeldung/akkahttp/UserRoutesTest.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 akka-http/src/test/java/com/baeldung/akkahttp/UserRoutesTest.java diff --git a/akka-http/src/test/java/com/baeldung/akkahttp/UserRoutesTest.java b/akka-http/src/test/java/com/baeldung/akkahttp/UserRoutesTest.java new file mode 100644 index 0000000000..db749c4f0b --- /dev/null +++ b/akka-http/src/test/java/com/baeldung/akkahttp/UserRoutesTest.java @@ -0,0 +1,48 @@ +package com.baeldung.akkahttp; + +import org.junit.Test; + +import akka.actor.ActorRef; +import akka.actor.ActorSystem; +import akka.http.javadsl.model.ContentType; +import akka.http.javadsl.model.ContentType.NonBinary; +import akka.http.javadsl.model.HttpHeader; +import akka.http.javadsl.model.HttpRequest; +import akka.http.javadsl.model.MediaType; +import akka.http.javadsl.model.MediaTypes; +import akka.http.javadsl.model.StatusCodes; +import akka.http.javadsl.model.headers.RawHeader; +import akka.http.javadsl.testkit.JUnitRouteTest; +import akka.http.javadsl.testkit.TestRoute; + +public class UserRoutesTest extends JUnitRouteTest { + + ActorSystem system = ActorSystem.create("helloAkkaHttpServer"); + ActorRef userActorRef = system.actorOf(UserActor.props(), "userActor"); + + TestRoute appRoute = testRoute(new UserRoutes(system, userActorRef).routes()); + + @Test + public void givenUser_WhenGetOrPostUsers_ThenUserRetrieved() { + + appRoute.run(HttpRequest.GET("/users")) + .assertStatusCode(200) + .assertContentType("application/json") + .assertEntity("{\"users\":[]}"); + + appRoute.run(HttpRequest.GET("/usersw")) + .assertStatusCode(404); + + appRoute.run(HttpRequest.POST("/users")) + .assertStatusCode(400); + + final RawHeader contentTypeHeader = RawHeader.create("Content-Type", "application/json"); + final RawHeader acceptHeader = RawHeader.create("", "application/json"); + + appRoute.run(HttpRequest.POST("/users") + .addHeader(contentTypeHeader) + .addHeader(acceptHeader)) + .assertStatusCode(400); + + } +} From 3b17051337aee90d0f85885263af4840666ab37f Mon Sep 17 00:00:00 2001 From: Yatendra Goel Date: Wed, 24 Oct 2018 17:55:34 +0530 Subject: [PATCH 006/271] BAEL-2203: Review edits --- .../java/com/baeldung/datetime/ConvertInstantToTimestamp.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java b/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java index b2f18fd3bf..e8ce4adaa1 100644 --- a/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java +++ b/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java @@ -16,8 +16,9 @@ public class ConvertInstantToTimestamp { public static void run() { Instant instant = Instant.now(); Timestamp timestamp = Timestamp.from(instant); // same point on the time-line as Instant + instant = timestamp.toInstant(); - System.out.println("Instant (milliseconds from epoch)" + instant.toEpochMilli()); + System.out.println("Instant (milliseconds from epoch): " + instant.toEpochMilli()); System.out.println("Timestamp (milliseconds from epoch): " + timestamp.getTime()); System.out.print("\n"); From 7064a7e30960c51b7ed2b8aebee6465d6d4c3cb2 Mon Sep 17 00:00:00 2001 From: Yatendra Goel Date: Sat, 3 Nov 2018 01:01:07 +0530 Subject: [PATCH 007/271] Removed ZoneId code --- .../datetime/ConvertInstantToTimestamp.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java b/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java index e8ce4adaa1..53618b3c31 100644 --- a/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java +++ b/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java @@ -1,5 +1,7 @@ package com.baeldung.datetime; +import static org.junit.Assert.assertEquals; + import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -16,22 +18,15 @@ public class ConvertInstantToTimestamp { public static void run() { Instant instant = Instant.now(); Timestamp timestamp = Timestamp.from(instant); // same point on the time-line as Instant + assertEquals(instant.toEpochMilli(), timestamp.getTime()); + instant = timestamp.toInstant(); - - System.out.println("Instant (milliseconds from epoch): " + instant.toEpochMilli()); - System.out.println("Timestamp (milliseconds from epoch): " + timestamp.getTime()); - System.out.print("\n"); - - // Local TimeZone of the machine at the time of running this code is GMT +5:30 a.k.a IST - ZoneId zoneId = ZoneId.of(ZoneId.SHORT_IDS.get("IST")); + assertEquals(instant.toEpochMilli(), timestamp.getTime()); DateFormat df = DateFormat.getDateTimeInstance(); - df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss:SS'Z'"); + df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS'Z'"); df.setTimeZone(TimeZone.getTimeZone("UTC")); - System.out.println("Instant (in UTC): " + instant); - System.out.println("Timestamp (in UTC): " + df.format(timestamp)); - System.out.println("Instant (in GMT +05:30): " + instant.atZone(zoneId)); - System.out.println("Timestamp (in GMT +05:30): " + timestamp); + assertEquals(instant.toString(), df.format(timestamp).toString()); } -} \ No newline at end of file +} From 5e1fc54ec2cfc589988af9f2b8cd4a3bf1ac7290 Mon Sep 17 00:00:00 2001 From: Yatendra Goel Date: Sat, 3 Nov 2018 15:59:05 +0530 Subject: [PATCH 008/271] Converted class to JUnit Test --- .../ConvertInstantToTimestampTest.java} | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) rename java-dates/src/{main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java => test/java/com/baeldung/datetime/ConvertInstantToTimestampTest.java} (55%) diff --git a/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java b/java-dates/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampTest.java similarity index 55% rename from java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java rename to java-dates/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampTest.java index 53618b3c31..bfbd911e95 100644 --- a/java-dates/src/main/java/com/baeldung/datetime/ConvertInstantToTimestamp.java +++ b/java-dates/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampTest.java @@ -1,6 +1,6 @@ package com.baeldung.datetime; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.sql.Timestamp; import java.text.DateFormat; @@ -9,24 +9,22 @@ import java.time.Instant; import java.time.ZoneId; import java.util.TimeZone; -public class ConvertInstantToTimestamp { +import org.junit.Test; - public static void main(String[] args) { - run(); - } +public class ConvertInstantToTimestampTest { - public static void run() { + @Test + public void givenInstant_whenConvertedToTimestamp_thenGetTimestampWithSamePointOnTimeline() { Instant instant = Instant.now(); Timestamp timestamp = Timestamp.from(instant); // same point on the time-line as Instant - assertEquals(instant.toEpochMilli(), timestamp.getTime()); + assertThat(instant.toEpochMilli()).isEqualTo(timestamp.getTime()); instant = timestamp.toInstant(); - assertEquals(instant.toEpochMilli(), timestamp.getTime()); + assertThat(instant.toEpochMilli()).isEqualTo(timestamp.getTime()); DateFormat df = DateFormat.getDateTimeInstance(); df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS'Z'"); df.setTimeZone(TimeZone.getTimeZone("UTC")); - - assertEquals(instant.toString(), df.format(timestamp).toString()); + assertThat(instant.toString()).isEqualTo(df.format(timestamp).toString()); } } From ce76dcde0d3594abb32b8b369d57baefaad786d1 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 3 Nov 2018 20:41:53 +0200 Subject: [PATCH 009/271] Update and rename ConvertInstantToTimestampTest.java to ConvertInstantToTimestampUnitTest.java --- ...imestampTest.java => ConvertInstantToTimestampUnitTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename java-dates/src/test/java/com/baeldung/datetime/{ConvertInstantToTimestampTest.java => ConvertInstantToTimestampUnitTest.java} (95%) diff --git a/java-dates/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampTest.java b/java-dates/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampUnitTest.java similarity index 95% rename from java-dates/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampTest.java rename to java-dates/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampUnitTest.java index bfbd911e95..3ba01a591a 100644 --- a/java-dates/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampTest.java +++ b/java-dates/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampUnitTest.java @@ -11,7 +11,7 @@ import java.util.TimeZone; import org.junit.Test; -public class ConvertInstantToTimestampTest { +public class ConvertInstantToTimestampUnitTest { @Test public void givenInstant_whenConvertedToTimestamp_thenGetTimestampWithSamePointOnTimeline() { From 530395a44a35abab70d4ca599cc5088ba01a855a Mon Sep 17 00:00:00 2001 From: Yatendra Goel Date: Sun, 2 Dec 2018 23:45:35 +0530 Subject: [PATCH 010/271] BAEL-2403: Immutable Map implementations in Java --- .../baeldung/java/map/ImmutableMapTest.java | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapTest.java diff --git a/java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapTest.java new file mode 100644 index 0000000000..d2637d8368 --- /dev/null +++ b/java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapTest.java @@ -0,0 +1,87 @@ +package com.baeldung.java.map; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.junit.jupiter.api.Test; + +import com.google.common.collect.ImmutableMap; + + +public class ImmutableMapTest { + + @Test + public void whenCollectionsUnModifiableMapMethod_thenOriginalCollectionChangesReflectInUnmodifiableMap() { + + Map mutableMap = new HashMap<>(); + mutableMap.put("USA", "North America"); + + Map unmodifiableMap = Collections.unmodifiableMap(mutableMap); + assertThrows(UnsupportedOperationException.class, () -> unmodifiableMap.put("Canada", "North America")); + + mutableMap.remove("USA"); + assertFalse(unmodifiableMap.containsKey("USA")); + + mutableMap.put("Mexico", "North America"); + assertTrue(unmodifiableMap.containsKey("Mexico")); + } + + @Test + @SuppressWarnings("deprecation") + public void whenGuavaImmutableMapFromCopyOfMethod_thenOriginalCollectionChangesDoNotReflectInImmutableMap() { + + Map mutableMap = new HashMap<>(); + mutableMap.put("USA", "North America"); + + ImmutableMap immutableMap = ImmutableMap.copyOf(mutableMap); + assertTrue(immutableMap.containsKey("USA")); + + assertThrows(UnsupportedOperationException.class, () -> immutableMap.put("Canada", "North America")); + + mutableMap.remove("USA"); + assertTrue(immutableMap.containsKey("USA")); + + mutableMap.put("Mexico", "North America"); + assertFalse(immutableMap.containsKey("Mexico")); + } + + @Test + @SuppressWarnings("deprecation") + public void whenGuavaImmutableMapFromBuilderMethod_thenOriginalCollectionChangesDoNotReflectInImmutableMap() { + + Map mutableMap = new HashMap<>(); + mutableMap.put("USA", "North America"); + + ImmutableMap immutableMap = ImmutableMap.builder() + .putAll(mutableMap) + .put("Costa Rica", "North America") + .build(); + assertTrue(immutableMap.containsKey("USA")); + assertTrue(immutableMap.containsKey("Costa Rica")); + + assertThrows(UnsupportedOperationException.class, () -> immutableMap.put("Canada", "North America")); + + mutableMap.remove("USA"); + assertTrue(immutableMap.containsKey("USA")); + + mutableMap.put("Mexico", "North America"); + assertFalse(immutableMap.containsKey("Mexico")); + } + + @Test + @SuppressWarnings("deprecation") + public void whenGuavaImmutableMapFromOfMethod_thenOriginalCollectionChangesDoNotReflectInImmutableMap() { + + ImmutableMap immutableMap = ImmutableMap.of("USA", "North America", "Costa Rica", "North America"); + assertTrue(immutableMap.containsKey("USA")); + assertTrue(immutableMap.containsKey("Costa Rica")); + + assertThrows(UnsupportedOperationException.class, () -> immutableMap.put("Canada", "North America")); + } + +} From 3b30ae74ceb47604688fac7922e5a850e51d5423 Mon Sep 17 00:00:00 2001 From: Yatendra Goel Date: Mon, 3 Dec 2018 22:53:00 +0530 Subject: [PATCH 011/271] BAEL-2403: Immutable Map implementations in Java - Changed file name --- .../map/{ImmutableMapTest.java => ImmutableMapUnitTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename java-collections-maps/src/test/java/com/baeldung/java/map/{ImmutableMapTest.java => ImmutableMapUnitTest.java} (98%) diff --git a/java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapUnitTest.java similarity index 98% rename from java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapTest.java rename to java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapUnitTest.java index d2637d8368..b239ae07d8 100644 --- a/java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapTest.java +++ b/java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapUnitTest.java @@ -13,7 +13,7 @@ import org.junit.jupiter.api.Test; import com.google.common.collect.ImmutableMap; -public class ImmutableMapTest { +public class ImmutableMapUnitTest { @Test public void whenCollectionsUnModifiableMapMethod_thenOriginalCollectionChangesReflectInUnmodifiableMap() { From a4d768763b9275d717c92bdf19ea93f4186dfd15 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Thu, 6 Dec 2018 15:23:13 +0400 Subject: [PATCH 012/271] Vector class example --- .../com/baeldung/java/list/VectorExample.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 core-java-collections/src/main/java/com/baeldung/java/list/VectorExample.java diff --git a/core-java-collections/src/main/java/com/baeldung/java/list/VectorExample.java b/core-java-collections/src/main/java/com/baeldung/java/list/VectorExample.java new file mode 100644 index 0000000000..38736390ca --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/java/list/VectorExample.java @@ -0,0 +1,21 @@ +package com.baeldung.java.list; + +import java.util.Enumeration; +import java.util.Vector; + +public class VectorExample { + + public static void main(String[] args) { + + Vector vector = new Vector<>(); + vector.add("baeldung"); + vector.add("Vector"); + vector.add("example"); + + Enumeration e = vector.elements(); + while(e.hasMoreElements()){ + System.out.println(e.nextElement()); + } + } + +} From c52862fdd42d370f6a9ac923cb9a43ad2a29696d Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Thu, 13 Dec 2018 17:23:25 +0400 Subject: [PATCH 013/271] Vector class JMH --- .../baeldung/performance/ArrayListBenchmark.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java b/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java index dddd85007d..5c3f7531e3 100644 --- a/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java +++ b/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java @@ -17,6 +17,7 @@ public class ArrayListBenchmark { public static class MyState { List employeeList = new ArrayList<>(); + Vector employeeVector = new Vector<>(); //LinkedList employeeList = new LinkedList<>(); long iterations = 100000; @@ -29,9 +30,11 @@ public class ArrayListBenchmark { public void setUp() { for (long i = 0; i < iterations; i++) { employeeList.add(new Employee(i, "John")); + employeeVector.add(new Employee(i, "John")); } employeeList.add(employee); + employeeVector.add(employee); employeeIndex = employeeList.indexOf(employee); } } @@ -55,16 +58,20 @@ public class ArrayListBenchmark { public Employee testGet(ArrayListBenchmark.MyState state) { return state.employeeList.get(state.employeeIndex); } + @Benchmark + public Employee testVectorGet(ArrayListBenchmark.MyState state) { + return state.employeeVector.get(state.employeeIndex); + } @Benchmark public boolean testRemove(ArrayListBenchmark.MyState state) { return state.employeeList.remove(state.employee); } -// @Benchmark -// public void testAdd(ArrayListBenchmark.MyState state) { -// state.employeeList.add(new Employee(state.iterations + 1, "John")); -// } + @Benchmark + public void testAdd(ArrayListBenchmark.MyState state) { + state.employeeList.add(new Employee(state.iterations + 1, "John")); + } public static void main(String[] args) throws Exception { Options options = new OptionsBuilder() From 997f1fcb5910ca592096d890335c4f442e2fea2b Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Sun, 16 Dec 2018 20:42:33 +0100 Subject: [PATCH 014/271] merge --- .../main/java/com/baeldung/akkahttp/User.java | 18 ++--- .../com/baeldung/akkahttp/UserMessages.java | 81 +++++++------------ .../com/baeldung/akkahttp/UserServer.java | 38 +++++---- .../com/baeldung/akkahttp/UserService.java | 31 +++++++ .../baeldung/akkahttp/UserServerUnitTest.java | 4 +- 5 files changed, 87 insertions(+), 85 deletions(-) diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/User.java b/akka-http/src/main/java/com/baeldung/akkahttp/User.java index 9b5b95ebc1..43c21eca62 100644 --- a/akka-http/src/main/java/com/baeldung/akkahttp/User.java +++ b/akka-http/src/main/java/com/baeldung/akkahttp/User.java @@ -1,30 +1,26 @@ package com.baeldung.akkahttp; -/** - * User Entity - * - */ public class User { + private final Long id; + private final String name; - private final String address; public User() { this.name = ""; - this.address = ""; + this.id = null; } - public User(String name, String address) { + public User(Long id, String name) { this.name = name; - this.address = address; + this.id = id; } public String getName() { return name; } - public String getAddress() { - return address; + public Long getId() { + return id; } - } \ No newline at end of file diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/UserMessages.java b/akka-http/src/main/java/com/baeldung/akkahttp/UserMessages.java index 1f88e5f646..995b92bcb0 100644 --- a/akka-http/src/main/java/com/baeldung/akkahttp/UserMessages.java +++ b/akka-http/src/main/java/com/baeldung/akkahttp/UserMessages.java @@ -2,71 +2,48 @@ package com.baeldung.akkahttp; import java.io.Serializable; -/** - * Defines all messages related to User Actor - * - */ -public interface UserRegistryMessages { +public interface UserMessages { - class GetUsers implements Serializable { + class ActionPerformed implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; + + private final String description; + + public ActionPerformed(String description) { + this.description = description; } - class ActionPerformed implements Serializable { + public String getDescription() { + return description; + } + } - private static final long serialVersionUID = 1L; + class CreateUserMessage implements Serializable { - private final String description; + private static final long serialVersionUID = 1L; + private final User user; - public ActionPerformed(String description) { - this.description = description; - } - - public String getDescription() { - return description; - } + public CreateUserMessage(User user) { + this.user = user; } - class CreateUser implements Serializable { + public User getUser() { + return user; + } + } - private static final long serialVersionUID = 1L; - private final User user; + class GetUserMessage implements Serializable { + private static final long serialVersionUID = 1L; + private final Long userId; - public CreateUser(User user) { - this.user = user; - } - - public User getUser() { - return user; - } + public GetUserMessage(Long userId) { + this.userId = userId; } - class GetUser implements Serializable { - - private static final long serialVersionUID = 1L; - private final String name; - - public GetUser(String name) { - this.name = name; - } - - public String getName() { - return name; - } + public Long getUserId() { + return userId; } + } - class DeleteUser implements Serializable { - - private static final long serialVersionUID = 1L; - private final String name; - - public DeleteUser(String name) { - this.name = name; - } - - public String getName() { - return name; - } - } } diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/UserServer.java b/akka-http/src/main/java/com/baeldung/akkahttp/UserServer.java index 151c92826d..0c1dbd1f60 100644 --- a/akka-http/src/main/java/com/baeldung/akkahttp/UserServer.java +++ b/akka-http/src/main/java/com/baeldung/akkahttp/UserServer.java @@ -5,37 +5,39 @@ import java.util.concurrent.CompletionStage; import java.util.concurrent.TimeUnit; import akka.actor.ActorRef; +import akka.actor.ActorSystem; import akka.http.javadsl.marshallers.jackson.Jackson; import akka.http.javadsl.model.StatusCodes; -import akka.http.javadsl.server.AllDirectives; +import akka.http.javadsl.server.HttpApp; import akka.http.javadsl.server.Route; import akka.pattern.PatternsCS; import akka.util.Timeout; import com.baeldung.akkahttp.UserMessages.ActionPerformed; -import com.baeldung.akkahttp.UserMessages.CreateUser; +import com.baeldung.akkahttp.UserMessages.CreateUserMessage; +import com.baeldung.akkahttp.UserMessages.GetUserMessage; import scala.concurrent.duration.Duration; import static akka.http.javadsl.server.PathMatchers.*; -class UserRoutes extends AllDirectives { +class UserServer extends HttpApp { private final ActorRef userActor; Timeout timeout = new Timeout(Duration.create(5, TimeUnit.SECONDS)); - UserRoutes(ActorRef userActor) { + UserServer(ActorRef userActor) { this.userActor = userActor; } - Route routes() { + @Override + public Route routes() { return path("users", this::postUser) .orElse(path(segment("users").slash(longSegment()), id -> - route(getUser(id), - deleteUser(id)))); + route(getUser(id)))); } private Route getUser(Long id) { return get(() -> { - CompletionStage> user = PatternsCS.ask(userActor, new UserMessages.GetUser(id), timeout) + CompletionStage> user = PatternsCS.ask(userActor, new GetUserMessage(id), timeout) .thenApply(obj -> (Optional) obj); return onSuccess(() -> user, performed -> { @@ -47,20 +49,9 @@ class UserRoutes extends AllDirectives { }); } - private Route deleteUser(Long id) { - return delete(() -> { - CompletionStage userDeleted = PatternsCS.ask(userActor, new UserMessages.DeleteUser(id), timeout) - .thenApply(obj -> (ActionPerformed) obj); - - return onSuccess(() -> userDeleted, performed -> { - return complete(StatusCodes.OK, performed, Jackson.marshaller()); - }); - }); - } - private Route postUser() { return route(post(() -> entity(Jackson.unmarshaller(User.class), user -> { - CompletionStage userCreated = PatternsCS.ask(userActor, new CreateUser(user), timeout) + CompletionStage userCreated = PatternsCS.ask(userActor, new CreateUserMessage(user), timeout) .thenApply(obj -> (ActionPerformed) obj); return onSuccess(() -> userCreated, performed -> { @@ -69,4 +60,11 @@ class UserRoutes extends AllDirectives { }))); } + public static void main(String[] args) throws Exception { + ActorSystem system = ActorSystem.create("userServer"); + ActorRef userActor = system.actorOf(UserActor.props(), "userActor"); + UserServer server = new UserServer(userActor); + server.startServer("localhost", 8080, system); + } + } diff --git a/akka-http/src/main/java/com/baeldung/akkahttp/UserService.java b/akka-http/src/main/java/com/baeldung/akkahttp/UserService.java index 67979dc76e..50dc1e1b28 100644 --- a/akka-http/src/main/java/com/baeldung/akkahttp/UserService.java +++ b/akka-http/src/main/java/com/baeldung/akkahttp/UserService.java @@ -1,4 +1,35 @@ package com.baeldung.akkahttp; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + public class UserService { + + private final static List users = new ArrayList<>(); + + static { + users.add(new User(1l, "Alice")); + users.add(new User(2l, "Bob")); + users.add(new User(3l, "Chris")); + users.add(new User(4l, "Dick")); + users.add(new User(5l, "Eve")); + users.add(new User(6l, "Finn")); + } + + public Optional getUser(Long id) { + return users.stream() + .filter(user -> user.getId() + .equals(id)) + .findFirst(); + } + + public void createUser(User user) { + users.add(user); + } + + public List getUsers(){ + return users; + } + } diff --git a/akka-http/src/test/java/com/baeldung/akkahttp/UserServerUnitTest.java b/akka-http/src/test/java/com/baeldung/akkahttp/UserServerUnitTest.java index b61929c801..1170a2d761 100644 --- a/akka-http/src/test/java/com/baeldung/akkahttp/UserServerUnitTest.java +++ b/akka-http/src/test/java/com/baeldung/akkahttp/UserServerUnitTest.java @@ -9,13 +9,13 @@ import akka.http.javadsl.testkit.JUnitRouteTest; import akka.http.javadsl.testkit.TestRoute; import org.junit.Test; -public class UserRoutesUnitTest extends JUnitRouteTest { +public class UserServerUnitTest extends JUnitRouteTest { ActorSystem system = ActorSystem.create("helloAkkaHttpServer"); ActorRef userActorRef = system.actorOf(UserActor.props(), "userActor"); - TestRoute appRoute = testRoute(new UserRoutes(userActorRef).routes()); + TestRoute appRoute = testRoute(new UserServer(userActorRef).routes()); @Test public void whenRequest_thenActorResponds() { From cf56b33b9bc2890f419e529ffd37dea4ec5c38ae Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 14:43:32 +0100 Subject: [PATCH 015/271] BAEL-2435 Update pom file -Add description -Change parent to parent-boot-2 to leverage a spring boot start up approach -Replace core dependency for axon-spring-boot-autoconfigure excluding axon-server as we cant start that up for this use case -Add spring-boot-autoconfigure dependency -Adjust the axon version to 4.0.3 --- axon/pom.xml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/axon/pom.xml b/axon/pom.xml index c643ea9e57..bb7839f150 100644 --- a/axon/pom.xml +++ b/axon/pom.xml @@ -4,29 +4,45 @@ 4.0.0 axon axon - + Basic Axon Framework with Spring Boot configuration tutorial + - parent-modules com.baeldung - 1.0.0-SNAPSHOT + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + + org.axonframework + axon-spring-boot-autoconfigure + ${axon.version} + + + org.axonframework + axon-server-connector + + + + org.axonframework axon-test ${axon.version} test + - org.axonframework - axon-core - ${axon.version} + org.springframework.boot + spring-boot-autoconfigure + 2.1.1.RELEASE + compile - 3.0.2 + 4.0.3 \ No newline at end of file From bd4881d4787cea8ee7f78309e956a7363d14c1b3 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 14:47:23 +0100 Subject: [PATCH 016/271] BAEL-2435 Update Aggregate in regards to latest axon version -Replace old import statements for the new locations -Mark the aggregate as @Aggregate to make it autowired through the spring boot starter -Move all command handlers/decision making functions to the top of the file -Rename the command handler to `handle` as a best practice for command handlers -Use @EventSourcingHandler i.o. @EventHandler as a best practice for event handlers in Aggregates, as those only are used to 'source' the aggregate -Update test case according to latest standards --- .../axon/aggregates/MessagesAggregate.java | 26 ++++++++++--------- .../MessagesAggregateIntegrationTest.java | 21 +++++++-------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/axon/src/main/java/com/baeldung/axon/aggregates/MessagesAggregate.java b/axon/src/main/java/com/baeldung/axon/aggregates/MessagesAggregate.java index e762604b74..d95dd81df9 100644 --- a/axon/src/main/java/com/baeldung/axon/aggregates/MessagesAggregate.java +++ b/axon/src/main/java/com/baeldung/axon/aggregates/MessagesAggregate.java @@ -1,16 +1,18 @@ package com.baeldung.axon.aggregates; +import static org.axonframework.modelling.command.AggregateLifecycle.apply; + +import org.axonframework.commandhandling.CommandHandler; +import org.axonframework.eventsourcing.EventSourcingHandler; +import org.axonframework.modelling.command.AggregateIdentifier; +import org.axonframework.spring.stereotype.Aggregate; + import com.baeldung.axon.commands.CreateMessageCommand; import com.baeldung.axon.commands.MarkReadMessageCommand; import com.baeldung.axon.events.MessageCreatedEvent; import com.baeldung.axon.events.MessageReadEvent; -import org.axonframework.commandhandling.CommandHandler; -import org.axonframework.commandhandling.model.AggregateIdentifier; -import org.axonframework.eventhandling.EventHandler; - -import static org.axonframework.commandhandling.model.AggregateLifecycle.apply; - +@Aggregate public class MessagesAggregate { @AggregateIdentifier @@ -24,13 +26,13 @@ public class MessagesAggregate { apply(new MessageCreatedEvent(command.getId(), command.getText())); } - @EventHandler + @CommandHandler + public void handle(MarkReadMessageCommand command) { + apply(new MessageReadEvent(id)); + } + + @EventSourcingHandler public void on(MessageCreatedEvent event) { this.id = event.getId(); } - - @CommandHandler - public void markRead(MarkReadMessageCommand command) { - apply(new MessageReadEvent(id)); - } } \ No newline at end of file diff --git a/axon/src/test/java/com/baeldung/axon/MessagesAggregateIntegrationTest.java b/axon/src/test/java/com/baeldung/axon/MessagesAggregateIntegrationTest.java index ad099d2c2b..dc008dcd78 100644 --- a/axon/src/test/java/com/baeldung/axon/MessagesAggregateIntegrationTest.java +++ b/axon/src/test/java/com/baeldung/axon/MessagesAggregateIntegrationTest.java @@ -1,29 +1,28 @@ package com.baeldung.axon; +import java.util.UUID; + +import org.axonframework.test.aggregate.AggregateTestFixture; +import org.axonframework.test.aggregate.FixtureConfiguration; +import org.junit.*; + import com.baeldung.axon.aggregates.MessagesAggregate; import com.baeldung.axon.commands.CreateMessageCommand; import com.baeldung.axon.commands.MarkReadMessageCommand; import com.baeldung.axon.events.MessageCreatedEvent; import com.baeldung.axon.events.MessageReadEvent; -import org.axonframework.test.aggregate.AggregateTestFixture; -import org.axonframework.test.aggregate.FixtureConfiguration; -import org.junit.Before; -import org.junit.Test; - -import java.util.UUID; public class MessagesAggregateIntegrationTest { private FixtureConfiguration fixture; @Before - public void setUp() throws Exception { - fixture = new AggregateTestFixture(MessagesAggregate.class); - + public void setUp() { + fixture = new AggregateTestFixture<>(MessagesAggregate.class); } @Test - public void giveAggregateRoot_whenCreateMessageCommand_thenShouldProduceMessageCreatedEvent() throws Exception { + public void giveAggregateRoot_whenCreateMessageCommand_thenShouldProduceMessageCreatedEvent() { String eventText = "Hello, how is your day?"; String id = UUID.randomUUID().toString(); fixture.given() @@ -32,7 +31,7 @@ public class MessagesAggregateIntegrationTest { } @Test - public void givenMessageCreatedEvent_whenReadMessageCommand_thenShouldProduceMessageReadEvent() throws Exception { + public void givenMessageCreatedEvent_whenReadMessageCommand_thenShouldProduceMessageReadEvent() { String id = UUID.randomUUID().toString(); fixture.given(new MessageCreatedEvent(id, "Hello :-)")) From 11b1112771d6327560debdf0c06306103c5bf7ac Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 14:48:10 +0100 Subject: [PATCH 017/271] BAEL-2435 Update the event handler Change the event handler to become a spring service, as this way Axon will automatically pick it up as an event handling component --- .../baeldung/axon/eventhandlers/MessagesEventHandler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/axon/src/main/java/com/baeldung/axon/eventhandlers/MessagesEventHandler.java b/axon/src/main/java/com/baeldung/axon/eventhandlers/MessagesEventHandler.java index 3e51e19c4e..d7ac115a16 100644 --- a/axon/src/main/java/com/baeldung/axon/eventhandlers/MessagesEventHandler.java +++ b/axon/src/main/java/com/baeldung/axon/eventhandlers/MessagesEventHandler.java @@ -1,10 +1,12 @@ package com.baeldung.axon.eventhandlers; -import com.baeldung.axon.events.MessageReadEvent; -import com.baeldung.axon.events.MessageCreatedEvent; import org.axonframework.eventhandling.EventHandler; +import org.springframework.stereotype.Service; +import com.baeldung.axon.events.MessageCreatedEvent; +import com.baeldung.axon.events.MessageReadEvent; +@Service public class MessagesEventHandler { @EventHandler From 3553fb750685f94af4f8dbdeaffb0a140497556a Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 14:49:30 +0100 Subject: [PATCH 018/271] BAEL-2435 Update commands and events -Change TargetAggregateIdentifier import statement to the new location -Add equals/hashcode as best practice for commands and events -Add description -Change parent to parent-boot-2 to leverage a spring boot start up approach --- .../axon/commands/CreateMessageCommand.java | 28 +++++++++++++++---- .../axon/commands/MarkReadMessageCommand.java | 26 ++++++++++++++--- .../axon/events/MessageCreatedEvent.java | 27 +++++++++++++++--- .../axon/events/MessageReadEvent.java | 25 +++++++++++++++-- 4 files changed, 90 insertions(+), 16 deletions(-) diff --git a/axon/src/main/java/com/baeldung/axon/commands/CreateMessageCommand.java b/axon/src/main/java/com/baeldung/axon/commands/CreateMessageCommand.java index d0651bf12e..70d2e46480 100644 --- a/axon/src/main/java/com/baeldung/axon/commands/CreateMessageCommand.java +++ b/axon/src/main/java/com/baeldung/axon/commands/CreateMessageCommand.java @@ -1,24 +1,42 @@ package com.baeldung.axon.commands; +import java.util.Objects; -import org.axonframework.commandhandling.TargetAggregateIdentifier; +import org.axonframework.modelling.command.TargetAggregateIdentifier; public class CreateMessageCommand { - + @TargetAggregateIdentifier private final String id; private final String text; - + public CreateMessageCommand(String id, String text) { this.id = id; this.text = text; } - + public String getId() { return id; } - + public String getText() { return text; } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateMessageCommand that = (CreateMessageCommand) o; + return Objects.equals(id, that.id) && Objects.equals(text, that.text); + } + + @Override + public int hashCode() { + return Objects.hash(id, text); + } } \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/commands/MarkReadMessageCommand.java b/axon/src/main/java/com/baeldung/axon/commands/MarkReadMessageCommand.java index e66582d9ec..f7d911d65b 100644 --- a/axon/src/main/java/com/baeldung/axon/commands/MarkReadMessageCommand.java +++ b/axon/src/main/java/com/baeldung/axon/commands/MarkReadMessageCommand.java @@ -1,18 +1,36 @@ package com.baeldung.axon.commands; +import java.util.Objects; -import org.axonframework.commandhandling.TargetAggregateIdentifier; +import org.axonframework.modelling.command.TargetAggregateIdentifier; public class MarkReadMessageCommand { - + @TargetAggregateIdentifier private final String id; - + public MarkReadMessageCommand(String id) { this.id = id; } - + public String getId() { return id; } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarkReadMessageCommand that = (MarkReadMessageCommand) o; + return Objects.equals(id, that.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } } \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/events/MessageCreatedEvent.java b/axon/src/main/java/com/baeldung/axon/events/MessageCreatedEvent.java index 3c9aac5ed8..e638a2a94d 100644 --- a/axon/src/main/java/com/baeldung/axon/events/MessageCreatedEvent.java +++ b/axon/src/main/java/com/baeldung/axon/events/MessageCreatedEvent.java @@ -1,20 +1,39 @@ package com.baeldung.axon.events; +import java.util.Objects; + public class MessageCreatedEvent { - + private final String id; private final String text; - + public MessageCreatedEvent(String id, String text) { this.id = id; this.text = text; } - + public String getId() { return id; } - + public String getText() { return text; } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageCreatedEvent that = (MessageCreatedEvent) o; + return Objects.equals(id, that.id) && Objects.equals(text, that.text); + } + + @Override + public int hashCode() { + return Objects.hash(id, text); + } } \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/events/MessageReadEvent.java b/axon/src/main/java/com/baeldung/axon/events/MessageReadEvent.java index 57bfc8e19e..e362599bb3 100644 --- a/axon/src/main/java/com/baeldung/axon/events/MessageReadEvent.java +++ b/axon/src/main/java/com/baeldung/axon/events/MessageReadEvent.java @@ -1,14 +1,33 @@ package com.baeldung.axon.events; +import java.util.Objects; + public class MessageReadEvent { - + private final String id; - + public MessageReadEvent(String id) { this.id = id; } - + public String getId() { return id; } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageReadEvent that = (MessageReadEvent) o; + return Objects.equals(id, that.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } } \ No newline at end of file From 3e3210a8038b4c9453d1958714119243d0c732d3 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 14:52:54 +0100 Subject: [PATCH 019/271] BAEL-2435 Change aggregate package -Change aggregate package to commandmodel package per best practice -Move the aggregate test to the same package for the test directory --- .../axon/{aggregates => commandmodel}/MessagesAggregate.java | 2 +- .../{ => commandmodel}/MessagesAggregateIntegrationTest.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) rename axon/src/main/java/com/baeldung/axon/{aggregates => commandmodel}/MessagesAggregate.java (96%) rename axon/src/test/java/com/baeldung/axon/{ => commandmodel}/MessagesAggregateIntegrationTest.java (94%) diff --git a/axon/src/main/java/com/baeldung/axon/aggregates/MessagesAggregate.java b/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java similarity index 96% rename from axon/src/main/java/com/baeldung/axon/aggregates/MessagesAggregate.java rename to axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java index d95dd81df9..b2c3a0a0b6 100644 --- a/axon/src/main/java/com/baeldung/axon/aggregates/MessagesAggregate.java +++ b/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java @@ -1,4 +1,4 @@ -package com.baeldung.axon.aggregates; +package com.baeldung.axon.commandmodel; import static org.axonframework.modelling.command.AggregateLifecycle.apply; diff --git a/axon/src/test/java/com/baeldung/axon/MessagesAggregateIntegrationTest.java b/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateIntegrationTest.java similarity index 94% rename from axon/src/test/java/com/baeldung/axon/MessagesAggregateIntegrationTest.java rename to axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateIntegrationTest.java index dc008dcd78..96bb2cf3b7 100644 --- a/axon/src/test/java/com/baeldung/axon/MessagesAggregateIntegrationTest.java +++ b/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.axon; +package com.baeldung.axon.commandmodel; import java.util.UUID; @@ -6,7 +6,6 @@ import org.axonframework.test.aggregate.AggregateTestFixture; import org.axonframework.test.aggregate.FixtureConfiguration; import org.junit.*; -import com.baeldung.axon.aggregates.MessagesAggregate; import com.baeldung.axon.commands.CreateMessageCommand; import com.baeldung.axon.commands.MarkReadMessageCommand; import com.baeldung.axon.events.MessageCreatedEvent; From 00b297a4d0a21282d13b7c7a41544aa56b782b59 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 14:53:43 +0100 Subject: [PATCH 020/271] BAEL-2435 Rename aggregate test Rename aggregate test from MessagesAggregateIntegrationTest to MessagesAggregateTest, as it's not an integration test but a regular unit test --- ...AggregateIntegrationTest.java => MessagesAggregateTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename axon/src/test/java/com/baeldung/axon/commandmodel/{MessagesAggregateIntegrationTest.java => MessagesAggregateTest.java} (96%) diff --git a/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateIntegrationTest.java b/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java similarity index 96% rename from axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateIntegrationTest.java rename to axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java index 96bb2cf3b7..30914e3fd3 100644 --- a/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateIntegrationTest.java +++ b/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java @@ -11,7 +11,7 @@ import com.baeldung.axon.commands.MarkReadMessageCommand; import com.baeldung.axon.events.MessageCreatedEvent; import com.baeldung.axon.events.MessageReadEvent; -public class MessagesAggregateIntegrationTest { +public class MessagesAggregateTest { private FixtureConfiguration fixture; From aaf2ef22276bc1b3f0bc64f3acbf0d3582afb9c9 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 14:54:07 +0100 Subject: [PATCH 021/271] BAEL-2435 Change eventhandlers package Change eventhandlers package to querymodel package per best practices --- .../{eventhandlers => querymodel}/MessagesEventHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename axon/src/main/java/com/baeldung/axon/{eventhandlers => querymodel}/MessagesEventHandler.java (93%) diff --git a/axon/src/main/java/com/baeldung/axon/eventhandlers/MessagesEventHandler.java b/axon/src/main/java/com/baeldung/axon/querymodel/MessagesEventHandler.java similarity index 93% rename from axon/src/main/java/com/baeldung/axon/eventhandlers/MessagesEventHandler.java rename to axon/src/main/java/com/baeldung/axon/querymodel/MessagesEventHandler.java index d7ac115a16..d93fe03941 100644 --- a/axon/src/main/java/com/baeldung/axon/eventhandlers/MessagesEventHandler.java +++ b/axon/src/main/java/com/baeldung/axon/querymodel/MessagesEventHandler.java @@ -1,4 +1,4 @@ -package com.baeldung.axon.eventhandlers; +package com.baeldung.axon.querymodel; import org.axonframework.eventhandling.EventHandler; import org.springframework.stereotype.Service; From 96945027a14e5bf1a9b72ddfac7e38e1c170af74 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 14:55:28 +0100 Subject: [PATCH 022/271] BAEL-2435 Change command message package Change the package of the command messages to coreapi.commands to signal that the commands are part of the API you'd share with the outside --- .../com/baeldung/axon/commandmodel/MessagesAggregate.java | 4 ++-- .../axon/{ => coreapi}/commands/CreateMessageCommand.java | 2 +- .../axon/{ => coreapi}/commands/MarkReadMessageCommand.java | 2 +- .../com/baeldung/axon/commandmodel/MessagesAggregateTest.java | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) rename axon/src/main/java/com/baeldung/axon/{ => coreapi}/commands/CreateMessageCommand.java (95%) rename axon/src/main/java/com/baeldung/axon/{ => coreapi}/commands/MarkReadMessageCommand.java (94%) diff --git a/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java b/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java index b2c3a0a0b6..60b5c7c94e 100644 --- a/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java +++ b/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java @@ -7,8 +7,8 @@ import org.axonframework.eventsourcing.EventSourcingHandler; import org.axonframework.modelling.command.AggregateIdentifier; import org.axonframework.spring.stereotype.Aggregate; -import com.baeldung.axon.commands.CreateMessageCommand; -import com.baeldung.axon.commands.MarkReadMessageCommand; +import com.baeldung.axon.coreapi.commands.CreateMessageCommand; +import com.baeldung.axon.coreapi.commands.MarkReadMessageCommand; import com.baeldung.axon.events.MessageCreatedEvent; import com.baeldung.axon.events.MessageReadEvent; diff --git a/axon/src/main/java/com/baeldung/axon/commands/CreateMessageCommand.java b/axon/src/main/java/com/baeldung/axon/coreapi/commands/CreateMessageCommand.java similarity index 95% rename from axon/src/main/java/com/baeldung/axon/commands/CreateMessageCommand.java rename to axon/src/main/java/com/baeldung/axon/coreapi/commands/CreateMessageCommand.java index 70d2e46480..fd03d6b269 100644 --- a/axon/src/main/java/com/baeldung/axon/commands/CreateMessageCommand.java +++ b/axon/src/main/java/com/baeldung/axon/coreapi/commands/CreateMessageCommand.java @@ -1,4 +1,4 @@ -package com.baeldung.axon.commands; +package com.baeldung.axon.coreapi.commands; import java.util.Objects; diff --git a/axon/src/main/java/com/baeldung/axon/commands/MarkReadMessageCommand.java b/axon/src/main/java/com/baeldung/axon/coreapi/commands/MarkReadMessageCommand.java similarity index 94% rename from axon/src/main/java/com/baeldung/axon/commands/MarkReadMessageCommand.java rename to axon/src/main/java/com/baeldung/axon/coreapi/commands/MarkReadMessageCommand.java index f7d911d65b..ec68a380f8 100644 --- a/axon/src/main/java/com/baeldung/axon/commands/MarkReadMessageCommand.java +++ b/axon/src/main/java/com/baeldung/axon/coreapi/commands/MarkReadMessageCommand.java @@ -1,4 +1,4 @@ -package com.baeldung.axon.commands; +package com.baeldung.axon.coreapi.commands; import java.util.Objects; diff --git a/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java b/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java index 30914e3fd3..3bb7fdc9a2 100644 --- a/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java +++ b/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java @@ -6,8 +6,8 @@ import org.axonframework.test.aggregate.AggregateTestFixture; import org.axonframework.test.aggregate.FixtureConfiguration; import org.junit.*; -import com.baeldung.axon.commands.CreateMessageCommand; -import com.baeldung.axon.commands.MarkReadMessageCommand; +import com.baeldung.axon.coreapi.commands.CreateMessageCommand; +import com.baeldung.axon.coreapi.commands.MarkReadMessageCommand; import com.baeldung.axon.events.MessageCreatedEvent; import com.baeldung.axon.events.MessageReadEvent; From 2b07c0364d5f7cd1e4d8f178bd99c968e89324c2 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 14:56:23 +0100 Subject: [PATCH 023/271] BAEL-2435 Change event message package Change the package of the event messages to coreapi.events to signal that the events are part of the API you'd share with the outside --- .../com/baeldung/axon/commandmodel/MessagesAggregate.java | 4 ++-- .../axon/{ => coreapi}/events/MessageCreatedEvent.java | 2 +- .../baeldung/axon/{ => coreapi}/events/MessageReadEvent.java | 2 +- .../com/baeldung/axon/querymodel/MessagesEventHandler.java | 4 ++-- .../com/baeldung/axon/commandmodel/MessagesAggregateTest.java | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) rename axon/src/main/java/com/baeldung/axon/{ => coreapi}/events/MessageCreatedEvent.java (94%) rename axon/src/main/java/com/baeldung/axon/{ => coreapi}/events/MessageReadEvent.java (93%) diff --git a/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java b/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java index 60b5c7c94e..1ab9501617 100644 --- a/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java +++ b/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java @@ -9,8 +9,8 @@ import org.axonframework.spring.stereotype.Aggregate; import com.baeldung.axon.coreapi.commands.CreateMessageCommand; import com.baeldung.axon.coreapi.commands.MarkReadMessageCommand; -import com.baeldung.axon.events.MessageCreatedEvent; -import com.baeldung.axon.events.MessageReadEvent; +import com.baeldung.axon.coreapi.events.MessageCreatedEvent; +import com.baeldung.axon.coreapi.events.MessageReadEvent; @Aggregate public class MessagesAggregate { diff --git a/axon/src/main/java/com/baeldung/axon/events/MessageCreatedEvent.java b/axon/src/main/java/com/baeldung/axon/coreapi/events/MessageCreatedEvent.java similarity index 94% rename from axon/src/main/java/com/baeldung/axon/events/MessageCreatedEvent.java rename to axon/src/main/java/com/baeldung/axon/coreapi/events/MessageCreatedEvent.java index e638a2a94d..debf383771 100644 --- a/axon/src/main/java/com/baeldung/axon/events/MessageCreatedEvent.java +++ b/axon/src/main/java/com/baeldung/axon/coreapi/events/MessageCreatedEvent.java @@ -1,4 +1,4 @@ -package com.baeldung.axon.events; +package com.baeldung.axon.coreapi.events; import java.util.Objects; diff --git a/axon/src/main/java/com/baeldung/axon/events/MessageReadEvent.java b/axon/src/main/java/com/baeldung/axon/coreapi/events/MessageReadEvent.java similarity index 93% rename from axon/src/main/java/com/baeldung/axon/events/MessageReadEvent.java rename to axon/src/main/java/com/baeldung/axon/coreapi/events/MessageReadEvent.java index e362599bb3..f90bfb054e 100644 --- a/axon/src/main/java/com/baeldung/axon/events/MessageReadEvent.java +++ b/axon/src/main/java/com/baeldung/axon/coreapi/events/MessageReadEvent.java @@ -1,4 +1,4 @@ -package com.baeldung.axon.events; +package com.baeldung.axon.coreapi.events; import java.util.Objects; diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/MessagesEventHandler.java b/axon/src/main/java/com/baeldung/axon/querymodel/MessagesEventHandler.java index d93fe03941..6988d40a53 100644 --- a/axon/src/main/java/com/baeldung/axon/querymodel/MessagesEventHandler.java +++ b/axon/src/main/java/com/baeldung/axon/querymodel/MessagesEventHandler.java @@ -3,8 +3,8 @@ package com.baeldung.axon.querymodel; import org.axonframework.eventhandling.EventHandler; import org.springframework.stereotype.Service; -import com.baeldung.axon.events.MessageCreatedEvent; -import com.baeldung.axon.events.MessageReadEvent; +import com.baeldung.axon.coreapi.events.MessageCreatedEvent; +import com.baeldung.axon.coreapi.events.MessageReadEvent; @Service public class MessagesEventHandler { diff --git a/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java b/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java index 3bb7fdc9a2..1a95726c83 100644 --- a/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java +++ b/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java @@ -8,8 +8,8 @@ import org.junit.*; import com.baeldung.axon.coreapi.commands.CreateMessageCommand; import com.baeldung.axon.coreapi.commands.MarkReadMessageCommand; -import com.baeldung.axon.events.MessageCreatedEvent; -import com.baeldung.axon.events.MessageReadEvent; +import com.baeldung.axon.coreapi.events.MessageCreatedEvent; +import com.baeldung.axon.coreapi.events.MessageReadEvent; public class MessagesAggregateTest { From e731b95ffbb596d3674bd3e6de724e35dcf4a7df Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 15:01:29 +0100 Subject: [PATCH 024/271] BAEL-2435 Rename unit test class Rename unit test class to actual contain 'UnitTest' per the defined standards --- ...essagesAggregateTest.java => MessagesAggregateUnitTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename axon/src/test/java/com/baeldung/axon/commandmodel/{MessagesAggregateTest.java => MessagesAggregateUnitTest.java} (97%) diff --git a/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java b/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateUnitTest.java similarity index 97% rename from axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java rename to axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateUnitTest.java index 1a95726c83..46357ddff8 100644 --- a/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateTest.java +++ b/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateUnitTest.java @@ -11,7 +11,7 @@ import com.baeldung.axon.coreapi.commands.MarkReadMessageCommand; import com.baeldung.axon.coreapi.events.MessageCreatedEvent; import com.baeldung.axon.coreapi.events.MessageReadEvent; -public class MessagesAggregateTest { +public class MessagesAggregateUnitTest { private FixtureConfiguration fixture; From fe30c44889111ccaa94b4e69d49fc800b21c5d90 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 15:15:23 +0100 Subject: [PATCH 025/271] BAEL-2435 Add a GUI -Add spring-boot-starter-web to support rest endpoints -Add a rest endpoint to spoof some form of UI to publish a message, as the old main will no longer publish the commands upon start up --- axon/pom.xml | 5 ++++ .../axon/gui/MessagesRestEndpoint.java | 28 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 axon/src/main/java/com/baeldung/axon/gui/MessagesRestEndpoint.java diff --git a/axon/pom.xml b/axon/pom.xml index bb7839f150..639c50d70b 100644 --- a/axon/pom.xml +++ b/axon/pom.xml @@ -39,6 +39,11 @@ 2.1.1.RELEASE compile + + + org.springframework.boot + spring-boot-starter-web + diff --git a/axon/src/main/java/com/baeldung/axon/gui/MessagesRestEndpoint.java b/axon/src/main/java/com/baeldung/axon/gui/MessagesRestEndpoint.java new file mode 100644 index 0000000000..ddbc3e2fc5 --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/gui/MessagesRestEndpoint.java @@ -0,0 +1,28 @@ +package com.baeldung.axon.gui; + +import java.util.UUID; + +import org.axonframework.commandhandling.gateway.CommandGateway; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.axon.coreapi.commands.CreateMessageCommand; +import com.baeldung.axon.coreapi.commands.MarkReadMessageCommand; + +@RestController +public class MessagesRestEndpoint { + + private final CommandGateway commandGateway; + + public MessagesRestEndpoint(CommandGateway commandGateway) { + this.commandGateway = commandGateway; + } + + @PostMapping("/hello") + public void publishMessages() { + final String itemId = UUID.randomUUID().toString(); + commandGateway.send(new CreateMessageCommand(itemId, "Hello, how is your day? :-)")); + commandGateway.send(new MarkReadMessageCommand(itemId)); + } + +} From d8ef050867fbf473260f51509ed775a719737879 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 15:16:31 +0100 Subject: [PATCH 026/271] BAEL-2435 Add JPA and H2 dependencies Add JPA and H2 dependencies to allow event sourcing, as for event sourcing and EventStore is mandatory, and to make an EventStore a database needs to be present for Axon's auto-configuration --- axon/pom.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/axon/pom.xml b/axon/pom.xml index 639c50d70b..03d2499a99 100644 --- a/axon/pom.xml +++ b/axon/pom.xml @@ -44,6 +44,17 @@ org.springframework.boot spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + com.h2database + h2 + runtime + From 557ce655522559c849e4a02cdd54955872d700c5 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 18 Dec 2018 15:17:16 +0100 Subject: [PATCH 027/271] BAEL-2435 Update main application Update the MessagesRunner to be a spring boot application --- .../com/baeldung/axon/MessagesRunner.java | 51 ++----------------- 1 file changed, 5 insertions(+), 46 deletions(-) diff --git a/axon/src/main/java/com/baeldung/axon/MessagesRunner.java b/axon/src/main/java/com/baeldung/axon/MessagesRunner.java index 77b50d09bd..4f83dd86f0 100644 --- a/axon/src/main/java/com/baeldung/axon/MessagesRunner.java +++ b/axon/src/main/java/com/baeldung/axon/MessagesRunner.java @@ -1,54 +1,13 @@ package com.baeldung.axon; -import com.baeldung.axon.aggregates.MessagesAggregate; -import com.baeldung.axon.commands.CreateMessageCommand; -import com.baeldung.axon.commands.MarkReadMessageCommand; -import com.baeldung.axon.eventhandlers.MessagesEventHandler; -import org.axonframework.commandhandling.AggregateAnnotationCommandHandler; -import org.axonframework.commandhandling.CommandBus; -import org.axonframework.commandhandling.SimpleCommandBus; -import org.axonframework.commandhandling.gateway.CommandGateway; -import org.axonframework.commandhandling.gateway.DefaultCommandGateway; -import org.axonframework.eventhandling.AnnotationEventListenerAdapter; -import org.axonframework.eventsourcing.EventSourcingRepository; -import org.axonframework.eventsourcing.eventstore.EmbeddedEventStore; -import org.axonframework.eventsourcing.eventstore.EventStore; -import org.axonframework.eventsourcing.eventstore.inmemory.InMemoryEventStorageEngine; - -import java.util.UUID; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +@SpringBootApplication public class MessagesRunner { public static void main(String[] args) { - CommandBus commandBus = new SimpleCommandBus(); - - CommandGateway commandGateway = new DefaultCommandGateway(commandBus); - - EventStore eventStore = new EmbeddedEventStore(new InMemoryEventStorageEngine()); - - EventSourcingRepository repository = - new EventSourcingRepository<>(MessagesAggregate.class, eventStore); - - - AggregateAnnotationCommandHandler messagesAggregateAggregateAnnotationCommandHandler = - new AggregateAnnotationCommandHandler(MessagesAggregate.class, repository); - messagesAggregateAggregateAnnotationCommandHandler.subscribe(commandBus); - - final AnnotationEventListenerAdapter annotationEventListenerAdapter = - new AnnotationEventListenerAdapter(new MessagesEventHandler()); - eventStore.subscribe(eventMessages -> eventMessages.forEach(e -> { - try { - annotationEventListenerAdapter.handle(e); - } catch (Exception e1) { - throw new RuntimeException(e1); - - } - } - - )); - - final String itemId = UUID.randomUUID().toString(); - commandGateway.send(new CreateMessageCommand(itemId, "Hello, how is your day? :-)")); - commandGateway.send(new MarkReadMessageCommand(itemId)); + SpringApplication.run(MessagesRunner.class, args); } + } \ No newline at end of file From 64b205a6ce2360de18c418fef3da2e53f1468e90 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Fri, 21 Dec 2018 12:19:09 +0400 Subject: [PATCH 028/271] Vector iterator --- .../src/main/java/com/baeldung/java/list/VectorExample.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core-java-collections/src/main/java/com/baeldung/java/list/VectorExample.java b/core-java-collections/src/main/java/com/baeldung/java/list/VectorExample.java index 38736390ca..7debc07911 100644 --- a/core-java-collections/src/main/java/com/baeldung/java/list/VectorExample.java +++ b/core-java-collections/src/main/java/com/baeldung/java/list/VectorExample.java @@ -1,6 +1,7 @@ package com.baeldung.java.list; import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; public class VectorExample { @@ -16,6 +17,11 @@ public class VectorExample { while(e.hasMoreElements()){ System.out.println(e.nextElement()); } + + Iterator iterator = vector.iterator(); + while (iterator.hasNext()) { + System.out.println(iterator.next()); + } } } From 29b4110b34701c1ac004d03bc8e8555158a40e31 Mon Sep 17 00:00:00 2001 From: geroza Date: Wed, 28 Nov 2018 12:17:30 -0200 Subject: [PATCH 029/271] just migrated poms, nothing checked --- mustache/pom.xml | 4 ++-- spring-amqp-simple/pom.xml | 4 ++-- spring-aop/pom.xml | 4 ++-- spring-cucumber/pom.xml | 4 ++-- spring-jooq/pom.xml | 4 ++-- spring-kafka/pom.xml | 4 ++-- spring-mockito/pom.xml | 4 ++-- spring-protobuf/pom.xml | 4 ++-- spring-quartz/pom.xml | 4 ++-- spring-reactor/pom.xml | 4 ++-- spring-remoting/pom.xml | 4 ++-- spring-sleuth/pom.xml | 4 ++-- spring-vertx/pom.xml | 4 ++-- spring-zuul/pom.xml | 4 ++-- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/mustache/pom.xml b/mustache/pom.xml index a276dfbf43..0c35345100 100644 --- a/mustache/pom.xml +++ b/mustache/pom.xml @@ -7,10 +7,10 @@ mustache - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-amqp-simple/pom.xml b/spring-amqp-simple/pom.xml index 57d84acee6..45cdc066a0 100644 --- a/spring-amqp-simple/pom.xml +++ b/spring-amqp-simple/pom.xml @@ -8,10 +8,10 @@ spring-amqp-simple - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-aop/pom.xml b/spring-aop/pom.xml index 368f3ada14..9e2f97916a 100644 --- a/spring-aop/pom.xml +++ b/spring-aop/pom.xml @@ -6,10 +6,10 @@ spring-aop - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-cucumber/pom.xml b/spring-cucumber/pom.xml index 64b543bb6c..2bc3201775 100644 --- a/spring-cucumber/pom.xml +++ b/spring-cucumber/pom.xml @@ -10,10 +10,10 @@ Demo project for Spring Boot - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-jooq/pom.xml b/spring-jooq/pom.xml index bbd6025418..c1f9dbff5b 100644 --- a/spring-jooq/pom.xml +++ b/spring-jooq/pom.xml @@ -5,10 +5,10 @@ spring-jooq - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-kafka/pom.xml b/spring-kafka/pom.xml index 3060dc00b3..e710f1ac03 100644 --- a/spring-kafka/pom.xml +++ b/spring-kafka/pom.xml @@ -8,10 +8,10 @@ Intro to Kafka with Spring - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-mockito/pom.xml b/spring-mockito/pom.xml index d1fa7f410e..481c818f39 100644 --- a/spring-mockito/pom.xml +++ b/spring-mockito/pom.xml @@ -11,10 +11,10 @@ Injecting Mockito Mocks into Spring Beans - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-protobuf/pom.xml b/spring-protobuf/pom.xml index 1ab5048d27..3d7b7efd7c 100644 --- a/spring-protobuf/pom.xml +++ b/spring-protobuf/pom.xml @@ -7,10 +7,10 @@ spring-protobuf - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-quartz/pom.xml b/spring-quartz/pom.xml index 47ffeccba9..77424c219e 100644 --- a/spring-quartz/pom.xml +++ b/spring-quartz/pom.xml @@ -11,10 +11,10 @@ Demo project for Scheduling in Spring with Quartz - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-reactor/pom.xml b/spring-reactor/pom.xml index e828c44f74..9ab512cddb 100644 --- a/spring-reactor/pom.xml +++ b/spring-reactor/pom.xml @@ -9,10 +9,10 @@ http://maven.apache.org - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-remoting/pom.xml b/spring-remoting/pom.xml index 9f05bc91d2..6fa2846130 100644 --- a/spring-remoting/pom.xml +++ b/spring-remoting/pom.xml @@ -10,10 +10,10 @@ Parent for all projects related to Spring Remoting. - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-sleuth/pom.xml b/spring-sleuth/pom.xml index dd4477c551..c693466ab0 100644 --- a/spring-sleuth/pom.xml +++ b/spring-sleuth/pom.xml @@ -9,10 +9,10 @@ spring-sleuth - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-vertx/pom.xml b/spring-vertx/pom.xml index 14ed77d359..7a0bdc81d0 100644 --- a/spring-vertx/pom.xml +++ b/spring-vertx/pom.xml @@ -8,10 +8,10 @@ A demo project with vertx spring integration - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-zuul/pom.xml b/spring-zuul/pom.xml index 266c20adee..b662b2ef6a 100644 --- a/spring-zuul/pom.xml +++ b/spring-zuul/pom.xml @@ -9,10 +9,10 @@ pom - parent-boot-1 + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 From a1b5d77656e8582fd4f094ceef19098816c353e5 Mon Sep 17 00:00:00 2001 From: geroza Date: Wed, 19 Dec 2018 16:37:10 -0200 Subject: [PATCH 030/271] Migrated the following modules, nos using parent-boot-2: spring-protobuf spring-mockito spring-mustache spring-kafka spring-jooq spring-cucumber spring-aop spring-amqp-simple --- .../baeldung/springamqpsimple/SpringAmqpConfig.java | 2 +- .../springamqpsimple/broadcast/BroadcastConfig.java | 2 +- .../src/test/resources/application.yaml | 5 +++++ spring-jooq/pom.xml | 7 ++++--- spring-kafka/pom.xml | 2 -- .../com/baeldung/spring/kafka/KafkaApplication.java | 8 ++++---- .../com/baeldung/NameServiceTestConfiguration.java | 2 +- spring-protobuf/pom.xml | 13 +------------ .../java/com/baeldung/protobuf/Application.java | 6 ++++++ 9 files changed, 23 insertions(+), 24 deletions(-) create mode 100644 spring-amqp-simple/src/test/resources/application.yaml diff --git a/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/SpringAmqpConfig.java b/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/SpringAmqpConfig.java index f6c82b635e..3bb0dbf33c 100644 --- a/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/SpringAmqpConfig.java +++ b/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/SpringAmqpConfig.java @@ -35,7 +35,7 @@ public class SpringAmqpConfig { } @Bean - SimpleMessageListenerContainer container(ConnectionFactory connectionFactory, + SimpleMessageListenerContainer SpringAmqpContainer(ConnectionFactory connectionFactory, MessageListenerAdapter listenerAdapter) { SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(connectionFactory); diff --git a/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/broadcast/BroadcastConfig.java b/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/broadcast/BroadcastConfig.java index 1d02b4dad9..c1df053c02 100644 --- a/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/broadcast/BroadcastConfig.java +++ b/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/broadcast/BroadcastConfig.java @@ -61,7 +61,7 @@ public class BroadcastConfig { } @Bean - public SimpleRabbitListenerContainerFactory container(ConnectionFactory connectionFactory, SimpleRabbitListenerContainerFactoryConfigurer configurer) { + public SimpleRabbitListenerContainerFactory BroadcastContainer(ConnectionFactory connectionFactory, SimpleRabbitListenerContainerFactoryConfigurer configurer) { SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); configurer.configure(factory, connectionFactory); return factory; diff --git a/spring-amqp-simple/src/test/resources/application.yaml b/spring-amqp-simple/src/test/resources/application.yaml new file mode 100644 index 0000000000..aa7a91bac5 --- /dev/null +++ b/spring-amqp-simple/src/test/resources/application.yaml @@ -0,0 +1,5 @@ +spring: + rabbitmq: + username: guest + password: guest + host: localhost \ No newline at end of file diff --git a/spring-jooq/pom.xml b/spring-jooq/pom.xml index c1f9dbff5b..8bce500a86 100644 --- a/spring-jooq/pom.xml +++ b/spring-jooq/pom.xml @@ -129,6 +129,9 @@ com.baeldung.jooq.introduction.db src/main/java + + + @@ -185,14 +188,12 @@ - 3.8.6 + 3.11.7 1.4.193 - 4.3.17.RELEASE 1.0.0 1.5 1.0.0 - 1.5.13.RELEASE org.jooq.example.spring.Application diff --git a/spring-kafka/pom.xml b/spring-kafka/pom.xml index e710f1ac03..67e732d819 100644 --- a/spring-kafka/pom.xml +++ b/spring-kafka/pom.xml @@ -30,11 +30,9 @@ com.fasterxml.jackson.core jackson-databind - - 1.1.3.RELEASE 2.6.7 diff --git a/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java b/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java index 50978d5ea9..4ee7f40335 100644 --- a/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java +++ b/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java @@ -22,7 +22,7 @@ public class KafkaApplication { public static void main(String[] args) throws Exception { ConfigurableApplicationContext context = SpringApplication.run(KafkaApplication.class, args); - + MessageProducer producer = context.getBean(MessageProducer.class); MessageListener listener = context.getBean(MessageListener.class); /* @@ -102,7 +102,7 @@ public class KafkaApplication { } public void sendMessageToPartion(String message, int partition) { - kafkaTemplate.send(partionedTopicName, partition, message); + kafkaTemplate.send(partionedTopicName, partition, null, message); } public void sendMessageToFiltered(String message) { @@ -124,13 +124,13 @@ public class KafkaApplication { private CountDownLatch greetingLatch = new CountDownLatch(1); - @KafkaListener(topics = "${message.topic.name}", group = "foo", containerFactory = "fooKafkaListenerContainerFactory") + @KafkaListener(topics = "${message.topic.name}", groupId = "foo", containerFactory = "fooKafkaListenerContainerFactory") public void listenGroupFoo(String message) { System.out.println("Received Messasge in group 'foo': " + message); latch.countDown(); } - @KafkaListener(topics = "${message.topic.name}", group = "bar", containerFactory = "barKafkaListenerContainerFactory") + @KafkaListener(topics = "${message.topic.name}", groupId = "bar", containerFactory = "barKafkaListenerContainerFactory") public void listenGroupBar(String message) { System.out.println("Received Messasge in group 'bar': " + message); latch.countDown(); diff --git a/spring-mockito/src/test/java/com/baeldung/NameServiceTestConfiguration.java b/spring-mockito/src/test/java/com/baeldung/NameServiceTestConfiguration.java index 2c63ff6203..c50377a22a 100644 --- a/spring-mockito/src/test/java/com/baeldung/NameServiceTestConfiguration.java +++ b/spring-mockito/src/test/java/com/baeldung/NameServiceTestConfiguration.java @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Profile; public class NameServiceTestConfiguration { @Bean @Primary - public NameService nameService() { + public NameService nameServiceTest() { return Mockito.mock(NameService.class); } } diff --git a/spring-protobuf/pom.xml b/spring-protobuf/pom.xml index 3d7b7efd7c..372f969bd7 100644 --- a/spring-protobuf/pom.xml +++ b/spring-protobuf/pom.xml @@ -36,21 +36,10 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - true - - - - - 3.1.0 1.4 + com.baeldung.protobuf.Application diff --git a/spring-protobuf/src/main/java/com/baeldung/protobuf/Application.java b/spring-protobuf/src/main/java/com/baeldung/protobuf/Application.java index 76f0e45244..d8aa34eb7c 100644 --- a/spring-protobuf/src/main/java/com/baeldung/protobuf/Application.java +++ b/spring-protobuf/src/main/java/com/baeldung/protobuf/Application.java @@ -4,7 +4,9 @@ import com.baeldung.protobuf.BaeldungTraining.Course; import com.baeldung.protobuf.BaeldungTraining.Student; import com.baeldung.protobuf.BaeldungTraining.Student.PhoneNumber; import com.baeldung.protobuf.BaeldungTraining.Student.PhoneType; + import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.annotation.Bean; import org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter; import org.springframework.web.client.RestTemplate; @@ -17,6 +19,10 @@ import java.util.Map; @SpringBootApplication public class Application { + + public static void main(String[] args) { + new SpringApplicationBuilder(Application.class).run(args); + } @Bean RestTemplate restTemplate(ProtobufHttpMessageConverter hmc) { From dcc054d6de77dce144d58129b6a437a113776907 Mon Sep 17 00:00:00 2001 From: geroza Date: Fri, 21 Dec 2018 13:39:11 -0200 Subject: [PATCH 031/271] Migrated the following modules to parent-boot-2: spring-reactor spring-quartz --- spring-reactor/pom.xml | 7 ++++++- .../com/baeldung/controller/NotificationController.java | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/spring-reactor/pom.xml b/spring-reactor/pom.xml index 9ab512cddb..c6ad99aea7 100644 --- a/spring-reactor/pom.xml +++ b/spring-reactor/pom.xml @@ -27,7 +27,12 @@ io.projectreactor reactor-bus + 2.0.8.RELEASE + + + io.projectreactor + reactor-core + 2.0.8.RELEASE - diff --git a/spring-reactor/src/main/java/com/baeldung/controller/NotificationController.java b/spring-reactor/src/main/java/com/baeldung/controller/NotificationController.java index b17691498e..8665f247b0 100644 --- a/spring-reactor/src/main/java/com/baeldung/controller/NotificationController.java +++ b/spring-reactor/src/main/java/com/baeldung/controller/NotificationController.java @@ -1,14 +1,16 @@ package com.baeldung.controller; -import com.baeldung.doman.NotificationData; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.doman.NotificationData; + import reactor.bus.Event; import reactor.bus.EventBus; -@Controller +@RestController public class NotificationController { @Autowired From cb4470edea53c68dd48688a6bc01901bbf133275 Mon Sep 17 00:00:00 2001 From: geroza Date: Sat, 22 Dec 2018 10:30:08 -0200 Subject: [PATCH 032/271] migration of modules: spring-zuul spring-vertx spring-sleuth --- spring-remoting/pom.xml | 5 +++-- .../remoting-hessian-burlap/pom.xml | 6 ++++-- spring-zuul/pom.xml | 18 +++++++++++++++--- .../config/ResourceServerApplication.java | 2 +- .../config/ResourceServerWebConfig.java | 4 ++-- .../src/main/resources/application.properties | 4 ++-- spring-zuul/spring-zuul-ui/pom.xml | 2 +- .../org/baeldung/config/UiApplication.java | 2 +- .../java/org/baeldung/config/UiWebConfig.java | 5 ++--- 9 files changed, 31 insertions(+), 17 deletions(-) diff --git a/spring-remoting/pom.xml b/spring-remoting/pom.xml index 6fa2846130..060f33837c 100644 --- a/spring-remoting/pom.xml +++ b/spring-remoting/pom.xml @@ -7,7 +7,8 @@ pom 1.0-SNAPSHOT spring-remoting - Parent for all projects related to Spring Remoting. + Parent for all projects related to Spring Remoting, except remoting-hessian-burlap + parent-boot-2 @@ -28,8 +29,8 @@ - remoting-http remoting-hessian-burlap + remoting-http remoting-amqp remoting-jms remoting-rmi diff --git a/spring-remoting/remoting-hessian-burlap/pom.xml b/spring-remoting/remoting-hessian-burlap/pom.xml index e63d0ee22e..8c30e76296 100644 --- a/spring-remoting/remoting-hessian-burlap/pom.xml +++ b/spring-remoting/remoting-hessian-burlap/pom.xml @@ -6,11 +6,13 @@ remoting-hessian-burlap pom remoting-hessian-burlap + 1.0-SNAPSHOT - spring-remoting + parent-boot-1 com.baeldung - 1.0-SNAPSHOT + 0.0.1-SNAPSHOT + ../../parent-boot-1 diff --git a/spring-zuul/pom.xml b/spring-zuul/pom.xml index b662b2ef6a..a8c891cd89 100644 --- a/spring-zuul/pom.xml +++ b/spring-zuul/pom.xml @@ -1,7 +1,8 @@ - 4.0.0 - + com.baeldung spring-zuul 1.0.0-SNAPSHOT @@ -38,11 +39,22 @@ - 1.2.7.RELEASE + 2.1.0.RC3 3.5 2.6 + + + spring-milestones + Spring Milestones + http://repo.spring.io/milestone + + false + + + + \ No newline at end of file diff --git a/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerApplication.java b/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerApplication.java index 9f1d2e162b..77eabe771b 100644 --- a/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerApplication.java +++ b/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerApplication.java @@ -2,7 +2,7 @@ package org.baeldung.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.web.support.SpringBootServletInitializer; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication public class ResourceServerApplication extends SpringBootServletInitializer { diff --git a/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerWebConfig.java b/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerWebConfig.java index c040c8ac42..1a45d20edb 100644 --- a/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerWebConfig.java +++ b/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerWebConfig.java @@ -3,11 +3,11 @@ package org.baeldung.config; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration @EnableWebMvc @ComponentScan({ "org.baeldung.web.controller" }) -public class ResourceServerWebConfig extends WebMvcConfigurerAdapter { +public class ResourceServerWebConfig implements WebMvcConfigurer { } diff --git a/spring-zuul/spring-zuul-foos-resource/src/main/resources/application.properties b/spring-zuul/spring-zuul-foos-resource/src/main/resources/application.properties index 94c0984ac3..9298027030 100644 --- a/spring-zuul/spring-zuul-foos-resource/src/main/resources/application.properties +++ b/spring-zuul/spring-zuul-foos-resource/src/main/resources/application.properties @@ -1,2 +1,2 @@ -server.contextPath=/spring-zuul-foos-resource -server.port=8081 \ No newline at end of file +server.servlet.context-path=/spring-zuul-foos-resource +server.port=8081 diff --git a/spring-zuul/spring-zuul-ui/pom.xml b/spring-zuul/spring-zuul-ui/pom.xml index 6090f5f8b8..159decd331 100644 --- a/spring-zuul/spring-zuul-ui/pom.xml +++ b/spring-zuul/spring-zuul-ui/pom.xml @@ -15,7 +15,7 @@ org.springframework.cloud - spring-cloud-starter-zuul + spring-cloud-starter-netflix-zuul ${spring-cloud.version} diff --git a/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiApplication.java b/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiApplication.java index b8eda25960..d3e13639ef 100644 --- a/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiApplication.java +++ b/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiApplication.java @@ -2,7 +2,7 @@ package org.baeldung.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.web.support.SpringBootServletInitializer; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.cloud.netflix.zuul.EnableZuulProxy; @EnableZuulProxy diff --git a/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiWebConfig.java b/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiWebConfig.java index 0732182354..7cda1f0e95 100644 --- a/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiWebConfig.java +++ b/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiWebConfig.java @@ -7,11 +7,11 @@ import org.springframework.web.servlet.config.annotation.DefaultServletHandlerCo import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration @EnableWebMvc -public class UiWebConfig extends WebMvcConfigurerAdapter { +public class UiWebConfig implements WebMvcConfigurer { @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { @@ -25,7 +25,6 @@ public class UiWebConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(final ViewControllerRegistry registry) { - super.addViewControllers(registry); registry.addViewController("/").setViewName("forward:/index"); registry.addViewController("/index"); registry.addViewController("/login"); From 832a3dc1761fdfbb0c9fed276863a6f222389548 Mon Sep 17 00:00:00 2001 From: geroza Date: Sat, 22 Dec 2018 10:30:56 -0200 Subject: [PATCH 033/271] Fixed deprecation usage in spring-boot --- .../main/java/com/baeldung/properties/ConfigProperties.java | 2 +- .../main/java/org/baeldung/properties/ConfigProperties.java | 2 +- .../demo/boottest/EmployeeControllerIntegrationTest.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-boot/src/main/java/com/baeldung/properties/ConfigProperties.java b/spring-boot/src/main/java/com/baeldung/properties/ConfigProperties.java index 863510738b..35b0239287 100644 --- a/spring-boot/src/main/java/com/baeldung/properties/ConfigProperties.java +++ b/spring-boot/src/main/java/com/baeldung/properties/ConfigProperties.java @@ -5,10 +5,10 @@ import java.util.Map; import javax.validation.constraints.Max; import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.Pattern; import org.hibernate.validator.constraints.Length; -import org.hibernate.validator.constraints.NotBlank; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; diff --git a/spring-boot/src/main/java/org/baeldung/properties/ConfigProperties.java b/spring-boot/src/main/java/org/baeldung/properties/ConfigProperties.java index 2c815fe998..2d3e56100c 100644 --- a/spring-boot/src/main/java/org/baeldung/properties/ConfigProperties.java +++ b/spring-boot/src/main/java/org/baeldung/properties/ConfigProperties.java @@ -5,10 +5,10 @@ import java.util.Map; import javax.validation.constraints.Max; import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.Pattern; import org.hibernate.validator.constraints.Length; -import org.hibernate.validator.constraints.NotBlank; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; diff --git a/spring-boot/src/test/java/org/baeldung/demo/boottest/EmployeeControllerIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/demo/boottest/EmployeeControllerIntegrationTest.java index 640a8b322a..2d70583a54 100644 --- a/spring-boot/src/test/java/org/baeldung/demo/boottest/EmployeeControllerIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/demo/boottest/EmployeeControllerIntegrationTest.java @@ -45,10 +45,10 @@ public class EmployeeControllerIntegrationTest { @Test public void whenPostEmployee_thenCreateEmployee() throws Exception { Employee alex = new Employee("alex"); - given(service.save(Mockito.anyObject())).willReturn(alex); + given(service.save(Mockito.any())).willReturn(alex); mvc.perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON).content(JsonUtil.toJson(alex))).andExpect(status().isCreated()).andExpect(jsonPath("$.name", is("alex"))); - verify(service, VerificationModeFactory.times(1)).save(Mockito.anyObject()); + verify(service, VerificationModeFactory.times(1)).save(Mockito.any()); reset(service); } From cb259f6f6ca97806cfb391bb38edf77ad0f324d1 Mon Sep 17 00:00:00 2001 From: geroza Date: Sat, 22 Dec 2018 11:05:38 -0200 Subject: [PATCH 034/271] minor fixes: fixed method naming added dirtiesContext annotation to classes that shouldnt share the app context state using SpringApplication instead of unnecessary SpringApplicationBuilder --- .../springamqpsimple/SpringAmqpConfig.java | 2 +- .../broadcast/BroadcastConfig.java | 2 +- .../com/baeldung/protobuf/Application.java | 24 +++++++++---------- .../protobuf/ApplicationIntegrationTest.java | 2 ++ .../SpringContextIntegrationTest.java | 2 ++ 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/SpringAmqpConfig.java b/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/SpringAmqpConfig.java index 3bb0dbf33c..92fa28ed6f 100644 --- a/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/SpringAmqpConfig.java +++ b/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/SpringAmqpConfig.java @@ -35,7 +35,7 @@ public class SpringAmqpConfig { } @Bean - SimpleMessageListenerContainer SpringAmqpContainer(ConnectionFactory connectionFactory, + SimpleMessageListenerContainer springAmqpContainer(ConnectionFactory connectionFactory, MessageListenerAdapter listenerAdapter) { SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(connectionFactory); diff --git a/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/broadcast/BroadcastConfig.java b/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/broadcast/BroadcastConfig.java index c1df053c02..868cfff0ac 100644 --- a/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/broadcast/BroadcastConfig.java +++ b/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/broadcast/BroadcastConfig.java @@ -61,7 +61,7 @@ public class BroadcastConfig { } @Bean - public SimpleRabbitListenerContainerFactory BroadcastContainer(ConnectionFactory connectionFactory, SimpleRabbitListenerContainerFactoryConfigurer configurer) { + public SimpleRabbitListenerContainerFactory broadcastContainer(ConnectionFactory connectionFactory, SimpleRabbitListenerContainerFactoryConfigurer configurer) { SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); configurer.configure(factory, connectionFactory); return factory; diff --git a/spring-protobuf/src/main/java/com/baeldung/protobuf/Application.java b/spring-protobuf/src/main/java/com/baeldung/protobuf/Application.java index d8aa34eb7c..fd36986549 100644 --- a/spring-protobuf/src/main/java/com/baeldung/protobuf/Application.java +++ b/spring-protobuf/src/main/java/com/baeldung/protobuf/Application.java @@ -1,27 +1,27 @@ package com.baeldung.protobuf; -import com.baeldung.protobuf.BaeldungTraining.Course; -import com.baeldung.protobuf.BaeldungTraining.Student; -import com.baeldung.protobuf.BaeldungTraining.Student.PhoneNumber; -import com.baeldung.protobuf.BaeldungTraining.Student.PhoneType; - -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.context.annotation.Bean; -import org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter; -import org.springframework.web.client.RestTemplate; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter; +import org.springframework.web.client.RestTemplate; + +import com.baeldung.protobuf.BaeldungTraining.Course; +import com.baeldung.protobuf.BaeldungTraining.Student; +import com.baeldung.protobuf.BaeldungTraining.Student.PhoneNumber; +import com.baeldung.protobuf.BaeldungTraining.Student.PhoneType; + @SpringBootApplication public class Application { public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).run(args); + SpringApplication.run(Application.class, args); } @Bean diff --git a/spring-protobuf/src/test/java/com/baeldung/protobuf/ApplicationIntegrationTest.java b/spring-protobuf/src/test/java/com/baeldung/protobuf/ApplicationIntegrationTest.java index 4b9f41ace3..f0e2473ec4 100644 --- a/spring-protobuf/src/test/java/com/baeldung/protobuf/ApplicationIntegrationTest.java +++ b/spring-protobuf/src/test/java/com/baeldung/protobuf/ApplicationIntegrationTest.java @@ -16,12 +16,14 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.http.ResponseEntity; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.web.client.RestTemplate; import com.baeldung.protobuf.BaeldungTraining.Course; import com.googlecode.protobuf.format.JsonFormat; +@DirtiesContext @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.DEFINED_PORT) public class ApplicationIntegrationTest { diff --git a/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 615ebd5f4a..6d021eb400 100644 --- a/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -3,10 +3,12 @@ package org.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; import com.baeldung.protobuf.Application; +@DirtiesContext @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class) public class SpringContextIntegrationTest { From c2fc5c0aa676e86696bf2ae9435e343803520077 Mon Sep 17 00:00:00 2001 From: Karanbir Singh Date: Sat, 22 Dec 2018 19:27:25 +0530 Subject: [PATCH 035/271] spelling mistake - minor one --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f3fe5e3bf0..378d77196a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Java and Spring Tutorials ================ This project is **a collection of small and focused tutorials** - each covering a single and well defined area of development in the Java ecosystem. -A strong focus of these is, of course, the Spring Framework - Spring, Spring Boot and Spring Securiyt. +A strong focus of these is, of course, the Spring Framework - Spring, Spring Boot and Spring Security. In additional to Spring, the following technologies are in focus: `core Java`, `Jackson`, `HttpClient`, `Guava`. From bba9a99f3231cec6e31e07cd1b7366bac8bcfdf2 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 23 Dec 2018 01:15:24 +0530 Subject: [PATCH 036/271] [BAEL-10836] - Create core-java-collections-list module --- core-java-collections-list/README.md | 28 +++++++++++ core-java-collections-list/pom.xml | 48 +++++++++++++++++++ .../ClassCastException.java | 0 .../com/baeldung/findanelement/Customer.java | 0 .../FindACustomerInGivenList.java | 0 .../baeldung/java/list/CopyListService.java | 0 .../com/baeldung/java/list/CustomList.java | 0 .../java/com/baeldung/java/list/Flower.java | 0 .../baeldung/java/list/ReverseIterator.java | 0 .../com/baeldung/java/list/WaysToIterate.java | 0 .../com/baeldung/java_8_features/Car.java | 0 .../com/baeldung/java_8_features/Person.java | 0 .../com/baeldung/list/listoflist/Pen.java | 0 .../com/baeldung/list/listoflist/Pencil.java | 0 .../com/baeldung/list/listoflist/Rubber.java | 0 .../baeldung/list/listoflist/Stationery.java | 0 .../ArrayListOfArrayList.java | 0 .../ThreeDimensionalArrayList.java | 0 .../baeldung/list/removeall/RemoveAll.java | 0 .../src/main/resources/logback.xml | 13 +++++ .../converter/ArrayConvertToListUnitTest.java | 0 .../collection/ClearVsRemoveAllUnitTest.java | 0 .../baeldung/collection/CollectionsEmpty.java | 0 .../FindItemsBasedOnOtherStreamUnitTest.java | 0 .../FindACustomerInGivenListUnitTest.java | 0 .../java/list/CopyListServiceUnitTest.java | 0 .../java/list/CustomListUnitTest.java | 0 .../java/list/ReverseIteratorUnitTest.java | 0 .../java/list/WaysToIterateUnitTest.java | 0 .../ListInitializationUnitTest.java | 0 .../baeldung/java8/Java8MaxMinUnitTest.java | 0 .../FlattenNestedListUnitTest.java | 0 .../listoflist/AddElementsToListUnitTest.java | 0 .../list/listoflist/ListOfListsUnitTest.java | 0 .../list/removeall/RemoveAllUnitTest.java | 0 .../RemoveFirstElementUnitTest.java | 0 .../baeldung/RandomListElementUnitTest.java | 2 +- .../java/collections/ArrayListUnitTest.java | 0 .../CoreJavaCollectionsUnitTest.java | 0 .../JavaCollectionCleanupUnitTest.java | 0 .../java/lists/ListAssertJUnitTest.java | 0 .../baeldung/java/lists/ListJUnitTest.java | 0 .../java/lists/ListTestNgUnitTest.java | 0 .../java/org/baeldung/java/lists/README.md | 0 core-java-collections/README.md | 25 +--------- pom.xml | 2 + 46 files changed, 93 insertions(+), 25 deletions(-) create mode 100644 core-java-collections-list/README.md create mode 100644 core-java-collections-list/pom.xml rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/classcastexception/ClassCastException.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/findanelement/Customer.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/findanelement/FindACustomerInGivenList.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/java/list/CopyListService.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/java/list/CustomList.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/java/list/Flower.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/java/list/ReverseIterator.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/java/list/WaysToIterate.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/java_8_features/Car.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/java_8_features/Person.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/list/listoflist/Pen.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/list/listoflist/Pencil.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/list/listoflist/Rubber.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/list/listoflist/Stationery.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/list/multidimensional/ThreeDimensionalArrayList.java (100%) rename {core-java-collections => core-java-collections-list}/src/main/java/com/baeldung/list/removeall/RemoveAll.java (100%) create mode 100644 core-java-collections-list/src/main/resources/logback.xml rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/array/converter/ArrayConvertToListUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/collection/ClearVsRemoveAllUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/collection/CollectionsEmpty.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/findanelement/FindACustomerInGivenListUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/java/list/CopyListServiceUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/java/list/CustomListUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/java/list/ReverseIteratorUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/java/list/WaysToIterateUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/list/listoflist/ListOfListsUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java (100%) rename {core-java/src/test/java/com => core-java-collections-list/src/test/java/org}/baeldung/RandomListElementUnitTest.java (98%) rename {core-java-collections => core-java-collections-list}/src/test/java/org/baeldung/java/collections/ArrayListUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/org/baeldung/java/collections/CoreJavaCollectionsUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/org/baeldung/java/collections/JavaCollectionCleanupUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/org/baeldung/java/lists/ListAssertJUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/org/baeldung/java/lists/ListJUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/org/baeldung/java/lists/ListTestNgUnitTest.java (100%) rename {core-java-collections => core-java-collections-list}/src/test/java/org/baeldung/java/lists/README.md (100%) diff --git a/core-java-collections-list/README.md b/core-java-collections-list/README.md new file mode 100644 index 0000000000..cb6999277c --- /dev/null +++ b/core-java-collections-list/README.md @@ -0,0 +1,28 @@ +========= + +## Core Java Collections List Cookbooks and Examples + +### Relevant Articles: +- [Immutable ArrayList in Java](http://www.baeldung.com/java-immutable-list) +- [Guide to the Java ArrayList](http://www.baeldung.com/java-arraylist) +- [Random List Element](http://www.baeldung.com/java-random-list-element) +- [Removing all nulls from a List in Java](http://www.baeldung.com/java-remove-nulls-from-list) +- [Removing all duplicates from a List in Java](http://www.baeldung.com/java-remove-duplicates-from-list) +- [How to TDD a List Implementation in Java](http://www.baeldung.com/java-test-driven-list) +- [Iterating Backward Through a List](http://www.baeldung.com/java-list-iterate-backwards) +- [Add Multiple Items to an Java ArrayList](http://www.baeldung.com/java-add-items-array-list) +- [Remove the First Element from a List](http://www.baeldung.com/java-remove-first-element-from-list) +- [How to Find an Element in a List with Java](http://www.baeldung.com/find-list-element-java) +- [Copy a List to Another List in Java](http://www.baeldung.com/java-copy-list-to-another) +- [Finding Max/Min of a List or Collection](http://www.baeldung.com/java-collection-min-max) +- [Collections.emptyList() vs. New List Instance](https://www.baeldung.com/java-collections-emptylist-new-list) +- [Remove All Occurrences of a Specific Value from a List](https://www.baeldung.com/java-remove-value-from-list) +- [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist) +- [Check If Two Lists are Equal in Java](http://www.baeldung.com/java-test-a-list-for-ordinality-and-equality) +- [Java 8 Streams: Find Items From One List Based On Values From Another List](https://www.baeldung.com/java-streams-find-list-items) +- [A Guide to the Java LinkedList](http://www.baeldung.com/java-linkedlist) +- [Java List UnsupportedOperationException](http://www.baeldung.com/java-list-unsupported-operation-exception) +- [Java List Initialization in One Line](https://www.baeldung.com/java-init-list-one-line) +- [Ways to Iterate Over a List in Java](https://www.baeldung.com/java-iterate-list) +- [ClassCastException: Arrays$ArrayList cannot be cast to ArrayList](https://www.baeldung.com/java-classcastexception-arrays-arraylist) +- [Flattening Nested Collections in Java](http://www.baeldung.com/java-flatten-nested-collections) \ No newline at end of file diff --git a/core-java-collections-list/pom.xml b/core-java-collections-list/pom.xml new file mode 100644 index 0000000000..ee99e470d0 --- /dev/null +++ b/core-java-collections-list/pom.xml @@ -0,0 +1,48 @@ + + 4.0.0 + core-java-collections-list + 0.1.0-SNAPSHOT + jar + core-java-collections-list + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + org.projectlombok + lombok + ${lombok.version} + provided + + + + + 4.1 + 3.8.1 + 1.7.0 + 3.11.1 + 1.16.12 + + diff --git a/core-java-collections/src/main/java/com/baeldung/classcastexception/ClassCastException.java b/core-java-collections-list/src/main/java/com/baeldung/classcastexception/ClassCastException.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/classcastexception/ClassCastException.java rename to core-java-collections-list/src/main/java/com/baeldung/classcastexception/ClassCastException.java diff --git a/core-java-collections/src/main/java/com/baeldung/findanelement/Customer.java b/core-java-collections-list/src/main/java/com/baeldung/findanelement/Customer.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/findanelement/Customer.java rename to core-java-collections-list/src/main/java/com/baeldung/findanelement/Customer.java diff --git a/core-java-collections/src/main/java/com/baeldung/findanelement/FindACustomerInGivenList.java b/core-java-collections-list/src/main/java/com/baeldung/findanelement/FindACustomerInGivenList.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/findanelement/FindACustomerInGivenList.java rename to core-java-collections-list/src/main/java/com/baeldung/findanelement/FindACustomerInGivenList.java diff --git a/core-java-collections/src/main/java/com/baeldung/java/list/CopyListService.java b/core-java-collections-list/src/main/java/com/baeldung/java/list/CopyListService.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/java/list/CopyListService.java rename to core-java-collections-list/src/main/java/com/baeldung/java/list/CopyListService.java diff --git a/core-java-collections/src/main/java/com/baeldung/java/list/CustomList.java b/core-java-collections-list/src/main/java/com/baeldung/java/list/CustomList.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/java/list/CustomList.java rename to core-java-collections-list/src/main/java/com/baeldung/java/list/CustomList.java diff --git a/core-java-collections/src/main/java/com/baeldung/java/list/Flower.java b/core-java-collections-list/src/main/java/com/baeldung/java/list/Flower.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/java/list/Flower.java rename to core-java-collections-list/src/main/java/com/baeldung/java/list/Flower.java diff --git a/core-java-collections/src/main/java/com/baeldung/java/list/ReverseIterator.java b/core-java-collections-list/src/main/java/com/baeldung/java/list/ReverseIterator.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/java/list/ReverseIterator.java rename to core-java-collections-list/src/main/java/com/baeldung/java/list/ReverseIterator.java diff --git a/core-java-collections/src/main/java/com/baeldung/java/list/WaysToIterate.java b/core-java-collections-list/src/main/java/com/baeldung/java/list/WaysToIterate.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/java/list/WaysToIterate.java rename to core-java-collections-list/src/main/java/com/baeldung/java/list/WaysToIterate.java diff --git a/core-java-collections/src/main/java/com/baeldung/java_8_features/Car.java b/core-java-collections-list/src/main/java/com/baeldung/java_8_features/Car.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/java_8_features/Car.java rename to core-java-collections-list/src/main/java/com/baeldung/java_8_features/Car.java diff --git a/core-java-collections/src/main/java/com/baeldung/java_8_features/Person.java b/core-java-collections-list/src/main/java/com/baeldung/java_8_features/Person.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/java_8_features/Person.java rename to core-java-collections-list/src/main/java/com/baeldung/java_8_features/Person.java diff --git a/core-java-collections/src/main/java/com/baeldung/list/listoflist/Pen.java b/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Pen.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/list/listoflist/Pen.java rename to core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Pen.java diff --git a/core-java-collections/src/main/java/com/baeldung/list/listoflist/Pencil.java b/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Pencil.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/list/listoflist/Pencil.java rename to core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Pencil.java diff --git a/core-java-collections/src/main/java/com/baeldung/list/listoflist/Rubber.java b/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Rubber.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/list/listoflist/Rubber.java rename to core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Rubber.java diff --git a/core-java-collections/src/main/java/com/baeldung/list/listoflist/Stationery.java b/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Stationery.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/list/listoflist/Stationery.java rename to core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Stationery.java diff --git a/core-java-collections/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java b/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java rename to core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java diff --git a/core-java-collections/src/main/java/com/baeldung/list/multidimensional/ThreeDimensionalArrayList.java b/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ThreeDimensionalArrayList.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/list/multidimensional/ThreeDimensionalArrayList.java rename to core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ThreeDimensionalArrayList.java diff --git a/core-java-collections/src/main/java/com/baeldung/list/removeall/RemoveAll.java b/core-java-collections-list/src/main/java/com/baeldung/list/removeall/RemoveAll.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/list/removeall/RemoveAll.java rename to core-java-collections-list/src/main/java/com/baeldung/list/removeall/RemoveAll.java diff --git a/core-java-collections-list/src/main/resources/logback.xml b/core-java-collections-list/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/core-java-collections-list/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/core-java-collections/src/test/java/com/baeldung/array/converter/ArrayConvertToListUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/array/converter/ArrayConvertToListUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/array/converter/ArrayConvertToListUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/array/converter/ArrayConvertToListUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/collection/ClearVsRemoveAllUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/collection/ClearVsRemoveAllUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/collection/ClearVsRemoveAllUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/collection/ClearVsRemoveAllUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/collection/CollectionsEmpty.java b/core-java-collections-list/src/test/java/com/baeldung/collection/CollectionsEmpty.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/collection/CollectionsEmpty.java rename to core-java-collections-list/src/test/java/com/baeldung/collection/CollectionsEmpty.java diff --git a/core-java-collections/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/findanelement/FindACustomerInGivenListUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/findanelement/FindACustomerInGivenListUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/findanelement/FindACustomerInGivenListUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/findanelement/FindACustomerInGivenListUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/java/list/CopyListServiceUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/java/list/CopyListServiceUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/java/list/CopyListServiceUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/java/list/CopyListServiceUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/java/list/CustomListUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/java/list/CustomListUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/java/list/CustomListUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/java/list/CustomListUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/java/list/ReverseIteratorUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/java/list/ReverseIteratorUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/java/list/ReverseIteratorUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/java/list/ReverseIteratorUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/java/list/WaysToIterateUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/java/list/WaysToIterateUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/java/list/WaysToIterateUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/java/list/WaysToIterateUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/list/listoflist/ListOfListsUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/list/listoflist/ListOfListsUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/list/listoflist/ListOfListsUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/list/listoflist/ListOfListsUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/RandomListElementUnitTest.java b/core-java-collections-list/src/test/java/org/baeldung/RandomListElementUnitTest.java similarity index 98% rename from core-java/src/test/java/com/baeldung/RandomListElementUnitTest.java rename to core-java-collections-list/src/test/java/org/baeldung/RandomListElementUnitTest.java index 6ae7c40f4d..4f5ba0f82f 100644 --- a/core-java/src/test/java/com/baeldung/RandomListElementUnitTest.java +++ b/core-java-collections-list/src/test/java/org/baeldung/RandomListElementUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung; +package org.baeldung; import com.google.common.collect.Lists; import org.junit.Test; diff --git a/core-java-collections/src/test/java/org/baeldung/java/collections/ArrayListUnitTest.java b/core-java-collections-list/src/test/java/org/baeldung/java/collections/ArrayListUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/org/baeldung/java/collections/ArrayListUnitTest.java rename to core-java-collections-list/src/test/java/org/baeldung/java/collections/ArrayListUnitTest.java diff --git a/core-java-collections/src/test/java/org/baeldung/java/collections/CoreJavaCollectionsUnitTest.java b/core-java-collections-list/src/test/java/org/baeldung/java/collections/CoreJavaCollectionsUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/org/baeldung/java/collections/CoreJavaCollectionsUnitTest.java rename to core-java-collections-list/src/test/java/org/baeldung/java/collections/CoreJavaCollectionsUnitTest.java diff --git a/core-java-collections/src/test/java/org/baeldung/java/collections/JavaCollectionCleanupUnitTest.java b/core-java-collections-list/src/test/java/org/baeldung/java/collections/JavaCollectionCleanupUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/org/baeldung/java/collections/JavaCollectionCleanupUnitTest.java rename to core-java-collections-list/src/test/java/org/baeldung/java/collections/JavaCollectionCleanupUnitTest.java diff --git a/core-java-collections/src/test/java/org/baeldung/java/lists/ListAssertJUnitTest.java b/core-java-collections-list/src/test/java/org/baeldung/java/lists/ListAssertJUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/org/baeldung/java/lists/ListAssertJUnitTest.java rename to core-java-collections-list/src/test/java/org/baeldung/java/lists/ListAssertJUnitTest.java diff --git a/core-java-collections/src/test/java/org/baeldung/java/lists/ListJUnitTest.java b/core-java-collections-list/src/test/java/org/baeldung/java/lists/ListJUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/org/baeldung/java/lists/ListJUnitTest.java rename to core-java-collections-list/src/test/java/org/baeldung/java/lists/ListJUnitTest.java diff --git a/core-java-collections/src/test/java/org/baeldung/java/lists/ListTestNgUnitTest.java b/core-java-collections-list/src/test/java/org/baeldung/java/lists/ListTestNgUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/org/baeldung/java/lists/ListTestNgUnitTest.java rename to core-java-collections-list/src/test/java/org/baeldung/java/lists/ListTestNgUnitTest.java diff --git a/core-java-collections/src/test/java/org/baeldung/java/lists/README.md b/core-java-collections-list/src/test/java/org/baeldung/java/lists/README.md similarity index 100% rename from core-java-collections/src/test/java/org/baeldung/java/lists/README.md rename to core-java-collections-list/src/test/java/org/baeldung/java/lists/README.md diff --git a/core-java-collections/README.md b/core-java-collections/README.md index 4c0b24cd5d..15be81156c 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -3,36 +3,21 @@ ## Core Java Collections Cookbooks and Examples ### Relevant Articles: -- [Immutable ArrayList in Java](http://www.baeldung.com/java-immutable-list) -- [Guide to the Java ArrayList](http://www.baeldung.com/java-arraylist) -- [Random List Element](http://www.baeldung.com/java-random-list-element) - [Java - Combine Multiple Collections](http://www.baeldung.com/java-combine-multiple-collections) -- [Removing all nulls from a List in Java](http://www.baeldung.com/java-remove-nulls-from-list) -- [Removing all duplicates from a List in Java](http://www.baeldung.com/java-remove-duplicates-from-list) -- [Flattening Nested Collections in Java](http://www.baeldung.com/java-flatten-nested-collections) - [HashSet and TreeSet Comparison](http://www.baeldung.com/java-hashset-vs-treeset) - [Collect a Java Stream to an Immutable Collection](http://www.baeldung.com/java-stream-immutable-collection) - [Introduction to the Java ArrayDeque](http://www.baeldung.com/java-array-deque) - [A Guide to HashSet in Java](http://www.baeldung.com/java-hashset) - [A Guide to TreeSet in Java](http://www.baeldung.com/java-tree-set) -- [How to TDD a List Implementation in Java](http://www.baeldung.com/java-test-driven-list) - [Getting the Size of an Iterable in Java](http://www.baeldung.com/java-iterable-size) -- [Iterating Backward Through a List](http://www.baeldung.com/java-list-iterate-backwards) - [How to Filter a Collection in Java](http://www.baeldung.com/java-collection-filtering) -- [Add Multiple Items to an Java ArrayList](http://www.baeldung.com/java-add-items-array-list) -- [Remove the First Element from a List](http://www.baeldung.com/java-remove-first-element-from-list) - [Initializing HashSet at the Time of Construction](http://www.baeldung.com/java-initialize-hashset) - [Removing the First Element of an Array](https://www.baeldung.com/java-array-remove-first-element) - [Fail-Safe Iterator vs Fail-Fast Iterator](http://www.baeldung.com/java-fail-safe-vs-fail-fast-iterator) - [Shuffling Collections In Java](http://www.baeldung.com/java-shuffle-collection) -- [How to Find an Element in a List with Java](http://www.baeldung.com/find-list-element-java) - [An Introduction to Java.util.Hashtable Class](http://www.baeldung.com/java-hash-table) -- [Copy a List to Another List in Java](http://www.baeldung.com/java-copy-list-to-another) -- [Finding Max/Min of a List or Collection](http://www.baeldung.com/java-collection-min-max) - [Java Null-Safe Streams from Collections](https://www.baeldung.com/java-null-safe-streams-from-collections) -- [Remove All Occurrences of a Specific Value from a List](https://www.baeldung.com/java-remove-value-from-list) - [Thread Safe LIFO Data Structure Implementations](https://www.baeldung.com/java-lifo-thread-safe) -- [Collections.emptyList() vs. New List Instance](https://www.baeldung.com/java-collections-emptylist-new-list) - [Differences Between Collection.clear() and Collection.removeAll()](https://www.baeldung.com/java-collection-clear-vs-removeall) - [Performance of contains() in a HashSet vs ArrayList](https://www.baeldung.com/java-hashset-arraylist-contains-performance) - [Time Complexity of Java Collections](https://www.baeldung.com/java-collections-complexity) @@ -40,15 +25,7 @@ - [An Introduction to Synchronized Java Collections](https://www.baeldung.com/java-synchronized-collections) - [Guide to EnumSet](https://www.baeldung.com/java-enumset) - [Removing Elements from Java Collections](https://www.baeldung.com/java-collection-remove-elements) -- [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist) -- [Java 8 Streams: Find Items From One List Based On Values From Another List](https://www.baeldung.com/java-streams-find-list-items) - [Combining Different Types of Collections in Java](https://www.baeldung.com/java-combine-collections) - [Sorting in Java](http://www.baeldung.com/java-sorting) -- [A Guide to the Java LinkedList](http://www.baeldung.com/java-linkedlist) -- [Java List UnsupportedOperationException](http://www.baeldung.com/java-list-unsupported-operation-exception) - [Join and Split Arrays and Collections in Java](http://www.baeldung.com/java-join-and-split) -- [Check If Two Lists are Equal in Java](http://www.baeldung.com/java-test-a-list-for-ordinality-and-equality) -- [Java List Initialization in One Line](https://www.baeldung.com/java-init-list-one-line) -- [ClassCastException: Arrays$ArrayList cannot be cast to ArrayList](https://www.baeldung.com/java-classcastexception-arrays-arraylist) -- [A Guide to EnumMap](https://www.baeldung.com/java-enum-map) -- [Ways to Iterate Over a List in Java](https://www.baeldung.com/java-iterate-list) +- [A Guide to EnumMap](https://www.baeldung.com/java-enum-map) \ No newline at end of file diff --git a/pom.xml b/pom.xml index d3a665b4e1..03cc78c9a9 100644 --- a/pom.xml +++ b/pom.xml @@ -379,6 +379,7 @@ core-java-arrays core-java-collections + core-java-collections-list core-java-concurrency-collections core-java-io core-java-lang @@ -1086,6 +1087,7 @@ core-java-arrays core-java-collections + core-java-collections-list core-java-concurrency-collections core-java-io core-java-lang From e8b07fea1dc1b44fcb904c3d0d33ae27ffd4ecd3 Mon Sep 17 00:00:00 2001 From: Ganesh Pagade Date: Sun, 23 Dec 2018 12:05:51 +0530 Subject: [PATCH 037/271] unit tests for nest based access control --- .../src/main/java/com/baeldung/Outer.java | 24 +++++++++ .../test/java/com/baeldung/OuterUnitTest.java | 50 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 core-java-11/src/main/java/com/baeldung/Outer.java create mode 100644 core-java-11/src/test/java/com/baeldung/OuterUnitTest.java diff --git a/core-java-11/src/main/java/com/baeldung/Outer.java b/core-java-11/src/main/java/com/baeldung/Outer.java new file mode 100644 index 0000000000..e2f1479ab1 --- /dev/null +++ b/core-java-11/src/main/java/com/baeldung/Outer.java @@ -0,0 +1,24 @@ +package com.baeldung; + +import java.lang.reflect.Method; + +public class Outer { + + public void outerPublic() { + } + + private void outerPrivate() { + } + + class Inner { + + public void innerPublic() { + outerPrivate(); + } + + public void innerPublicReflection(Outer ob) throws Exception { + Method method = ob.getClass().getDeclaredMethod("outerPrivate"); + method.invoke(ob); + } + } +} \ No newline at end of file diff --git a/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java b/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java new file mode 100644 index 0000000000..a954416f68 --- /dev/null +++ b/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java @@ -0,0 +1,50 @@ +package com.baeldung; + +import static org.hamcrest.CoreMatchers.is; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import org.junit.Test; + +public class OuterUnitTest { + + private static final String NEST_HOST_NAME = "com.baeldung.Outer"; + + @Test + public void whenGetNestHostFromOuter_thenGetNestHost() { + is(Outer.class.getNestHost().getName()).equals(NEST_HOST_NAME); + } + + @Test + public void whenGetNestHostFromInner_thenGetNestHost() { + is(Outer.Inner.class.getNestHost().getName()).equals(NEST_HOST_NAME); + } + + @Test + public void whenCheckNestmatesForNestedClasses_thenGetTrue() { + is(Outer.Inner.class.isNestmateOf(Outer.class)).equals(true); + } + + @Test + public void whenCheckNestmatesForUnrelatedClasses_thenGetFalse() { + is(Outer.Inner.class.isNestmateOf(Outer.class)).equals(false); + } + + @Test + public void whenGetNestMembersForNestedClasses_thenGetAllNestedClasses() { + List nestMembers = Arrays.stream(Outer.Inner.class.getNestMembers()) + .map(Class::getName) + .collect(Collectors.toList()); + + is(nestMembers.size()).equals(2); + + boolean containsOuter = nestMembers.stream() + .anyMatch("com.baeldung.Outer"::equals); + is(containsOuter).equals(true); + + boolean containsInner = nestMembers.stream() + .anyMatch("com.baeldung.Outer$Inner"::equals); + is(containsInner).equals(true); + } +} \ No newline at end of file From 338b0bc80cf15eb20e9f9201e8efafc3d2a65eab Mon Sep 17 00:00:00 2001 From: Ganesh Pagade Date: Sun, 23 Dec 2018 12:08:36 +0530 Subject: [PATCH 038/271] format --- .../src/main/java/com/baeldung/Outer.java | 30 +++++----- .../test/java/com/baeldung/OuterUnitTest.java | 60 +++++++++---------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/core-java-11/src/main/java/com/baeldung/Outer.java b/core-java-11/src/main/java/com/baeldung/Outer.java index e2f1479ab1..1d3cd72b44 100644 --- a/core-java-11/src/main/java/com/baeldung/Outer.java +++ b/core-java-11/src/main/java/com/baeldung/Outer.java @@ -4,21 +4,21 @@ import java.lang.reflect.Method; public class Outer { - public void outerPublic() { - } - - private void outerPrivate() { - } - - class Inner { - - public void innerPublic() { - outerPrivate(); + public void outerPublic() { } - public void innerPublicReflection(Outer ob) throws Exception { - Method method = ob.getClass().getDeclaredMethod("outerPrivate"); - method.invoke(ob); - } - } + private void outerPrivate() { + } + + class Inner { + + public void innerPublic() { + outerPrivate(); + } + + public void innerPublicReflection(Outer ob) throws Exception { + Method method = ob.getClass().getDeclaredMethod("outerPrivate"); + method.invoke(ob); + } + } } \ No newline at end of file diff --git a/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java b/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java index a954416f68..6680a8d518 100644 --- a/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java +++ b/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java @@ -9,42 +9,42 @@ import org.junit.Test; public class OuterUnitTest { - private static final String NEST_HOST_NAME = "com.baeldung.Outer"; + private static final String NEST_HOST_NAME = "com.baeldung.Outer"; - @Test - public void whenGetNestHostFromOuter_thenGetNestHost() { - is(Outer.class.getNestHost().getName()).equals(NEST_HOST_NAME); - } + @Test + public void whenGetNestHostFromOuter_thenGetNestHost() { + is(Outer.class.getNestHost().getName()).equals(NEST_HOST_NAME); + } - @Test - public void whenGetNestHostFromInner_thenGetNestHost() { - is(Outer.Inner.class.getNestHost().getName()).equals(NEST_HOST_NAME); - } + @Test + public void whenGetNestHostFromInner_thenGetNestHost() { + is(Outer.Inner.class.getNestHost().getName()).equals(NEST_HOST_NAME); + } - @Test - public void whenCheckNestmatesForNestedClasses_thenGetTrue() { - is(Outer.Inner.class.isNestmateOf(Outer.class)).equals(true); - } + @Test + public void whenCheckNestmatesForNestedClasses_thenGetTrue() { + is(Outer.Inner.class.isNestmateOf(Outer.class)).equals(true); + } - @Test - public void whenCheckNestmatesForUnrelatedClasses_thenGetFalse() { - is(Outer.Inner.class.isNestmateOf(Outer.class)).equals(false); - } + @Test + public void whenCheckNestmatesForUnrelatedClasses_thenGetFalse() { + is(Outer.Inner.class.isNestmateOf(Outer.class)).equals(false); + } - @Test - public void whenGetNestMembersForNestedClasses_thenGetAllNestedClasses() { - List nestMembers = Arrays.stream(Outer.Inner.class.getNestMembers()) - .map(Class::getName) - .collect(Collectors.toList()); + @Test + public void whenGetNestMembersForNestedClasses_thenGetAllNestedClasses() { + List nestMembers = Arrays.stream(Outer.Inner.class.getNestMembers()) + .map(Class::getName) + .collect(Collectors.toList()); - is(nestMembers.size()).equals(2); + is(nestMembers.size()).equals(2); - boolean containsOuter = nestMembers.stream() - .anyMatch("com.baeldung.Outer"::equals); - is(containsOuter).equals(true); + boolean containsOuter = nestMembers.stream() + .anyMatch("com.baeldung.Outer"::equals); + is(containsOuter).equals(true); - boolean containsInner = nestMembers.stream() - .anyMatch("com.baeldung.Outer$Inner"::equals); - is(containsInner).equals(true); - } + boolean containsInner = nestMembers.stream() + .anyMatch("com.baeldung.Outer$Inner"::equals); + is(containsInner).equals(true); + } } \ No newline at end of file From 7bc513561c21863aa882cfd901950a47cb0198fd Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 23 Dec 2018 23:31:21 +0530 Subject: [PATCH 039/271] [BAEL-10968] - Updated Jackson Dates article --- .../baeldung/jackson/test/JacksonDateUnitTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonDateUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/test/JacksonDateUnitTest.java index 390030d0d4..672ff5c6fd 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonDateUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/test/JacksonDateUnitTest.java @@ -11,7 +11,6 @@ import java.time.LocalDateTime; import java.util.Date; import java.util.TimeZone; -import com.fasterxml.jackson.databind.util.ISO8601DateFormat; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.junit.Test; @@ -24,8 +23,9 @@ import com.baeldung.jackson.date.EventWithSerializer; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.util.StdDateFormat; import com.fasterxml.jackson.datatype.joda.JodaModule; -import com.fasterxml.jackson.datatype.jsr310.JSR310Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; public class JacksonDateUnitTest { @@ -54,10 +54,12 @@ public class JacksonDateUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - mapper.setDateFormat(new ISO8601DateFormat()); + + // StdDateFormat is ISO8601 since jackson 2.9 + mapper.setDateFormat(new StdDateFormat().withColonInTimeZone(true)); final String result = mapper.writeValueAsString(event); - assertThat(result, containsString("1970-01-01T02:30:00Z")); + assertThat(result, containsString("1970-01-01T02:30:00.000+00:00")); } @Test @@ -152,7 +154,7 @@ public class JacksonDateUnitTest { final LocalDateTime date = LocalDateTime.of(2014, 12, 20, 2, 30); final ObjectMapper mapper = new ObjectMapper(); - mapper.registerModule(new JSR310Module()); + mapper.registerModule(new JavaTimeModule()); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); final String result = mapper.writeValueAsString(date); From 8cf3e3f41a348249b8b12502ca09350b065ef2f4 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Mon, 24 Dec 2018 01:10:15 +0530 Subject: [PATCH 040/271] [BAEL-10838] - Created core-java-lang-syntax module --- core-java-lang-syntax/.gitignore | 25 +++++++++ core-java-lang-syntax/README.md | 19 +++++++ core-java-lang-syntax/pom.xml | 53 +++++++++++++++++++ .../baeldung/breakcontinue/BreakContinue.java | 0 .../main/java/com/baeldung/enums/Pizza.java | 0 .../baeldung/enums/PizzaDeliveryStrategy.java | 0 .../PizzaDeliverySystemConfiguration.java | 0 .../main/java/com/baeldung/enums/README.md | 0 .../java/com/baeldung/generics/Building.java | 0 .../java/com/baeldung/generics/Generics.java | 0 .../java/com/baeldung/generics/House.java | 0 .../baeldung/initializationguide/User.java | 0 .../com/baeldung/loops/InfiniteLoops.java | 0 .../java/com/baeldung/loops/LoopsInJava.java | 0 .../switchstatement/SwitchStatement.java | 0 .../java/com/baeldung/system/ChatWindow.java | 0 .../com/baeldung/system/DateTimeService.java | 0 .../baeldung/system/EnvironmentVariables.java | 0 .../com/baeldung/system/SystemErrDemo.java | 0 .../com/baeldung/system/SystemExitDemo.java | 0 .../com/baeldung/system/SystemOutDemo.java | 0 .../com/baeldung/system/UserCredentials.java | 0 .../breakcontinue/BreakContinueUnitTest.java | 0 .../com/baeldung/enums/PizzaUnitTest.java | 0 .../baeldung/generics/GenericsUnitTest.java | 0 .../initializationguide/UserUnitTest.java | 0 .../java/com/baeldung/java/diamond/Car.java | 0 .../java/diamond/DiamondOperatorUnitTest.java | 0 .../com/baeldung/java/diamond/Diesel.java | 0 .../com/baeldung/java/diamond/Engine.java | 0 .../com/baeldung/java/diamond/Vehicle.java | 0 .../java/doublebrace/DoubleBraceUnitTest.java | 0 .../com/baeldung/loops/WhenUsingLoops.java | 0 .../com/baeldung/modulo/ModuloUnitTest.java | 0 .../PrimitiveConversionsJUnitTest.java | 0 .../SwitchStatementUnitTest.java | 0 .../system/DateTimeServiceUnitTest.java | 0 .../system/EnvironmentVariablesUnitTest.java | 0 .../system/SystemArrayCopyUnitTest.java | 0 .../baeldung/system/SystemNanoUnitTest.java | 0 .../system/SystemPropertiesUnitTest.java | 0 .../TernaryOperatorUnitTest.java | 0 .../baeldung/varargs/FormatterUnitTest.java | 0 core-java-lang/README.md | 14 ----- pom.xml | 2 + 45 files changed, 99 insertions(+), 14 deletions(-) create mode 100644 core-java-lang-syntax/.gitignore create mode 100644 core-java-lang-syntax/README.md create mode 100644 core-java-lang-syntax/pom.xml rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/breakcontinue/BreakContinue.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/enums/Pizza.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/enums/README.md (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/generics/Building.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/generics/Generics.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/generics/House.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/initializationguide/User.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/loops/InfiniteLoops.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/loops/LoopsInJava.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/switchstatement/SwitchStatement.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/system/ChatWindow.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/system/DateTimeService.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/system/EnvironmentVariables.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/system/SystemErrDemo.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/system/SystemExitDemo.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/system/SystemOutDemo.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/main/java/com/baeldung/system/UserCredentials.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/breakcontinue/BreakContinueUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/enums/PizzaUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/generics/GenericsUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/initializationguide/UserUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/java/diamond/Car.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/java/diamond/DiamondOperatorUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/java/diamond/Diesel.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/java/diamond/Engine.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/java/diamond/Vehicle.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/java/doublebrace/DoubleBraceUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/loops/WhenUsingLoops.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/modulo/ModuloUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/primitiveconversion/PrimitiveConversionsJUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/switchstatement/SwitchStatementUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/system/DateTimeServiceUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/system/EnvironmentVariablesUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/system/SystemArrayCopyUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/system/SystemNanoUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/system/SystemPropertiesUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java (100%) rename {core-java-lang => core-java-lang-syntax}/src/test/java/com/baeldung/varargs/FormatterUnitTest.java (100%) diff --git a/core-java-lang-syntax/.gitignore b/core-java-lang-syntax/.gitignore new file mode 100644 index 0000000000..374c8bf907 --- /dev/null +++ b/core-java-lang-syntax/.gitignore @@ -0,0 +1,25 @@ +*.class + +0.* + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* +.resourceCache + +# Packaged files # +*.jar +*.war +*.ear + +# Files generated by integration tests +backup-pom.xml +/bin/ +/temp + +#IntelliJ specific +.idea/ +*.iml \ No newline at end of file diff --git a/core-java-lang-syntax/README.md b/core-java-lang-syntax/README.md new file mode 100644 index 0000000000..a7c1b7cc4a --- /dev/null +++ b/core-java-lang-syntax/README.md @@ -0,0 +1,19 @@ +========= + +## Core Java Lang Syntax Cookbooks and Examples + +### Relevant Articles: +- [Introduction to Java Generics](http://www.baeldung.com/java-generics) +- [Java Primitive Conversions](http://www.baeldung.com/java-primitive-conversions) +- [Java Double Brace Initialization](http://www.baeldung.com/java-double-brace-initialization) +- [Guide to the Diamond Operator in Java](http://www.baeldung.com/java-diamond-operator) +- [The Java continue and break Keywords](http://www.baeldung.com/java-continue-and-break) +- [A Guide to Java Initialization](http://www.baeldung.com/java-initialization) +- [A Guide to Java Loops](http://www.baeldung.com/java-loops) +- [Varargs in Java](http://www.baeldung.com/java-varargs) +- [A Guide to Java Enums](http://www.baeldung.com/a-guide-to-java-enums) +- [Infinite Loops in Java](http://www.baeldung.com/infinite-loops-java) +- [Quick Guide to java.lang.System](http://www.baeldung.com/java-lang-system) +- [Java Switch Statement](https://www.baeldung.com/java-switch) +- [The Modulo Operator in Java](https://www.baeldung.com/modulo-java) +- [Ternary Operator In Java](https://www.baeldung.com/java-ternary-operator) \ No newline at end of file diff --git a/core-java-lang-syntax/pom.xml b/core-java-lang-syntax/pom.xml new file mode 100644 index 0000000000..9481f29459 --- /dev/null +++ b/core-java-lang-syntax/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + com.baeldung + core-java-lang-syntax + 0.1.0-SNAPSHOT + jar + core-java-lang-syntax + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + + log4j + log4j + ${log4j.version} + + + org.slf4j + log4j-over-slf4j + ${org.slf4j.version} + + + + org.assertj + assertj-core + ${assertj-core.version} + test + + + + + core-java-lang-syntax + + + src/main/resources + true + + + + + + + 3.10.0 + + + diff --git a/core-java-lang/src/main/java/com/baeldung/breakcontinue/BreakContinue.java b/core-java-lang-syntax/src/main/java/com/baeldung/breakcontinue/BreakContinue.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/breakcontinue/BreakContinue.java rename to core-java-lang-syntax/src/main/java/com/baeldung/breakcontinue/BreakContinue.java diff --git a/core-java-lang/src/main/java/com/baeldung/enums/Pizza.java b/core-java-lang-syntax/src/main/java/com/baeldung/enums/Pizza.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/enums/Pizza.java rename to core-java-lang-syntax/src/main/java/com/baeldung/enums/Pizza.java diff --git a/core-java-lang/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java b/core-java-lang-syntax/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java rename to core-java-lang-syntax/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java diff --git a/core-java-lang/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java b/core-java-lang-syntax/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java rename to core-java-lang-syntax/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java diff --git a/core-java-lang/src/main/java/com/baeldung/enums/README.md b/core-java-lang-syntax/src/main/java/com/baeldung/enums/README.md similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/enums/README.md rename to core-java-lang-syntax/src/main/java/com/baeldung/enums/README.md diff --git a/core-java-lang/src/main/java/com/baeldung/generics/Building.java b/core-java-lang-syntax/src/main/java/com/baeldung/generics/Building.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/generics/Building.java rename to core-java-lang-syntax/src/main/java/com/baeldung/generics/Building.java diff --git a/core-java-lang/src/main/java/com/baeldung/generics/Generics.java b/core-java-lang-syntax/src/main/java/com/baeldung/generics/Generics.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/generics/Generics.java rename to core-java-lang-syntax/src/main/java/com/baeldung/generics/Generics.java diff --git a/core-java-lang/src/main/java/com/baeldung/generics/House.java b/core-java-lang-syntax/src/main/java/com/baeldung/generics/House.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/generics/House.java rename to core-java-lang-syntax/src/main/java/com/baeldung/generics/House.java diff --git a/core-java-lang/src/main/java/com/baeldung/initializationguide/User.java b/core-java-lang-syntax/src/main/java/com/baeldung/initializationguide/User.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/initializationguide/User.java rename to core-java-lang-syntax/src/main/java/com/baeldung/initializationguide/User.java diff --git a/core-java-lang/src/main/java/com/baeldung/loops/InfiniteLoops.java b/core-java-lang-syntax/src/main/java/com/baeldung/loops/InfiniteLoops.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/loops/InfiniteLoops.java rename to core-java-lang-syntax/src/main/java/com/baeldung/loops/InfiniteLoops.java diff --git a/core-java-lang/src/main/java/com/baeldung/loops/LoopsInJava.java b/core-java-lang-syntax/src/main/java/com/baeldung/loops/LoopsInJava.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/loops/LoopsInJava.java rename to core-java-lang-syntax/src/main/java/com/baeldung/loops/LoopsInJava.java diff --git a/core-java-lang/src/main/java/com/baeldung/switchstatement/SwitchStatement.java b/core-java-lang-syntax/src/main/java/com/baeldung/switchstatement/SwitchStatement.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/switchstatement/SwitchStatement.java rename to core-java-lang-syntax/src/main/java/com/baeldung/switchstatement/SwitchStatement.java diff --git a/core-java-lang/src/main/java/com/baeldung/system/ChatWindow.java b/core-java-lang-syntax/src/main/java/com/baeldung/system/ChatWindow.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/system/ChatWindow.java rename to core-java-lang-syntax/src/main/java/com/baeldung/system/ChatWindow.java diff --git a/core-java-lang/src/main/java/com/baeldung/system/DateTimeService.java b/core-java-lang-syntax/src/main/java/com/baeldung/system/DateTimeService.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/system/DateTimeService.java rename to core-java-lang-syntax/src/main/java/com/baeldung/system/DateTimeService.java diff --git a/core-java-lang/src/main/java/com/baeldung/system/EnvironmentVariables.java b/core-java-lang-syntax/src/main/java/com/baeldung/system/EnvironmentVariables.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/system/EnvironmentVariables.java rename to core-java-lang-syntax/src/main/java/com/baeldung/system/EnvironmentVariables.java diff --git a/core-java-lang/src/main/java/com/baeldung/system/SystemErrDemo.java b/core-java-lang-syntax/src/main/java/com/baeldung/system/SystemErrDemo.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/system/SystemErrDemo.java rename to core-java-lang-syntax/src/main/java/com/baeldung/system/SystemErrDemo.java diff --git a/core-java-lang/src/main/java/com/baeldung/system/SystemExitDemo.java b/core-java-lang-syntax/src/main/java/com/baeldung/system/SystemExitDemo.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/system/SystemExitDemo.java rename to core-java-lang-syntax/src/main/java/com/baeldung/system/SystemExitDemo.java diff --git a/core-java-lang/src/main/java/com/baeldung/system/SystemOutDemo.java b/core-java-lang-syntax/src/main/java/com/baeldung/system/SystemOutDemo.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/system/SystemOutDemo.java rename to core-java-lang-syntax/src/main/java/com/baeldung/system/SystemOutDemo.java diff --git a/core-java-lang/src/main/java/com/baeldung/system/UserCredentials.java b/core-java-lang-syntax/src/main/java/com/baeldung/system/UserCredentials.java similarity index 100% rename from core-java-lang/src/main/java/com/baeldung/system/UserCredentials.java rename to core-java-lang-syntax/src/main/java/com/baeldung/system/UserCredentials.java diff --git a/core-java-lang/src/test/java/com/baeldung/breakcontinue/BreakContinueUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/breakcontinue/BreakContinueUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/breakcontinue/BreakContinueUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/breakcontinue/BreakContinueUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/enums/PizzaUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/enums/PizzaUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/enums/PizzaUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/enums/PizzaUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/generics/GenericsUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/generics/GenericsUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/generics/GenericsUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/generics/GenericsUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/initializationguide/UserUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/initializationguide/UserUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/initializationguide/UserUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/initializationguide/UserUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/java/diamond/Car.java b/core-java-lang-syntax/src/test/java/com/baeldung/java/diamond/Car.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/java/diamond/Car.java rename to core-java-lang-syntax/src/test/java/com/baeldung/java/diamond/Car.java diff --git a/core-java-lang/src/test/java/com/baeldung/java/diamond/DiamondOperatorUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/java/diamond/DiamondOperatorUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/java/diamond/DiamondOperatorUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/java/diamond/DiamondOperatorUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/java/diamond/Diesel.java b/core-java-lang-syntax/src/test/java/com/baeldung/java/diamond/Diesel.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/java/diamond/Diesel.java rename to core-java-lang-syntax/src/test/java/com/baeldung/java/diamond/Diesel.java diff --git a/core-java-lang/src/test/java/com/baeldung/java/diamond/Engine.java b/core-java-lang-syntax/src/test/java/com/baeldung/java/diamond/Engine.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/java/diamond/Engine.java rename to core-java-lang-syntax/src/test/java/com/baeldung/java/diamond/Engine.java diff --git a/core-java-lang/src/test/java/com/baeldung/java/diamond/Vehicle.java b/core-java-lang-syntax/src/test/java/com/baeldung/java/diamond/Vehicle.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/java/diamond/Vehicle.java rename to core-java-lang-syntax/src/test/java/com/baeldung/java/diamond/Vehicle.java diff --git a/core-java-lang/src/test/java/com/baeldung/java/doublebrace/DoubleBraceUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/java/doublebrace/DoubleBraceUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/java/doublebrace/DoubleBraceUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/java/doublebrace/DoubleBraceUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/loops/WhenUsingLoops.java b/core-java-lang-syntax/src/test/java/com/baeldung/loops/WhenUsingLoops.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/loops/WhenUsingLoops.java rename to core-java-lang-syntax/src/test/java/com/baeldung/loops/WhenUsingLoops.java diff --git a/core-java-lang/src/test/java/com/baeldung/modulo/ModuloUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/modulo/ModuloUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/modulo/ModuloUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/modulo/ModuloUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/primitiveconversion/PrimitiveConversionsJUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/primitiveconversion/PrimitiveConversionsJUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/primitiveconversion/PrimitiveConversionsJUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/primitiveconversion/PrimitiveConversionsJUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/switchstatement/SwitchStatementUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/switchstatement/SwitchStatementUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/switchstatement/SwitchStatementUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/switchstatement/SwitchStatementUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/system/DateTimeServiceUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/system/DateTimeServiceUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/system/DateTimeServiceUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/system/DateTimeServiceUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/system/EnvironmentVariablesUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/system/EnvironmentVariablesUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/system/EnvironmentVariablesUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/system/EnvironmentVariablesUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/system/SystemArrayCopyUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/system/SystemArrayCopyUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/system/SystemArrayCopyUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/system/SystemArrayCopyUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/system/SystemNanoUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/system/SystemNanoUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/system/SystemNanoUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/system/SystemNanoUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/system/SystemPropertiesUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/system/SystemPropertiesUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/system/SystemPropertiesUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/system/SystemPropertiesUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/varargs/FormatterUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/varargs/FormatterUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/varargs/FormatterUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/varargs/FormatterUnitTest.java diff --git a/core-java-lang/README.md b/core-java-lang/README.md index 69209bb193..0ca4d3009f 100644 --- a/core-java-lang/README.md +++ b/core-java-lang/README.md @@ -4,24 +4,16 @@ ### Relevant Articles: - [Guide to Java Reflection](http://www.baeldung.com/java-reflection) -- [Introduction to Java Generics](http://www.baeldung.com/java-generics) - [Generate equals() and hashCode() with Eclipse](http://www.baeldung.com/java-eclipse-equals-and-hashcode) - [Chained Exceptions in Java](http://www.baeldung.com/java-chained-exceptions) -- [Java Primitive Conversions](http://www.baeldung.com/java-primitive-conversions) - [Call Methods at Runtime Using Java Reflection](http://www.baeldung.com/java-method-reflection) - [Iterating Over Enum Values in Java](http://www.baeldung.com/java-enum-iteration) - [Changing Annotation Parameters At Runtime](http://www.baeldung.com/java-reflection-change-annotation-params) - [Dynamic Proxies in Java](http://www.baeldung.com/java-dynamic-proxies) -- [Java Double Brace Initialization](http://www.baeldung.com/java-double-brace-initialization) - [Guide to hashCode() in Java](http://www.baeldung.com/java-hashcode) -- [Guide to the Diamond Operator in Java](http://www.baeldung.com/java-diamond-operator) - [A Guide to the Static Keyword in Java](http://www.baeldung.com/java-static) - [Quick Example - Comparator vs Comparable in Java](http://www.baeldung.com/java-comparator-comparable) -- [The Java continue and break Keywords](http://www.baeldung.com/java-continue-and-break) -- [A Guide to Java Initialization](http://www.baeldung.com/java-initialization) - [Nested Classes in Java](http://www.baeldung.com/java-nested-classes) -- [A Guide to Java Loops](http://www.baeldung.com/java-loops) -- [Varargs in Java](http://www.baeldung.com/java-varargs) - [A Guide to Inner Interfaces in Java](http://www.baeldung.com/java-inner-interfaces) - [Polymorphism in Java](http://www.baeldung.com/java-polymorphism) - [Recursion In Java](http://www.baeldung.com/java-recursion) @@ -31,9 +23,6 @@ - [Guide to Inheritance in Java](http://www.baeldung.com/java-inheritance) - [Object Type Casting in Java](http://www.baeldung.com/java-type-casting) - [The "final" Keyword in Java](http://www.baeldung.com/java-final) -- [A Guide to Java Enums](http://www.baeldung.com/a-guide-to-java-enums) -- [Infinite Loops in Java](http://www.baeldung.com/infinite-loops-java) -- [Quick Guide to java.lang.System](http://www.baeldung.com/java-lang-system) - [Type Erasure in Java Explained](http://www.baeldung.com/java-type-erasure) - [Using Java Assertions](http://www.baeldung.com/java-assert) - [Pass-By-Value as a Parameter Passing Mechanism in Java](http://www.baeldung.com/java-pass-by-value-or-pass-by-reference) @@ -50,9 +39,6 @@ - [Static and Dynamic Binding in Java](https://www.baeldung.com/java-static-dynamic-binding) - [Difference Between Throw and Throws in Java](https://www.baeldung.com/java-throw-throws) - [Synthetic Constructs in Java](https://www.baeldung.com/java-synthetic) -- [Java Switch Statement](https://www.baeldung.com/java-switch) -- [The Modulo Operator in Java](https://www.baeldung.com/modulo-java) -- [Ternary Operator In Java](https://www.baeldung.com/java-ternary-operator) - [How to Separate Double into Integer and Decimal Parts](https://www.baeldung.com/java-separate-double-into-integer-decimal-parts) - [“Sneaky Throws” in Java](http://www.baeldung.com/java-sneaky-throws) - [Inheritance and Composition (Is-a vs Has-a relationship) in Java](http://www.baeldung.com/java-inheritance-composition) diff --git a/pom.xml b/pom.xml index d3a665b4e1..adea3b114d 100644 --- a/pom.xml +++ b/pom.xml @@ -381,6 +381,7 @@ core-java-collections core-java-concurrency-collections core-java-io + core-java-lang-syntax core-java-lang core-java-networking core-java-sun @@ -1088,6 +1089,7 @@ core-java-collections core-java-concurrency-collections core-java-io + core-java-lang-syntax core-java-lang core-java-networking core-java-sun From cdaf0b46bfe7ea3119c440659cad6bfe53e462d3 Mon Sep 17 00:00:00 2001 From: Fabian Rivera Date: Mon, 24 Dec 2018 17:44:09 -0600 Subject: [PATCH 041/271] BAEL-2454 Reading the error response and building the full response BAEL-2454 Add examples for reading response content on failed requests. Add example on how to build full response string. --- .../baeldung/http/FullResponseBuilder.java | 65 ++++++++++++++++++ .../baeldung/http/HttpRequestLiveTest.java | 66 +++++++++++++++++-- 2 files changed, 126 insertions(+), 5 deletions(-) create mode 100644 core-java/src/main/java/com/baeldung/http/FullResponseBuilder.java diff --git a/core-java/src/main/java/com/baeldung/http/FullResponseBuilder.java b/core-java/src/main/java/com/baeldung/http/FullResponseBuilder.java new file mode 100644 index 0000000000..394255bd70 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/http/FullResponseBuilder.java @@ -0,0 +1,65 @@ +package com.baeldung.http; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.net.HttpURLConnection; +import java.util.Iterator; +import java.util.List; + +public class FullResponseBuilder { + public static String getFullResponse(HttpURLConnection con) throws IOException { + StringBuilder fullResponseBuilder = new StringBuilder(); + + fullResponseBuilder.append(con.getResponseCode()) + .append(" ") + .append(con.getResponseMessage()) + .append("\n"); + + con.getHeaderFields() + .entrySet() + .stream() + .filter(entry -> entry.getKey() != null) + .forEach(entry -> { + + fullResponseBuilder.append(entry.getKey()) + .append(": "); + + List headerValues = entry.getValue(); + Iterator it = headerValues.iterator(); + if (it.hasNext()) { + fullResponseBuilder.append(it.next()); + + while (it.hasNext()) { + fullResponseBuilder.append(", ") + .append(it.next()); + } + } + + fullResponseBuilder.append("\n"); + }); + + Reader streamReader = null; + + if (con.getResponseCode() > 299) { + streamReader = new InputStreamReader(con.getErrorStream()); + } else { + streamReader = new InputStreamReader(con.getInputStream()); + } + + BufferedReader in = new BufferedReader(streamReader); + String inputLine; + StringBuilder content = new StringBuilder(); + while ((inputLine = in.readLine()) != null) { + content.append(inputLine); + } + + in.close(); + + fullResponseBuilder.append("Response: ") + .append(content); + + return fullResponseBuilder.toString(); + } +} diff --git a/core-java/src/test/java/com/baeldung/http/HttpRequestLiveTest.java b/core-java/src/test/java/com/baeldung/http/HttpRequestLiveTest.java index acd6536ac4..37e9f0d752 100644 --- a/core-java/src/test/java/com/baeldung/http/HttpRequestLiveTest.java +++ b/core-java/src/test/java/com/baeldung/http/HttpRequestLiveTest.java @@ -7,6 +7,7 @@ import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.io.Reader; import java.net.CookieManager; import java.net.HttpCookie; import java.net.HttpURLConnection; @@ -48,7 +49,8 @@ public class HttpRequestLiveTest { in.close(); assertEquals("status code incorrect", status, 200); - assertTrue("content incorrect", content.toString().contains("Example Domain")); + assertTrue("content incorrect", content.toString() + .contains("Example Domain")); } @Test @@ -89,18 +91,24 @@ public class HttpRequestLiveTest { Optional usernameCookie = null; if (cookiesHeader != null) { List cookies = HttpCookie.parse(cookiesHeader); - cookies.forEach(cookie -> cookieManager.getCookieStore().add(null, cookie)); - usernameCookie = cookies.stream().findAny().filter(cookie -> cookie.getName().equals("username")); + cookies.forEach(cookie -> cookieManager.getCookieStore() + .add(null, cookie)); + usernameCookie = cookies.stream() + .findAny() + .filter(cookie -> cookie.getName() + .equals("username")); } if (usernameCookie == null) { - cookieManager.getCookieStore().add(null, new HttpCookie("username", "john")); + cookieManager.getCookieStore() + .add(null, new HttpCookie("username", "john")); } con.disconnect(); con = (HttpURLConnection) url.openConnection(); - con.setRequestProperty("Cookie", StringUtils.join(cookieManager.getCookieStore().getCookies(), ";")); + con.setRequestProperty("Cookie", StringUtils.join(cookieManager.getCookieStore() + .getCookies(), ";")); int status = con.getResponseCode(); @@ -125,4 +133,52 @@ public class HttpRequestLiveTest { assertEquals("status code incorrect", con.getResponseCode(), 200); } + @Test + public void whenFailedRequest_thenOk() throws IOException { + URL url = new URL("http://example.com"); + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setRequestMethod("POST"); + + con.setConnectTimeout(5000); + con.setReadTimeout(5000); + + int status = con.getResponseCode(); + + Reader streamReader = null; + + if (status > 299) { + streamReader = new InputStreamReader(con.getErrorStream()); + } else { + streamReader = new InputStreamReader(con.getInputStream()); + } + + BufferedReader in = new BufferedReader(streamReader); + String inputLine; + StringBuilder content = new StringBuilder(); + while ((inputLine = in.readLine()) != null) { + content.append(inputLine); + } + in.close(); + + assertEquals("status code incorrect", status, 411); + assertTrue("error content", content.toString() + .contains("411 - Length Required")); + } + + @Test + public void whenGetRequestFullResponse_thenOk() throws IOException { + URL url = new URL("http://example.com"); + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setRequestMethod("GET"); + + con.setConnectTimeout(5000); + con.setReadTimeout(5000); + + String fullResponse = FullResponseBuilder.getFullResponse(con); + + assertEquals("status code incorrect", con.getResponseCode(), 200); + assertTrue("header incorrect", fullResponse.contains("Content-Type: text/html; charset=UTF-8")); + assertTrue("response incorrect", fullResponse.contains("")); + } + } From 48c0b83978c8f799e2ea2c0ba5b0e715277b34a4 Mon Sep 17 00:00:00 2001 From: Fabian Rivera Date: Mon, 24 Dec 2018 17:46:12 -0600 Subject: [PATCH 042/271] BAEL-2454 Add missing disconnect call on open connections --- .../src/test/java/com/baeldung/http/HttpRequestLiveTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core-java/src/test/java/com/baeldung/http/HttpRequestLiveTest.java b/core-java/src/test/java/com/baeldung/http/HttpRequestLiveTest.java index 37e9f0d752..752a75daa5 100644 --- a/core-java/src/test/java/com/baeldung/http/HttpRequestLiveTest.java +++ b/core-java/src/test/java/com/baeldung/http/HttpRequestLiveTest.java @@ -160,6 +160,8 @@ public class HttpRequestLiveTest { } in.close(); + con.disconnect(); + assertEquals("status code incorrect", status, 411); assertTrue("error content", content.toString() .contains("411 - Length Required")); @@ -176,6 +178,8 @@ public class HttpRequestLiveTest { String fullResponse = FullResponseBuilder.getFullResponse(con); + con.disconnect(); + assertEquals("status code incorrect", con.getResponseCode(), 200); assertTrue("header incorrect", fullResponse.contains("Content-Type: text/html; charset=UTF-8")); assertTrue("response incorrect", fullResponse.contains("")); From 10c52bc1b900d46d08d4b7ec51fea74a8894cdc7 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Tue, 25 Dec 2018 16:32:35 +0530 Subject: [PATCH 043/271] [BAEL-10839] - Added missed class and moved articles related to hashcode and equals --- core-java-lang-oop/README.md | 4 +++- .../baeldung/immutableobjects/ImmutableObjectsUnitTest.java | 0 core-java-lang/README.md | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-) rename {core-java-lang => core-java-lang-oop}/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java (100%) diff --git a/core-java-lang-oop/README.md b/core-java-lang-oop/README.md index 665178452c..3531ab9677 100644 --- a/core-java-lang-oop/README.md +++ b/core-java-lang-oop/README.md @@ -20,4 +20,6 @@ - [Guide to the this Java Keyword](http://www.baeldung.com/java-this) - [Immutable Objects in Java](http://www.baeldung.com/java-immutable-object) - [Inheritance and Composition (Is-a vs Has-a relationship) in Java](http://www.baeldung.com/java-inheritance-composition) -- [A Guide to Constructors in Java](https://www.baeldung.com/java-constructors) \ No newline at end of file +- [A Guide to Constructors in Java](https://www.baeldung.com/java-constructors) +- [Generate equals() and hashCode() with Eclipse](http://www.baeldung.com/java-eclipse-equals-and-hashcode) +- [Java equals() and hashCode() Contracts](https://www.baeldung.com/java-equals-hashcode-contracts) \ No newline at end of file diff --git a/core-java-lang/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java b/core-java-lang-oop/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java similarity index 100% rename from core-java-lang/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java rename to core-java-lang-oop/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java diff --git a/core-java-lang/README.md b/core-java-lang/README.md index 56de6d2e82..68cd7ce452 100644 --- a/core-java-lang/README.md +++ b/core-java-lang/README.md @@ -5,7 +5,6 @@ ### Relevant Articles: - [Guide to Java Reflection](http://www.baeldung.com/java-reflection) - [Introduction to Java Generics](http://www.baeldung.com/java-generics) -- [Generate equals() and hashCode() with Eclipse](http://www.baeldung.com/java-eclipse-equals-and-hashcode) - [Chained Exceptions in Java](http://www.baeldung.com/java-chained-exceptions) - [Java Primitive Conversions](http://www.baeldung.com/java-primitive-conversions) - [Call Methods at Runtime Using Java Reflection](http://www.baeldung.com/java-method-reflection) @@ -40,4 +39,3 @@ - [How to Separate Double into Integer and Decimal Parts](https://www.baeldung.com/java-separate-double-into-integer-decimal-parts) - [“Sneaky Throws” in Java](http://www.baeldung.com/java-sneaky-throws) - [Retrieving a Class Name in Java](https://www.baeldung.com/java-class-name) -- [Java equals() and hashCode() Contracts](https://www.baeldung.com/java-equals-hashcode-contracts) From fb66f1bc78fd363c0c51c110f98ab97272111d11 Mon Sep 17 00:00:00 2001 From: Loredana Date: Tue, 25 Dec 2018 14:05:10 +0200 Subject: [PATCH 044/271] move networking articles, update readme --- core-java-networking/README.md | 4 +++- core-java-networking/pom.xml | 6 ++++++ .../src/main/java/com/baeldung/networking/README.md | 5 ----- .../main/java/com/baeldung/networking}/uriurl/URIDemo.java | 2 +- .../main/java/com/baeldung/networking}/uriurl/URLDemo.java | 2 +- .../networking/interfaces/NetworkInterfaceManualTest.java | 2 +- .../com/baeldung/networking/uriurl}/URIDemoLiveTest.java | 4 ++-- .../com/baeldung/networking}/uriurl/URIvsURLUnitTest.java | 2 +- .../com/baeldung/networking/uriurl}/URLDemoLiveTest.java | 4 ++-- .../test/java/com/baeldung}/networking/url/UrlUnitTest.java | 2 +- core-java/README.md | 1 + .../main/java/com/baeldung/console/ConsoleConsoleClass.java | 0 .../main/java/com/baeldung/console/ConsoleScannerClass.java | 0 13 files changed, 19 insertions(+), 15 deletions(-) delete mode 100644 core-java-networking/src/main/java/com/baeldung/networking/README.md rename {core-java/src/main/java/com/baeldung/javanetworking => core-java-networking/src/main/java/com/baeldung/networking}/uriurl/URIDemo.java (98%) rename {core-java/src/main/java/com/baeldung/javanetworking => core-java-networking/src/main/java/com/baeldung/networking}/uriurl/URLDemo.java (98%) rename {core-java/src/test/java/com/baeldung/java => core-java-networking/src/test/java/com/baeldung}/networking/interfaces/NetworkInterfaceManualTest.java (98%) rename {core-java/src/test/java/com/baeldung/javanetworking/uriurl/test => core-java-networking/src/test/java/com/baeldung/networking/uriurl}/URIDemoLiveTest.java (95%) rename {core-java/src/test/java/com/baeldung/javanetworking => core-java-networking/src/test/java/com/baeldung/networking}/uriurl/URIvsURLUnitTest.java (98%) rename {core-java/src/test/java/com/baeldung/javanetworking/uriurl/test => core-java-networking/src/test/java/com/baeldung/networking/uriurl}/URLDemoLiveTest.java (97%) rename {core-java/src/test/java/com/baeldung/java => core-java-networking/src/test/java/com/baeldung}/networking/url/UrlUnitTest.java (98%) rename {core-java-networking => core-java}/src/main/java/com/baeldung/console/ConsoleConsoleClass.java (100%) rename {core-java-networking => core-java}/src/main/java/com/baeldung/console/ConsoleScannerClass.java (100%) diff --git a/core-java-networking/README.md b/core-java-networking/README.md index 2cb2c52d3d..4b77aa3c1f 100644 --- a/core-java-networking/README.md +++ b/core-java-networking/README.md @@ -8,4 +8,6 @@ - [Broadcasting and Multicasting in Java](http://www.baeldung.com/java-broadcast-multicast) - [A Guide To UDP In Java](http://www.baeldung.com/udp-in-java) - [Sending Emails with Java](http://www.baeldung.com/java-email) -- [Console I/O in Java](http://www.baeldung.com/java-console-input-output) \ No newline at end of file +- [A Guide To HTTP Cookies In Java](http://www.baeldung.com/cookies-java) +- [A Guide to the Java URL](http://www.baeldung.com/java-url) +- [Working with Network Interfaces in Java](http://www.baeldung.com/java-network-interfaces) diff --git a/core-java-networking/pom.xml b/core-java-networking/pom.xml index 7d7bf4bc95..c7fa2af180 100644 --- a/core-java-networking/pom.xml +++ b/core-java-networking/pom.xml @@ -19,6 +19,11 @@ mail ${javax.mail.version} + + commons-io + commons-io + ${commons-io.version} + @@ -27,5 +32,6 @@ 1.5.0-b01 + 2.5 diff --git a/core-java-networking/src/main/java/com/baeldung/networking/README.md b/core-java-networking/src/main/java/com/baeldung/networking/README.md deleted file mode 100644 index b9e827f085..0000000000 --- a/core-java-networking/src/main/java/com/baeldung/networking/README.md +++ /dev/null @@ -1,5 +0,0 @@ -### Relevant Articles: -- [A Guide To UDP In Java](http://www.baeldung.com/udp-in-java) -- [A Guide To HTTP Cookies In Java](http://www.baeldung.com/cookies-java) -- [A Guide to the Java URL](http://www.baeldung.com/java-url) -- [Working with Network Interfaces in Java](http://www.baeldung.com/java-network-interfaces) diff --git a/core-java/src/main/java/com/baeldung/javanetworking/uriurl/URIDemo.java b/core-java-networking/src/main/java/com/baeldung/networking/uriurl/URIDemo.java similarity index 98% rename from core-java/src/main/java/com/baeldung/javanetworking/uriurl/URIDemo.java rename to core-java-networking/src/main/java/com/baeldung/networking/uriurl/URIDemo.java index 121e0f5d72..91f6e21293 100644 --- a/core-java/src/main/java/com/baeldung/javanetworking/uriurl/URIDemo.java +++ b/core-java-networking/src/main/java/com/baeldung/networking/uriurl/URIDemo.java @@ -1,4 +1,4 @@ -package com.baeldung.javanetworking.uriurl; +package com.baeldung.networking.uriurl; import java.io.BufferedReader; import java.io.IOException; diff --git a/core-java/src/main/java/com/baeldung/javanetworking/uriurl/URLDemo.java b/core-java-networking/src/main/java/com/baeldung/networking/uriurl/URLDemo.java similarity index 98% rename from core-java/src/main/java/com/baeldung/javanetworking/uriurl/URLDemo.java rename to core-java-networking/src/main/java/com/baeldung/networking/uriurl/URLDemo.java index 109a9951d2..d257e7a295 100644 --- a/core-java/src/main/java/com/baeldung/javanetworking/uriurl/URLDemo.java +++ b/core-java-networking/src/main/java/com/baeldung/networking/uriurl/URLDemo.java @@ -1,4 +1,4 @@ -package com.baeldung.javanetworking.uriurl; +package com.baeldung.networking.uriurl; import java.io.BufferedReader; import java.io.IOException; diff --git a/core-java/src/test/java/com/baeldung/java/networking/interfaces/NetworkInterfaceManualTest.java b/core-java-networking/src/test/java/com/baeldung/networking/interfaces/NetworkInterfaceManualTest.java similarity index 98% rename from core-java/src/test/java/com/baeldung/java/networking/interfaces/NetworkInterfaceManualTest.java rename to core-java-networking/src/test/java/com/baeldung/networking/interfaces/NetworkInterfaceManualTest.java index 8635a24f18..47a598f599 100644 --- a/core-java/src/test/java/com/baeldung/java/networking/interfaces/NetworkInterfaceManualTest.java +++ b/core-java-networking/src/test/java/com/baeldung/networking/interfaces/NetworkInterfaceManualTest.java @@ -1,4 +1,4 @@ -package com.baeldung.java.networking.interfaces; +package com.baeldung.networking.interfaces; import org.junit.Test; diff --git a/core-java/src/test/java/com/baeldung/javanetworking/uriurl/test/URIDemoLiveTest.java b/core-java-networking/src/test/java/com/baeldung/networking/uriurl/URIDemoLiveTest.java similarity index 95% rename from core-java/src/test/java/com/baeldung/javanetworking/uriurl/test/URIDemoLiveTest.java rename to core-java-networking/src/test/java/com/baeldung/networking/uriurl/URIDemoLiveTest.java index 0c312ff613..3b73cc0943 100644 --- a/core-java/src/test/java/com/baeldung/javanetworking/uriurl/test/URIDemoLiveTest.java +++ b/core-java-networking/src/test/java/com/baeldung/networking/uriurl/URIDemoLiveTest.java @@ -1,4 +1,4 @@ -package com.baeldung.javanetworking.uriurl.test; +package com.baeldung.networking.uriurl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -20,7 +20,7 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.baeldung.javanetworking.uriurl.URLDemo; +import com.baeldung.networking.uriurl.URLDemo; @FixMethodOrder public class URIDemoLiveTest { diff --git a/core-java/src/test/java/com/baeldung/javanetworking/uriurl/URIvsURLUnitTest.java b/core-java-networking/src/test/java/com/baeldung/networking/uriurl/URIvsURLUnitTest.java similarity index 98% rename from core-java/src/test/java/com/baeldung/javanetworking/uriurl/URIvsURLUnitTest.java rename to core-java-networking/src/test/java/com/baeldung/networking/uriurl/URIvsURLUnitTest.java index 8837dc5556..ec1cb4c0c9 100644 --- a/core-java/src/test/java/com/baeldung/javanetworking/uriurl/URIvsURLUnitTest.java +++ b/core-java-networking/src/test/java/com/baeldung/networking/uriurl/URIvsURLUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.javanetworking.uriurl; +package com.baeldung.networking.uriurl; import java.io.IOException; import java.net.MalformedURLException; diff --git a/core-java/src/test/java/com/baeldung/javanetworking/uriurl/test/URLDemoLiveTest.java b/core-java-networking/src/test/java/com/baeldung/networking/uriurl/URLDemoLiveTest.java similarity index 97% rename from core-java/src/test/java/com/baeldung/javanetworking/uriurl/test/URLDemoLiveTest.java rename to core-java-networking/src/test/java/com/baeldung/networking/uriurl/URLDemoLiveTest.java index 15f53ed878..a9104311e6 100644 --- a/core-java/src/test/java/com/baeldung/javanetworking/uriurl/test/URLDemoLiveTest.java +++ b/core-java-networking/src/test/java/com/baeldung/networking/uriurl/URLDemoLiveTest.java @@ -1,4 +1,4 @@ -package com.baeldung.javanetworking.uriurl.test; +package com.baeldung.networking.uriurl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -18,7 +18,7 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.baeldung.javanetworking.uriurl.URLDemo; +import com.baeldung.networking.uriurl.URLDemo; @FixMethodOrder public class URLDemoLiveTest { diff --git a/core-java/src/test/java/com/baeldung/java/networking/url/UrlUnitTest.java b/core-java-networking/src/test/java/com/baeldung/networking/url/UrlUnitTest.java similarity index 98% rename from core-java/src/test/java/com/baeldung/java/networking/url/UrlUnitTest.java rename to core-java-networking/src/test/java/com/baeldung/networking/url/UrlUnitTest.java index 505d9595ab..112f2cf53f 100644 --- a/core-java/src/test/java/com/baeldung/java/networking/url/UrlUnitTest.java +++ b/core-java-networking/src/test/java/com/baeldung/networking/url/UrlUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.java.networking.url; +package com.baeldung.networking.url; import static org.junit.Assert.assertEquals; diff --git a/core-java/README.md b/core-java/README.md index 961ca45cce..b0e8f81e1f 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -71,3 +71,4 @@ - [Calculate the Area of a Circle in Java](https://www.baeldung.com/java-calculate-circle-area) - [A Guide to the Java Math Class](https://www.baeldung.com/java-lang-math) - [Graphs in Java](https://www.baeldung.com/java-graphs) +- [Console I/O in Java](http://www.baeldung.com/java-console-input-output) diff --git a/core-java-networking/src/main/java/com/baeldung/console/ConsoleConsoleClass.java b/core-java/src/main/java/com/baeldung/console/ConsoleConsoleClass.java similarity index 100% rename from core-java-networking/src/main/java/com/baeldung/console/ConsoleConsoleClass.java rename to core-java/src/main/java/com/baeldung/console/ConsoleConsoleClass.java diff --git a/core-java-networking/src/main/java/com/baeldung/console/ConsoleScannerClass.java b/core-java/src/main/java/com/baeldung/console/ConsoleScannerClass.java similarity index 100% rename from core-java-networking/src/main/java/com/baeldung/console/ConsoleScannerClass.java rename to core-java/src/main/java/com/baeldung/console/ConsoleScannerClass.java From e02f08eb8c334e836df78827c891daa598b99c84 Mon Sep 17 00:00:00 2001 From: Loredana Date: Tue, 25 Dec 2018 14:13:34 +0200 Subject: [PATCH 045/271] update readmes --- patterns/README.md | 11 ----------- patterns/design-patterns/README.md | 4 ++++ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/patterns/README.md b/patterns/README.md index 9653558f43..9a15cdff02 100644 --- a/patterns/README.md +++ b/patterns/README.md @@ -1,14 +1,3 @@ ### Relevant Articles: - [A Guide to the Front Controller Pattern in Java](http://www.baeldung.com/java-front-controller-pattern) - [Introduction to Intercepting Filter Pattern in Java](http://www.baeldung.com/intercepting-filter-pattern-in-java) -- [Implementing the Template Method Pattern in Java](http://www.baeldung.com/java-template-method-pattern) -- [Chain of Responsibility Design Pattern in Java](http://www.baeldung.com/chain-of-responsibility-pattern) -- [The Command Pattern in Java](http://www.baeldung.com/java-command-pattern) -- [The DAO Pattern in Java](http://www.baeldung.com/java-dao-pattern) -- [Introduction to Creational Design Patterns](http://www.baeldung.com/creational-design-patterns) -- [Proxy, Decorator, Adapter and Bridge Patterns](http://www.baeldung.com/java-structural-design-patterns) -- [Singletons in Java](http://www.baeldung.com/java-singleton) -- [Flyweight Pattern in Java](http://www.baeldung.com/java-flyweight) -- [The Observer Pattern in Java](http://www.baeldung.com/java-observer-pattern) -- [Service Locator Pattern](http://www.baeldung.com/java-service-locator-pattern) -- [Java Constructors vs Static Factory Methods](https://www.baeldung.com/java-constructors-vs-static-factory-methods) \ No newline at end of file diff --git a/patterns/design-patterns/README.md b/patterns/design-patterns/README.md index e56872b3fd..8046d2034b 100644 --- a/patterns/design-patterns/README.md +++ b/patterns/design-patterns/README.md @@ -14,3 +14,7 @@ - [State Design Pattern in Java](https://www.baeldung.com/java-state-design-pattern) - [The Decorator Pattern in Java](https://www.baeldung.com/java-decorator-pattern) - [Abstract Factory Pattern in Java](https://www.baeldung.com/java-abstract-factory-pattern) +- [Implementing the Template Method Pattern in Java](http://www.baeldung.com/java-template-method-pattern) +- [Chain of Responsibility Design Pattern in Java](http://www.baeldung.com/chain-of-responsibility-pattern) +- [The Command Pattern in Java](http://www.baeldung.com/java-command-pattern) +- [Java Constructors vs Static Factory Methods](https://www.baeldung.com/java-constructors-vs-static-factory-methods) From 55158e59c9d46e96de7468b262e83326cdf2290b Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Tue, 25 Dec 2018 15:54:29 +0200 Subject: [PATCH 046/271] Update README.md --- core-java-lang-oop/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core-java-lang-oop/README.md b/core-java-lang-oop/README.md index 3531ab9677..bbc3d26c99 100644 --- a/core-java-lang-oop/README.md +++ b/core-java-lang-oop/README.md @@ -21,5 +21,4 @@ - [Immutable Objects in Java](http://www.baeldung.com/java-immutable-object) - [Inheritance and Composition (Is-a vs Has-a relationship) in Java](http://www.baeldung.com/java-inheritance-composition) - [A Guide to Constructors in Java](https://www.baeldung.com/java-constructors) -- [Generate equals() and hashCode() with Eclipse](http://www.baeldung.com/java-eclipse-equals-and-hashcode) -- [Java equals() and hashCode() Contracts](https://www.baeldung.com/java-equals-hashcode-contracts) \ No newline at end of file +- [Java equals() and hashCode() Contracts](https://www.baeldung.com/java-equals-hashcode-contracts) From 45ba2a9387df43f5d50115fd24274ab8202f194e Mon Sep 17 00:00:00 2001 From: amit2103 Date: Tue, 25 Dec 2018 21:54:46 +0530 Subject: [PATCH 047/271] [BAEL-10837] - Splitted core-java-concurrency module --- .../.gitignore | 0 .../README.md | 14 +--- .../pom.xml | 6 +- .../atomic/SafeCounterWithLock.java | 26 +++---- .../atomic/SafeCounterWithoutLock.java | 42 +++++----- .../concurrent/atomic/UnsafeCounter.java | 26 +++---- .../countdownlatch/BrokenWorker.java | 0 .../CountdownLatchCountExample.java | 0 .../CountdownLatchResetExample.java | 0 .../countdownlatch/WaitingWorker.java | 0 .../concurrent/countdownlatch/Worker.java | 0 .../CyclicBarrierCompletionMethodExample.java | 0 .../CyclicBarrierCountExample.java | 0 .../cyclicbarrier/CyclicBarrierDemo.java | 0 .../CyclicBarrierResetExample.java | 0 .../daemon/MultipleThreadsExample.java | 0 .../baeldung/concurrent/daemon/NewThread.java | 0 .../daemon/SingleThreadExample.java | 0 .../DiningPhilosophers.java | 0 .../diningphilosophers/Philosopher.java | 0 .../evenandodd/PrintEvenOddSemaphore.java | 0 .../evenandodd/PrintEvenOddWaitNotify.java | 0 .../locks/ReentrantLockWithCondition.java | 0 .../locks/SharedObjectWithLock.java | 0 .../concurrent/locks/StampedLockDemo.java | 0 .../locks/SynchronizedHashMapWithRWLock.java | 0 .../parameter/AverageCalculator.java | 0 .../parameter/ParameterizedThreadExample.java | 0 .../concurrent/phaser/LongRunningAction.java | 0 .../concurrent/prioritytaskexecution/Job.java | 0 .../prioritytaskexecution/JobPriority.java | 0 .../PriorityJobScheduler.java | 0 .../semaphores/CounterUsingMutex.java | 0 .../DelayQueueUsingTimedSemaphore.java | 0 .../semaphores/LoginQueueUsingSemaphore.java | 0 .../volatilekeyword/SharedObject.java | 0 .../concurrent/yield/ThreadYield.java | 0 .../forkjoin/CustomRecursiveAction.java | 0 .../forkjoin/CustomRecursiveTask.java | 0 .../com/baeldung/forkjoin/util/PoolUtil.java | 0 .../com/baeldung/threadlocal/Context.java | 0 .../threadlocal/SharedMapWithUserContext.java | 0 .../ThreadLocalWithUserContext.java | 0 .../baeldung/threadlocal/UserRepository.java | 0 .../ThreadLocalRandomBenchMarkRunner.java | 0 .../ThreadLocalRandomBenchMarker.java | 0 .../com/baeldung/threadpool/CountingTask.java | 0 .../ExitingExecutorServiceExample.java | 0 .../com/baeldung/threadpool/TreeNode.java | 0 .../src/main/java/log4j.properties | 0 .../src/main/resources/logback.xml | 0 .../accumulator/LongAccumulatorUnitTest.java | 0 .../concurrent/adder/LongAdderUnitTest.java | 0 .../ThreadSafeCounterIntegrationTest.java | 76 +++++++++---------- .../atomic/ThreadUnsafeCounterManualTest.java | 66 ++++++++-------- .../CountdownLatchCountExampleUnitTest.java | 0 .../CountdownLatchExampleIntegrationTest.java | 0 .../CountdownLatchResetExampleUnitTest.java | 0 ...arrierCompletionMethodExampleUnitTest.java | 0 .../CyclicBarrierCountExampleUnitTest.java | 0 .../CyclicBarrierResetExampleUnitTest.java | 0 .../daemon/DaemonThreadUnitTest.java | 0 .../locks/SharedObjectWithLockManualTest.java | 0 ...nchronizedHashMapWithRWLockManualTest.java | 0 .../concurrent/phaser/PhaserUnitTest.java | 0 .../PriorityJobSchedulerUnitTest.java | 0 .../semaphores/SemaphoresManualTest.java | 0 .../SharedObjectManualTest.java | 0 .../java8/Java8ForkJoinIntegrationTest.java | 0 .../ParameterizedThreadUnitTest.java | 0 .../thread/join/ThreadJoinUnitTest.java | 0 .../ThreadLocalIntegrationTest.java | 0 .../ThreadLocalRandomIntegrationTest.java | 0 .../CoreThreadPoolIntegrationTest.java | 0 .../GuavaThreadPoolIntegrationTest.java | 0 .../src/test/resources/.gitignore | 0 core-java-concurrency-basic/.gitignore | 26 +++++++ core-java-concurrency-basic/README.md | 17 +++++ core-java-concurrency-basic/pom.xml | 55 ++++++++++++++ .../ScheduledExecutorServiceDemo.java | 0 .../concurrent/callable/FactorialTask.java | 0 .../cyclicbarrier/CyclicBarrierExample.java | 0 .../concurrent/cyclicbarrier/Task.java | 0 .../concurrent/executor/ExecutorDemo.java | 0 .../baeldung/concurrent/executor/Invoker.java | 0 .../executorservice/DelayedCallable.java | 0 .../executorservice/ExecutorServiceDemo.java | 0 .../concurrent/executorservice/Task.java | 0 .../future/FactorialSquareCalculator.java | 0 .../concurrent/future/FutureDemo.java | 0 .../concurrent/future/SquareCalculator.java | 0 .../concurrent/runnable/EventLoggingTask.java | 0 .../concurrent/runnable/TaskRunner.java | 0 .../concurrent/semaphore/SemaPhoreDemo.java | 0 .../concurrent/sleepwait/ThreadA.java | 0 .../concurrent/sleepwait/ThreadB.java | 0 .../sleepwait/WaitSleepExample.java | 0 .../concurrent/stopping/ControlSubThread.java | 0 .../BaeldungSynchronizedBlocks.java | 0 .../BaeldungSynchronizedMethods.java | 0 .../threadfactory/BaeldungThreadFactory.java | 0 .../concurrent/threadfactory/Demo.java | 0 .../concurrent/threadfactory/Task.java | 0 .../threadlifecycle/BlockedState.java | 0 .../concurrent/threadlifecycle/NewState.java | 0 .../threadlifecycle/RunnableState.java | 0 .../threadlifecycle/TerminatedState.java | 0 .../threadlifecycle/TimedWaitingState.java | 0 .../threadlifecycle/WaitingState.java | 0 .../concurrent/waitandnotify/Data.java | 0 .../waitandnotify/NetworkDriver.java | 0 .../concurrent/waitandnotify/Receiver.java | 0 .../concurrent/waitandnotify/Sender.java | 0 .../src/main/resources/logback.xml | 19 +++++ .../CompletableFutureLongRunningUnitTest.java | 0 .../callable/FactorialTaskManualTest.java | 0 .../WaitingForThreadsToFinishManualTest.java | 0 .../FactorialSquareCalculatorUnitTest.java | 0 .../SquareCalculatorIntegrationTest.java | 0 .../runnable/RunnableVsThreadLiveTest.java | 0 .../stopping/StopThreadManualTest.java | 0 .../BaeldungSychronizedBlockUnitTest.java | 0 .../BaeldungSynchronizeMethodsUnitTest.java | 0 .../waitandnotify/NetworkIntegrationTest.java | 0 .../Java8ExecutorServiceIntegrationTest.java | 0 .../src/test/resources/.gitignore | 13 ++++ pom.xml | 6 +- 127 files changed, 256 insertions(+), 136 deletions(-) rename {core-java-concurrency => core-java-concurrency-advanced}/.gitignore (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/README.md (60%) rename {core-java-concurrency => core-java-concurrency-advanced}/pom.xml (94%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java (94%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java (96%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java (94%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/countdownlatch/BrokenWorker.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExample.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExample.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/countdownlatch/WaitingWorker.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/countdownlatch/Worker.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExample.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExample.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierDemo.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExample.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/daemon/MultipleThreadsExample.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/daemon/NewThread.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/daemon/SingleThreadExample.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/diningphilosophers/DiningPhilosophers.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/diningphilosophers/Philosopher.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddSemaphore.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddWaitNotify.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/parameter/AverageCalculator.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/parameter/ParameterizedThreadExample.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/phaser/LongRunningAction.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/prioritytaskexecution/Job.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/prioritytaskexecution/JobPriority.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/prioritytaskexecution/PriorityJobScheduler.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/semaphores/CounterUsingMutex.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/semaphores/DelayQueueUsingTimedSemaphore.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/semaphores/LoginQueueUsingSemaphore.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/concurrent/yield/ThreadYield.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/threadlocal/Context.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/threadlocal/SharedMapWithUserContext.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/threadlocal/ThreadLocalWithUserContext.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/threadlocal/UserRepository.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/threadlocalrandom/ThreadLocalRandomBenchMarkRunner.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/threadlocalrandom/ThreadLocalRandomBenchMarker.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/threadpool/CountingTask.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/com/baeldung/threadpool/TreeNode.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/java/log4j.properties (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/main/resources/logback.xml (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/accumulator/LongAccumulatorUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/adder/LongAdderUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterIntegrationTest.java (97%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java (97%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExampleUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchExampleIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExampleUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExampleUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExampleUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExampleUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/daemon/DaemonThreadUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/phaser/PhaserUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/prioritytaskexecution/PriorityJobSchedulerUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/java8/Java8ForkJoinIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/parameters/ParameterizedThreadUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/thread/join/ThreadJoinUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/threadlocal/ThreadLocalIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/threadlocalrandom/ThreadLocalRandomIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/threadpool/CoreThreadPoolIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/java/com/baeldung/threadpool/GuavaThreadPoolIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-advanced}/src/test/resources/.gitignore (100%) create mode 100644 core-java-concurrency-basic/.gitignore create mode 100644 core-java-concurrency-basic/README.md create mode 100644 core-java-concurrency-basic/pom.xml rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/callable/FactorialTask.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierExample.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/cyclicbarrier/Task.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/executor/ExecutorDemo.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/executor/Invoker.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/executorservice/DelayedCallable.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/executorservice/ExecutorServiceDemo.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/executorservice/Task.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/future/FactorialSquareCalculator.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/future/FutureDemo.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/runnable/EventLoggingTask.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/runnable/TaskRunner.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/semaphore/SemaPhoreDemo.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/sleepwait/ThreadA.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/sleepwait/ThreadB.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/sleepwait/WaitSleepExample.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/stopping/ControlSubThread.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedBlocks.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedMethods.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/threadfactory/BaeldungThreadFactory.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/threadfactory/Demo.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/threadfactory/Task.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/threadlifecycle/BlockedState.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/threadlifecycle/NewState.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/threadlifecycle/RunnableState.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/threadlifecycle/TerminatedState.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/threadlifecycle/TimedWaitingState.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/threadlifecycle/WaitingState.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/waitandnotify/Data.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/waitandnotify/NetworkDriver.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/waitandnotify/Receiver.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/main/java/com/baeldung/concurrent/waitandnotify/Sender.java (100%) create mode 100644 core-java-concurrency-basic/src/main/resources/logback.xml rename {core-java-concurrency => core-java-concurrency-basic}/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/test/java/com/baeldung/concurrent/callable/FactorialTaskManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/test/java/com/baeldung/concurrent/executorservice/WaitingForThreadsToFinishManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/test/java/com/baeldung/concurrent/future/FactorialSquareCalculatorUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/test/java/com/baeldung/concurrent/future/SquareCalculatorIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/test/java/com/baeldung/concurrent/runnable/RunnableVsThreadLiveTest.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/test/java/com/baeldung/concurrent/stopping/StopThreadManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSychronizedBlockUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizeMethodsUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/test/java/com/baeldung/concurrent/waitandnotify/NetworkIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-basic}/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java (100%) create mode 100644 core-java-concurrency-basic/src/test/resources/.gitignore diff --git a/core-java-concurrency/.gitignore b/core-java-concurrency-advanced/.gitignore similarity index 100% rename from core-java-concurrency/.gitignore rename to core-java-concurrency-advanced/.gitignore diff --git a/core-java-concurrency/README.md b/core-java-concurrency-advanced/README.md similarity index 60% rename from core-java-concurrency/README.md rename to core-java-concurrency-advanced/README.md index e8693a0231..bcbec9d687 100644 --- a/core-java-concurrency/README.md +++ b/core-java-concurrency-advanced/README.md @@ -1,33 +1,21 @@ ========= -## Core Java Concurrency Examples +## Core Java Concurrency Advanced Examples ### Relevant Articles: -- [Guide To CompletableFuture](http://www.baeldung.com/java-completablefuture) -- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial) - [Introduction to Thread Pools in Java](http://www.baeldung.com/thread-pool-java-and-guava) -- [Guide to java.util.concurrent.Future](http://www.baeldung.com/java-future) - [Guide to CountDownLatch in Java](http://www.baeldung.com/java-countdown-latch) - [Guide to java.util.concurrent.Locks](http://www.baeldung.com/java-concurrent-locks) - [An Introduction to ThreadLocal in Java](http://www.baeldung.com/java-threadlocal) -- [Difference Between Wait and Sleep in Java](http://www.baeldung.com/java-wait-and-sleep) - [LongAdder and LongAccumulator in Java](http://www.baeldung.com/java-longadder-and-longaccumulator) - [The Dining Philosophers Problem in Java](http://www.baeldung.com/java-dining-philoshophers) - [Guide to the Java Phaser](http://www.baeldung.com/java-phaser) -- [Guide to Synchronized Keyword in Java](http://www.baeldung.com/java-synchronized) - [An Introduction to Atomic Variables in Java](http://www.baeldung.com/java-atomic-variables) - [CyclicBarrier in Java](http://www.baeldung.com/java-cyclic-barrier) - [Guide to Volatile Keyword in Java](http://www.baeldung.com/java-volatile) -- [Overview of the java.util.concurrent](http://www.baeldung.com/java-util-concurrent) - [Semaphores in Java](http://www.baeldung.com/java-semaphore) - [Daemon Threads in Java](http://www.baeldung.com/java-daemon-thread) -- [Implementing a Runnable vs Extending a Thread](http://www.baeldung.com/java-runnable-vs-extending-thread) -- [How to Kill a Java Thread](http://www.baeldung.com/java-thread-stop) -- [ExecutorService - Waiting for Threads to Finish](http://www.baeldung.com/java-executor-wait-for-threads) -- [wait and notify() Methods in Java](http://www.baeldung.com/java-wait-notify) - [Priority-based Job Scheduling in Java](http://www.baeldung.com/java-priority-job-schedule) -- [Life Cycle of a Thread in Java](http://www.baeldung.com/java-thread-lifecycle) -- [Runnable vs. Callable in Java](http://www.baeldung.com/java-runnable-callable) - [Brief Introduction to Java Thread.yield()](https://www.baeldung.com/java-thread-yield) - [Print Even and Odd Numbers Using 2 Threads](https://www.baeldung.com/java-even-odd-numbers-with-2-threads) - [Java CyclicBarrier vs CountDownLatch](https://www.baeldung.com/java-cyclicbarrier-countdownlatch) diff --git a/core-java-concurrency/pom.xml b/core-java-concurrency-advanced/pom.xml similarity index 94% rename from core-java-concurrency/pom.xml rename to core-java-concurrency-advanced/pom.xml index 5dde4d5820..1209cba619 100644 --- a/core-java-concurrency/pom.xml +++ b/core-java-concurrency-advanced/pom.xml @@ -2,10 +2,10 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.baeldung - core-java-concurrency + core-java-concurrency-advanced 0.1.0-SNAPSHOT jar - core-java-concurrency + core-java-concurrency-advanced com.baeldung @@ -60,7 +60,7 @@ - core-java-concurrency + core-java-concurrency-advanced src/main/resources diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java similarity index 94% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java index e3a1629ce1..ef6b7ee8c8 100644 --- a/core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java +++ b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java @@ -1,13 +1,13 @@ -package com.baeldung.concurrent.atomic; - -public class SafeCounterWithLock { - private volatile int counter; - - int getValue() { - return counter; - } - - synchronized void increment() { - counter++; - } -} +package com.baeldung.concurrent.atomic; + +public class SafeCounterWithLock { + private volatile int counter; + + int getValue() { + return counter; + } + + synchronized void increment() { + counter++; + } +} diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java similarity index 96% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java index 18ade35efb..8b2aebba7c 100644 --- a/core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java +++ b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java @@ -1,21 +1,21 @@ -package com.baeldung.concurrent.atomic; - -import java.util.concurrent.atomic.AtomicInteger; - -public class SafeCounterWithoutLock { - private final AtomicInteger counter = new AtomicInteger(0); - - int getValue() { - return counter.get(); - } - - void increment() { - while(true) { - int existingValue = getValue(); - int newValue = existingValue + 1; - if(counter.compareAndSet(existingValue, newValue)) { - return; - } - } - } -} +package com.baeldung.concurrent.atomic; + +import java.util.concurrent.atomic.AtomicInteger; + +public class SafeCounterWithoutLock { + private final AtomicInteger counter = new AtomicInteger(0); + + int getValue() { + return counter.get(); + } + + void increment() { + while(true) { + int existingValue = getValue(); + int newValue = existingValue + 1; + if(counter.compareAndSet(existingValue, newValue)) { + return; + } + } + } +} diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java similarity index 94% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java index 500ef5bd7e..290c26b73d 100644 --- a/core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java +++ b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java @@ -1,13 +1,13 @@ -package com.baeldung.concurrent.atomic; - -public class UnsafeCounter { - private int counter; - - int getValue() { - return counter; - } - - void increment() { - counter++; - } -} +package com.baeldung.concurrent.atomic; + +public class UnsafeCounter { + private int counter; + + int getValue() { + return counter; + } + + void increment() { + counter++; + } +} diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/BrokenWorker.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/countdownlatch/BrokenWorker.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/BrokenWorker.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/countdownlatch/BrokenWorker.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExample.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExample.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExample.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExample.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExample.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExample.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExample.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExample.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/WaitingWorker.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/countdownlatch/WaitingWorker.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/WaitingWorker.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/countdownlatch/WaitingWorker.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/Worker.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/countdownlatch/Worker.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/Worker.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/countdownlatch/Worker.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExample.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExample.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExample.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExample.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExample.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExample.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExample.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExample.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierDemo.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierDemo.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierDemo.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierDemo.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExample.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExample.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExample.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExample.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/MultipleThreadsExample.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/daemon/MultipleThreadsExample.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/MultipleThreadsExample.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/daemon/MultipleThreadsExample.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/NewThread.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/daemon/NewThread.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/NewThread.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/daemon/NewThread.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/SingleThreadExample.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/daemon/SingleThreadExample.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/SingleThreadExample.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/daemon/SingleThreadExample.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/diningphilosophers/DiningPhilosophers.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/diningphilosophers/DiningPhilosophers.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/diningphilosophers/DiningPhilosophers.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/diningphilosophers/DiningPhilosophers.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/diningphilosophers/Philosopher.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/diningphilosophers/Philosopher.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/diningphilosophers/Philosopher.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/diningphilosophers/Philosopher.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddSemaphore.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddSemaphore.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddSemaphore.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddSemaphore.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddWaitNotify.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddWaitNotify.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddWaitNotify.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddWaitNotify.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/parameter/AverageCalculator.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/parameter/AverageCalculator.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/parameter/AverageCalculator.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/parameter/AverageCalculator.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/parameter/ParameterizedThreadExample.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/parameter/ParameterizedThreadExample.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/parameter/ParameterizedThreadExample.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/parameter/ParameterizedThreadExample.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/phaser/LongRunningAction.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/phaser/LongRunningAction.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/phaser/LongRunningAction.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/phaser/LongRunningAction.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/prioritytaskexecution/Job.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/prioritytaskexecution/Job.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/prioritytaskexecution/Job.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/prioritytaskexecution/Job.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/prioritytaskexecution/JobPriority.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/prioritytaskexecution/JobPriority.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/prioritytaskexecution/JobPriority.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/prioritytaskexecution/JobPriority.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/prioritytaskexecution/PriorityJobScheduler.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/prioritytaskexecution/PriorityJobScheduler.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/prioritytaskexecution/PriorityJobScheduler.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/prioritytaskexecution/PriorityJobScheduler.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphores/CounterUsingMutex.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/semaphores/CounterUsingMutex.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphores/CounterUsingMutex.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/semaphores/CounterUsingMutex.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphores/DelayQueueUsingTimedSemaphore.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/semaphores/DelayQueueUsingTimedSemaphore.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphores/DelayQueueUsingTimedSemaphore.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/semaphores/DelayQueueUsingTimedSemaphore.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphores/LoginQueueUsingSemaphore.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/semaphores/LoginQueueUsingSemaphore.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphores/LoginQueueUsingSemaphore.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/semaphores/LoginQueueUsingSemaphore.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/yield/ThreadYield.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/yield/ThreadYield.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/yield/ThreadYield.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/yield/ThreadYield.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/threadlocal/Context.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocal/Context.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/threadlocal/Context.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocal/Context.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/threadlocal/SharedMapWithUserContext.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocal/SharedMapWithUserContext.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/threadlocal/SharedMapWithUserContext.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocal/SharedMapWithUserContext.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/threadlocal/ThreadLocalWithUserContext.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocal/ThreadLocalWithUserContext.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/threadlocal/ThreadLocalWithUserContext.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocal/ThreadLocalWithUserContext.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/threadlocal/UserRepository.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocal/UserRepository.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/threadlocal/UserRepository.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocal/UserRepository.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/threadlocalrandom/ThreadLocalRandomBenchMarkRunner.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocalrandom/ThreadLocalRandomBenchMarkRunner.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/threadlocalrandom/ThreadLocalRandomBenchMarkRunner.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocalrandom/ThreadLocalRandomBenchMarkRunner.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/threadlocalrandom/ThreadLocalRandomBenchMarker.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocalrandom/ThreadLocalRandomBenchMarker.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/threadlocalrandom/ThreadLocalRandomBenchMarker.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocalrandom/ThreadLocalRandomBenchMarker.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/threadpool/CountingTask.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/threadpool/CountingTask.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/threadpool/CountingTask.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/threadpool/CountingTask.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/threadpool/TreeNode.java b/core-java-concurrency-advanced/src/main/java/com/baeldung/threadpool/TreeNode.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/threadpool/TreeNode.java rename to core-java-concurrency-advanced/src/main/java/com/baeldung/threadpool/TreeNode.java diff --git a/core-java-concurrency/src/main/java/log4j.properties b/core-java-concurrency-advanced/src/main/java/log4j.properties similarity index 100% rename from core-java-concurrency/src/main/java/log4j.properties rename to core-java-concurrency-advanced/src/main/java/log4j.properties diff --git a/core-java-concurrency/src/main/resources/logback.xml b/core-java-concurrency-advanced/src/main/resources/logback.xml similarity index 100% rename from core-java-concurrency/src/main/resources/logback.xml rename to core-java-concurrency-advanced/src/main/resources/logback.xml diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/accumulator/LongAccumulatorUnitTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/accumulator/LongAccumulatorUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/accumulator/LongAccumulatorUnitTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/accumulator/LongAccumulatorUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/adder/LongAdderUnitTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/adder/LongAdderUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/adder/LongAdderUnitTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/adder/LongAdderUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterIntegrationTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterIntegrationTest.java similarity index 97% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterIntegrationTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterIntegrationTest.java index 4eead471f8..c3c44b40cf 100644 --- a/core-java-concurrency/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterIntegrationTest.java +++ b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterIntegrationTest.java @@ -1,38 +1,38 @@ -package com.baeldung.concurrent.atomic; - -import static org.junit.Assert.assertEquals; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.stream.IntStream; - -import org.junit.Test; - -public class ThreadSafeCounterIntegrationTest { - - @Test - public void givenMultiThread_whenSafeCounterWithLockIncrement() throws InterruptedException { - ExecutorService service = Executors.newFixedThreadPool(3); - SafeCounterWithLock safeCounter = new SafeCounterWithLock(); - - IntStream.range(0, 1000) - .forEach(count -> service.submit(safeCounter::increment)); - service.awaitTermination(100, TimeUnit.MILLISECONDS); - - assertEquals(1000, safeCounter.getValue()); - } - - @Test - public void givenMultiThread_whenSafeCounterWithoutLockIncrement() throws InterruptedException { - ExecutorService service = Executors.newFixedThreadPool(3); - SafeCounterWithoutLock safeCounter = new SafeCounterWithoutLock(); - - IntStream.range(0, 1000) - .forEach(count -> service.submit(safeCounter::increment)); - service.awaitTermination(100, TimeUnit.MILLISECONDS); - - assertEquals(1000, safeCounter.getValue()); - } - -} +package com.baeldung.concurrent.atomic; + +import static org.junit.Assert.assertEquals; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; + +import org.junit.Test; + +public class ThreadSafeCounterIntegrationTest { + + @Test + public void givenMultiThread_whenSafeCounterWithLockIncrement() throws InterruptedException { + ExecutorService service = Executors.newFixedThreadPool(3); + SafeCounterWithLock safeCounter = new SafeCounterWithLock(); + + IntStream.range(0, 1000) + .forEach(count -> service.submit(safeCounter::increment)); + service.awaitTermination(100, TimeUnit.MILLISECONDS); + + assertEquals(1000, safeCounter.getValue()); + } + + @Test + public void givenMultiThread_whenSafeCounterWithoutLockIncrement() throws InterruptedException { + ExecutorService service = Executors.newFixedThreadPool(3); + SafeCounterWithoutLock safeCounter = new SafeCounterWithoutLock(); + + IntStream.range(0, 1000) + .forEach(count -> service.submit(safeCounter::increment)); + service.awaitTermination(100, TimeUnit.MILLISECONDS); + + assertEquals(1000, safeCounter.getValue()); + } + +} diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java similarity index 97% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java index cc7cc18bb5..bf451e58de 100644 --- a/core-java-concurrency/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java +++ b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java @@ -1,33 +1,33 @@ -package com.baeldung.concurrent.atomic; - -import static org.junit.Assert.assertEquals; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.stream.IntStream; - -import org.junit.Test; - -/** - * This test shows the behaviour of a thread-unsafe class in a multithreaded scenario. We are calling - * the increment methods 1000 times from a pool of 3 threads. In most of the cases, the counter will - * less than 1000, because of lost updates, however, occasionally it may reach 1000, when no threads - * called the method simultaneously. This may cause the build to fail occasionally. Hence excluding this - * test from build by adding this in manual test - */ -public class ThreadUnsafeCounterManualTest { - - @Test - public void givenMultiThread_whenUnsafeCounterIncrement() throws InterruptedException { - ExecutorService service = Executors.newFixedThreadPool(3); - UnsafeCounter unsafeCounter = new UnsafeCounter(); - - IntStream.range(0, 1000) - .forEach(count -> service.submit(unsafeCounter::increment)); - service.awaitTermination(100, TimeUnit.MILLISECONDS); - - assertEquals(1000, unsafeCounter.getValue()); - } - -} +package com.baeldung.concurrent.atomic; + +import static org.junit.Assert.assertEquals; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; + +import org.junit.Test; + +/** + * This test shows the behaviour of a thread-unsafe class in a multithreaded scenario. We are calling + * the increment methods 1000 times from a pool of 3 threads. In most of the cases, the counter will + * less than 1000, because of lost updates, however, occasionally it may reach 1000, when no threads + * called the method simultaneously. This may cause the build to fail occasionally. Hence excluding this + * test from build by adding this in manual test + */ +public class ThreadUnsafeCounterManualTest { + + @Test + public void givenMultiThread_whenUnsafeCounterIncrement() throws InterruptedException { + ExecutorService service = Executors.newFixedThreadPool(3); + UnsafeCounter unsafeCounter = new UnsafeCounter(); + + IntStream.range(0, 1000) + .forEach(count -> service.submit(unsafeCounter::increment)); + service.awaitTermination(100, TimeUnit.MILLISECONDS); + + assertEquals(1000, unsafeCounter.getValue()); + } + +} diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExampleUnitTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExampleUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExampleUnitTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExampleUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchExampleIntegrationTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchExampleIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchExampleIntegrationTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchExampleIntegrationTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExampleUnitTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExampleUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExampleUnitTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExampleUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExampleUnitTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExampleUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExampleUnitTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExampleUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExampleUnitTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExampleUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExampleUnitTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExampleUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExampleUnitTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExampleUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExampleUnitTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExampleUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/daemon/DaemonThreadUnitTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/daemon/DaemonThreadUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/daemon/DaemonThreadUnitTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/daemon/DaemonThreadUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/phaser/PhaserUnitTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/phaser/PhaserUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/phaser/PhaserUnitTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/phaser/PhaserUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/prioritytaskexecution/PriorityJobSchedulerUnitTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/prioritytaskexecution/PriorityJobSchedulerUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/prioritytaskexecution/PriorityJobSchedulerUnitTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/prioritytaskexecution/PriorityJobSchedulerUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/java8/Java8ForkJoinIntegrationTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/java8/Java8ForkJoinIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/java8/Java8ForkJoinIntegrationTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/java8/Java8ForkJoinIntegrationTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/parameters/ParameterizedThreadUnitTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/parameters/ParameterizedThreadUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/parameters/ParameterizedThreadUnitTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/parameters/ParameterizedThreadUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/thread/join/ThreadJoinUnitTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/thread/join/ThreadJoinUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/thread/join/ThreadJoinUnitTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/thread/join/ThreadJoinUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/threadlocal/ThreadLocalIntegrationTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/threadlocal/ThreadLocalIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/threadlocal/ThreadLocalIntegrationTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/threadlocal/ThreadLocalIntegrationTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/threadlocalrandom/ThreadLocalRandomIntegrationTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/threadlocalrandom/ThreadLocalRandomIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/threadlocalrandom/ThreadLocalRandomIntegrationTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/threadlocalrandom/ThreadLocalRandomIntegrationTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/threadpool/CoreThreadPoolIntegrationTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/threadpool/CoreThreadPoolIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/threadpool/CoreThreadPoolIntegrationTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/threadpool/CoreThreadPoolIntegrationTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/threadpool/GuavaThreadPoolIntegrationTest.java b/core-java-concurrency-advanced/src/test/java/com/baeldung/threadpool/GuavaThreadPoolIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/threadpool/GuavaThreadPoolIntegrationTest.java rename to core-java-concurrency-advanced/src/test/java/com/baeldung/threadpool/GuavaThreadPoolIntegrationTest.java diff --git a/core-java-concurrency/src/test/resources/.gitignore b/core-java-concurrency-advanced/src/test/resources/.gitignore similarity index 100% rename from core-java-concurrency/src/test/resources/.gitignore rename to core-java-concurrency-advanced/src/test/resources/.gitignore diff --git a/core-java-concurrency-basic/.gitignore b/core-java-concurrency-basic/.gitignore new file mode 100644 index 0000000000..3de4cc647e --- /dev/null +++ b/core-java-concurrency-basic/.gitignore @@ -0,0 +1,26 @@ +*.class + +0.* + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* +.resourceCache + +# Packaged files # +*.jar +*.war +*.ear + +# Files generated by integration tests +*.txt +backup-pom.xml +/bin/ +/temp + +#IntelliJ specific +.idea/ +*.iml \ No newline at end of file diff --git a/core-java-concurrency-basic/README.md b/core-java-concurrency-basic/README.md new file mode 100644 index 0000000000..1c43149d03 --- /dev/null +++ b/core-java-concurrency-basic/README.md @@ -0,0 +1,17 @@ +========= + +## Core Java Concurrency Basic Examples + +### Relevant Articles: +- [Guide To CompletableFuture](http://www.baeldung.com/java-completablefuture) +- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial) +- [Guide to java.util.concurrent.Future](http://www.baeldung.com/java-future) +- [Difference Between Wait and Sleep in Java](http://www.baeldung.com/java-wait-and-sleep) +- [Guide to Synchronized Keyword in Java](http://www.baeldung.com/java-synchronized) +- [Overview of the java.util.concurrent](http://www.baeldung.com/java-util-concurrent) +- [Implementing a Runnable vs Extending a Thread](http://www.baeldung.com/java-runnable-vs-extending-thread) +- [How to Kill a Java Thread](http://www.baeldung.com/java-thread-stop) +- [ExecutorService - Waiting for Threads to Finish](http://www.baeldung.com/java-executor-wait-for-threads) +- [wait and notify() Methods in Java](http://www.baeldung.com/java-wait-notify) +- [Life Cycle of a Thread in Java](http://www.baeldung.com/java-thread-lifecycle) +- [Runnable vs. Callable in Java](http://www.baeldung.com/java-runnable-callable) \ No newline at end of file diff --git a/core-java-concurrency-basic/pom.xml b/core-java-concurrency-basic/pom.xml new file mode 100644 index 0000000000..3544403aca --- /dev/null +++ b/core-java-concurrency-basic/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + com.baeldung + core-java-concurrency-basic + 0.1.0-SNAPSHOT + jar + core-java-concurrency-basic + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + com.jayway.awaitility + awaitility + ${avaitility.version} + test + + + + + core-java-concurrency-basic + + + src/main/resources + true + + + + + + + 3.5 + + 3.6.1 + 1.7.0 + + + diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/callable/FactorialTask.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/callable/FactorialTask.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/callable/FactorialTask.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/callable/FactorialTask.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierExample.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierExample.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierExample.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierExample.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/Task.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/cyclicbarrier/Task.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/Task.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/cyclicbarrier/Task.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/executor/ExecutorDemo.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/executor/ExecutorDemo.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/executor/ExecutorDemo.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/executor/ExecutorDemo.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/executor/Invoker.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/executor/Invoker.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/executor/Invoker.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/executor/Invoker.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/executorservice/DelayedCallable.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/executorservice/DelayedCallable.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/executorservice/DelayedCallable.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/executorservice/DelayedCallable.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/executorservice/ExecutorServiceDemo.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/executorservice/ExecutorServiceDemo.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/executorservice/ExecutorServiceDemo.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/executorservice/ExecutorServiceDemo.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/executorservice/Task.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/executorservice/Task.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/executorservice/Task.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/executorservice/Task.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/future/FactorialSquareCalculator.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/future/FactorialSquareCalculator.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/future/FactorialSquareCalculator.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/future/FactorialSquareCalculator.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/future/FutureDemo.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/future/FutureDemo.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/future/FutureDemo.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/future/FutureDemo.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/runnable/EventLoggingTask.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/runnable/EventLoggingTask.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/runnable/EventLoggingTask.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/runnable/EventLoggingTask.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/runnable/TaskRunner.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/runnable/TaskRunner.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/runnable/TaskRunner.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/runnable/TaskRunner.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphore/SemaPhoreDemo.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/semaphore/SemaPhoreDemo.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphore/SemaPhoreDemo.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/semaphore/SemaPhoreDemo.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/sleepwait/ThreadA.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/sleepwait/ThreadA.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/sleepwait/ThreadA.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/sleepwait/ThreadA.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/sleepwait/ThreadB.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/sleepwait/ThreadB.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/sleepwait/ThreadB.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/sleepwait/ThreadB.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/sleepwait/WaitSleepExample.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/sleepwait/WaitSleepExample.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/sleepwait/WaitSleepExample.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/sleepwait/WaitSleepExample.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/stopping/ControlSubThread.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/stopping/ControlSubThread.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/stopping/ControlSubThread.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/stopping/ControlSubThread.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedBlocks.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedBlocks.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedBlocks.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedBlocks.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedMethods.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedMethods.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedMethods.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedMethods.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/threadfactory/BaeldungThreadFactory.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadfactory/BaeldungThreadFactory.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/threadfactory/BaeldungThreadFactory.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadfactory/BaeldungThreadFactory.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/threadfactory/Demo.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadfactory/Demo.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/threadfactory/Demo.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadfactory/Demo.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/threadfactory/Task.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadfactory/Task.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/threadfactory/Task.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadfactory/Task.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/threadlifecycle/BlockedState.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadlifecycle/BlockedState.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/threadlifecycle/BlockedState.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadlifecycle/BlockedState.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/threadlifecycle/NewState.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadlifecycle/NewState.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/threadlifecycle/NewState.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadlifecycle/NewState.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/threadlifecycle/RunnableState.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadlifecycle/RunnableState.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/threadlifecycle/RunnableState.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadlifecycle/RunnableState.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/threadlifecycle/TerminatedState.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadlifecycle/TerminatedState.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/threadlifecycle/TerminatedState.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadlifecycle/TerminatedState.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/threadlifecycle/TimedWaitingState.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadlifecycle/TimedWaitingState.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/threadlifecycle/TimedWaitingState.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadlifecycle/TimedWaitingState.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/threadlifecycle/WaitingState.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadlifecycle/WaitingState.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/threadlifecycle/WaitingState.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadlifecycle/WaitingState.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/waitandnotify/Data.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/waitandnotify/Data.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/waitandnotify/Data.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/waitandnotify/Data.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/waitandnotify/NetworkDriver.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/waitandnotify/NetworkDriver.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/waitandnotify/NetworkDriver.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/waitandnotify/NetworkDriver.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/waitandnotify/Receiver.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/waitandnotify/Receiver.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/waitandnotify/Receiver.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/waitandnotify/Receiver.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/waitandnotify/Sender.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/waitandnotify/Sender.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/waitandnotify/Sender.java rename to core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/waitandnotify/Sender.java diff --git a/core-java-concurrency-basic/src/main/resources/logback.xml b/core-java-concurrency-basic/src/main/resources/logback.xml new file mode 100644 index 0000000000..56af2d397e --- /dev/null +++ b/core-java-concurrency-basic/src/main/resources/logback.xml @@ -0,0 +1,19 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core-java-concurrency/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java b/core-java-concurrency-basic/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java rename to core-java-concurrency-basic/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/callable/FactorialTaskManualTest.java b/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/callable/FactorialTaskManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/callable/FactorialTaskManualTest.java rename to core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/callable/FactorialTaskManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/executorservice/WaitingForThreadsToFinishManualTest.java b/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/executorservice/WaitingForThreadsToFinishManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/executorservice/WaitingForThreadsToFinishManualTest.java rename to core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/executorservice/WaitingForThreadsToFinishManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/future/FactorialSquareCalculatorUnitTest.java b/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/future/FactorialSquareCalculatorUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/future/FactorialSquareCalculatorUnitTest.java rename to core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/future/FactorialSquareCalculatorUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/future/SquareCalculatorIntegrationTest.java b/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/future/SquareCalculatorIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/future/SquareCalculatorIntegrationTest.java rename to core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/future/SquareCalculatorIntegrationTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/runnable/RunnableVsThreadLiveTest.java b/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/runnable/RunnableVsThreadLiveTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/runnable/RunnableVsThreadLiveTest.java rename to core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/runnable/RunnableVsThreadLiveTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/stopping/StopThreadManualTest.java b/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/stopping/StopThreadManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/stopping/StopThreadManualTest.java rename to core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/stopping/StopThreadManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSychronizedBlockUnitTest.java b/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSychronizedBlockUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSychronizedBlockUnitTest.java rename to core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSychronizedBlockUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizeMethodsUnitTest.java b/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizeMethodsUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizeMethodsUnitTest.java rename to core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizeMethodsUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/waitandnotify/NetworkIntegrationTest.java b/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/waitandnotify/NetworkIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/waitandnotify/NetworkIntegrationTest.java rename to core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/waitandnotify/NetworkIntegrationTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java b/core-java-concurrency-basic/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java rename to core-java-concurrency-basic/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java diff --git a/core-java-concurrency-basic/src/test/resources/.gitignore b/core-java-concurrency-basic/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/core-java-concurrency-basic/src/test/resources/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/pom.xml b/pom.xml index 51c94458fb..6fc3e7910b 100644 --- a/pom.xml +++ b/pom.xml @@ -379,6 +379,7 @@ core-java-arrays core-java-collections + core-java-concurrency-basic core-java-concurrency-collections core-java-io core-java-lang-syntax @@ -990,7 +991,7 @@ parent-kotlin core-java - core-java-concurrency + core-java-concurrency-advanced core-kotlin jenkins/hello-world @@ -1088,6 +1089,7 @@ core-java-arrays core-java-collections + core-java-concurrency-basic core-java-concurrency-collections core-java-io core-java-lang-syntax @@ -1535,7 +1537,7 @@ parent-kotlin core-java - core-java-concurrency + core-java-concurrency-advanced core-kotlin jenkins/hello-world From 21bde94745d09a128bd3ce612ce3b525e10a0d93 Mon Sep 17 00:00:00 2001 From: kyleandari <44148335+kyleandari@users.noreply.github.com> Date: Tue, 25 Dec 2018 14:58:14 -0500 Subject: [PATCH 048/271] Java Interfaces Examples (#5992) * Implementing Hexagonal Architecture in java * Implementing multi-inheritance and Polymorphism using interfaces * Removing hexagonal code * Deleting hexagonal architecture code * fix for unit test names * Java Interfaces examples --- .../com/baeldung/interfaces/Electronic.java | 22 ++++++++++++++++++ .../com/baeldung/interfaces/Employee.java | 15 ++++++++++++ .../interfaces/EmployeeSalaryComparator.java | 18 +++++++++++++++ .../com/baeldung/interfaces/HasColor.java | 5 ++++ .../com/baeldung/interfaces/Motorcycle.java | 10 ++++++++ .../java/com/baeldung/interfaces/Truck.java | 8 +++++++ .../java/com/baeldung/interfaces/Vehicle.java | 6 +++++ .../interfaces/multiinheritance/Car.java | 13 +++++++++++ .../multiinheritance/Transform.java | 5 ++++ .../interfaces/polymorphysim/Circle.java | 4 ++++ .../polymorphysim/DisplayShape.java | 4 ++++ .../polymorphysim/FunctionalMain.java | 23 +++++++++++++++++++ .../interfaces/polymorphysim/Shape.java | 5 +++- .../interfaces/polymorphysim/Square.java | 5 ++++ 14 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/Electronic.java create mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/Employee.java create mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java create mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/HasColor.java create mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/Motorcycle.java create mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/Truck.java create mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/Vehicle.java create mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java create mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/FunctionalMain.java diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/Electronic.java b/core-java-8/src/main/java/com/baeldung/interfaces/Electronic.java new file mode 100644 index 0000000000..bfbc381483 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/interfaces/Electronic.java @@ -0,0 +1,22 @@ +package com.baeldung.interfaces; + +public interface Electronic { + //Constant variable + public static final String LED = "LED"; + + //Abstract method + public int getElectricityUse(); + + // Static method + public static boolean isEnergyEfficient(String electtronicType) { + if (electtronicType.equals(LED)) { + return true; + } + return false; + } + + //Default method + public default void printDescription() { + System.out.println("Electronic Description"); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/Employee.java b/core-java-8/src/main/java/com/baeldung/interfaces/Employee.java new file mode 100644 index 0000000000..903bc81e6f --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/interfaces/Employee.java @@ -0,0 +1,15 @@ +package com.baeldung.interfaces; + +public class Employee { + + private double salary; + + public double getSalary() { + return salary; + } + + public void setSalary(double salary) { + this.salary = salary; + } + +} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java b/core-java-8/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java new file mode 100644 index 0000000000..cfa4226c1a --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java @@ -0,0 +1,18 @@ +package com.baeldung.interfaces; + +import java.util.Comparator; + +public class EmployeeSalaryComparator implements Comparator { + + @Override + public int compare(Employee employeeA, Employee employeeB) { + + if(employeeA.getSalary() < employeeB.getSalary()){ + return -1; + }else if(employeeA.getSalary() > employeeB.getSalary()){ + return 1; + }else{ + return 0; + } + } +} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/HasColor.java b/core-java-8/src/main/java/com/baeldung/interfaces/HasColor.java new file mode 100644 index 0000000000..6eface2d47 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/interfaces/HasColor.java @@ -0,0 +1,5 @@ +package com.baeldung.interfaces; + +public interface HasColor { + public String getColor(); +} \ No newline at end of file diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/Motorcycle.java b/core-java-8/src/main/java/com/baeldung/interfaces/Motorcycle.java new file mode 100644 index 0000000000..6003f476a3 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/interfaces/Motorcycle.java @@ -0,0 +1,10 @@ +package com.baeldung.interfaces; + +import com.baeldung.interfaces.multiinheritance.Transform; + +public class Motorcycle implements Transform { + @Override + public void transform() { + // Implementation + } +} \ No newline at end of file diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/Truck.java b/core-java-8/src/main/java/com/baeldung/interfaces/Truck.java new file mode 100644 index 0000000000..d78de23371 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/interfaces/Truck.java @@ -0,0 +1,8 @@ +package com.baeldung.interfaces; + +public class Truck extends Vehicle { + @Override + public void transform() { + // implementation + } +} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/Vehicle.java b/core-java-8/src/main/java/com/baeldung/interfaces/Vehicle.java new file mode 100644 index 0000000000..8b4662e1a3 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/interfaces/Vehicle.java @@ -0,0 +1,6 @@ +package com.baeldung.interfaces; + +import com.baeldung.interfaces.multiinheritance.Transform; + +public abstract class Vehicle implements Transform { +} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java b/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java new file mode 100644 index 0000000000..b951fc0273 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java @@ -0,0 +1,13 @@ +package com.baeldung.interfaces.multiinheritance; + +public class Car implements Fly, Transform { + @Override + public void fly() { + System.out.println("I can Fly!!"); + } + + @Override + public void transform() { + System.out.println("I can Transform!!"); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java b/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java index a18bbafdc1..8bdba43a05 100644 --- a/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java +++ b/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java @@ -1,5 +1,10 @@ package com.baeldung.interfaces.multiinheritance; public interface Transform { + void transform(); + + default void printSpecs(){ + System.out.println("Transform Specification"); + } } diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java index bf0e613567..afb3142d96 100644 --- a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java +++ b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java @@ -18,4 +18,8 @@ public class Circle implements Shape { return Math.PI * (radius * radius); } + @Override + public String getColor() { + return "green"; + } } diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/DisplayShape.java b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/DisplayShape.java index 2cf4fafee1..d9c9dd107a 100644 --- a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/DisplayShape.java +++ b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/DisplayShape.java @@ -6,6 +6,10 @@ public class DisplayShape { private ArrayList shapes; + public ArrayList getShapes() { + return shapes; + } + public DisplayShape() { shapes = new ArrayList<>(); } diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/FunctionalMain.java b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/FunctionalMain.java new file mode 100644 index 0000000000..5316dd7db7 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/FunctionalMain.java @@ -0,0 +1,23 @@ +package com.baeldung.interfaces.polymorphysim; + +import java.util.function.Predicate; + +public class FunctionalMain { + +public static void main(String[] args) { + Shape circleShape = new Circle(2); + Shape squareShape = new Square(2); + + DisplayShape DisplayShape = new DisplayShape(); + DisplayShape.add(circleShape); + DisplayShape.add(squareShape); + + Predicate checkArea = (shape) -> shape.area() < 5; + + for (Shape shape : DisplayShape.getShapes()) { + if (checkArea.test(shape)) { + System.out.println(shape.name() + " " + shape.area()); + } + } +} +} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java index fcb0c65e7b..560e07a80a 100644 --- a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java +++ b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java @@ -1,6 +1,9 @@ package com.baeldung.interfaces.polymorphysim; -public interface Shape { +import com.baeldung.interfaces.HasColor; + +public interface Shape extends HasColor { + public abstract String name(); public abstract double area(); } diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java index 9c440150b5..00b75ace20 100644 --- a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java +++ b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java @@ -17,4 +17,9 @@ public class Square implements Shape { public double area() { return width * width; } + + @Override + public String getColor() { + return "red"; + } } From 0a0701c947c5aad67d70742f308591e74b8f5055 Mon Sep 17 00:00:00 2001 From: Loredana Date: Wed, 26 Dec 2018 20:42:28 +0200 Subject: [PATCH 049/271] new module core-java-perf --- core-java-perf/README.md | 3 ++ core-java-perf/pom.xml | 33 +++++++++++++++++++ .../gc/VerboseGarbageCollectorRunner.java | 0 pom.xml | 4 ++- 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 core-java-perf/README.md create mode 100644 core-java-perf/pom.xml rename {core-java => core-java-perf}/src/main/java/com/baeldung/gc/VerboseGarbageCollectorRunner.java (100%) diff --git a/core-java-perf/README.md b/core-java-perf/README.md new file mode 100644 index 0000000000..bd76388310 --- /dev/null +++ b/core-java-perf/README.md @@ -0,0 +1,3 @@ +## Core Java Performance + +### Relevant Articles: diff --git a/core-java-perf/pom.xml b/core-java-perf/pom.xml new file mode 100644 index 0000000000..062f76db77 --- /dev/null +++ b/core-java-perf/pom.xml @@ -0,0 +1,33 @@ + + 4.0.0 + com.baeldung + core-java-perf + 0.1.0-SNAPSHOT + jar + core-java-perf + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + + + + + + 3.8.1 + + + + diff --git a/core-java/src/main/java/com/baeldung/gc/VerboseGarbageCollectorRunner.java b/core-java-perf/src/main/java/com/baeldung/gc/VerboseGarbageCollectorRunner.java similarity index 100% rename from core-java/src/main/java/com/baeldung/gc/VerboseGarbageCollectorRunner.java rename to core-java-perf/src/main/java/com/baeldung/gc/VerboseGarbageCollectorRunner.java diff --git a/pom.xml b/pom.xml index 51c94458fb..a4588bf546 100644 --- a/pom.xml +++ b/pom.xml @@ -384,7 +384,8 @@ core-java-lang-syntax core-java-lang core-java-lang-oop - core-java-networking + core-java-networking + core-java-perf core-java-sun core-scala couchbase @@ -1094,6 +1095,7 @@ core-java-lang core-java-lang-oop core-java-networking + core-java-perf core-java-sun core-scala couchbase From a5cf9e4343a8f909a20c8a3036a96c3477cd7d32 Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 27 Dec 2018 04:46:39 +0100 Subject: [PATCH 050/271] BAEL-2438 Difference between HashMap and HashTable (#5931) * BAEL-2368 convert string array to string * BAEL-2368 Convert array to string code * BAEL-2368 Change package * Fix for test * BAEL-2438 Difference between HashMap and HashTable --- .../HashmapVsHashtableDifferenceUnitTest.java | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 core-java-collections/src/test/java/com/baeldung/hashmapvshashtable/HashmapVsHashtableDifferenceUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/hashmapvshashtable/HashmapVsHashtableDifferenceUnitTest.java b/core-java-collections/src/test/java/com/baeldung/hashmapvshashtable/HashmapVsHashtableDifferenceUnitTest.java new file mode 100644 index 0000000000..5218332d60 --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/hashmapvshashtable/HashmapVsHashtableDifferenceUnitTest.java @@ -0,0 +1,98 @@ +package com.baeldung.hashmapvshashtable; + +import static org.junit.Assert.assertEquals; + +import java.util.Collections; +import java.util.ConcurrentModificationException; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.junit.Test; + +import com.google.common.collect.Lists; + +public class HashmapVsHashtableDifferenceUnitTest { + + // null values + @Test(expected = NullPointerException.class) + public void givenHashtable_whenAddNullKey_thenNullPointerExceptionThrown() { + Hashtable table = new Hashtable(); + table.put(null, "value"); + } + + @Test(expected = NullPointerException.class) + public void givenHashtable_whenAddNullValue_thenNullPointerExceptionThrown() { + Hashtable table = new Hashtable(); + table.put("key", null); + } + + @Test + public void givenHashmap_whenAddNullKeyAndValue_thenObjectAdded() { + HashMap map = new HashMap(); + map.put(null, "value"); + map.put("key1", null); + map.put("key2", null); + + assertEquals(3, map.size()); + } + + // fail-fast iterator + @Test(expected = ConcurrentModificationException.class) + public void givenHashmap_whenModifyUnderlyingCollection_thenConcurrentModificationExceptionThrown() { + HashMap map = new HashMap(); + map.put("key1", "value1"); + map.put("key2", "value2"); + map.put("key3", "value3"); + + Iterator iterator = map.keySet().iterator(); + while(iterator.hasNext()){ + iterator.next(); + map.put("key4", "value4"); + } + } + + @Test + public void givenHashtable_whenModifyUnderlyingCollection_thenItHasNoEffectOnIteratedCollection() { + Hashtable table = new Hashtable(); + table.put("key1", "value1"); + table.put("key2", "value2"); + + List keysSelected = Lists.newArrayList(); + Enumeration keys = table.keys(); + while (keys.hasMoreElements()) { + String key = keys.nextElement(); + keysSelected.add(key); + + if (key.equals("key1")) { + table.put("key3", "value3"); + } + } + + assertEquals(2, keysSelected.size()); + } + + // synchronized map + @Test + public void givenHashmap_thenCreateSynchronizedMap() { + HashMap map = new HashMap(); + map.put("key1", "value1"); + map.put("key2", "value2"); + map.put("key3", "value3"); + + Set> set = map.entrySet(); + synchronized (map) { + Iterator> it = set.iterator(); + while(it.hasNext()) { + Map.Entry elem = (Map.Entry)it.next(); + } + } + + Map syncMap = Collections.synchronizedMap(map); + } +} From 2279246a426c9d35618ce2a1dc2f26b724922060 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Thu, 27 Dec 2018 09:39:40 +0100 Subject: [PATCH 051/271] BAEL-2435 Switch domain around Change the domain from 'Messages' to 'Order' as that domain is better suited for an example project like this. First, update the commands and events, adding an extra command/event to flesh out the domain some what --- .../coreapi/commands/ConfirmOrderCommand.java | 36 ++++++++++++++++ .../commands/CreateMessageCommand.java | 42 ------------------ .../commands/MarkReadMessageCommand.java | 36 ---------------- .../coreapi/commands/PlaceOrderCommand.java | 43 +++++++++++++++++++ .../coreapi/commands/ShipOrderCommand.java | 36 ++++++++++++++++ .../coreapi/events/MessageCreatedEvent.java | 39 ----------------- .../axon/coreapi/events/MessageReadEvent.java | 33 -------------- .../coreapi/events/OrderConfirmedEvent.java | 33 ++++++++++++++ .../axon/coreapi/events/OrderPlacedEvent.java | 40 +++++++++++++++++ .../coreapi/events/OrderShippedEvent.java | 33 ++++++++++++++ 10 files changed, 221 insertions(+), 150 deletions(-) create mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/commands/ConfirmOrderCommand.java delete mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/commands/CreateMessageCommand.java delete mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/commands/MarkReadMessageCommand.java create mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/commands/PlaceOrderCommand.java create mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/commands/ShipOrderCommand.java delete mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/events/MessageCreatedEvent.java delete mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/events/MessageReadEvent.java create mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/events/OrderConfirmedEvent.java create mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/events/OrderPlacedEvent.java create mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/events/OrderShippedEvent.java diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/ConfirmOrderCommand.java b/axon/src/main/java/com/baeldung/axon/coreapi/commands/ConfirmOrderCommand.java new file mode 100644 index 0000000000..ba04343af1 --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/coreapi/commands/ConfirmOrderCommand.java @@ -0,0 +1,36 @@ +package com.baeldung.axon.coreapi.commands; + +import org.axonframework.modelling.command.TargetAggregateIdentifier; + +import java.util.Objects; + +public class ConfirmOrderCommand { + + @TargetAggregateIdentifier + private final String orderId; + + public ConfirmOrderCommand(String orderId) { + this.orderId = orderId; + } + + public String getOrderId() { + return orderId; + } + + @Override + public int hashCode() { + return Objects.hash(orderId); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + final ConfirmOrderCommand other = (ConfirmOrderCommand) obj; + return Objects.equals(this.orderId, other.orderId); + } +} diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/CreateMessageCommand.java b/axon/src/main/java/com/baeldung/axon/coreapi/commands/CreateMessageCommand.java deleted file mode 100644 index fd03d6b269..0000000000 --- a/axon/src/main/java/com/baeldung/axon/coreapi/commands/CreateMessageCommand.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.axon.coreapi.commands; - -import java.util.Objects; - -import org.axonframework.modelling.command.TargetAggregateIdentifier; - -public class CreateMessageCommand { - - @TargetAggregateIdentifier - private final String id; - private final String text; - - public CreateMessageCommand(String id, String text) { - this.id = id; - this.text = text; - } - - public String getId() { - return id; - } - - public String getText() { - return text; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateMessageCommand that = (CreateMessageCommand) o; - return Objects.equals(id, that.id) && Objects.equals(text, that.text); - } - - @Override - public int hashCode() { - return Objects.hash(id, text); - } -} \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/MarkReadMessageCommand.java b/axon/src/main/java/com/baeldung/axon/coreapi/commands/MarkReadMessageCommand.java deleted file mode 100644 index ec68a380f8..0000000000 --- a/axon/src/main/java/com/baeldung/axon/coreapi/commands/MarkReadMessageCommand.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baeldung.axon.coreapi.commands; - -import java.util.Objects; - -import org.axonframework.modelling.command.TargetAggregateIdentifier; - -public class MarkReadMessageCommand { - - @TargetAggregateIdentifier - private final String id; - - public MarkReadMessageCommand(String id) { - this.id = id; - } - - public String getId() { - return id; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MarkReadMessageCommand that = (MarkReadMessageCommand) o; - return Objects.equals(id, that.id); - } - - @Override - public int hashCode() { - return Objects.hash(id); - } -} \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/PlaceOrderCommand.java b/axon/src/main/java/com/baeldung/axon/coreapi/commands/PlaceOrderCommand.java new file mode 100644 index 0000000000..cde2d7f1ae --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/coreapi/commands/PlaceOrderCommand.java @@ -0,0 +1,43 @@ +package com.baeldung.axon.coreapi.commands; + +import java.util.Objects; + +import org.axonframework.modelling.command.TargetAggregateIdentifier; + +public class PlaceOrderCommand { + + @TargetAggregateIdentifier + private final String orderId; + private final String product; + + public PlaceOrderCommand(String orderId, String product) { + this.orderId = orderId; + this.product = product; + } + + public String getOrderId() { + return orderId; + } + + public String getProduct() { + return product; + } + + @Override + public int hashCode() { + return Objects.hash(orderId, product); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + final PlaceOrderCommand other = (PlaceOrderCommand) obj; + return Objects.equals(this.orderId, other.orderId) + && Objects.equals(this.product, other.product); + } +} \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/ShipOrderCommand.java b/axon/src/main/java/com/baeldung/axon/coreapi/commands/ShipOrderCommand.java new file mode 100644 index 0000000000..75469533b9 --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/coreapi/commands/ShipOrderCommand.java @@ -0,0 +1,36 @@ +package com.baeldung.axon.coreapi.commands; + +import java.util.Objects; + +import org.axonframework.modelling.command.TargetAggregateIdentifier; + +public class ShipOrderCommand { + + @TargetAggregateIdentifier + private final String orderId; + + public ShipOrderCommand(String orderId) { + this.orderId = orderId; + } + + public String getOrderId() { + return orderId; + } + + @Override + public int hashCode() { + return Objects.hash(orderId); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + final ShipOrderCommand other = (ShipOrderCommand) obj; + return Objects.equals(this.orderId, other.orderId); + } +} \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/MessageCreatedEvent.java b/axon/src/main/java/com/baeldung/axon/coreapi/events/MessageCreatedEvent.java deleted file mode 100644 index debf383771..0000000000 --- a/axon/src/main/java/com/baeldung/axon/coreapi/events/MessageCreatedEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.axon.coreapi.events; - -import java.util.Objects; - -public class MessageCreatedEvent { - - private final String id; - private final String text; - - public MessageCreatedEvent(String id, String text) { - this.id = id; - this.text = text; - } - - public String getId() { - return id; - } - - public String getText() { - return text; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MessageCreatedEvent that = (MessageCreatedEvent) o; - return Objects.equals(id, that.id) && Objects.equals(text, that.text); - } - - @Override - public int hashCode() { - return Objects.hash(id, text); - } -} \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/MessageReadEvent.java b/axon/src/main/java/com/baeldung/axon/coreapi/events/MessageReadEvent.java deleted file mode 100644 index f90bfb054e..0000000000 --- a/axon/src/main/java/com/baeldung/axon/coreapi/events/MessageReadEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.axon.coreapi.events; - -import java.util.Objects; - -public class MessageReadEvent { - - private final String id; - - public MessageReadEvent(String id) { - this.id = id; - } - - public String getId() { - return id; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MessageReadEvent that = (MessageReadEvent) o; - return Objects.equals(id, that.id); - } - - @Override - public int hashCode() { - return Objects.hash(id); - } -} \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderConfirmedEvent.java b/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderConfirmedEvent.java new file mode 100644 index 0000000000..1706b08023 --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderConfirmedEvent.java @@ -0,0 +1,33 @@ +package com.baeldung.axon.coreapi.events; + +import java.util.Objects; + +public class OrderConfirmedEvent { + + private final String orderId; + + public OrderConfirmedEvent(String orderId) { + this.orderId = orderId; + } + + public String getOrderId() { + return orderId; + } + + @Override + public int hashCode() { + return Objects.hash(orderId); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + final OrderConfirmedEvent other = (OrderConfirmedEvent) obj; + return Objects.equals(this.orderId, other.orderId); + } +} diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderPlacedEvent.java b/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderPlacedEvent.java new file mode 100644 index 0000000000..8d5364f4c6 --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderPlacedEvent.java @@ -0,0 +1,40 @@ +package com.baeldung.axon.coreapi.events; + +import java.util.Objects; + +public class OrderPlacedEvent { + + private final String orderId; + private final String product; + + public OrderPlacedEvent(String orderId, String product) { + this.orderId = orderId; + this.product = product; + } + + public String getOrderId() { + return orderId; + } + + public String getProduct() { + return product; + } + + @Override + public int hashCode() { + return Objects.hash(orderId, product); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + final OrderPlacedEvent other = (OrderPlacedEvent) obj; + return Objects.equals(this.orderId, other.orderId) + && Objects.equals(this.product, other.product); + } +} \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderShippedEvent.java b/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderShippedEvent.java new file mode 100644 index 0000000000..5abcd09a3c --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderShippedEvent.java @@ -0,0 +1,33 @@ +package com.baeldung.axon.coreapi.events; + +import java.util.Objects; + +public class OrderShippedEvent { + + private final String orderId; + + public OrderShippedEvent(String orderId) { + this.orderId = orderId; + } + + public String getOrderId() { + return orderId; + } + + @Override + public int hashCode() { + return Objects.hash(orderId); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + final OrderShippedEvent other = (OrderShippedEvent) obj; + return Objects.equals(this.orderId, other.orderId); + } +} \ No newline at end of file From 5dd6d520254050e3378cbc06c46f1985467a8557 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Thu, 27 Dec 2018 12:48:51 +0400 Subject: [PATCH 052/271] Vector class more tests --- .../com/baeldung/performance/ArrayListBenchmark.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java b/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java index 5c3f7531e3..1eeb17df87 100644 --- a/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java +++ b/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java @@ -49,6 +49,11 @@ public class ArrayListBenchmark { return state.employeeList.contains(state.employee); } + @Benchmark + public boolean testContainsVector(ArrayListBenchmark.MyState state) { + return state.employeeVector.contains(state.employee); + } + @Benchmark public int testIndexOf(ArrayListBenchmark.MyState state) { return state.employeeList.indexOf(state.employee); @@ -73,6 +78,11 @@ public class ArrayListBenchmark { state.employeeList.add(new Employee(state.iterations + 1, "John")); } + @Benchmark + public void testAddVector(ArrayListBenchmark.MyState state) { + state.employeeVector.add(new Employee(state.iterations + 1, "John")); + } + public static void main(String[] args) throws Exception { Options options = new OptionsBuilder() .include(ArrayListBenchmark.class.getSimpleName()).threads(1) From bd0a1efe707ba65b04f21a21f621110b7769ab0a Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Thu, 27 Dec 2018 09:51:08 +0100 Subject: [PATCH 053/271] BAEL-2435 Switch domain around Change the domain from 'Messages' to 'Order' as that domain is better suited for an example project like this. To that end the MessagesAggregate should be replaced by an OrderAggregate. Additionally, add some decision making logic which denies the shipping of an order if it hasn't been confirmed yet. Adjust and update thee unit test accordingly --- .../axon/commandmodel/MessagesAggregate.java | 38 ------------ .../axon/commandmodel/OrderAggregate.java | 58 +++++++++++++++++++ .../MessagesAggregateUnitTest.java | 40 ------------- .../commandmodel/OrderAggregateUnitTest.java | 48 +++++++++++++++ 4 files changed, 106 insertions(+), 78 deletions(-) delete mode 100644 axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java create mode 100644 axon/src/main/java/com/baeldung/axon/commandmodel/OrderAggregate.java delete mode 100644 axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateUnitTest.java create mode 100644 axon/src/test/java/com/baeldung/axon/commandmodel/OrderAggregateUnitTest.java diff --git a/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java b/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java deleted file mode 100644 index 1ab9501617..0000000000 --- a/axon/src/main/java/com/baeldung/axon/commandmodel/MessagesAggregate.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.axon.commandmodel; - -import static org.axonframework.modelling.command.AggregateLifecycle.apply; - -import org.axonframework.commandhandling.CommandHandler; -import org.axonframework.eventsourcing.EventSourcingHandler; -import org.axonframework.modelling.command.AggregateIdentifier; -import org.axonframework.spring.stereotype.Aggregate; - -import com.baeldung.axon.coreapi.commands.CreateMessageCommand; -import com.baeldung.axon.coreapi.commands.MarkReadMessageCommand; -import com.baeldung.axon.coreapi.events.MessageCreatedEvent; -import com.baeldung.axon.coreapi.events.MessageReadEvent; - -@Aggregate -public class MessagesAggregate { - - @AggregateIdentifier - private String id; - - public MessagesAggregate() { - } - - @CommandHandler - public MessagesAggregate(CreateMessageCommand command) { - apply(new MessageCreatedEvent(command.getId(), command.getText())); - } - - @CommandHandler - public void handle(MarkReadMessageCommand command) { - apply(new MessageReadEvent(id)); - } - - @EventSourcingHandler - public void on(MessageCreatedEvent event) { - this.id = event.getId(); - } -} \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/commandmodel/OrderAggregate.java b/axon/src/main/java/com/baeldung/axon/commandmodel/OrderAggregate.java new file mode 100644 index 0000000000..fd4f901032 --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/commandmodel/OrderAggregate.java @@ -0,0 +1,58 @@ +package com.baeldung.axon.commandmodel; + +import static org.axonframework.modelling.command.AggregateLifecycle.apply; + +import org.axonframework.commandhandling.CommandHandler; +import org.axonframework.eventsourcing.EventSourcingHandler; +import org.axonframework.modelling.command.AggregateIdentifier; +import org.axonframework.spring.stereotype.Aggregate; + +import com.baeldung.axon.coreapi.commands.ConfirmOrderCommand; +import com.baeldung.axon.coreapi.commands.PlaceOrderCommand; +import com.baeldung.axon.coreapi.commands.ShipOrderCommand; +import com.baeldung.axon.coreapi.events.OrderConfirmedEvent; +import com.baeldung.axon.coreapi.events.OrderPlacedEvent; +import com.baeldung.axon.coreapi.events.OrderShippedEvent; + +@Aggregate +public class OrderAggregate { + + @AggregateIdentifier + private String orderId; + private boolean orderConfirmed; + + @CommandHandler + public OrderAggregate(PlaceOrderCommand command) { + apply(new OrderPlacedEvent(command.getOrderId(), command.getProduct())); + } + + @CommandHandler + public void handle(ConfirmOrderCommand command) { + apply(new OrderConfirmedEvent(orderId)); + } + + @CommandHandler + public void handle(ShipOrderCommand command) { + if (!orderConfirmed) { + throw new IllegalStateException("Cannot ship an order which has not ben confirmed yet."); + } + + apply(new OrderShippedEvent(orderId)); + } + + @EventSourcingHandler + public void on(OrderPlacedEvent event) { + this.orderId = event.getOrderId(); + orderConfirmed = false; + } + + @EventSourcingHandler + public void on(OrderConfirmedEvent event) { + orderConfirmed = true; + } + + protected OrderAggregate() { + // Required by Axon to build a default Aggregate prior to Event Sourcing + } + +} \ No newline at end of file diff --git a/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateUnitTest.java b/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateUnitTest.java deleted file mode 100644 index 46357ddff8..0000000000 --- a/axon/src/test/java/com/baeldung/axon/commandmodel/MessagesAggregateUnitTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.axon.commandmodel; - -import java.util.UUID; - -import org.axonframework.test.aggregate.AggregateTestFixture; -import org.axonframework.test.aggregate.FixtureConfiguration; -import org.junit.*; - -import com.baeldung.axon.coreapi.commands.CreateMessageCommand; -import com.baeldung.axon.coreapi.commands.MarkReadMessageCommand; -import com.baeldung.axon.coreapi.events.MessageCreatedEvent; -import com.baeldung.axon.coreapi.events.MessageReadEvent; - -public class MessagesAggregateUnitTest { - - private FixtureConfiguration fixture; - - @Before - public void setUp() { - fixture = new AggregateTestFixture<>(MessagesAggregate.class); - } - - @Test - public void giveAggregateRoot_whenCreateMessageCommand_thenShouldProduceMessageCreatedEvent() { - String eventText = "Hello, how is your day?"; - String id = UUID.randomUUID().toString(); - fixture.given() - .when(new CreateMessageCommand(id, eventText)) - .expectEvents(new MessageCreatedEvent(id, eventText)); - } - - @Test - public void givenMessageCreatedEvent_whenReadMessageCommand_thenShouldProduceMessageReadEvent() { - String id = UUID.randomUUID().toString(); - - fixture.given(new MessageCreatedEvent(id, "Hello :-)")) - .when(new MarkReadMessageCommand(id)) - .expectEvents(new MessageReadEvent(id)); - } -} \ No newline at end of file diff --git a/axon/src/test/java/com/baeldung/axon/commandmodel/OrderAggregateUnitTest.java b/axon/src/test/java/com/baeldung/axon/commandmodel/OrderAggregateUnitTest.java new file mode 100644 index 0000000000..e7dfdeb794 --- /dev/null +++ b/axon/src/test/java/com/baeldung/axon/commandmodel/OrderAggregateUnitTest.java @@ -0,0 +1,48 @@ +package com.baeldung.axon.commandmodel; + +import java.util.UUID; + +import org.axonframework.test.aggregate.AggregateTestFixture; +import org.axonframework.test.aggregate.FixtureConfiguration; +import org.junit.*; + +import com.baeldung.axon.coreapi.commands.PlaceOrderCommand; +import com.baeldung.axon.coreapi.commands.ShipOrderCommand; +import com.baeldung.axon.coreapi.events.OrderConfirmedEvent; +import com.baeldung.axon.coreapi.events.OrderPlacedEvent; +import com.baeldung.axon.coreapi.events.OrderShippedEvent; + +public class OrderAggregateUnitTest { + + private static final String ORDER_ID = UUID.randomUUID().toString(); + private static final String DEFAULT_PRODUCT = "Deluxe Chair"; + + private FixtureConfiguration fixture; + + @Before + public void setUp() { + fixture = new AggregateTestFixture<>(OrderAggregate.class); + } + + @Test + public void giveNoPriorActivity_whenPlaceOrderCommand_thenShouldPublishOrderPlacedEvent() { + fixture.givenNoPriorActivity() + .when(new PlaceOrderCommand(ORDER_ID, DEFAULT_PRODUCT)) + .expectEvents(new OrderPlacedEvent(ORDER_ID, DEFAULT_PRODUCT)); + } + + @Test + public void givenOrderPlacedEvent_whenShipOrderCommand_thenShouldThrowIllegalStateException() { + fixture.given(new OrderPlacedEvent(ORDER_ID, DEFAULT_PRODUCT)) + .when(new ShipOrderCommand(ORDER_ID)) + .expectException(IllegalStateException.class); + } + + @Test + public void givenOrderPlacedEventAndOrderConfirmedEvent_whenShipOrderCommand_thenShouldPublishOrderShippedEvent() { + fixture.given(new OrderPlacedEvent(ORDER_ID, DEFAULT_PRODUCT), new OrderConfirmedEvent(ORDER_ID)) + .when(new ShipOrderCommand(ORDER_ID)) + .expectEvents(new OrderShippedEvent(ORDER_ID)); + } + +} \ No newline at end of file From eab6dfe0dd5e29afd990f7b3770242c93d1f3d01 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Thu, 27 Dec 2018 09:55:49 +0100 Subject: [PATCH 054/271] BAEL-2435 Switch domain around Change the domain from 'Messages' to 'Order' as that domain is better suited for an example project like this. Update the endpoint to reflect the order focus i.o. the message focus. Additionally, add a POST endpoint which would return an exception due to the state check in the aggregate --- .../axon/gui/MessagesRestEndpoint.java | 28 ------------- .../baeldung/axon/gui/OrderRestEndpoint.java | 40 +++++++++++++++++++ 2 files changed, 40 insertions(+), 28 deletions(-) delete mode 100644 axon/src/main/java/com/baeldung/axon/gui/MessagesRestEndpoint.java create mode 100644 axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java diff --git a/axon/src/main/java/com/baeldung/axon/gui/MessagesRestEndpoint.java b/axon/src/main/java/com/baeldung/axon/gui/MessagesRestEndpoint.java deleted file mode 100644 index ddbc3e2fc5..0000000000 --- a/axon/src/main/java/com/baeldung/axon/gui/MessagesRestEndpoint.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.axon.gui; - -import java.util.UUID; - -import org.axonframework.commandhandling.gateway.CommandGateway; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.baeldung.axon.coreapi.commands.CreateMessageCommand; -import com.baeldung.axon.coreapi.commands.MarkReadMessageCommand; - -@RestController -public class MessagesRestEndpoint { - - private final CommandGateway commandGateway; - - public MessagesRestEndpoint(CommandGateway commandGateway) { - this.commandGateway = commandGateway; - } - - @PostMapping("/hello") - public void publishMessages() { - final String itemId = UUID.randomUUID().toString(); - commandGateway.send(new CreateMessageCommand(itemId, "Hello, how is your day? :-)")); - commandGateway.send(new MarkReadMessageCommand(itemId)); - } - -} diff --git a/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java b/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java new file mode 100644 index 0000000000..3c86f9c3b1 --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java @@ -0,0 +1,40 @@ +package com.baeldung.axon.gui; + +import java.util.UUID; + +import org.axonframework.commandhandling.gateway.CommandGateway; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.axon.coreapi.commands.ConfirmOrderCommand; +import com.baeldung.axon.coreapi.commands.PlaceOrderCommand; +import com.baeldung.axon.coreapi.commands.ShipOrderCommand; + +@RestController +public class OrderRestEndpoint { + + private static final String DEFAULT_PRODUCT = "Deluxe Chair"; + + private final CommandGateway commandGateway; + + public OrderRestEndpoint(CommandGateway commandGateway) { + this.commandGateway = commandGateway; + } + + @PostMapping("/ship-order") + public void shipOrder() { + String orderId = UUID.randomUUID().toString(); + commandGateway.send(new PlaceOrderCommand(orderId, DEFAULT_PRODUCT)); + commandGateway.send(new ConfirmOrderCommand(orderId)); + commandGateway.send(new ShipOrderCommand(orderId)); + } + + @PostMapping("/ship-unconfirmed-order") + public void shipUnconfirmedOrder() { + String orderId = UUID.randomUUID().toString(); + commandGateway.send(new PlaceOrderCommand(orderId, DEFAULT_PRODUCT)); + // This throws an exception, as an Order cannot be shipped if it has not been confirmed yet. + commandGateway.send(new ShipOrderCommand(orderId)); + } + +} From 84b6dc1dbb7badacaed4bbcc5a889ba5a1d5171c Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Thu, 27 Dec 2018 10:36:10 +0100 Subject: [PATCH 055/271] BAEL-2435 Switch domain around Change the domain from 'Messages' to 'Order' as that domain is better suited for an example project like this. The Query Model would be better suited to revolve around the OrderedProducts rather than just printing out a line of text. To that end, add a OrderedProduct model with the OrderStatus, which is updated in the (renamed) OrderedProductsEventHandler upon all the events --- .../axon/coreapi/queries/OrderStatus.java | 7 +++ .../axon/coreapi/queries/OrderedProduct.java | 55 +++++++++++++++++++ .../axon/querymodel/MessagesEventHandler.java | 21 ------- .../OrderedProductsEventHandler.java | 42 ++++++++++++++ 4 files changed, 104 insertions(+), 21 deletions(-) create mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderStatus.java create mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderedProduct.java delete mode 100644 axon/src/main/java/com/baeldung/axon/querymodel/MessagesEventHandler.java create mode 100644 axon/src/main/java/com/baeldung/axon/querymodel/OrderedProductsEventHandler.java diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderStatus.java b/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderStatus.java new file mode 100644 index 0000000000..d215c5fc32 --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderStatus.java @@ -0,0 +1,7 @@ +package com.baeldung.axon.coreapi.queries; + +public enum OrderStatus { + + PLACED, CONFIRMED, SHIPPED + +} diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderedProduct.java b/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderedProduct.java new file mode 100644 index 0000000000..25096eeb42 --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderedProduct.java @@ -0,0 +1,55 @@ +package com.baeldung.axon.coreapi.queries; + +import java.util.Objects; + +public class OrderedProduct { + + private final String orderId; + private final String product; + private OrderStatus orderStatus; + + public OrderedProduct(String orderId, String product) { + this.orderId = orderId; + this.product = product; + orderStatus = OrderStatus.PLACED; + } + + public String getOrderId() { + return orderId; + } + + public String getProduct() { + return product; + } + + public OrderStatus getOrderStatus() { + return orderStatus; + } + + public void setOrderConfirmed() { + this.orderStatus = OrderStatus.CONFIRMED; + } + + public void setOrderShipped() { + this.orderStatus = OrderStatus.SHIPPED; + } + + @Override + public int hashCode() { + return Objects.hash(orderId, product, orderStatus); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + final OrderedProduct other = (OrderedProduct) obj; + return Objects.equals(this.orderId, other.orderId) + && Objects.equals(this.product, other.product) + && Objects.equals(this.orderStatus, other.orderStatus); + } +} diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/MessagesEventHandler.java b/axon/src/main/java/com/baeldung/axon/querymodel/MessagesEventHandler.java deleted file mode 100644 index 6988d40a53..0000000000 --- a/axon/src/main/java/com/baeldung/axon/querymodel/MessagesEventHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.axon.querymodel; - -import org.axonframework.eventhandling.EventHandler; -import org.springframework.stereotype.Service; - -import com.baeldung.axon.coreapi.events.MessageCreatedEvent; -import com.baeldung.axon.coreapi.events.MessageReadEvent; - -@Service -public class MessagesEventHandler { - - @EventHandler - public void handle(MessageCreatedEvent event) { - System.out.println("Message received: " + event.getText() + " (" + event.getId() + ")"); - } - - @EventHandler - public void handle(MessageReadEvent event) { - System.out.println("Message read: " + event.getId()); - } -} \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/OrderedProductsEventHandler.java b/axon/src/main/java/com/baeldung/axon/querymodel/OrderedProductsEventHandler.java new file mode 100644 index 0000000000..7bcdb27af7 --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/querymodel/OrderedProductsEventHandler.java @@ -0,0 +1,42 @@ +package com.baeldung.axon.querymodel; + +import java.util.HashMap; +import java.util.Map; + +import org.axonframework.eventhandling.EventHandler; +import org.springframework.stereotype.Service; + +import com.baeldung.axon.coreapi.queries.OrderedProduct; +import com.baeldung.axon.coreapi.events.OrderConfirmedEvent; +import com.baeldung.axon.coreapi.events.OrderPlacedEvent; +import com.baeldung.axon.coreapi.events.OrderShippedEvent; + +@Service +public class OrderedProductsEventHandler { + + private final Map orderedProducts = new HashMap<>(); + + @EventHandler + public void on(OrderPlacedEvent event) { + String orderId = event.getOrderId(); + orderedProducts.put(orderId, new OrderedProduct(orderId, event.getProduct())); + + } + + @EventHandler + public void on(OrderShippedEvent event) { + orderedProducts.computeIfPresent(event.getOrderId(), (orderId, orderedProduct) -> { + orderedProduct.setOrderShipped(); + return orderedProduct; + }); + } + + @EventHandler + public void on(OrderConfirmedEvent event) { + orderedProducts.computeIfPresent(event.getOrderId(), (orderId, orderedProduct) -> { + orderedProduct.setOrderConfirmed(); + return orderedProduct; + }); + } + +} \ No newline at end of file From 769af6759ed6dca02d6c8732f2627e11e5f66a48 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Thu, 27 Dec 2018 10:39:42 +0100 Subject: [PATCH 056/271] BAEL-2435 Introduce Query message logic Introduce a FindAllOrderedProductsQuery query message, which is published on the QueryGateway through the OrderRestEndpoint and handled by the OrderedProductsEventHandler --- .../queries/FindAllOrderedProductsQuery.java | 5 +++++ .../com/baeldung/axon/gui/OrderRestEndpoint.java | 16 +++++++++++++++- .../querymodel/OrderedProductsEventHandler.java | 11 ++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 axon/src/main/java/com/baeldung/axon/coreapi/queries/FindAllOrderedProductsQuery.java diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/queries/FindAllOrderedProductsQuery.java b/axon/src/main/java/com/baeldung/axon/coreapi/queries/FindAllOrderedProductsQuery.java new file mode 100644 index 0000000000..9d6ca2cfb2 --- /dev/null +++ b/axon/src/main/java/com/baeldung/axon/coreapi/queries/FindAllOrderedProductsQuery.java @@ -0,0 +1,5 @@ +package com.baeldung.axon.coreapi.queries; + +public class FindAllOrderedProductsQuery { + +} diff --git a/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java b/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java index 3c86f9c3b1..3b8be0bc46 100644 --- a/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java +++ b/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java @@ -1,14 +1,20 @@ package com.baeldung.axon.gui; +import java.util.List; import java.util.UUID; import org.axonframework.commandhandling.gateway.CommandGateway; +import org.axonframework.messaging.responsetypes.ResponseTypes; +import org.axonframework.queryhandling.QueryGateway; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import com.baeldung.axon.coreapi.commands.ConfirmOrderCommand; import com.baeldung.axon.coreapi.commands.PlaceOrderCommand; import com.baeldung.axon.coreapi.commands.ShipOrderCommand; +import com.baeldung.axon.coreapi.queries.FindAllOrderedProductsQuery; +import com.baeldung.axon.coreapi.queries.OrderedProduct; @RestController public class OrderRestEndpoint { @@ -16,9 +22,11 @@ public class OrderRestEndpoint { private static final String DEFAULT_PRODUCT = "Deluxe Chair"; private final CommandGateway commandGateway; + private final QueryGateway queryGateway; - public OrderRestEndpoint(CommandGateway commandGateway) { + public OrderRestEndpoint(CommandGateway commandGateway, QueryGateway queryGateway) { this.commandGateway = commandGateway; + this.queryGateway = queryGateway; } @PostMapping("/ship-order") @@ -37,4 +45,10 @@ public class OrderRestEndpoint { commandGateway.send(new ShipOrderCommand(orderId)); } + @GetMapping("/all-orders") + public List findAllOrderedProducts() { + return queryGateway.query(new FindAllOrderedProductsQuery(), ResponseTypes.multipleInstancesOf(OrderedProduct.class)) + .join(); + } + } diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/OrderedProductsEventHandler.java b/axon/src/main/java/com/baeldung/axon/querymodel/OrderedProductsEventHandler.java index 7bcdb27af7..c2bf48614b 100644 --- a/axon/src/main/java/com/baeldung/axon/querymodel/OrderedProductsEventHandler.java +++ b/axon/src/main/java/com/baeldung/axon/querymodel/OrderedProductsEventHandler.java @@ -1,15 +1,19 @@ package com.baeldung.axon.querymodel; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.axonframework.eventhandling.EventHandler; +import org.axonframework.queryhandling.QueryHandler; import org.springframework.stereotype.Service; -import com.baeldung.axon.coreapi.queries.OrderedProduct; import com.baeldung.axon.coreapi.events.OrderConfirmedEvent; import com.baeldung.axon.coreapi.events.OrderPlacedEvent; import com.baeldung.axon.coreapi.events.OrderShippedEvent; +import com.baeldung.axon.coreapi.queries.FindAllOrderedProductsQuery; +import com.baeldung.axon.coreapi.queries.OrderedProduct; @Service public class OrderedProductsEventHandler { @@ -39,4 +43,9 @@ public class OrderedProductsEventHandler { }); } + @QueryHandler + public List handle(FindAllOrderedProductsQuery query) { + return new ArrayList<>(orderedProducts.values()); + } + } \ No newline at end of file From 4c7303c2936706da2aa207eae4b41f0caf8f9d19 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Thu, 27 Dec 2018 10:46:45 +0100 Subject: [PATCH 057/271] BAEL-2435 Rename main file Rename main file from MessagesRunner to OrderApplication --- .../axon/{MessagesRunner.java => OrderApplication.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename axon/src/main/java/com/baeldung/axon/{MessagesRunner.java => OrderApplication.java} (70%) diff --git a/axon/src/main/java/com/baeldung/axon/MessagesRunner.java b/axon/src/main/java/com/baeldung/axon/OrderApplication.java similarity index 70% rename from axon/src/main/java/com/baeldung/axon/MessagesRunner.java rename to axon/src/main/java/com/baeldung/axon/OrderApplication.java index 4f83dd86f0..8f507e141c 100644 --- a/axon/src/main/java/com/baeldung/axon/MessagesRunner.java +++ b/axon/src/main/java/com/baeldung/axon/OrderApplication.java @@ -4,10 +4,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class MessagesRunner { +public class OrderApplication { public static void main(String[] args) { - SpringApplication.run(MessagesRunner.class, args); + SpringApplication.run(OrderApplication.class, args); } } \ No newline at end of file From d5ad67a801d96ba707729c0dcb87e331eef5ae28 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Thu, 27 Dec 2018 10:47:22 +0100 Subject: [PATCH 058/271] BAEL-2435 Add http resource Add http resource to try out all the end points when running the application in Intellij --- axon/src/main/resources/order-api.http | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 axon/src/main/resources/order-api.http diff --git a/axon/src/main/resources/order-api.http b/axon/src/main/resources/order-api.http new file mode 100644 index 0000000000..a3c69c72bc --- /dev/null +++ b/axon/src/main/resources/order-api.http @@ -0,0 +1,11 @@ +POST http://localhost:8080/ship-order + +### + +POST http://localhost:8080/ship-unconfirmed-order + +### + +GET http://localhost:8080/all-orders + +### From 67d011540ef655e03faef2a2dc795653c0806fbc Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 27 Dec 2018 12:35:01 +0200 Subject: [PATCH 059/271] Update README.md --- core-java-perf/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-perf/README.md b/core-java-perf/README.md index bd76388310..6af1c82a0a 100644 --- a/core-java-perf/README.md +++ b/core-java-perf/README.md @@ -1,3 +1,4 @@ ## Core Java Performance ### Relevant Articles: +- [Verbose Garbage Collection in Java](https://www.baeldung.com/java-verbose-gc) From 9e23ea5abee98cd5dfd874bb31619045e35e62fd Mon Sep 17 00:00:00 2001 From: Ganesh Pagade Date: Thu, 27 Dec 2018 17:02:37 +0530 Subject: [PATCH 060/271] simplier asserts --- .../src/test/java/com/baeldung/OuterUnitTest.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java b/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java index 6680a8d518..798736149a 100644 --- a/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java +++ b/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java @@ -1,9 +1,11 @@ package com.baeldung; +import static org.junit.Assert.assertTrue; import static org.hamcrest.CoreMatchers.is; import java.util.Arrays; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import org.junit.Test; @@ -33,18 +35,13 @@ public class OuterUnitTest { @Test public void whenGetNestMembersForNestedClasses_thenGetAllNestedClasses() { - List nestMembers = Arrays.stream(Outer.Inner.class.getNestMembers()) + Set nestMembers = Arrays.stream(Outer.Inner.class.getNestMembers()) .map(Class::getName) - .collect(Collectors.toList()); + .collect(Collectors.toSet()); is(nestMembers.size()).equals(2); - boolean containsOuter = nestMembers.stream() - .anyMatch("com.baeldung.Outer"::equals); - is(containsOuter).equals(true); - - boolean containsInner = nestMembers.stream() - .anyMatch("com.baeldung.Outer$Inner"::equals); - is(containsInner).equals(true); + assertTrue(nestMembers.contains("com.baeldung.Outer")); + assertTrue(nestMembers.contains("com.baeldung.Outer$Inner")); } } \ No newline at end of file From 6ae59f8f8d36a8a20612fe449a7a33ec683c869b Mon Sep 17 00:00:00 2001 From: Ganesh Pagade Date: Thu, 27 Dec 2018 17:08:34 +0530 Subject: [PATCH 061/271] clean up --- core-java-11/src/test/java/com/baeldung/OuterUnitTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java b/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java index 798736149a..9e6bd72680 100644 --- a/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java +++ b/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java @@ -4,7 +4,6 @@ import static org.junit.Assert.assertTrue; import static org.hamcrest.CoreMatchers.is; import java.util.Arrays; -import java.util.List; import java.util.Set; import java.util.stream.Collectors; import org.junit.Test; From 07f762dfc8838acb09bf53ce1d4bf960d117baf7 Mon Sep 17 00:00:00 2001 From: raghav-jha Date: Fri, 28 Dec 2018 04:22:09 +0530 Subject: [PATCH 062/271] BAEL-2436 * BAEL-2436 Type Safe Criteria Queries Using Hibernate Metamodel * Formattng fixes * Formatting fixes --- persistence-modules/hibernate5/pom.xml | 1 - .../java/com/baeldung/hibernate/criteriaquery/HibernateUtil.java | 1 - 2 files changed, 2 deletions(-) diff --git a/persistence-modules/hibernate5/pom.xml b/persistence-modules/hibernate5/pom.xml index 9bfea14d30..af94025a73 100644 --- a/persistence-modules/hibernate5/pom.xml +++ b/persistence-modules/hibernate5/pom.xml @@ -72,7 +72,6 @@ org.hibernate hibernate-jpamodelgen ${hibernate.version} - provided diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/criteriaquery/HibernateUtil.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/criteriaquery/HibernateUtil.java index 0d11ea1567..35cfe55ba6 100644 --- a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/criteriaquery/HibernateUtil.java +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/criteriaquery/HibernateUtil.java @@ -35,7 +35,6 @@ public class HibernateUtil { Metadata metadata = metadataSources.getMetadataBuilder() .applyBasicType(LocalDateStringType.INSTANCE) .build(); - return metadata.getSessionFactoryBuilder().build(); } catch (IOException ex) { throw new ExceptionInInitializerError(ex); From 5cc9a60c591e249d281ef97c55662eb780785f61 Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Fri, 28 Dec 2018 00:05:55 -0600 Subject: [PATCH 063/271] BAEL-2367: update README (#6006) * BAEL-2246: add link back to article * BAEL-2174: rename core-java-net module to core-java-networking * BAEL-2174: add link back to article * BAEL-2363 BAEL-2337 BAEL-1996 BAEL-2277 add links back to articles * BAEL-2367: add link back to article --- java-strings/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-strings/README.md b/java-strings/README.md index cbc32d0015..4d735490ce 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -43,3 +43,4 @@ - [Pad a String with Zeros or Spaces in Java](https://www.baeldung.com/java-pad-string) - [Adding a Newline Character to a String in Java](https://www.baeldung.com/java-string-newline) - [Remove or Replace part of a String in Java](https://www.baeldung.com/java-remove-replace-string-part) +- [Replace a Character at a Specific Index in a String in Java](https://www.baeldung.com/java-replace-character-at-index) From 15071b6d49ef751184dbf7fbd033553257a69400 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Fri, 28 Dec 2018 10:44:23 +0200 Subject: [PATCH 064/271] Update README.md --- persistence-modules/hibernate5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index b6e112b5fc..c066ccb50b 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -21,3 +21,4 @@ - [Custom Types in Hibernate](https://www.baeldung.com/hibernate-custom-types) - [Criteria API – An Example of IN Expressions](https://www.baeldung.com/jpa-criteria-api-in-expressions) - [Difference Between @JoinColumn and mappedBy](https://www.baeldung.com/jpa-joincolumn-vs-mappedby) +- [Hibernate 5 Bootstrapping API](https://www.baeldung.com/hibernate-5-bootstrapping-api) From 8ce227cce7d92ca7ac1e5e7b0e63b8b41da604a2 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Fri, 28 Dec 2018 16:26:57 +0400 Subject: [PATCH 065/271] immutable sets --- .../com/baeldung/set/UnmodifiableSet.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 core-java-collections/src/main/java/com/baeldung/set/UnmodifiableSet.java diff --git a/core-java-collections/src/main/java/com/baeldung/set/UnmodifiableSet.java b/core-java-collections/src/main/java/com/baeldung/set/UnmodifiableSet.java new file mode 100644 index 0000000000..d821c46a3c --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/set/UnmodifiableSet.java @@ -0,0 +1,44 @@ +package com.baeldung.set; + +import com.google.common.collect.ImmutableSet; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +public class UnmodifiableSet { + + public static void main(String[] args) { + + Set set = new HashSet<>(); + set.add("Canada"); + set.add("USA"); + + coreJDK(set); + guavaOf(); + copyOf(set); + setOf(); + } + + private static void setOf() { + Set immutable = Set.of("Canada", "USA"); + System.out.println(immutable); + } + + private static void guavaOf() { + Set immutable = ImmutableSet.of("Canada", "USA"); + System.out.println(immutable); + } + + private static void copyOf(Set set) { + Set immutable = ImmutableSet.copyOf(set); + set.add("Costa Rica"); + System.out.println(immutable); + } + + private static void coreJDK(Set set) { + Set unmodifiableSet = Collections.unmodifiableSet(set); + set.add("Costa Rica"); + System.out.println(unmodifiableSet); + } +} From fb8183d69434b3f3a4b3d2ec311cdbe6a40d98da Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Fri, 28 Dec 2018 16:33:41 +0400 Subject: [PATCH 066/271] comment java 9 --- .../src/main/java/com/baeldung/set/UnmodifiableSet.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core-java-collections/src/main/java/com/baeldung/set/UnmodifiableSet.java b/core-java-collections/src/main/java/com/baeldung/set/UnmodifiableSet.java index d821c46a3c..06f477c50a 100644 --- a/core-java-collections/src/main/java/com/baeldung/set/UnmodifiableSet.java +++ b/core-java-collections/src/main/java/com/baeldung/set/UnmodifiableSet.java @@ -17,12 +17,12 @@ public class UnmodifiableSet { coreJDK(set); guavaOf(); copyOf(set); - setOf(); + java9Of(); } - private static void setOf() { - Set immutable = Set.of("Canada", "USA"); - System.out.println(immutable); + private static void java9Of() { + //Set immutable = Set.of("Canada", "USA"); + //System.out.println(immutable); } private static void guavaOf() { From 5aed1b89bbceaa2d91b49675779a72c3d80578ff Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Fri, 28 Dec 2018 17:17:13 +0330 Subject: [PATCH 067/271] Added a test for Optional#isEmpty. (#5938) --- .../baeldung/optional/OptionalUnitTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 core-java-11/src/test/java/com/baeldung/optional/OptionalUnitTest.java diff --git a/core-java-11/src/test/java/com/baeldung/optional/OptionalUnitTest.java b/core-java-11/src/test/java/com/baeldung/optional/OptionalUnitTest.java new file mode 100644 index 0000000000..281155138d --- /dev/null +++ b/core-java-11/src/test/java/com/baeldung/optional/OptionalUnitTest.java @@ -0,0 +1,23 @@ +package com.baeldung.optional; + +import org.junit.Test; + +import java.util.Optional; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * Unit tests for {@link Optional} in Java 11. + */ +public class OptionalUnitTest { + + @Test + public void givenAnEmptyOptional_isEmpty_thenBehavesAsExpected() { + Optional opt = Optional.of("Baeldung"); + assertFalse(opt.isEmpty()); + + opt = Optional.ofNullable(null); + assertTrue(opt.isEmpty()); + } +} From 415ecc6421ff449dba0fc09458f2aa896c54af16 Mon Sep 17 00:00:00 2001 From: Loredana Date: Fri, 28 Dec 2018 16:22:03 +0200 Subject: [PATCH 068/271] remove completablefuture --- .../controllers/EthereumRestController.java | 16 +++++------ .../baeldung/web3j/services/Web3Service.java | 28 +++++++++---------- .../services/EthereumContractUnitTest.java | 10 +++---- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/ethereum/src/main/java/com/baeldung/web3j/controllers/EthereumRestController.java b/ethereum/src/main/java/com/baeldung/web3j/controllers/EthereumRestController.java index e05517bc79..3238a19ff9 100644 --- a/ethereum/src/main/java/com/baeldung/web3j/controllers/EthereumRestController.java +++ b/ethereum/src/main/java/com/baeldung/web3j/controllers/EthereumRestController.java @@ -32,8 +32,8 @@ public class EthereumRestController { return CompletableFuture.supplyAsync(() -> { try { - CompletableFuture result = web3Service.getBlockNumber(); - responseTransfer.setMessage(result.get().toString()); + EthBlockNumber result = web3Service.getBlockNumber(); + responseTransfer.setMessage(result.toString()); } catch (Exception e) { responseTransfer.setMessage(GENERIC_EXCEPTION); } @@ -51,8 +51,8 @@ public class EthereumRestController { return CompletableFuture.supplyAsync(() -> { try { - CompletableFuture result = web3Service.getEthAccounts(); - responseTransfer.setMessage(result.get().toString()); + EthAccounts result = web3Service.getEthAccounts(); + responseTransfer.setMessage(result.toString()); } catch (Exception e) { responseTransfer.setMessage(GENERIC_EXCEPTION); } @@ -70,8 +70,8 @@ public class EthereumRestController { Instant start = TimeHelper.start(); return CompletableFuture.supplyAsync(() -> { try { - CompletableFuture result = web3Service.getTransactionCount(); - responseTransfer.setMessage(result.get().toString()); + EthGetTransactionCount result = web3Service.getTransactionCount(); + responseTransfer.setMessage(result.toString()); } catch (Exception e) { responseTransfer.setMessage(GENERIC_EXCEPTION); } @@ -88,8 +88,8 @@ public class EthereumRestController { Instant start = TimeHelper.start(); return CompletableFuture.supplyAsync(() -> { try { - CompletableFuture result = web3Service.getEthBalance(); - responseTransfer.setMessage(result.get().toString()); + EthGetBalance result = web3Service.getEthBalance(); + responseTransfer.setMessage(result.toString()); } catch (Exception e) { responseTransfer.setMessage(GENERIC_EXCEPTION); } diff --git a/ethereum/src/main/java/com/baeldung/web3j/services/Web3Service.java b/ethereum/src/main/java/com/baeldung/web3j/services/Web3Service.java index c943ee4006..4b7d01e52b 100644 --- a/ethereum/src/main/java/com/baeldung/web3j/services/Web3Service.java +++ b/ethereum/src/main/java/com/baeldung/web3j/services/Web3Service.java @@ -47,47 +47,47 @@ public class Web3Service { return "0x" + binary; } - public CompletableFuture getBlockNumber() { + public EthBlockNumber getBlockNumber() { EthBlockNumber result = new EthBlockNumber(); try { result = this.web3j.ethBlockNumber().sendAsync().get(); } catch (Exception ex) { System.out.println(GENERIC_EXCEPTION); } - return CompletableFuture.completedFuture(result); + return result; } - public CompletableFuture getEthAccounts() { + public EthAccounts getEthAccounts() { EthAccounts result = new EthAccounts(); try { result = this.web3j.ethAccounts().sendAsync().get(); } catch (Exception ex) { System.out.println(GENERIC_EXCEPTION); } - return CompletableFuture.completedFuture(result); + return result; } - public CompletableFuture getTransactionCount() { + public EthGetTransactionCount getTransactionCount() { EthGetTransactionCount result = new EthGetTransactionCount(); try { result = this.web3j.ethGetTransactionCount(DEFAULT_ADDRESS, DefaultBlockParameter.valueOf("latest")).sendAsync().get(); } catch (Exception ex) { System.out.println(GENERIC_EXCEPTION); } - return CompletableFuture.completedFuture(result); + return result; } - public CompletableFuture getEthBalance() { + public EthGetBalance getEthBalance() { EthGetBalance result = new EthGetBalance(); try { result = this.web3j.ethGetBalance(DEFAULT_ADDRESS, DefaultBlockParameter.valueOf("latest")).sendAsync().get(); } catch (Exception ex) { System.out.println(GENERIC_EXCEPTION); } - return CompletableFuture.completedFuture(result); + return result; } - public CompletableFuture fromScratchContractExample() { + public String fromScratchContractExample() { String contractAddress = ""; @@ -108,13 +108,13 @@ public class Web3Service { } catch (Exception ex) { System.out.println(PLEASE_SUPPLY_REAL_DATA); - return CompletableFuture.completedFuture(PLEASE_SUPPLY_REAL_DATA); + return PLEASE_SUPPLY_REAL_DATA; } - return CompletableFuture.completedFuture(contractAddress); + return contractAddress; } @Async - public CompletableFuture sendTx() { + public String sendTx() { String transactionHash = ""; try { @@ -135,10 +135,10 @@ public class Web3Service { } catch (Exception ex) { System.out.println(PLEASE_SUPPLY_REAL_DATA); - return CompletableFuture.completedFuture(PLEASE_SUPPLY_REAL_DATA); + return PLEASE_SUPPLY_REAL_DATA; } - return CompletableFuture.completedFuture(transactionHash); + return transactionHash; } } diff --git a/ethereum/src/test/java/com/baeldung/web3j/services/EthereumContractUnitTest.java b/ethereum/src/test/java/com/baeldung/web3j/services/EthereumContractUnitTest.java index 382c96e985..ff02659bd5 100644 --- a/ethereum/src/test/java/com/baeldung/web3j/services/EthereumContractUnitTest.java +++ b/ethereum/src/test/java/com/baeldung/web3j/services/EthereumContractUnitTest.java @@ -4,8 +4,6 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import java.util.concurrent.CompletableFuture; - public class EthereumContractUnitTest { private Web3Service web3Service; @@ -17,14 +15,14 @@ public class EthereumContractUnitTest { @Test public void testContract() { - CompletableFuture result = web3Service.fromScratchContractExample(); - assert (result instanceof CompletableFuture); + String result = web3Service.fromScratchContractExample(); + assert (result instanceof String); } @Test public void sendTx() { - CompletableFuture result = web3Service.sendTx(); - assert (result instanceof CompletableFuture); + String result = web3Service.sendTx(); + assert (result instanceof String); } @After From 03306112bdc117277afa828912a81b5fe938d158 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Fri, 28 Dec 2018 15:58:41 +0100 Subject: [PATCH 069/271] BAEL-2435 Minor clean ups -Add toString() function to messages/query-model -Fix typo in exception -Reorder event handlers in OrderedProductsEventHandler -Replace usage of constants for local fields -Add missing Aggregate test case --- .../axon/commandmodel/OrderAggregate.java | 2 +- .../coreapi/commands/ConfirmOrderCommand.java | 7 ++++ .../coreapi/commands/PlaceOrderCommand.java | 8 +++++ .../coreapi/commands/ShipOrderCommand.java | 7 ++++ .../coreapi/events/OrderConfirmedEvent.java | 7 ++++ .../axon/coreapi/events/OrderPlacedEvent.java | 8 +++++ .../coreapi/events/OrderShippedEvent.java | 7 ++++ .../axon/coreapi/queries/OrderedProduct.java | 9 +++++ .../baeldung/axon/gui/OrderRestEndpoint.java | 8 ++--- .../OrderedProductsEventHandler.java | 17 +++++----- .../commandmodel/OrderAggregateUnitTest.java | 33 +++++++++++++------ 11 files changed, 88 insertions(+), 25 deletions(-) diff --git a/axon/src/main/java/com/baeldung/axon/commandmodel/OrderAggregate.java b/axon/src/main/java/com/baeldung/axon/commandmodel/OrderAggregate.java index fd4f901032..b37b2fdd66 100644 --- a/axon/src/main/java/com/baeldung/axon/commandmodel/OrderAggregate.java +++ b/axon/src/main/java/com/baeldung/axon/commandmodel/OrderAggregate.java @@ -34,7 +34,7 @@ public class OrderAggregate { @CommandHandler public void handle(ShipOrderCommand command) { if (!orderConfirmed) { - throw new IllegalStateException("Cannot ship an order which has not ben confirmed yet."); + throw new IllegalStateException("Cannot ship an order which has not been confirmed yet."); } apply(new OrderShippedEvent(orderId)); diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/ConfirmOrderCommand.java b/axon/src/main/java/com/baeldung/axon/coreapi/commands/ConfirmOrderCommand.java index ba04343af1..244b69f3b7 100644 --- a/axon/src/main/java/com/baeldung/axon/coreapi/commands/ConfirmOrderCommand.java +++ b/axon/src/main/java/com/baeldung/axon/coreapi/commands/ConfirmOrderCommand.java @@ -33,4 +33,11 @@ public class ConfirmOrderCommand { final ConfirmOrderCommand other = (ConfirmOrderCommand) obj; return Objects.equals(this.orderId, other.orderId); } + + @Override + public String toString() { + return "ConfirmOrderCommand{" + + "orderId='" + orderId + '\'' + + '}'; + } } diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/PlaceOrderCommand.java b/axon/src/main/java/com/baeldung/axon/coreapi/commands/PlaceOrderCommand.java index cde2d7f1ae..c70d503050 100644 --- a/axon/src/main/java/com/baeldung/axon/coreapi/commands/PlaceOrderCommand.java +++ b/axon/src/main/java/com/baeldung/axon/coreapi/commands/PlaceOrderCommand.java @@ -40,4 +40,12 @@ public class PlaceOrderCommand { return Objects.equals(this.orderId, other.orderId) && Objects.equals(this.product, other.product); } + + @Override + public String toString() { + return "PlaceOrderCommand{" + + "orderId='" + orderId + '\'' + + ", product='" + product + '\'' + + '}'; + } } \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/ShipOrderCommand.java b/axon/src/main/java/com/baeldung/axon/coreapi/commands/ShipOrderCommand.java index 75469533b9..7312bc1fdb 100644 --- a/axon/src/main/java/com/baeldung/axon/coreapi/commands/ShipOrderCommand.java +++ b/axon/src/main/java/com/baeldung/axon/coreapi/commands/ShipOrderCommand.java @@ -33,4 +33,11 @@ public class ShipOrderCommand { final ShipOrderCommand other = (ShipOrderCommand) obj; return Objects.equals(this.orderId, other.orderId); } + + @Override + public String toString() { + return "ShipOrderCommand{" + + "orderId='" + orderId + '\'' + + '}'; + } } \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderConfirmedEvent.java b/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderConfirmedEvent.java index 1706b08023..d2b7d58435 100644 --- a/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderConfirmedEvent.java +++ b/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderConfirmedEvent.java @@ -30,4 +30,11 @@ public class OrderConfirmedEvent { final OrderConfirmedEvent other = (OrderConfirmedEvent) obj; return Objects.equals(this.orderId, other.orderId); } + + @Override + public String toString() { + return "OrderConfirmedEvent{" + + "orderId='" + orderId + '\'' + + '}'; + } } diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderPlacedEvent.java b/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderPlacedEvent.java index 8d5364f4c6..06de4c5f9f 100644 --- a/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderPlacedEvent.java +++ b/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderPlacedEvent.java @@ -37,4 +37,12 @@ public class OrderPlacedEvent { return Objects.equals(this.orderId, other.orderId) && Objects.equals(this.product, other.product); } + + @Override + public String toString() { + return "OrderPlacedEvent{" + + "orderId='" + orderId + '\'' + + ", product='" + product + '\'' + + '}'; + } } \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderShippedEvent.java b/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderShippedEvent.java index 5abcd09a3c..76aa684629 100644 --- a/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderShippedEvent.java +++ b/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderShippedEvent.java @@ -30,4 +30,11 @@ public class OrderShippedEvent { final OrderShippedEvent other = (OrderShippedEvent) obj; return Objects.equals(this.orderId, other.orderId); } + + @Override + public String toString() { + return "OrderShippedEvent{" + + "orderId='" + orderId + '\'' + + '}'; + } } \ No newline at end of file diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderedProduct.java b/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderedProduct.java index 25096eeb42..d847bb2a98 100644 --- a/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderedProduct.java +++ b/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderedProduct.java @@ -52,4 +52,13 @@ public class OrderedProduct { && Objects.equals(this.product, other.product) && Objects.equals(this.orderStatus, other.orderStatus); } + + @Override + public String toString() { + return "OrderedProduct{" + + "orderId='" + orderId + '\'' + + ", product='" + product + '\'' + + ", orderStatus=" + orderStatus + + '}'; + } } diff --git a/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java b/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java index 3b8be0bc46..a9f34cc691 100644 --- a/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java +++ b/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java @@ -19,8 +19,6 @@ import com.baeldung.axon.coreapi.queries.OrderedProduct; @RestController public class OrderRestEndpoint { - private static final String DEFAULT_PRODUCT = "Deluxe Chair"; - private final CommandGateway commandGateway; private final QueryGateway queryGateway; @@ -32,7 +30,7 @@ public class OrderRestEndpoint { @PostMapping("/ship-order") public void shipOrder() { String orderId = UUID.randomUUID().toString(); - commandGateway.send(new PlaceOrderCommand(orderId, DEFAULT_PRODUCT)); + commandGateway.send(new PlaceOrderCommand(orderId, "Deluxe Chair")); commandGateway.send(new ConfirmOrderCommand(orderId)); commandGateway.send(new ShipOrderCommand(orderId)); } @@ -40,7 +38,7 @@ public class OrderRestEndpoint { @PostMapping("/ship-unconfirmed-order") public void shipUnconfirmedOrder() { String orderId = UUID.randomUUID().toString(); - commandGateway.send(new PlaceOrderCommand(orderId, DEFAULT_PRODUCT)); + commandGateway.send(new PlaceOrderCommand(orderId, "Deluxe Chair")); // This throws an exception, as an Order cannot be shipped if it has not been confirmed yet. commandGateway.send(new ShipOrderCommand(orderId)); } @@ -48,7 +46,7 @@ public class OrderRestEndpoint { @GetMapping("/all-orders") public List findAllOrderedProducts() { return queryGateway.query(new FindAllOrderedProductsQuery(), ResponseTypes.multipleInstancesOf(OrderedProduct.class)) - .join(); + .join(); } } diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/OrderedProductsEventHandler.java b/axon/src/main/java/com/baeldung/axon/querymodel/OrderedProductsEventHandler.java index c2bf48614b..d4cf3d999b 100644 --- a/axon/src/main/java/com/baeldung/axon/querymodel/OrderedProductsEventHandler.java +++ b/axon/src/main/java/com/baeldung/axon/querymodel/OrderedProductsEventHandler.java @@ -24,15 +24,6 @@ public class OrderedProductsEventHandler { public void on(OrderPlacedEvent event) { String orderId = event.getOrderId(); orderedProducts.put(orderId, new OrderedProduct(orderId, event.getProduct())); - - } - - @EventHandler - public void on(OrderShippedEvent event) { - orderedProducts.computeIfPresent(event.getOrderId(), (orderId, orderedProduct) -> { - orderedProduct.setOrderShipped(); - return orderedProduct; - }); } @EventHandler @@ -43,6 +34,14 @@ public class OrderedProductsEventHandler { }); } + @EventHandler + public void on(OrderShippedEvent event) { + orderedProducts.computeIfPresent(event.getOrderId(), (orderId, orderedProduct) -> { + orderedProduct.setOrderShipped(); + return orderedProduct; + }); + } + @QueryHandler public List handle(FindAllOrderedProductsQuery query) { return new ArrayList<>(orderedProducts.values()); diff --git a/axon/src/test/java/com/baeldung/axon/commandmodel/OrderAggregateUnitTest.java b/axon/src/test/java/com/baeldung/axon/commandmodel/OrderAggregateUnitTest.java index e7dfdeb794..9beedbaa19 100644 --- a/axon/src/test/java/com/baeldung/axon/commandmodel/OrderAggregateUnitTest.java +++ b/axon/src/test/java/com/baeldung/axon/commandmodel/OrderAggregateUnitTest.java @@ -6,6 +6,7 @@ import org.axonframework.test.aggregate.AggregateTestFixture; import org.axonframework.test.aggregate.FixtureConfiguration; import org.junit.*; +import com.baeldung.axon.coreapi.commands.ConfirmOrderCommand; import com.baeldung.axon.coreapi.commands.PlaceOrderCommand; import com.baeldung.axon.coreapi.commands.ShipOrderCommand; import com.baeldung.axon.coreapi.events.OrderConfirmedEvent; @@ -14,9 +15,6 @@ import com.baeldung.axon.coreapi.events.OrderShippedEvent; public class OrderAggregateUnitTest { - private static final String ORDER_ID = UUID.randomUUID().toString(); - private static final String DEFAULT_PRODUCT = "Deluxe Chair"; - private FixtureConfiguration fixture; @Before @@ -26,23 +24,38 @@ public class OrderAggregateUnitTest { @Test public void giveNoPriorActivity_whenPlaceOrderCommand_thenShouldPublishOrderPlacedEvent() { + String orderId = UUID.randomUUID().toString(); + String product = "Deluxe Chair"; fixture.givenNoPriorActivity() - .when(new PlaceOrderCommand(ORDER_ID, DEFAULT_PRODUCT)) - .expectEvents(new OrderPlacedEvent(ORDER_ID, DEFAULT_PRODUCT)); + .when(new PlaceOrderCommand(orderId, product)) + .expectEvents(new OrderPlacedEvent(orderId, product)); + } + + @Test + public void givenOrderPlacedEvent_whenConfirmOrderCommand_thenShouldPublishOrderConfirmedEvent() { + String orderId = UUID.randomUUID().toString(); + String product = "Deluxe Chair"; + fixture.given(new OrderPlacedEvent(orderId, product)) + .when(new ConfirmOrderCommand(orderId)) + .expectEvents(new OrderConfirmedEvent(orderId)); } @Test public void givenOrderPlacedEvent_whenShipOrderCommand_thenShouldThrowIllegalStateException() { - fixture.given(new OrderPlacedEvent(ORDER_ID, DEFAULT_PRODUCT)) - .when(new ShipOrderCommand(ORDER_ID)) + String orderId = UUID.randomUUID().toString(); + String product = "Deluxe Chair"; + fixture.given(new OrderPlacedEvent(orderId, product)) + .when(new ShipOrderCommand(orderId)) .expectException(IllegalStateException.class); } @Test public void givenOrderPlacedEventAndOrderConfirmedEvent_whenShipOrderCommand_thenShouldPublishOrderShippedEvent() { - fixture.given(new OrderPlacedEvent(ORDER_ID, DEFAULT_PRODUCT), new OrderConfirmedEvent(ORDER_ID)) - .when(new ShipOrderCommand(ORDER_ID)) - .expectEvents(new OrderShippedEvent(ORDER_ID)); + String orderId = UUID.randomUUID().toString(); + String product = "Deluxe Chair"; + fixture.given(new OrderPlacedEvent(orderId, product), new OrderConfirmedEvent(orderId)) + .when(new ShipOrderCommand(orderId)) + .expectEvents(new OrderShippedEvent(orderId)); } } \ No newline at end of file From 4d6cb52be4642c22cfa57ed52162c695ebe6b2f5 Mon Sep 17 00:00:00 2001 From: Yatendra Goel Date: Fri, 28 Dec 2018 21:57:38 +0530 Subject: [PATCH 070/271] BAEL-1978: Added a test to demostrate classpath resource with relative path --- .../SpringResourceIntegrationTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spring-core/src/test/java/com/baeldung/resource/SpringResourceIntegrationTest.java b/spring-core/src/test/java/com/baeldung/resource/SpringResourceIntegrationTest.java index 38e8304f0f..284776fdfa 100644 --- a/spring-core/src/test/java/com/baeldung/resource/SpringResourceIntegrationTest.java +++ b/spring-core/src/test/java/com/baeldung/resource/SpringResourceIntegrationTest.java @@ -7,6 +7,8 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLClassLoader; import java.nio.file.Files; import java.util.stream.Collectors; @@ -23,6 +25,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; import org.springframework.util.ResourceUtils; +import com.baeldung.dependson.config.TestConfig; + /** * Test class illustrating various methods of accessing a file from the classpath using Resource. * @author tritty @@ -98,4 +102,19 @@ public class SpringResourceIntegrationTest { final String employees = new String(Files.readAllBytes(resource.toPath())); assertEquals(EMPLOYEES_EXPECTED, employees); } + + @Test + public void whenClassPathResourceWithAbsoultePath_thenReadSuccessful() throws IOException { + final File resource = new ClassPathResource("/data/employees.dat", this.getClass()).getFile(); + final String employees = new String(Files.readAllBytes(resource.toPath())); + assertEquals(EMPLOYEES_EXPECTED, employees); + } + + @Test + public void whenClassPathResourceWithRelativePath_thenReadSuccessful() throws IOException { +// final File resource = new ClassPathResource("../../../data/employees.dat", SpringResourceIntegrationTest.class).getFile(); + final File resource = new ClassPathResource("/data/employees.dat", SpringResourceIntegrationTest.class).getFile(); + final String employees = new String(Files.readAllBytes(resource.toPath())); + assertEquals(EMPLOYEES_EXPECTED, employees); + } } From c3eb5c939fff07533096eabb859096970eb147ad Mon Sep 17 00:00:00 2001 From: Yatendra Goel Date: Fri, 28 Dec 2018 22:00:35 +0530 Subject: [PATCH 071/271] BAEL-1978: Added a test to demostrate classpath resource with relative path --- .../com/baeldung/resource/SpringResourceIntegrationTest.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spring-core/src/test/java/com/baeldung/resource/SpringResourceIntegrationTest.java b/spring-core/src/test/java/com/baeldung/resource/SpringResourceIntegrationTest.java index 284776fdfa..c1464feded 100644 --- a/spring-core/src/test/java/com/baeldung/resource/SpringResourceIntegrationTest.java +++ b/spring-core/src/test/java/com/baeldung/resource/SpringResourceIntegrationTest.java @@ -7,8 +7,6 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLClassLoader; import java.nio.file.Files; import java.util.stream.Collectors; @@ -25,8 +23,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; import org.springframework.util.ResourceUtils; -import com.baeldung.dependson.config.TestConfig; - /** * Test class illustrating various methods of accessing a file from the classpath using Resource. * @author tritty From 3220d1b958446f47ac7d4a4c259f94405b306beb Mon Sep 17 00:00:00 2001 From: Loredana Date: Sat, 29 Dec 2018 00:27:55 +0200 Subject: [PATCH 072/271] fix spring-core mockito issue --- spring-core/pom.xml | 1 + .../com/baeldung/resource/SpringResourceIntegrationTest.java | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-core/pom.xml b/spring-core/pom.xml index 60f3262f08..f1e2e2a748 100644 --- a/spring-core/pom.xml +++ b/spring-core/pom.xml @@ -85,6 +85,7 @@ 1.16.12 2.5 1.5.2.RELEASE + 1.10.19 \ No newline at end of file diff --git a/spring-core/src/test/java/com/baeldung/resource/SpringResourceIntegrationTest.java b/spring-core/src/test/java/com/baeldung/resource/SpringResourceIntegrationTest.java index c1464feded..a7a2a9032a 100644 --- a/spring-core/src/test/java/com/baeldung/resource/SpringResourceIntegrationTest.java +++ b/spring-core/src/test/java/com/baeldung/resource/SpringResourceIntegrationTest.java @@ -108,8 +108,7 @@ public class SpringResourceIntegrationTest { @Test public void whenClassPathResourceWithRelativePath_thenReadSuccessful() throws IOException { -// final File resource = new ClassPathResource("../../../data/employees.dat", SpringResourceIntegrationTest.class).getFile(); - final File resource = new ClassPathResource("/data/employees.dat", SpringResourceIntegrationTest.class).getFile(); + final File resource = new ClassPathResource("../../../data/employees.dat", SpringResourceIntegrationTest.class).getFile(); final String employees = new String(Files.readAllBytes(resource.toPath())); assertEquals(EMPLOYEES_EXPECTED, employees); } From a1b1e02e71df82eb3ff6d267efdd3db7643ea804 Mon Sep 17 00:00:00 2001 From: Emily Cheyne Date: Fri, 28 Dec 2018 16:11:16 -0700 Subject: [PATCH 073/271] BAEL-2421 Update readme (#6014) --- java-strings/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-strings/README.md b/java-strings/README.md index 4d735490ce..60131e392d 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -44,3 +44,4 @@ - [Adding a Newline Character to a String in Java](https://www.baeldung.com/java-string-newline) - [Remove or Replace part of a String in Java](https://www.baeldung.com/java-remove-replace-string-part) - [Replace a Character at a Specific Index in a String in Java](https://www.baeldung.com/java-replace-character-at-index) +- [Convert a Comma Separated String to a List in Java](https://www.baeldung.com/java-string-with-separator-to-list) From 2c801888e7f3e538f2371d6ad1627ebc761128ca Mon Sep 17 00:00:00 2001 From: FrancoCorleone Date: Sat, 29 Dec 2018 00:18:30 +0100 Subject: [PATCH 074/271] BAEL-2090 Insert with JPA * Adding inserts for JPA objects repositories * Refactor tests * Small refactor * Small refactor * Remove redundant @Repository annotation * Refactor tests * Change to simple entity manager implementation * Refactor changes * Remove Spring repositories, Add simple implementation using EntityManager * Remove redundant Interface * Remove redundant files * Update persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/PersonInsertRepository.java Co-Authored-By: FrancoCorleone --- .../dao/repositories/InsertRepository.java | 5 -- .../PersonEntityManagerInsertRepository.java | 7 -- .../PersonEntityManagerRepository.java | 10 --- .../PersonQueryInsertRepository.java | 7 -- .../repositories/PersonQueryRepository.java | 16 ----- ...rsonEntityManagerInsertRepositoryImpl.java | 21 ------ ...yImpl.java => PersonInsertRepository.java} | 18 +++-- ...PersonInsertRepositoryIntegrationTest.java | 67 +++++++------------ 8 files changed, 35 insertions(+), 116 deletions(-) delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InsertRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonEntityManagerInsertRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonEntityManagerRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonQueryInsertRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonQueryRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/PersonEntityManagerInsertRepositoryImpl.java rename persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/{PersonQueryInsertRepositoryImpl.java => PersonInsertRepository.java} (60%) diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InsertRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InsertRepository.java deleted file mode 100644 index 6a74e067fe..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InsertRepository.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.baeldung.dao.repositories; - -public interface InsertRepository { - void insert(S entity); -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonEntityManagerInsertRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonEntityManagerInsertRepository.java deleted file mode 100644 index 6d3cbb07df..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonEntityManagerInsertRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.dao.repositories; - -import com.baeldung.domain.Person; - -public interface PersonEntityManagerInsertRepository { - void insert(Person person); -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonEntityManagerRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonEntityManagerRepository.java deleted file mode 100644 index cbf3d59620..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonEntityManagerRepository.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.dao.repositories; - -import com.baeldung.domain.Person; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface PersonEntityManagerRepository extends JpaRepository, PersonEntityManagerInsertRepository { - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonQueryInsertRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonQueryInsertRepository.java deleted file mode 100644 index be01e9883a..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonQueryInsertRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.dao.repositories; - -import com.baeldung.domain.Person; - -public interface PersonQueryInsertRepository { - void insert(Person person); -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonQueryRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonQueryRepository.java deleted file mode 100644 index 1516c38443..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/PersonQueryRepository.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.dao.repositories; - -import com.baeldung.domain.Person; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; - -@Repository -public interface PersonQueryRepository extends JpaRepository, PersonQueryInsertRepository { - - @Modifying - @Query(value = "INSERT INTO person (id, first_name, last_name) VALUES (:id,:firstName,:lastName)", nativeQuery = true) - void insertWithAnnotation(@Param("id") Long id, @Param("firstName") String firstName, @Param("lastName") String lastName); -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/PersonEntityManagerInsertRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/PersonEntityManagerInsertRepositoryImpl.java deleted file mode 100644 index c14cc44125..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/PersonEntityManagerInsertRepositoryImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.dao.repositories.impl; - -import com.baeldung.dao.repositories.PersonEntityManagerInsertRepository; -import com.baeldung.domain.Person; -import org.springframework.transaction.annotation.Transactional; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; - -@Transactional -public class PersonEntityManagerInsertRepositoryImpl implements PersonEntityManagerInsertRepository { - - @PersistenceContext - private EntityManager entityManager; - - @Override - public void insert(Person person) { - this.entityManager.persist(person); - } -} - diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/PersonQueryInsertRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/PersonInsertRepository.java similarity index 60% rename from persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/PersonQueryInsertRepositoryImpl.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/PersonInsertRepository.java index 341db1615d..d809385456 100644 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/PersonQueryInsertRepositoryImpl.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/PersonInsertRepository.java @@ -1,24 +1,30 @@ package com.baeldung.dao.repositories.impl; -import com.baeldung.dao.repositories.PersonQueryInsertRepository; import com.baeldung.domain.Person; +import org.springframework.stereotype.Repository; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.transaction.Transactional; -@Transactional -public class PersonQueryInsertRepositoryImpl implements PersonQueryInsertRepository { +@Repository +public class PersonInsertRepository { @PersistenceContext private EntityManager entityManager; - @Override - public void insert(Person person) { - entityManager.createNativeQuery("INSERT INTO person (id,first_name, last_name) VALUES (?,?,?)") + @Transactional + public void insertWithQuery(Person person) { + entityManager.createNativeQuery("INSERT INTO person (id, first_name, last_name) VALUES (?,?,?)") .setParameter(1, person.getId()) .setParameter(2, person.getFirstName()) .setParameter(3, person.getLastName()) .executeUpdate(); } + + @Transactional + public void insertWithEntityManager(Person person) { + this.entityManager.persist(person); + } + } diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/PersonInsertRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/PersonInsertRepositoryIntegrationTest.java index 476554f6d6..b248cf8bf1 100644 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/PersonInsertRepositoryIntegrationTest.java +++ b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/PersonInsertRepositoryIntegrationTest.java @@ -1,21 +1,24 @@ package com.baeldung.dao.repositories; +import com.baeldung.dao.repositories.impl.PersonInsertRepository; import com.baeldung.domain.Person; import org.junit.Test; -import org.junit.jupiter.api.BeforeEach; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.dao.DataIntegrityViolationException; +import org.springframework.context.annotation.Import; import org.springframework.test.context.junit4.SpringRunner; -import java.util.Optional; +import javax.persistence.EntityExistsException; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceException; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; @RunWith(SpringRunner.class) @DataJpaTest +@Import(PersonInsertRepository.class) public class PersonInsertRepositoryIntegrationTest { private static final Long ID = 1L; @@ -24,43 +27,23 @@ public class PersonInsertRepositoryIntegrationTest { private static final Person PERSON = new Person(ID, FIRST_NAME, LAST_NAME); @Autowired - private PersonQueryRepository personQueryRepository; + private PersonInsertRepository personInsertRepository; @Autowired - private PersonEntityManagerRepository personEntityManagerRepository; - - @BeforeEach - public void clearDB() { - personQueryRepository.deleteAll(); - } + private EntityManager entityManager; @Test public void givenPersonEntity_whenInsertWithNativeQuery_ThenPersonIsPersisted() { - insertPerson(); + insertWithQuery(); assertPersonPersisted(); } @Test - public void givenPersonEntity_whenInsertedTwiceWithNativeQuery_thenDataIntegrityViolationExceptionIsThrown() { - assertThatExceptionOfType(DataIntegrityViolationException.class).isThrownBy(() -> { - insertPerson(); - insertPerson(); - }); - } - - @Test - public void givenPersonEntity_whenInsertWithQueryAnnotation_thenPersonIsPersisted() { - insertPersonWithQueryAnnotation(); - - assertPersonPersisted(); - } - - @Test - public void givenPersonEntity_whenInsertedTwiceWithQueryAnnotation_thenDataIntegrityViolationExceptionIsThrown() { - assertThatExceptionOfType(DataIntegrityViolationException.class).isThrownBy(() -> { - insertPersonWithQueryAnnotation(); - insertPersonWithQueryAnnotation(); + public void givenPersonEntity_whenInsertedTwiceWithNativeQuery_thenPersistenceExceptionExceptionIsThrown() { + assertThatExceptionOfType(PersistenceException.class).isThrownBy(() -> { + insertWithQuery(); + insertWithQuery(); }); } @@ -72,31 +55,27 @@ public class PersonInsertRepositoryIntegrationTest { } @Test - public void givenPersonEntity_whenInsertedTwiceWithEntityManager_thenDataIntegrityViolationExceptionIsThrown() { - assertThatExceptionOfType(DataIntegrityViolationException.class).isThrownBy(() -> { + public void givenPersonEntity_whenInsertedTwiceWithEntityManager_thenEntityExistsExceptionIsThrown() { + assertThatExceptionOfType(EntityExistsException.class).isThrownBy(() -> { insertPersonWithEntityManager(); insertPersonWithEntityManager(); }); } - private void insertPerson() { - personQueryRepository.insert(PERSON); - } - - private void insertPersonWithQueryAnnotation() { - personQueryRepository.insertWithAnnotation(ID, FIRST_NAME, LAST_NAME); + private void insertWithQuery() { + personInsertRepository.insertWithQuery(PERSON); } private void insertPersonWithEntityManager() { - personEntityManagerRepository.insert(new Person(ID, FIRST_NAME, LAST_NAME)); + personInsertRepository.insertWithEntityManager(new Person(ID, FIRST_NAME, LAST_NAME)); } private void assertPersonPersisted() { - Optional personOptional = personQueryRepository.findById(PERSON.getId()); + Person person = entityManager.find(Person.class, ID); - assertThat(personOptional.isPresent()).isTrue(); - assertThat(personOptional.get().getId()).isEqualTo(PERSON.getId()); - assertThat(personOptional.get().getFirstName()).isEqualTo(PERSON.getFirstName()); - assertThat(personOptional.get().getLastName()).isEqualTo(PERSON.getLastName()); + assertThat(person).isNotNull(); + assertThat(person.getId()).isEqualTo(PERSON.getId()); + assertThat(person.getFirstName()).isEqualTo(PERSON.getFirstName()); + assertThat(person.getLastName()).isEqualTo(PERSON.getLastName()); } } From 33ba36dc4140f9dec604eea6adc0155b6c287643 Mon Sep 17 00:00:00 2001 From: Yatendra Goel Date: Sat, 29 Dec 2018 13:30:46 +0530 Subject: [PATCH 075/271] BAEL-2307: Added Code to add SAN needed by Chrome to the X509 Certificate --- .../keystore/JavaKeyStoreUnitTest.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/core-java/src/test/java/com/baeldung/keystore/JavaKeyStoreUnitTest.java b/core-java/src/test/java/com/baeldung/keystore/JavaKeyStoreUnitTest.java index cb2a9f1c49..7473c52a35 100644 --- a/core-java/src/test/java/com/baeldung/keystore/JavaKeyStoreUnitTest.java +++ b/core-java/src/test/java/com/baeldung/keystore/JavaKeyStoreUnitTest.java @@ -4,15 +4,24 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; + import sun.security.x509.AlgorithmId; import sun.security.x509.CertificateAlgorithmId; import sun.security.x509.CertificateSerialNumber; import sun.security.x509.CertificateValidity; import sun.security.x509.CertificateVersion; import sun.security.x509.CertificateX509Key; +import sun.security.x509.SubjectAlternativeNameExtension; import sun.security.x509.X500Name; import sun.security.x509.X509CertImpl; import sun.security.x509.X509CertInfo; +import sun.security.x509.CertificateExtensions; +import sun.security.x509.GeneralNames; +import sun.security.x509.GeneralName; +import sun.security.x509.GeneralNameInterface; +import sun.security.x509.DNSName; +import sun.security.x509.IPAddressName; +import sun.security.util.DerOutputStream; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; @@ -188,6 +197,23 @@ public class JavaKeyStoreUnitTest { Date validTo = new Date(validFrom.getTime() + 50L * 365L * 24L * 60L * 60L * 1000L); //50 years CertificateValidity validity = new CertificateValidity(validFrom, validTo); certInfo.set(X509CertInfo.VALIDITY, validity); + + GeneralNameInterface dnsName = new DNSName("baeldung.com"); + DerOutputStream dnsNameOutputStream = new DerOutputStream(); + dnsName.encode(dnsNameOutputStream); + + GeneralNameInterface ipAddress = new IPAddressName("127.0.0.1"); + DerOutputStream ipAddressOutputStream = new DerOutputStream(); + ipAddress.encode(ipAddressOutputStream); + + GeneralNames generalNames = new GeneralNames(); + generalNames.add(new GeneralName(dnsName)); + generalNames.add(new GeneralName(ipAddress)); + + CertificateExtensions ext = new CertificateExtensions(); + ext.set(SubjectAlternativeNameExtension.NAME, new SubjectAlternativeNameExtension(generalNames)); + + certInfo.set(X509CertInfo.EXTENSIONS, ext); // Create certificate and sign it X509CertImpl cert = new X509CertImpl(certInfo); @@ -202,4 +228,5 @@ public class JavaKeyStoreUnitTest { return newCert; } + } \ No newline at end of file From cf3d7b69e6e43f9f4d232b97e69c09a400f3d24a Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 29 Dec 2018 20:11:40 +0530 Subject: [PATCH 076/271] [BAEL-10836] - Moved Java8CollectionCleanupUnitTest, AddElementsUnitTest and articles --- core-java-collections-list/README.md | 1 - .../src/main/java/com/baeldung/list/Flower.java | 0 .../java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java | 0 .../src/test/java/com/baeldung/list/AddElementsUnitTest.java | 0 java-collections-conversions/README.md | 1 + 5 files changed, 1 insertion(+), 1 deletion(-) rename {core-java-8 => core-java-collections-list}/src/main/java/com/baeldung/list/Flower.java (100%) rename {core-java-8 => core-java-collections-list}/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java (100%) rename {core-java-8 => core-java-collections-list}/src/test/java/com/baeldung/list/AddElementsUnitTest.java (100%) diff --git a/core-java-collections-list/README.md b/core-java-collections-list/README.md index cb6999277c..aba53f5b30 100644 --- a/core-java-collections-list/README.md +++ b/core-java-collections-list/README.md @@ -17,7 +17,6 @@ - [Finding Max/Min of a List or Collection](http://www.baeldung.com/java-collection-min-max) - [Collections.emptyList() vs. New List Instance](https://www.baeldung.com/java-collections-emptylist-new-list) - [Remove All Occurrences of a Specific Value from a List](https://www.baeldung.com/java-remove-value-from-list) -- [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist) - [Check If Two Lists are Equal in Java](http://www.baeldung.com/java-test-a-list-for-ordinality-and-equality) - [Java 8 Streams: Find Items From One List Based On Values From Another List](https://www.baeldung.com/java-streams-find-list-items) - [A Guide to the Java LinkedList](http://www.baeldung.com/java-linkedlist) diff --git a/core-java-8/src/main/java/com/baeldung/list/Flower.java b/core-java-collections-list/src/main/java/com/baeldung/list/Flower.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/list/Flower.java rename to core-java-collections-list/src/main/java/com/baeldung/list/Flower.java diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/list/AddElementsUnitTest.java b/core-java-collections-list/src/test/java/com/baeldung/list/AddElementsUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/list/AddElementsUnitTest.java rename to core-java-collections-list/src/test/java/com/baeldung/list/AddElementsUnitTest.java diff --git a/java-collections-conversions/README.md b/java-collections-conversions/README.md index 0f89e07d63..31fead3c42 100644 --- a/java-collections-conversions/README.md +++ b/java-collections-conversions/README.md @@ -10,3 +10,4 @@ - [Converting a List to String in Java](http://www.baeldung.com/java-list-to-string) - [How to Convert List to Map in Java](http://www.baeldung.com/java-list-to-map) - [Array to String Conversions](https://www.baeldung.com/java-array-to-string) +- [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist) \ No newline at end of file From 8b65216ba33e90c6f4c3d4cf3a3a85e773a85eed Mon Sep 17 00:00:00 2001 From: Emily Cheyne Date: Sat, 29 Dec 2018 08:13:10 -0700 Subject: [PATCH 077/271] BAEL-2436 update readme (#6019) --- persistence-modules/hibernate5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index c066ccb50b..2b948a683a 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -22,3 +22,4 @@ - [Criteria API – An Example of IN Expressions](https://www.baeldung.com/jpa-criteria-api-in-expressions) - [Difference Between @JoinColumn and mappedBy](https://www.baeldung.com/jpa-joincolumn-vs-mappedby) - [Hibernate 5 Bootstrapping API](https://www.baeldung.com/hibernate-5-bootstrapping-api) +- [Criteria Queries Using JPA Metamodel](https://www.baeldung.com/hibernate-criteria-queries-metamodel) From c61ac5101e8732677f44b4b9efe5956dcdcb34ed Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 29 Dec 2018 21:54:59 +0530 Subject: [PATCH 078/271] [BAEL-11401] - Moved articles out of core-java (part 2) --- core-java-networking/README.md | 3 +++ core-java-networking/pom.xml | 12 ++++++++++++ .../baeldung/http/FullResponseBuilder.java | 0 .../baeldung/http/ParameterStringBuilder.java | 0 .../java/com/baeldung/socket/EchoClient.java | 0 .../com/baeldung/socket/EchoMultiServer.java | 0 .../java/com/baeldung/socket/EchoServer.java | 0 .../java/com/baeldung/socket/GreetClient.java | 0 .../java/com/baeldung/socket/GreetServer.java | 0 .../EncoderDecoderUnitTest.java | 0 .../baeldung/http/HttpRequestLiveTest.java | 2 +- .../baeldung/socket/EchoIntegrationTest.java | 0 .../socket/GreetServerIntegrationTest.java | 0 .../SocketEchoMultiIntegrationTest.java | 0 core-java-perf/README.md | 4 ++++ .../java/com/baeldung/heapdump/HeapDump.java | 0 .../src/main/java/com/baeldung/jmx/Game.java | 0 .../main/java/com/baeldung/jmx/GameMBean.java | 0 .../baeldung/jmx/JMXTutorialMainlauncher.java | 0 .../memoryleaks/equalshashcode/Person.java | 0 .../equalshashcode/PersonOptimized.java | 0 .../memoryleaks/finalize/BulkyObject.java | 0 .../finalize/BulkyObjectOptimized.java | 0 .../memoryleaks/innerclass/BulkyObject.java | 0 .../innerclass/InnerClassDriver.java | 0 .../innerclass/InnerClassWrapper.java | 0 .../innerclass/StaticNestedClassWrapper.java | 0 .../internedstrings/InternedString.java | 0 .../ReadStringFromFileUtil.java | 0 .../internedstrings/StringObject.java | 0 .../staticfields/NonStaticFieldsDemo.java | 0 .../staticfields/StaticFieldsDemo.java | 0 .../OutOfMemoryGCLimitExceed.java | 0 core-java-perf/src/main/resources/logback.xml | 19 +++++++++++++++++++ .../PersonMemoryLeakUnitTest.java | 0 .../finalize/FinalizeMemoryLeakUnitTest.java | 0 .../StaticInnerClassMemoryLeakUnitTest.java | 0 .../StringInternMemoryLeakUnitTest.java | 0 .../NonStaticFieldsMemoryLeakUnitTest.java | 0 .../StaticFieldsMemoryLeakUnitTest.java | 0 core-java-sun/README.md | 1 + .../java/com/baeldung/unsafe/CASCounter.java | 0 .../com/baeldung/unsafe/OffHeapArray.java | 0 .../com/baeldung/unsafe/UnsafeUnitTest.java | 0 core-java/README.md | 8 -------- 45 files changed, 40 insertions(+), 9 deletions(-) rename {core-java => core-java-networking}/src/main/java/com/baeldung/http/FullResponseBuilder.java (100%) rename {core-java => core-java-networking}/src/main/java/com/baeldung/http/ParameterStringBuilder.java (100%) rename {core-java => core-java-networking}/src/main/java/com/baeldung/socket/EchoClient.java (100%) rename {core-java => core-java-networking}/src/main/java/com/baeldung/socket/EchoMultiServer.java (100%) rename {core-java => core-java-networking}/src/main/java/com/baeldung/socket/EchoServer.java (100%) rename {core-java => core-java-networking}/src/main/java/com/baeldung/socket/GreetClient.java (100%) rename {core-java => core-java-networking}/src/main/java/com/baeldung/socket/GreetServer.java (100%) rename {core-java => core-java-networking}/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java (100%) rename {core-java => core-java-networking}/src/test/java/com/baeldung/http/HttpRequestLiveTest.java (99%) rename {core-java => core-java-networking}/src/test/java/com/baeldung/socket/EchoIntegrationTest.java (100%) rename {core-java => core-java-networking}/src/test/java/com/baeldung/socket/GreetServerIntegrationTest.java (100%) rename {core-java => core-java-networking}/src/test/java/com/baeldung/socket/SocketEchoMultiIntegrationTest.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/heapdump/HeapDump.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/jmx/Game.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/jmx/GameMBean.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/jmx/JMXTutorialMainlauncher.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/equalshashcode/Person.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/equalshashcode/PersonOptimized.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/finalize/BulkyObject.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/finalize/BulkyObjectOptimized.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/innerclass/BulkyObject.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/innerclass/InnerClassDriver.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/innerclass/InnerClassWrapper.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/innerclass/StaticNestedClassWrapper.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/internedstrings/InternedString.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/internedstrings/ReadStringFromFileUtil.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/internedstrings/StringObject.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/staticfields/NonStaticFieldsDemo.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/memoryleaks/staticfields/StaticFieldsDemo.java (100%) rename {core-java => core-java-perf}/src/main/java/com/baeldung/outofmemoryerror/OutOfMemoryGCLimitExceed.java (100%) create mode 100644 core-java-perf/src/main/resources/logback.xml rename {core-java => core-java-perf}/src/test/java/com/baeldung/memoryleaks/equalshashcode/PersonMemoryLeakUnitTest.java (100%) rename {core-java => core-java-perf}/src/test/java/com/baeldung/memoryleaks/finalize/FinalizeMemoryLeakUnitTest.java (100%) rename {core-java => core-java-perf}/src/test/java/com/baeldung/memoryleaks/innerclass/StaticInnerClassMemoryLeakUnitTest.java (100%) rename {core-java => core-java-perf}/src/test/java/com/baeldung/memoryleaks/internedstrings/StringInternMemoryLeakUnitTest.java (100%) rename {core-java => core-java-perf}/src/test/java/com/baeldung/memoryleaks/staticfields/NonStaticFieldsMemoryLeakUnitTest.java (100%) rename {core-java => core-java-perf}/src/test/java/com/baeldung/memoryleaks/staticfields/StaticFieldsMemoryLeakUnitTest.java (100%) rename {core-java => core-java-sun}/src/test/java/com/baeldung/unsafe/CASCounter.java (100%) rename {core-java => core-java-sun}/src/test/java/com/baeldung/unsafe/OffHeapArray.java (100%) rename {core-java => core-java-sun}/src/test/java/com/baeldung/unsafe/UnsafeUnitTest.java (100%) diff --git a/core-java-networking/README.md b/core-java-networking/README.md index 4b77aa3c1f..b2367782b6 100644 --- a/core-java-networking/README.md +++ b/core-java-networking/README.md @@ -11,3 +11,6 @@ - [A Guide To HTTP Cookies In Java](http://www.baeldung.com/cookies-java) - [A Guide to the Java URL](http://www.baeldung.com/java-url) - [Working with Network Interfaces in Java](http://www.baeldung.com/java-network-interfaces) +- [A Guide to Java Sockets](http://www.baeldung.com/a-guide-to-java-sockets) +- [URL Encoding and Decoding in Java](http://www.baeldung.com/java-url-encoding-decoding) +- [How to Perform a Simple HTTP Request in Java](http://www.baeldung.com/java-http-request) \ No newline at end of file diff --git a/core-java-networking/pom.xml b/core-java-networking/pom.xml index c7fa2af180..d9c7c691e9 100644 --- a/core-java-networking/pom.xml +++ b/core-java-networking/pom.xml @@ -24,6 +24,16 @@ commons-io ${commons-io.version} + + org.springframework + spring-web + ${springframework.spring-web.version} + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + @@ -33,5 +43,7 @@ 1.5.0-b01 2.5 + 3.5 + 4.3.4.RELEASE diff --git a/core-java/src/main/java/com/baeldung/http/FullResponseBuilder.java b/core-java-networking/src/main/java/com/baeldung/http/FullResponseBuilder.java similarity index 100% rename from core-java/src/main/java/com/baeldung/http/FullResponseBuilder.java rename to core-java-networking/src/main/java/com/baeldung/http/FullResponseBuilder.java diff --git a/core-java/src/main/java/com/baeldung/http/ParameterStringBuilder.java b/core-java-networking/src/main/java/com/baeldung/http/ParameterStringBuilder.java similarity index 100% rename from core-java/src/main/java/com/baeldung/http/ParameterStringBuilder.java rename to core-java-networking/src/main/java/com/baeldung/http/ParameterStringBuilder.java diff --git a/core-java/src/main/java/com/baeldung/socket/EchoClient.java b/core-java-networking/src/main/java/com/baeldung/socket/EchoClient.java similarity index 100% rename from core-java/src/main/java/com/baeldung/socket/EchoClient.java rename to core-java-networking/src/main/java/com/baeldung/socket/EchoClient.java diff --git a/core-java/src/main/java/com/baeldung/socket/EchoMultiServer.java b/core-java-networking/src/main/java/com/baeldung/socket/EchoMultiServer.java similarity index 100% rename from core-java/src/main/java/com/baeldung/socket/EchoMultiServer.java rename to core-java-networking/src/main/java/com/baeldung/socket/EchoMultiServer.java diff --git a/core-java/src/main/java/com/baeldung/socket/EchoServer.java b/core-java-networking/src/main/java/com/baeldung/socket/EchoServer.java similarity index 100% rename from core-java/src/main/java/com/baeldung/socket/EchoServer.java rename to core-java-networking/src/main/java/com/baeldung/socket/EchoServer.java diff --git a/core-java/src/main/java/com/baeldung/socket/GreetClient.java b/core-java-networking/src/main/java/com/baeldung/socket/GreetClient.java similarity index 100% rename from core-java/src/main/java/com/baeldung/socket/GreetClient.java rename to core-java-networking/src/main/java/com/baeldung/socket/GreetClient.java diff --git a/core-java/src/main/java/com/baeldung/socket/GreetServer.java b/core-java-networking/src/main/java/com/baeldung/socket/GreetServer.java similarity index 100% rename from core-java/src/main/java/com/baeldung/socket/GreetServer.java rename to core-java-networking/src/main/java/com/baeldung/socket/GreetServer.java diff --git a/core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java b/core-java-networking/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java rename to core-java-networking/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/http/HttpRequestLiveTest.java b/core-java-networking/src/test/java/com/baeldung/http/HttpRequestLiveTest.java similarity index 99% rename from core-java/src/test/java/com/baeldung/http/HttpRequestLiveTest.java rename to core-java-networking/src/test/java/com/baeldung/http/HttpRequestLiveTest.java index 752a75daa5..bd6c0a4410 100644 --- a/core-java/src/test/java/com/baeldung/http/HttpRequestLiveTest.java +++ b/core-java-networking/src/test/java/com/baeldung/http/HttpRequestLiveTest.java @@ -1,6 +1,6 @@ package com.baeldung.http; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.junit.Test; import java.io.BufferedReader; diff --git a/core-java/src/test/java/com/baeldung/socket/EchoIntegrationTest.java b/core-java-networking/src/test/java/com/baeldung/socket/EchoIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/socket/EchoIntegrationTest.java rename to core-java-networking/src/test/java/com/baeldung/socket/EchoIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/socket/GreetServerIntegrationTest.java b/core-java-networking/src/test/java/com/baeldung/socket/GreetServerIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/socket/GreetServerIntegrationTest.java rename to core-java-networking/src/test/java/com/baeldung/socket/GreetServerIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/socket/SocketEchoMultiIntegrationTest.java b/core-java-networking/src/test/java/com/baeldung/socket/SocketEchoMultiIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/socket/SocketEchoMultiIntegrationTest.java rename to core-java-networking/src/test/java/com/baeldung/socket/SocketEchoMultiIntegrationTest.java diff --git a/core-java-perf/README.md b/core-java-perf/README.md index 6af1c82a0a..252ee4cc45 100644 --- a/core-java-perf/README.md +++ b/core-java-perf/README.md @@ -2,3 +2,7 @@ ### Relevant Articles: - [Verbose Garbage Collection in Java](https://www.baeldung.com/java-verbose-gc) +- [Different Ways to Capture Java Heap Dumps](https://www.baeldung.com/java-heap-dump-capture) +- [Understanding Memory Leaks in Java](https://www.baeldung.com/java-memory-leaks) +- [OutOfMemoryError: GC Overhead Limit Exceeded](http://www.baeldung.com/java-gc-overhead-limit-exceeded) +- [Basic Introduction to JMX](http://www.baeldung.com/java-management-extensions) \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/heapdump/HeapDump.java b/core-java-perf/src/main/java/com/baeldung/heapdump/HeapDump.java similarity index 100% rename from core-java/src/main/java/com/baeldung/heapdump/HeapDump.java rename to core-java-perf/src/main/java/com/baeldung/heapdump/HeapDump.java diff --git a/core-java/src/main/java/com/baeldung/jmx/Game.java b/core-java-perf/src/main/java/com/baeldung/jmx/Game.java similarity index 100% rename from core-java/src/main/java/com/baeldung/jmx/Game.java rename to core-java-perf/src/main/java/com/baeldung/jmx/Game.java diff --git a/core-java/src/main/java/com/baeldung/jmx/GameMBean.java b/core-java-perf/src/main/java/com/baeldung/jmx/GameMBean.java similarity index 100% rename from core-java/src/main/java/com/baeldung/jmx/GameMBean.java rename to core-java-perf/src/main/java/com/baeldung/jmx/GameMBean.java diff --git a/core-java/src/main/java/com/baeldung/jmx/JMXTutorialMainlauncher.java b/core-java-perf/src/main/java/com/baeldung/jmx/JMXTutorialMainlauncher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/jmx/JMXTutorialMainlauncher.java rename to core-java-perf/src/main/java/com/baeldung/jmx/JMXTutorialMainlauncher.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/equalshashcode/Person.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/equalshashcode/Person.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/equalshashcode/Person.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/equalshashcode/Person.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/equalshashcode/PersonOptimized.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/equalshashcode/PersonOptimized.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/equalshashcode/PersonOptimized.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/equalshashcode/PersonOptimized.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/finalize/BulkyObject.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/finalize/BulkyObject.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/finalize/BulkyObject.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/finalize/BulkyObject.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/finalize/BulkyObjectOptimized.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/finalize/BulkyObjectOptimized.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/finalize/BulkyObjectOptimized.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/finalize/BulkyObjectOptimized.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/innerclass/BulkyObject.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/innerclass/BulkyObject.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/innerclass/BulkyObject.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/innerclass/BulkyObject.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/innerclass/InnerClassDriver.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/innerclass/InnerClassDriver.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/innerclass/InnerClassDriver.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/innerclass/InnerClassDriver.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/innerclass/InnerClassWrapper.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/innerclass/InnerClassWrapper.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/innerclass/InnerClassWrapper.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/innerclass/InnerClassWrapper.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/innerclass/StaticNestedClassWrapper.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/innerclass/StaticNestedClassWrapper.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/innerclass/StaticNestedClassWrapper.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/innerclass/StaticNestedClassWrapper.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/internedstrings/InternedString.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/internedstrings/InternedString.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/internedstrings/InternedString.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/internedstrings/InternedString.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/internedstrings/ReadStringFromFileUtil.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/internedstrings/ReadStringFromFileUtil.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/internedstrings/ReadStringFromFileUtil.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/internedstrings/ReadStringFromFileUtil.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/internedstrings/StringObject.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/internedstrings/StringObject.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/internedstrings/StringObject.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/internedstrings/StringObject.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/staticfields/NonStaticFieldsDemo.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/staticfields/NonStaticFieldsDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/staticfields/NonStaticFieldsDemo.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/staticfields/NonStaticFieldsDemo.java diff --git a/core-java/src/main/java/com/baeldung/memoryleaks/staticfields/StaticFieldsDemo.java b/core-java-perf/src/main/java/com/baeldung/memoryleaks/staticfields/StaticFieldsDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/memoryleaks/staticfields/StaticFieldsDemo.java rename to core-java-perf/src/main/java/com/baeldung/memoryleaks/staticfields/StaticFieldsDemo.java diff --git a/core-java/src/main/java/com/baeldung/outofmemoryerror/OutOfMemoryGCLimitExceed.java b/core-java-perf/src/main/java/com/baeldung/outofmemoryerror/OutOfMemoryGCLimitExceed.java similarity index 100% rename from core-java/src/main/java/com/baeldung/outofmemoryerror/OutOfMemoryGCLimitExceed.java rename to core-java-perf/src/main/java/com/baeldung/outofmemoryerror/OutOfMemoryGCLimitExceed.java diff --git a/core-java-perf/src/main/resources/logback.xml b/core-java-perf/src/main/resources/logback.xml new file mode 100644 index 0000000000..56af2d397e --- /dev/null +++ b/core-java-perf/src/main/resources/logback.xml @@ -0,0 +1,19 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/memoryleaks/equalshashcode/PersonMemoryLeakUnitTest.java b/core-java-perf/src/test/java/com/baeldung/memoryleaks/equalshashcode/PersonMemoryLeakUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/memoryleaks/equalshashcode/PersonMemoryLeakUnitTest.java rename to core-java-perf/src/test/java/com/baeldung/memoryleaks/equalshashcode/PersonMemoryLeakUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/memoryleaks/finalize/FinalizeMemoryLeakUnitTest.java b/core-java-perf/src/test/java/com/baeldung/memoryleaks/finalize/FinalizeMemoryLeakUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/memoryleaks/finalize/FinalizeMemoryLeakUnitTest.java rename to core-java-perf/src/test/java/com/baeldung/memoryleaks/finalize/FinalizeMemoryLeakUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/memoryleaks/innerclass/StaticInnerClassMemoryLeakUnitTest.java b/core-java-perf/src/test/java/com/baeldung/memoryleaks/innerclass/StaticInnerClassMemoryLeakUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/memoryleaks/innerclass/StaticInnerClassMemoryLeakUnitTest.java rename to core-java-perf/src/test/java/com/baeldung/memoryleaks/innerclass/StaticInnerClassMemoryLeakUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/memoryleaks/internedstrings/StringInternMemoryLeakUnitTest.java b/core-java-perf/src/test/java/com/baeldung/memoryleaks/internedstrings/StringInternMemoryLeakUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/memoryleaks/internedstrings/StringInternMemoryLeakUnitTest.java rename to core-java-perf/src/test/java/com/baeldung/memoryleaks/internedstrings/StringInternMemoryLeakUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/memoryleaks/staticfields/NonStaticFieldsMemoryLeakUnitTest.java b/core-java-perf/src/test/java/com/baeldung/memoryleaks/staticfields/NonStaticFieldsMemoryLeakUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/memoryleaks/staticfields/NonStaticFieldsMemoryLeakUnitTest.java rename to core-java-perf/src/test/java/com/baeldung/memoryleaks/staticfields/NonStaticFieldsMemoryLeakUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/memoryleaks/staticfields/StaticFieldsMemoryLeakUnitTest.java b/core-java-perf/src/test/java/com/baeldung/memoryleaks/staticfields/StaticFieldsMemoryLeakUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/memoryleaks/staticfields/StaticFieldsMemoryLeakUnitTest.java rename to core-java-perf/src/test/java/com/baeldung/memoryleaks/staticfields/StaticFieldsMemoryLeakUnitTest.java diff --git a/core-java-sun/README.md b/core-java-sun/README.md index 9cf8b26f1b..e2dba76b41 100644 --- a/core-java-sun/README.md +++ b/core-java-sun/README.md @@ -4,3 +4,4 @@ ### Relevant Articles: - [Creating a Java Compiler Plugin](http://www.baeldung.com/java-build-compiler-plugin) +- [Guide to sun.misc.Unsafe](http://www.baeldung.com/java-unsafe) \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/unsafe/CASCounter.java b/core-java-sun/src/test/java/com/baeldung/unsafe/CASCounter.java similarity index 100% rename from core-java/src/test/java/com/baeldung/unsafe/CASCounter.java rename to core-java-sun/src/test/java/com/baeldung/unsafe/CASCounter.java diff --git a/core-java/src/test/java/com/baeldung/unsafe/OffHeapArray.java b/core-java-sun/src/test/java/com/baeldung/unsafe/OffHeapArray.java similarity index 100% rename from core-java/src/test/java/com/baeldung/unsafe/OffHeapArray.java rename to core-java-sun/src/test/java/com/baeldung/unsafe/OffHeapArray.java diff --git a/core-java/src/test/java/com/baeldung/unsafe/UnsafeUnitTest.java b/core-java-sun/src/test/java/com/baeldung/unsafe/UnsafeUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/unsafe/UnsafeUnitTest.java rename to core-java-sun/src/test/java/com/baeldung/unsafe/UnsafeUnitTest.java diff --git a/core-java/README.md b/core-java/README.md index b0e8f81e1f..21c58bb880 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -6,19 +6,14 @@ - [Java Timer](http://www.baeldung.com/java-timer-and-timertask) - [How to Run a Shell Command in Java](http://www.baeldung.com/run-shell-command-in-java) - [MD5 Hashing in Java](http://www.baeldung.com/java-md5) -- [A Guide to Java Sockets](http://www.baeldung.com/a-guide-to-java-sockets) - [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java) - [A Guide To Java Regular Expressions API](http://www.baeldung.com/regular-expressions-java) - [Getting Started with Java Properties](http://www.baeldung.com/java-properties) - [Pattern Search with Grep in Java](http://www.baeldung.com/grep-in-java) -- [URL Encoding and Decoding in Java](http://www.baeldung.com/java-url-encoding-decoding) - [How to Create an Executable JAR with Maven](http://www.baeldung.com/executable-jar-with-maven) -- [Basic Introduction to JMX](http://www.baeldung.com/java-management-extensions) - [Introduction to Nashorn](http://www.baeldung.com/java-nashorn) - [Java Money and the Currency API](http://www.baeldung.com/java-money-and-currency) - [JVM Log Forging](http://www.baeldung.com/jvm-log-forging) -- [Guide to sun.misc.Unsafe](http://www.baeldung.com/java-unsafe) -- [How to Perform a Simple HTTP Request in Java](http://www.baeldung.com/java-http-request) - [How to Add a Single Element to a Stream](http://www.baeldung.com/java-stream-append-prepend) - [How to Find all Getters Returning Null](http://www.baeldung.com/java-getters-returning-null) - [How to Get a Name of a Method Being Executed?](http://www.baeldung.com/java-name-of-executing-method) @@ -26,7 +21,6 @@ - [Guide to UUID in Java](http://www.baeldung.com/java-uuid) - [Guide to Escaping Characters in Java RegExps](http://www.baeldung.com/java-regexp-escape-char) - [Difference between URL and URI](http://www.baeldung.com/java-url-vs-uri) -- [OutOfMemoryError: GC Overhead Limit Exceeded](http://www.baeldung.com/java-gc-overhead-limit-exceeded) - [Creating a Java Compiler Plugin](http://www.baeldung.com/java-build-compiler-plugin) - [Quick Guide to Java Stack](http://www.baeldung.com/java-stack) - [Guide to java.util.Formatter](http://www.baeldung.com/java-string-formatter) @@ -57,11 +51,9 @@ - [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) - [Calculating the nth Root in Java](https://www.baeldung.com/java-nth-root) - [Convert Double to String, Removing Decimal Places](https://www.baeldung.com/java-double-to-string) -- [Different Ways to Capture Java Heap Dumps](https://www.baeldung.com/java-heap-dump-capture) - [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset) - [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing) - [Merging java.util.Properties Objects](https://www.baeldung.com/java-merging-properties) -- [Understanding Memory Leaks in Java](https://www.baeldung.com/java-memory-leaks) - [A Guide to SimpleDateFormat](https://www.baeldung.com/java-simple-date-format) - [SSL Handshake Failures](https://www.baeldung.com/java-ssl-handshake-failures) - [Changing the Order in a Sum Operation Can Produce Different Results?](https://www.baeldung.com/java-floating-point-sum-order) From 9def7653f7cd2ce7e53a3d40af5ddb3fb3620783 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 29 Dec 2018 21:59:01 +0530 Subject: [PATCH 079/271] [BAEL-11401] - Removed spring web dependency from core-java --- core-java/pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/core-java/pom.xml b/core-java/pom.xml index 442d378dab..b4f0643aa8 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -121,11 +121,6 @@ jmh-generator-annprocess ${jmh-generator-annprocess.version} - - org.springframework - spring-web - ${springframework.spring-web.version} - com.h2database h2 @@ -500,7 +495,6 @@ 2.21.0 - 4.3.4.RELEASE 1.1 1.4.197 From ef0c49beaa4a49aa8390947ae2d606fa42ac61e2 Mon Sep 17 00:00:00 2001 From: eric-martin Date: Sat, 29 Dec 2018 10:32:29 -0600 Subject: [PATCH 080/271] Fixed TestLauncher test name and config property name --- .../junit-5/src/test/java/com/baeldung/TestLauncher.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/TestLauncher.java b/testing-modules/junit-5/src/test/java/com/baeldung/TestLauncher.java index f9766d2bd9..2e477084aa 100644 --- a/testing-modules/junit-5/src/test/java/com/baeldung/TestLauncher.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/TestLauncher.java @@ -18,9 +18,9 @@ public class TestLauncher { //@formatter:off LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request() - .selectors(selectClass("com.baeldung.EmployeesTest")) + .selectors(selectClass("com.baeldung.EmployeesUnitTest")) .configurationParameter("junit.conditions.deactivate", "com.baeldung.extensions.*") - .configurationParameter("junit.extensions.autodetection.enabled", "true") + .configurationParameter("junit.jupiter.extensions.autodetection.enabled", "true") .build(); //@formatter:on From 0a64e26a8fc0e4121159d61a3bd42a419c1acc30 Mon Sep 17 00:00:00 2001 From: DOHA Date: Sat, 29 Dec 2018 20:29:20 +0200 Subject: [PATCH 081/271] cleanup --- .../src/main/java/com/baeldung/boot/Application.java | 2 +- .../com/baeldung/boot/controller/rest/WebController.java | 6 +++--- .../{org => com}/baeldung/boot/LoadContextTest.groovy | 4 ++-- .../{org => com}/baeldung/boot/WebControllerTest.groovy | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) rename spring-boot-testing/src/test/groovy/{org => com}/baeldung/boot/LoadContextTest.groovy (87%) rename spring-boot-testing/src/test/groovy/{org => com}/baeldung/boot/WebControllerTest.groovy (98%) diff --git a/spring-boot-testing/src/main/java/com/baeldung/boot/Application.java b/spring-boot-testing/src/main/java/com/baeldung/boot/Application.java index c1b6558b26..cb0d0c1532 100644 --- a/spring-boot-testing/src/main/java/com/baeldung/boot/Application.java +++ b/spring-boot-testing/src/main/java/com/baeldung/boot/Application.java @@ -1,4 +1,4 @@ -package org.baeldung.boot; +package com.baeldung.boot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-boot-testing/src/main/java/com/baeldung/boot/controller/rest/WebController.java b/spring-boot-testing/src/main/java/com/baeldung/boot/controller/rest/WebController.java index 5b65599e00..7247ca3dfa 100644 --- a/spring-boot-testing/src/main/java/com/baeldung/boot/controller/rest/WebController.java +++ b/spring-boot-testing/src/main/java/com/baeldung/boot/controller/rest/WebController.java @@ -1,4 +1,6 @@ -package org.baeldung.boot.controller.rest; +package com.baeldung.boot.controller.rest; + +import java.util.Optional; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.DeleteMapping; @@ -9,8 +11,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; -import java.util.Optional; - @RestController @RequestMapping("/hello") public class WebController { diff --git a/spring-boot-testing/src/test/groovy/org/baeldung/boot/LoadContextTest.groovy b/spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextTest.groovy similarity index 87% rename from spring-boot-testing/src/test/groovy/org/baeldung/boot/LoadContextTest.groovy rename to spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextTest.groovy index 2d4a7ca2cf..85b0a4b89b 100644 --- a/spring-boot-testing/src/test/groovy/org/baeldung/boot/LoadContextTest.groovy +++ b/spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextTest.groovy @@ -1,6 +1,6 @@ -package org.baeldung.boot +package com.baeldung.boot -import org.baeldung.boot.controller.rest.WebController +import com.baeldung.boot.controller.rest.WebController import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import spock.lang.Narrative diff --git a/spring-boot-testing/src/test/groovy/org/baeldung/boot/WebControllerTest.groovy b/spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerTest.groovy similarity index 98% rename from spring-boot-testing/src/test/groovy/org/baeldung/boot/WebControllerTest.groovy rename to spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerTest.groovy index fe1b34ab8c..119992acc3 100644 --- a/spring-boot-testing/src/test/groovy/org/baeldung/boot/WebControllerTest.groovy +++ b/spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerTest.groovy @@ -1,4 +1,4 @@ -package org.baeldung.boot +package com.baeldung.boot import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc From d1fb8935e794e1c171754defb478762954f8d5cd Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 30 Dec 2018 00:00:21 +0530 Subject: [PATCH 082/271] [BAEL-10836] - Removed CollectionsEmpty from core-java-collections module --- .../java/collections/CollectionsEmpty.java | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 core-java-collections/src/test/java/org/baeldung/java/collections/CollectionsEmpty.java diff --git a/core-java-collections/src/test/java/org/baeldung/java/collections/CollectionsEmpty.java b/core-java-collections/src/test/java/org/baeldung/java/collections/CollectionsEmpty.java deleted file mode 100644 index 09ecebe47b..0000000000 --- a/core-java-collections/src/test/java/org/baeldung/java/collections/CollectionsEmpty.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.baeldung.java.collections; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import org.junit.Assert; -import org.junit.Test; - -class CollectionsEmpty { - - @Test - public void givenArrayList_whenAddingElement_addsNewElement() { - ArrayList mutableList = new ArrayList<>(); - mutableList.add("test"); - - Assert.assertEquals(mutableList.size(), 1); - Assert.assertEquals(mutableList.get(0), "test"); - } - - @Test(expected = UnsupportedOperationException.class) - public void givenCollectionsEmptyList_whenAddingElement_throwsUnsupportedOperationException() { - List immutableList = Collections.emptyList(); - immutableList.add("test"); - } - -} From b4ff5c46f08a21ea01ffdca6859286a3e351bdb3 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 30 Dec 2018 01:19:12 +0530 Subject: [PATCH 083/271] [BAEL-11402] - Moved articles out of core-java (part 3) --- core-java-io/README.md | 2 + core-java-io/pom.xml | 14 +++++ .../com/baeldung/extension/Extension.java | 0 .../baeldung/extension/ExtensionUnitTest.java | 0 .../java/mimetype/MimeTypeUnitTest.java | 0 .../src/test/resources/META-INF/mime.types | 0 .../src/test/resources/product.png | Bin core-java-security/README.md | 11 ++++ core-java-security/pom.xml | 55 ++++++++++++++++++ .../java/com/baeldung/cipher/Encryptor.java | 0 .../encrypt/FileEncrypterDecrypter.java | 0 .../com/baeldung/hashing/SHA256Hashing.java | 0 .../com/baeldung/keystore/JavaKeyStore.java | 0 .../passwordhashing/PBKDF2Hasher.java | 0 .../passwordhashing/SHA512Hasher.java | 0 .../passwordhashing/SimplePBKDF2Hasher.java | 0 .../com/baeldung/ssl/SecureConnection.java | 0 .../baeldung/ssl/example/SimpleClient.java | 0 .../baeldung/ssl/example/SimpleServer.java | 0 .../src/main/resources/logback.xml | 19 ++++++ .../baeldung/cipher/EncryptorUnitTest.java | 0 ...FileEncrypterDecrypterIntegrationTest.java | 0 .../hashing/SHA256HashingUnitTest.java | 0 .../keystore/JavaKeyStoreUnitTest.java | 0 .../passwordhashing/PBKDF2HasherUnitTest.java | 0 .../passwordhashing/SHA512HasherUnitTest.java | 0 .../baeldung/java/md5/JavaMD5UnitTest.java | 0 .../src/test/resources/test_md5.txt | 0 core-java/README.md | 9 --- core-java/pom.xml | 27 --------- guava/README.md | 1 - pom.xml | 2 + 32 files changed, 103 insertions(+), 37 deletions(-) rename {core-java => core-java-io}/src/main/java/com/baeldung/extension/Extension.java (100%) rename {core-java => core-java-io}/src/test/java/com/baeldung/extension/ExtensionUnitTest.java (100%) rename {core-java => core-java-io}/src/test/java/com/baeldung/java/mimetype/MimeTypeUnitTest.java (100%) rename {core-java => core-java-io}/src/test/resources/META-INF/mime.types (100%) rename {core-java => core-java-io}/src/test/resources/product.png (100%) create mode 100644 core-java-security/README.md create mode 100644 core-java-security/pom.xml rename {core-java => core-java-security}/src/main/java/com/baeldung/cipher/Encryptor.java (100%) rename {core-java => core-java-security}/src/main/java/com/baeldung/encrypt/FileEncrypterDecrypter.java (100%) rename {core-java => core-java-security}/src/main/java/com/baeldung/hashing/SHA256Hashing.java (100%) rename {core-java => core-java-security}/src/main/java/com/baeldung/keystore/JavaKeyStore.java (100%) rename {core-java => core-java-security}/src/main/java/com/baeldung/passwordhashing/PBKDF2Hasher.java (100%) rename {core-java => core-java-security}/src/main/java/com/baeldung/passwordhashing/SHA512Hasher.java (100%) rename {core-java => core-java-security}/src/main/java/com/baeldung/passwordhashing/SimplePBKDF2Hasher.java (100%) rename {core-java => core-java-security}/src/main/java/com/baeldung/ssl/SecureConnection.java (100%) rename {core-java => core-java-security}/src/main/java/com/baeldung/ssl/example/SimpleClient.java (100%) rename {core-java => core-java-security}/src/main/java/com/baeldung/ssl/example/SimpleServer.java (100%) create mode 100644 core-java-security/src/main/resources/logback.xml rename {core-java => core-java-security}/src/test/java/com/baeldung/cipher/EncryptorUnitTest.java (100%) rename {core-java => core-java-security}/src/test/java/com/baeldung/encrypt/FileEncrypterDecrypterIntegrationTest.java (100%) rename {core-java => core-java-security}/src/test/java/com/baeldung/hashing/SHA256HashingUnitTest.java (100%) rename {core-java => core-java-security}/src/test/java/com/baeldung/keystore/JavaKeyStoreUnitTest.java (100%) rename {core-java => core-java-security}/src/test/java/com/baeldung/passwordhashing/PBKDF2HasherUnitTest.java (100%) rename {core-java => core-java-security}/src/test/java/com/baeldung/passwordhashing/SHA512HasherUnitTest.java (100%) rename {core-java => core-java-security}/src/test/java/org/baeldung/java/md5/JavaMD5UnitTest.java (100%) rename {core-java => core-java-security}/src/test/resources/test_md5.txt (100%) diff --git a/core-java-io/README.md b/core-java-io/README.md index 3d028783ed..2ad980ca6a 100644 --- a/core-java-io/README.md +++ b/core-java-io/README.md @@ -35,3 +35,5 @@ - [Guide to Java OutputStream](https://www.baeldung.com/java-outputstream) - [Reading a CSV File into an Array](https://www.baeldung.com/java-csv-file-array) - [Guide to BufferedReader](https://www.baeldung.com/java-buffered-reader) +- [How to Get the File Extension of a File in Java](http://www.baeldung.com/java-file-extension) +- [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type) \ No newline at end of file diff --git a/core-java-io/pom.xml b/core-java-io/pom.xml index ac5f1f7c2e..1f2d52de81 100644 --- a/core-java-io/pom.xml +++ b/core-java-io/pom.xml @@ -160,6 +160,17 @@ ${opencsv.version} test + + + org.apache.tika + tika-core + ${tika.version} + + + net.sf.jmimemagic + jmimemagic + ${jmime-magic.version} + @@ -264,6 +275,9 @@ 2.1.0.1 1.19 2.4.5 + + 1.18 + 0.1.5 \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/extension/Extension.java b/core-java-io/src/main/java/com/baeldung/extension/Extension.java similarity index 100% rename from core-java/src/main/java/com/baeldung/extension/Extension.java rename to core-java-io/src/main/java/com/baeldung/extension/Extension.java diff --git a/core-java/src/test/java/com/baeldung/extension/ExtensionUnitTest.java b/core-java-io/src/test/java/com/baeldung/extension/ExtensionUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/extension/ExtensionUnitTest.java rename to core-java-io/src/test/java/com/baeldung/extension/ExtensionUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java/mimetype/MimeTypeUnitTest.java b/core-java-io/src/test/java/com/baeldung/java/mimetype/MimeTypeUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java/mimetype/MimeTypeUnitTest.java rename to core-java-io/src/test/java/com/baeldung/java/mimetype/MimeTypeUnitTest.java diff --git a/core-java/src/test/resources/META-INF/mime.types b/core-java-io/src/test/resources/META-INF/mime.types similarity index 100% rename from core-java/src/test/resources/META-INF/mime.types rename to core-java-io/src/test/resources/META-INF/mime.types diff --git a/core-java/src/test/resources/product.png b/core-java-io/src/test/resources/product.png similarity index 100% rename from core-java/src/test/resources/product.png rename to core-java-io/src/test/resources/product.png diff --git a/core-java-security/README.md b/core-java-security/README.md new file mode 100644 index 0000000000..415171094b --- /dev/null +++ b/core-java-security/README.md @@ -0,0 +1,11 @@ +## Core Java Security + +### Relevant Articles: +- [MD5 Hashing in Java](http://www.baeldung.com/java-md5) +- [Guide to the Cipher Class](http://www.baeldung.com/java-cipher-class) +- [Introduction to SSL in Java](http://www.baeldung.com/java-ssl) +- [Java KeyStore API](http://www.baeldung.com/java-keystore) +- [Encrypting and Decrypting Files in Java](http://www.baeldung.com/java-cipher-input-output-stream) +- [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing) +- [SSL Handshake Failures](https://www.baeldung.com/java-ssl-handshake-failures) +- [SHA-256 Hashing in Java](https://www.baeldung.com/sha-256-hashing-java) \ No newline at end of file diff --git a/core-java-security/pom.xml b/core-java-security/pom.xml new file mode 100644 index 0000000000..cf91121465 --- /dev/null +++ b/core-java-security/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + com.baeldung + core-java-security + 0.1.0-SNAPSHOT + jar + core-java-security + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + + org.assertj + assertj-core + ${assertj-core.version} + test + + + + commons-codec + commons-codec + ${commons-codec.version} + + + org.bouncycastle + bcprov-jdk15on + ${bouncycastle.version} + + + + + + + 3.8.1 + 1.55 + 1.10 + + + 3.10.0 + + + + diff --git a/core-java/src/main/java/com/baeldung/cipher/Encryptor.java b/core-java-security/src/main/java/com/baeldung/cipher/Encryptor.java similarity index 100% rename from core-java/src/main/java/com/baeldung/cipher/Encryptor.java rename to core-java-security/src/main/java/com/baeldung/cipher/Encryptor.java diff --git a/core-java/src/main/java/com/baeldung/encrypt/FileEncrypterDecrypter.java b/core-java-security/src/main/java/com/baeldung/encrypt/FileEncrypterDecrypter.java similarity index 100% rename from core-java/src/main/java/com/baeldung/encrypt/FileEncrypterDecrypter.java rename to core-java-security/src/main/java/com/baeldung/encrypt/FileEncrypterDecrypter.java diff --git a/core-java/src/main/java/com/baeldung/hashing/SHA256Hashing.java b/core-java-security/src/main/java/com/baeldung/hashing/SHA256Hashing.java similarity index 100% rename from core-java/src/main/java/com/baeldung/hashing/SHA256Hashing.java rename to core-java-security/src/main/java/com/baeldung/hashing/SHA256Hashing.java diff --git a/core-java/src/main/java/com/baeldung/keystore/JavaKeyStore.java b/core-java-security/src/main/java/com/baeldung/keystore/JavaKeyStore.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keystore/JavaKeyStore.java rename to core-java-security/src/main/java/com/baeldung/keystore/JavaKeyStore.java diff --git a/core-java/src/main/java/com/baeldung/passwordhashing/PBKDF2Hasher.java b/core-java-security/src/main/java/com/baeldung/passwordhashing/PBKDF2Hasher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/passwordhashing/PBKDF2Hasher.java rename to core-java-security/src/main/java/com/baeldung/passwordhashing/PBKDF2Hasher.java diff --git a/core-java/src/main/java/com/baeldung/passwordhashing/SHA512Hasher.java b/core-java-security/src/main/java/com/baeldung/passwordhashing/SHA512Hasher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/passwordhashing/SHA512Hasher.java rename to core-java-security/src/main/java/com/baeldung/passwordhashing/SHA512Hasher.java diff --git a/core-java/src/main/java/com/baeldung/passwordhashing/SimplePBKDF2Hasher.java b/core-java-security/src/main/java/com/baeldung/passwordhashing/SimplePBKDF2Hasher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/passwordhashing/SimplePBKDF2Hasher.java rename to core-java-security/src/main/java/com/baeldung/passwordhashing/SimplePBKDF2Hasher.java diff --git a/core-java/src/main/java/com/baeldung/ssl/SecureConnection.java b/core-java-security/src/main/java/com/baeldung/ssl/SecureConnection.java similarity index 100% rename from core-java/src/main/java/com/baeldung/ssl/SecureConnection.java rename to core-java-security/src/main/java/com/baeldung/ssl/SecureConnection.java diff --git a/core-java/src/main/java/com/baeldung/ssl/example/SimpleClient.java b/core-java-security/src/main/java/com/baeldung/ssl/example/SimpleClient.java similarity index 100% rename from core-java/src/main/java/com/baeldung/ssl/example/SimpleClient.java rename to core-java-security/src/main/java/com/baeldung/ssl/example/SimpleClient.java diff --git a/core-java/src/main/java/com/baeldung/ssl/example/SimpleServer.java b/core-java-security/src/main/java/com/baeldung/ssl/example/SimpleServer.java similarity index 100% rename from core-java/src/main/java/com/baeldung/ssl/example/SimpleServer.java rename to core-java-security/src/main/java/com/baeldung/ssl/example/SimpleServer.java diff --git a/core-java-security/src/main/resources/logback.xml b/core-java-security/src/main/resources/logback.xml new file mode 100644 index 0000000000..56af2d397e --- /dev/null +++ b/core-java-security/src/main/resources/logback.xml @@ -0,0 +1,19 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/cipher/EncryptorUnitTest.java b/core-java-security/src/test/java/com/baeldung/cipher/EncryptorUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/cipher/EncryptorUnitTest.java rename to core-java-security/src/test/java/com/baeldung/cipher/EncryptorUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/encrypt/FileEncrypterDecrypterIntegrationTest.java b/core-java-security/src/test/java/com/baeldung/encrypt/FileEncrypterDecrypterIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/encrypt/FileEncrypterDecrypterIntegrationTest.java rename to core-java-security/src/test/java/com/baeldung/encrypt/FileEncrypterDecrypterIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/hashing/SHA256HashingUnitTest.java b/core-java-security/src/test/java/com/baeldung/hashing/SHA256HashingUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/hashing/SHA256HashingUnitTest.java rename to core-java-security/src/test/java/com/baeldung/hashing/SHA256HashingUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/keystore/JavaKeyStoreUnitTest.java b/core-java-security/src/test/java/com/baeldung/keystore/JavaKeyStoreUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/keystore/JavaKeyStoreUnitTest.java rename to core-java-security/src/test/java/com/baeldung/keystore/JavaKeyStoreUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/passwordhashing/PBKDF2HasherUnitTest.java b/core-java-security/src/test/java/com/baeldung/passwordhashing/PBKDF2HasherUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/passwordhashing/PBKDF2HasherUnitTest.java rename to core-java-security/src/test/java/com/baeldung/passwordhashing/PBKDF2HasherUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/passwordhashing/SHA512HasherUnitTest.java b/core-java-security/src/test/java/com/baeldung/passwordhashing/SHA512HasherUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/passwordhashing/SHA512HasherUnitTest.java rename to core-java-security/src/test/java/com/baeldung/passwordhashing/SHA512HasherUnitTest.java diff --git a/core-java/src/test/java/org/baeldung/java/md5/JavaMD5UnitTest.java b/core-java-security/src/test/java/org/baeldung/java/md5/JavaMD5UnitTest.java similarity index 100% rename from core-java/src/test/java/org/baeldung/java/md5/JavaMD5UnitTest.java rename to core-java-security/src/test/java/org/baeldung/java/md5/JavaMD5UnitTest.java diff --git a/core-java/src/test/resources/test_md5.txt b/core-java-security/src/test/resources/test_md5.txt similarity index 100% rename from core-java/src/test/resources/test_md5.txt rename to core-java-security/src/test/resources/test_md5.txt diff --git a/core-java/README.md b/core-java/README.md index 21c58bb880..a3dd7fb2b7 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -5,7 +5,6 @@ ### Relevant Articles: - [Java Timer](http://www.baeldung.com/java-timer-and-timertask) - [How to Run a Shell Command in Java](http://www.baeldung.com/run-shell-command-in-java) -- [MD5 Hashing in Java](http://www.baeldung.com/java-md5) - [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java) - [A Guide To Java Regular Expressions API](http://www.baeldung.com/regular-expressions-java) - [Getting Started with Java Properties](http://www.baeldung.com/java-properties) @@ -24,7 +23,6 @@ - [Creating a Java Compiler Plugin](http://www.baeldung.com/java-build-compiler-plugin) - [Quick Guide to Java Stack](http://www.baeldung.com/java-stack) - [Guide to java.util.Formatter](http://www.baeldung.com/java-string-formatter) -- [Guide to the Cipher Class](http://www.baeldung.com/java-cipher-class) - [Compiling Java *.class Files with javac](http://www.baeldung.com/javac) - [A Guide to Iterator in Java](http://www.baeldung.com/java-iterator) - [Introduction to Javadoc](http://www.baeldung.com/javadoc) @@ -35,27 +33,20 @@ - [What is the serialVersionUID?](http://www.baeldung.com/java-serial-version-uid) - [A Guide to the ResourceBundle](http://www.baeldung.com/java-resourcebundle) - [Class Loaders in Java](http://www.baeldung.com/java-classloaders) -- [Introduction to SSL in Java](http://www.baeldung.com/java-ssl) -- [Java KeyStore API](http://www.baeldung.com/java-keystore) - [Double-Checked Locking with Singleton](http://www.baeldung.com/java-singleton-double-checked-locking) - [Guide to Java Clock Class](http://www.baeldung.com/java-clock) - [Importance of Main Manifest Attribute in a Self-Executing JAR](http://www.baeldung.com/java-jar-executable-manifest-main-class) -- [How to Get the File Extension of a File in Java](http://www.baeldung.com/java-file-extension) - [Java Global Exception Handler](http://www.baeldung.com/java-global-exception-handler) -- [Encrypting and Decrypting Files in Java](http://www.baeldung.com/java-cipher-input-output-stream) - [How to Get the Size of an Object in Java](http://www.baeldung.com/java-size-of-object) - [Guide to Java Instrumentation](http://www.baeldung.com/java-instrumentation) -- [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type) - [Common Java Exceptions](http://www.baeldung.com/java-common-exceptions) - [Throw Exception in Optional in Java 8](https://www.baeldung.com/java-optional-throw-exception) - [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) - [Calculating the nth Root in Java](https://www.baeldung.com/java-nth-root) - [Convert Double to String, Removing Decimal Places](https://www.baeldung.com/java-double-to-string) - [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset) -- [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing) - [Merging java.util.Properties Objects](https://www.baeldung.com/java-merging-properties) - [A Guide to SimpleDateFormat](https://www.baeldung.com/java-simple-date-format) -- [SSL Handshake Failures](https://www.baeldung.com/java-ssl-handshake-failures) - [Changing the Order in a Sum Operation Can Produce Different Results?](https://www.baeldung.com/java-floating-point-sum-order) - [Java – Try with Resources](https://www.baeldung.com/java-try-with-resources) - [Abstract Classes in Java](https://www.baeldung.com/java-abstract-class) diff --git a/core-java/pom.xml b/core-java/pom.xml index b4f0643aa8..6c58653d5a 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -24,11 +24,6 @@ commons-lang3 ${commons-lang3.version} - - org.bouncycastle - bcprov-jdk15on - ${bouncycastle.version} - org.unix4j unix4j-command @@ -75,12 +70,6 @@ ${assertj-core.version} test - - - commons-codec - commons-codec - ${commons-codec.version} - org.javamoney moneta @@ -126,17 +115,6 @@ h2 ${h2database.version} - - - org.apache.tika - tika-core - ${tika.version} - - - net.sf.jmimemagic - jmimemagic - ${jmime-magic.version} - org.javassist @@ -477,8 +455,6 @@ 3.5 - 1.55 - 1.10 2.5 3.6.1 1.0.3 @@ -509,9 +485,6 @@ 2.0.3.RELEASE 1.6.0 61.1 - - 1.18 - 0.1.5 3.21.0-GA diff --git a/guava/README.md b/guava/README.md index 0346d34903..60754dbe57 100644 --- a/guava/README.md +++ b/guava/README.md @@ -18,4 +18,3 @@ - [Hamcrest Text Matchers](http://www.baeldung.com/hamcrest-text-matchers) - [Quick Guide to the Guava RateLimiter](http://www.baeldung.com/guava-rate-limiter) - [Hamcrest File Matchers](https://www.baeldung.com/hamcrest-file-matchers) -- [SHA-256 Hashing in Java](https://www.baeldung.com/sha-256-hashing-java) diff --git a/pom.xml b/pom.xml index 923cbab302..e8ff86665c 100644 --- a/pom.xml +++ b/pom.xml @@ -383,6 +383,7 @@ core-java-concurrency-basic core-java-concurrency-collections core-java-io + core-java-security core-java-lang-syntax core-java-lang core-java-lang-oop @@ -1095,6 +1096,7 @@ core-java-concurrency-basic core-java-concurrency-collections core-java-io + core-java-security core-java-lang-syntax core-java-lang core-java-lang-oop From 40e26514f431478b98e98f42c4a61faed23f908e Mon Sep 17 00:00:00 2001 From: geroza Date: Sat, 29 Dec 2018 19:09:35 -0200 Subject: [PATCH 084/271] * Renamed IntegrationTests that needed manual configurations to run succesfully as ManualTests * Renamed Integrationtests that needed the project (or related project, in case of client-server) as LiveTests * Fixed migration of mustache module to make it compatible with spring-boot 2.1 --- mustache/pom.xml | 5 +++++ mustache/src/main/resources/application.properties | 1 + ...textIntegrationTest.java => SpringContextManualTest.java} | 2 +- ...textIntegrationTest.java => SpringContextManualTest.java} | 2 +- ...textIntegrationTest.java => SpringContextManualTest.java} | 2 +- ...textIntegrationTest.java => SpringContextManualTest.java} | 2 +- ...ontextIntegrationTest.java => SpringContextLiveTest.java} | 2 +- 7 files changed, 11 insertions(+), 5 deletions(-) rename spring-amqp-simple/src/test/java/org/baeldung/{SpringContextIntegrationTest.java => SpringContextManualTest.java} (90%) rename spring-kafka/src/test/java/org/baeldung/{SpringContextIntegrationTest.java => SpringContextManualTest.java} (90%) rename spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/{SpringContextIntegrationTest.java => SpringContextManualTest.java} (90%) rename spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/{SpringContextIntegrationTest.java => SpringContextManualTest.java} (90%) rename spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/{SpringContextIntegrationTest.java => SpringContextLiveTest.java} (90%) diff --git a/mustache/pom.xml b/mustache/pom.xml index 0c35345100..1b89997996 100644 --- a/mustache/pom.xml +++ b/mustache/pom.xml @@ -30,6 +30,11 @@ log4j ${log4j.version} + + + org.springframework.boot + spring-boot-starter-web + org.springframework.boot diff --git a/mustache/src/main/resources/application.properties b/mustache/src/main/resources/application.properties index e69de29bb2..011bbae980 100644 --- a/mustache/src/main/resources/application.properties +++ b/mustache/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.mustache.suffix:.html \ No newline at end of file diff --git a/spring-amqp-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-amqp-simple/src/test/java/org/baeldung/SpringContextManualTest.java similarity index 90% rename from spring-amqp-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-amqp-simple/src/test/java/org/baeldung/SpringContextManualTest.java index f134074cf8..03cb34eeb5 100644 --- a/spring-amqp-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-amqp-simple/src/test/java/org/baeldung/SpringContextManualTest.java @@ -9,7 +9,7 @@ import com.baeldung.springamqpsimple.SpringAmqpApplication; @RunWith(SpringRunner.class) @SpringBootTest(classes = SpringAmqpApplication.class) -public class SpringContextIntegrationTest { +public class SpringContextManualTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/spring-kafka/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-kafka/src/test/java/org/baeldung/SpringContextManualTest.java similarity index 90% rename from spring-kafka/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-kafka/src/test/java/org/baeldung/SpringContextManualTest.java index 40bf86c76f..b8195633fd 100644 --- a/spring-kafka/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-kafka/src/test/java/org/baeldung/SpringContextManualTest.java @@ -9,7 +9,7 @@ import com.baeldung.spring.kafka.KafkaApplication; @RunWith(SpringRunner.class) @SpringBootTest(classes = KafkaApplication.class) -public class SpringContextIntegrationTest { +public class SpringContextManualTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextManualTest.java similarity index 90% rename from spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextManualTest.java index 5dc6d1df75..a6ee0b6000 100644 --- a/spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextManualTest.java @@ -9,7 +9,7 @@ import com.baeldung.server.AmqpServer; @RunWith(SpringRunner.class) @SpringBootTest(classes = AmqpServer.class) -public class SpringContextIntegrationTest { +public class SpringContextManualTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextManualTest.java similarity index 90% rename from spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextManualTest.java index 5c9cc5f872..b806f21c27 100644 --- a/spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextManualTest.java @@ -9,7 +9,7 @@ import com.baeldung.server.JmsServer; @SpringBootTest(classes = JmsServer.class) @RunWith(SpringRunner.class) -public class SpringContextIntegrationTest { +public class SpringContextManualTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextLiveTest.java similarity index 90% rename from spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextLiveTest.java index 3460792fc6..3bace4cd1e 100644 --- a/spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextLiveTest.java @@ -9,7 +9,7 @@ import com.baeldung.client.RmiClient; @SpringBootTest(classes = RmiClient.class) @RunWith(SpringRunner.class) -public class SpringContextIntegrationTest { +public class SpringContextLiveTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { From 676f55e8720e8ec6cc00a73e3bcb1526318a948e Mon Sep 17 00:00:00 2001 From: rahusriv Date: Sun, 30 Dec 2018 08:40:43 +0530 Subject: [PATCH 085/271] BAEL-2335 (#6015) * Making examples simple * Changing variable names --- .../ArrayListOfArrayList.java | 26 +++++++++---------- .../ThreeDimensionalArrayList.java | 16 ++++++------ 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java b/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java index 72045d6761..2c3da7b1fc 100644 --- a/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java +++ b/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java @@ -6,30 +6,28 @@ public class ArrayListOfArrayList { public static void main(String args[]) { - int vertex = 5; - ArrayList> graph = new ArrayList<>(vertex); + int numVertices = 3; + ArrayList> graph = new ArrayList<>(numVertices); //Initializing each element of ArrayList with ArrayList - for(int i=0; i< vertex; i++) { + for(int i=0; i< numVertices; i++) { graph.add(new ArrayList()); } //We can add any number of columns to each row graph.get(0).add(1); - graph.get(0).add(5); - graph.get(1).add(0); graph.get(1).add(2); + graph.get(2).add(0); + graph.get(1).add(0); graph.get(2).add(1); - graph.get(2).add(3); - graph.get(3).add(2); - graph.get(3).add(4); - graph.get(4).add(3); - graph.get(4).add(5); - + graph.get(0).add(2); + //Printing all the edges - for(int i=0; i listOfVertices = graph.get(vertexNo); + for(int i=0; i Date: Sun, 30 Dec 2018 00:38:11 -0300 Subject: [PATCH 086/271] BAEL-2444 Samples (#6002) --- core-java-8/pom.xml | 37 +++++++++++++- .../baeldung/time/LocalDateTimeUnitTest.java | 43 +++++++++++++++++ .../time/LocalDateTimeWithJMockUnitTest.java | 48 +++++++++++++++++++ 3 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 core-java-8/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java create mode 100644 core-java-8/src/test/java/com/baeldung/time/LocalDateTimeWithJMockUnitTest.java diff --git a/core-java-8/pom.xml b/core-java-8/pom.xml index 18bdaa15f4..112e8b764d 100644 --- a/core-java-8/pom.xml +++ b/core-java-8/pom.xml @@ -1,5 +1,5 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.baeldung core-java-8 @@ -104,6 +104,24 @@ aspectjweaver ${asspectj.version} + + org.powermock + powermock-module-junit4 + ${powermock.version} + test + + + org.powermock + powermock-api-mockito2 + ${powermock.version} + test + + + org.jmockit + jmockit + ${jmockit.version} + test + @@ -119,7 +137,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -142,6 +160,16 @@ + + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + -javaagent:${settings.localRepository}/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar + + true + + @@ -159,9 +187,14 @@ 3.6.1 1.8.9 + 2.0.0-RC.4 + 1.44 1.7.0 1.19 1.19 2.0.4.RELEASE + + 3.8.0 + 2.22.1 diff --git a/core-java-8/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java b/core-java-8/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java new file mode 100644 index 0000000000..04c1a0b74e --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java @@ -0,0 +1,43 @@ +package com.baeldung.time; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.time.Clock; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; +import static org.powermock.api.mockito.PowerMockito.mockStatic; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({ LocalDateTime.class }) +public class LocalDateTimeUnitTest { + + @Test + public void givenLocalDateTimeMock_whenNow_thenGetFixedLocalDateTime() { + Clock clock = Clock.fixed(Instant.parse("2014-12-22T10:15:30.00Z"), ZoneId.of("UTC")); + LocalDateTime dateTime = LocalDateTime.now(clock); + mockStatic(LocalDateTime.class); + when(LocalDateTime.now()).thenReturn(dateTime); + String dateTimeExpected = "2014-12-22T10:15:30"; + + LocalDateTime now = LocalDateTime.now(); + + assertThat(now).isEqualTo(dateTimeExpected); + } + + @Test + public void givenFixedClock_whenNow_thenGetFixedLocalDateTime() { + Clock clock = Clock.fixed(Instant.parse("2014-12-22T10:15:30.00Z"), ZoneId.of("UTC")); + String dateTimeExpected = "2014-12-22T10:15:30"; + + LocalDateTime dateTime = LocalDateTime.now(clock); + + assertThat(dateTime).isEqualTo(dateTimeExpected); + } +} diff --git a/core-java-8/src/test/java/com/baeldung/time/LocalDateTimeWithJMockUnitTest.java b/core-java-8/src/test/java/com/baeldung/time/LocalDateTimeWithJMockUnitTest.java new file mode 100644 index 0000000000..13861dfd0b --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/time/LocalDateTimeWithJMockUnitTest.java @@ -0,0 +1,48 @@ +package com.baeldung.time; + +import mockit.Expectations; +import mockit.Mock; +import mockit.MockUp; +import org.junit.jupiter.api.Test; + +import java.time.Clock; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; + +import static org.assertj.core.api.Assertions.assertThat; + +public class LocalDateTimeWithJMockUnitTest { + + @Test + public void givenLocalDateTimeWithJMock_whenNow_thenGetFixedLocalDateTime() { + Clock clock = Clock.fixed(Instant.parse("2014-12-21T10:15:30.00Z"), ZoneId.of("UTC")); + new MockUp() { + @Mock + public LocalDateTime now() { + return LocalDateTime.now(clock); + } + }; + String dateTimeExpected = "2014-12-21T10:15:30"; + + LocalDateTime now = LocalDateTime.now(); + + assertThat(now).isEqualTo(dateTimeExpected); + } + + @Test + public void givenLocalDateTimeWithExpectations_whenNow_thenGetFixedLocalDateTime() { + Clock clock = Clock.fixed(Instant.parse("2014-12-23T10:15:30.00Z"), ZoneId.of("UTC")); + LocalDateTime dateTimeExpected = LocalDateTime.now(clock); + new Expectations(LocalDateTime.class) { + { + LocalDateTime.now(); + result = dateTimeExpected; + } + }; + + LocalDateTime now = LocalDateTime.now(); + + assertThat(now).isEqualTo(dateTimeExpected); + } +} From a89983a65cbf165f0e18889b6e43b1a7ed686dd3 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Sun, 30 Dec 2018 14:19:24 +0400 Subject: [PATCH 087/271] move unmodifiable set code to java 9 module --- .../com/baeldung/java9}/set/UnmodifiableSet.java | 6 +++--- .../java/com/baeldung/java9/SetExamplesUnitTest.java | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) rename {core-java-collections/src/main/java/com/baeldung => core-java-9/src/main/java/com/baeldung/java9}/set/UnmodifiableSet.java (88%) diff --git a/core-java-collections/src/main/java/com/baeldung/set/UnmodifiableSet.java b/core-java-9/src/main/java/com/baeldung/java9/set/UnmodifiableSet.java similarity index 88% rename from core-java-collections/src/main/java/com/baeldung/set/UnmodifiableSet.java rename to core-java-9/src/main/java/com/baeldung/java9/set/UnmodifiableSet.java index 06f477c50a..7dbcd2a3a3 100644 --- a/core-java-collections/src/main/java/com/baeldung/set/UnmodifiableSet.java +++ b/core-java-9/src/main/java/com/baeldung/java9/set/UnmodifiableSet.java @@ -1,4 +1,4 @@ -package com.baeldung.set; +package com.baeldung.java9.set; import com.google.common.collect.ImmutableSet; @@ -21,8 +21,8 @@ public class UnmodifiableSet { } private static void java9Of() { - //Set immutable = Set.of("Canada", "USA"); - //System.out.println(immutable); + Set immutable = Set.of("Canada", "USA"); + System.out.println(immutable); } private static void guavaOf() { diff --git a/core-java-9/src/test/java/com/baeldung/java9/SetExamplesUnitTest.java b/core-java-9/src/test/java/com/baeldung/java9/SetExamplesUnitTest.java index 9e7e8e6e4b..28e71affcc 100644 --- a/core-java-9/src/test/java/com/baeldung/java9/SetExamplesUnitTest.java +++ b/core-java-9/src/test/java/com/baeldung/java9/SetExamplesUnitTest.java @@ -1,5 +1,7 @@ package com.baeldung.java9; +import java.util.Collections; +import java.util.HashSet; import java.util.Set; import org.junit.Test; @@ -23,4 +25,14 @@ public class SetExamplesUnitTest { Set intSet = Set.of(intArray); assertEquals(intSet.size(), intArray.length); } + + @Test(expected = UnsupportedOperationException.class) + public void testUnmodifiableSet() { + Set set = new HashSet<>(); + set.add("Canada"); + set.add("USA"); + + Set unmodifiableSet = Collections.unmodifiableSet(set); + unmodifiableSet.add("Costa Rica"); + } } From eb4928b972264c86472576a1673fa7245431a740 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 30 Dec 2018 16:30:36 +0530 Subject: [PATCH 088/271] [BAEL-11403] - Moved articles out of core-java (part 4) --- core-java-collections/README.md | 3 +- .../baeldung/iteratorguide/IteratorGuide.java | 0 core-java/README.md | 11 --- .../StringReplaceAndRemoveUnitTest.java | 83 ------------------- java-dates/README.md | 2 + .../zoneddatetime/OffsetDateTimeExample.java | 0 .../zoneddatetime/OffsetTimeExample.java | 0 .../zoneddatetime/ZoneDateTimeExample.java | 0 .../com/baeldung/date/DateDiffUnitTest.java | 2 + .../SimpleDateFormatUnitTest.java | 0 .../OffsetDateTimeExampleUnitTest.java | 0 .../OffsetTimeExampleUnitTest.java | 0 .../ZoneDateTimeExampleUnitTest.java | 0 java-numbers/README.md | 6 ++ .../java/com/baeldung/area/circle/Circle.java | 0 .../com/baeldung/area/circle/CircleArea.java | 0 .../root/calculator/NthRootCalculator.java | 0 .../java/com/baeldung/nth/root/main/Main.java | 0 .../DecimalFormatExamplesUnitTest.java | 0 .../com/baeldung/java/math/MathUnitTest.java | 0 .../calculator/NthRootCalculatorUnitTest.java | 0 .../baeldung/nth/root/main/MainUnitTest.java | 0 .../RemovingDecimalsManualTest.java | 0 .../RemovingDecimalsUnitTest.java | 0 java-strings/README.md | 2 + .../string/AppendCharAtPositionX.java | 0 .../string/AppendCharAtPositionXUnitTest.java | 0 .../DateToStringFormatterUnitTest.java | 9 +- 28 files changed, 19 insertions(+), 99 deletions(-) rename {core-java => core-java-collections}/src/main/java/com/baeldung/iteratorguide/IteratorGuide.java (100%) delete mode 100644 core-java/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java rename {core-java => java-dates}/src/main/java/com/baeldung/zoneddatetime/OffsetDateTimeExample.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/zoneddatetime/OffsetTimeExample.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/zoneddatetime/ZoneDateTimeExample.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/zoneddatetime/OffsetDateTimeExampleUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/zoneddatetime/OffsetTimeExampleUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/zoneddatetime/ZoneDateTimeExampleUnitTest.java (100%) rename {core-java => java-numbers}/src/main/java/com/baeldung/area/circle/Circle.java (100%) rename {core-java => java-numbers}/src/main/java/com/baeldung/area/circle/CircleArea.java (100%) rename {core-java => java-numbers}/src/main/java/com/baeldung/nth/root/calculator/NthRootCalculator.java (100%) rename {core-java => java-numbers}/src/main/java/com/baeldung/nth/root/main/Main.java (100%) rename {core-java => java-numbers}/src/test/java/com/baeldung/decimalformat/DecimalFormatExamplesUnitTest.java (100%) rename {core-java => java-numbers}/src/test/java/com/baeldung/java/math/MathUnitTest.java (100%) rename {core-java => java-numbers}/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java (100%) rename {core-java => java-numbers}/src/test/java/com/baeldung/nth/root/main/MainUnitTest.java (100%) rename {core-java => java-numbers}/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsManualTest.java (100%) rename {core-java => java-numbers}/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsUnitTest.java (100%) rename {core-java => java-strings}/src/main/java/com/baeldung/string/AppendCharAtPositionX.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/string/AppendCharAtPositionXUnitTest.java (100%) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index 15be81156c..71d4e6b614 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -28,4 +28,5 @@ - [Combining Different Types of Collections in Java](https://www.baeldung.com/java-combine-collections) - [Sorting in Java](http://www.baeldung.com/java-sorting) - [Join and Split Arrays and Collections in Java](http://www.baeldung.com/java-join-and-split) -- [A Guide to EnumMap](https://www.baeldung.com/java-enum-map) \ No newline at end of file +- [A Guide to EnumMap](https://www.baeldung.com/java-enum-map) +- [A Guide to Iterator in Java](http://www.baeldung.com/java-iterator) \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/iteratorguide/IteratorGuide.java b/core-java-collections/src/main/java/com/baeldung/iteratorguide/IteratorGuide.java similarity index 100% rename from core-java/src/main/java/com/baeldung/iteratorguide/IteratorGuide.java rename to core-java-collections/src/main/java/com/baeldung/iteratorguide/IteratorGuide.java diff --git a/core-java/README.md b/core-java/README.md index 21c58bb880..4f03bac732 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -23,13 +23,10 @@ - [Difference between URL and URI](http://www.baeldung.com/java-url-vs-uri) - [Creating a Java Compiler Plugin](http://www.baeldung.com/java-build-compiler-plugin) - [Quick Guide to Java Stack](http://www.baeldung.com/java-stack) -- [Guide to java.util.Formatter](http://www.baeldung.com/java-string-formatter) - [Guide to the Cipher Class](http://www.baeldung.com/java-cipher-class) - [Compiling Java *.class Files with javac](http://www.baeldung.com/javac) -- [A Guide to Iterator in Java](http://www.baeldung.com/java-iterator) - [Introduction to Javadoc](http://www.baeldung.com/javadoc) - [Guide to the Externalizable Interface in Java](http://www.baeldung.com/java-externalizable) -- [A Practical Guide to DecimalFormat](http://www.baeldung.com/java-decimalformat) - [How to Detect the OS Using Java](http://www.baeldung.com/java-detect-os) - [ASCII Art in Java](http://www.baeldung.com/ascii-art-in-java) - [What is the serialVersionUID?](http://www.baeldung.com/java-serial-version-uid) @@ -48,19 +45,11 @@ - [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type) - [Common Java Exceptions](http://www.baeldung.com/java-common-exceptions) - [Throw Exception in Optional in Java 8](https://www.baeldung.com/java-optional-throw-exception) -- [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) -- [Calculating the nth Root in Java](https://www.baeldung.com/java-nth-root) -- [Convert Double to String, Removing Decimal Places](https://www.baeldung.com/java-double-to-string) -- [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset) - [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing) - [Merging java.util.Properties Objects](https://www.baeldung.com/java-merging-properties) -- [A Guide to SimpleDateFormat](https://www.baeldung.com/java-simple-date-format) - [SSL Handshake Failures](https://www.baeldung.com/java-ssl-handshake-failures) -- [Changing the Order in a Sum Operation Can Produce Different Results?](https://www.baeldung.com/java-floating-point-sum-order) - [Java – Try with Resources](https://www.baeldung.com/java-try-with-resources) - [Abstract Classes in Java](https://www.baeldung.com/java-abstract-class) - [Guide to Character Encoding](https://www.baeldung.com/java-char-encoding) -- [Calculate the Area of a Circle in Java](https://www.baeldung.com/java-calculate-circle-area) -- [A Guide to the Java Math Class](https://www.baeldung.com/java-lang-math) - [Graphs in Java](https://www.baeldung.com/java-graphs) - [Console I/O in Java](http://www.baeldung.com/java-console-input-output) diff --git a/core-java/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java b/core-java/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java deleted file mode 100644 index d952d2383b..0000000000 --- a/core-java/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.baeldung.string; - - -import org.apache.commons.lang3.StringUtils; -import org.junit.Test; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class StringReplaceAndRemoveUnitTest { - - - @Test - public void givenTestStrings_whenReplace_thenProcessedString() { - - String master = "Hello World Baeldung!"; - String target = "Baeldung"; - String replacement = "Java"; - String processed = master.replace(target, replacement); - assertTrue(processed.contains(replacement)); - assertFalse(processed.contains(target)); - - } - - @Test - public void givenTestStrings_whenReplaceAll_thenProcessedString() { - - String master2 = "Welcome to Baeldung, Hello World Baeldung"; - String regexTarget= "(Baeldung)$"; - String replacement = "Java"; - String processed2 = master2.replaceAll(regexTarget, replacement); - assertTrue(processed2.endsWith("Java")); - - } - - @Test - public void givenTestStrings_whenStringBuilderMethods_thenProcessedString() { - - String master = "Hello World Baeldung!"; - String target = "Baeldung"; - String replacement = "Java"; - - int startIndex = master.indexOf(target); - int stopIndex = startIndex + target.length(); - - StringBuilder builder = new StringBuilder(master); - - - builder.delete(startIndex, stopIndex); - assertFalse(builder.toString().contains(target)); - - - builder.replace(startIndex, stopIndex, replacement); - assertTrue(builder.toString().contains(replacement)); - - - } - - - @Test - public void givenTestStrings_whenStringUtilsMethods_thenProcessedStrings() { - - String master = "Hello World Baeldung!"; - String target = "Baeldung"; - String replacement = "Java"; - - String processed = StringUtils.replace(master, target, replacement); - assertTrue(processed.contains(replacement)); - - String master2 = "Hello World Baeldung!"; - String target2 = "baeldung"; - String processed2 = StringUtils.replaceIgnoreCase(master2, target2, replacement); - assertFalse(processed2.contains(target)); - - } - - - - - - - -} diff --git a/java-dates/README.md b/java-dates/README.md index 21e54082f4..ac3166d938 100644 --- a/java-dates/README.md +++ b/java-dates/README.md @@ -26,3 +26,5 @@ - [Format ZonedDateTime to String](https://www.baeldung.com/java-format-zoned-datetime-string) - [Convert Between java.time.Instant and java.sql.Timestamp](https://www.baeldung.com/java-time-instant-to-java-sql-timestamp) - [Convert between String and Timestamp](https://www.baeldung.com/java-string-to-timestamp) +- [A Guide to SimpleDateFormat](https://www.baeldung.com/java-simple-date-format) +- [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset) \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/zoneddatetime/OffsetDateTimeExample.java b/java-dates/src/main/java/com/baeldung/zoneddatetime/OffsetDateTimeExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/zoneddatetime/OffsetDateTimeExample.java rename to java-dates/src/main/java/com/baeldung/zoneddatetime/OffsetDateTimeExample.java diff --git a/core-java/src/main/java/com/baeldung/zoneddatetime/OffsetTimeExample.java b/java-dates/src/main/java/com/baeldung/zoneddatetime/OffsetTimeExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/zoneddatetime/OffsetTimeExample.java rename to java-dates/src/main/java/com/baeldung/zoneddatetime/OffsetTimeExample.java diff --git a/core-java/src/main/java/com/baeldung/zoneddatetime/ZoneDateTimeExample.java b/java-dates/src/main/java/com/baeldung/zoneddatetime/ZoneDateTimeExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/zoneddatetime/ZoneDateTimeExample.java rename to java-dates/src/main/java/com/baeldung/zoneddatetime/ZoneDateTimeExample.java diff --git a/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java b/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java index 1234a700de..a35699e469 100644 --- a/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java +++ b/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java @@ -8,6 +8,8 @@ import java.time.Duration; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.Period; +import java.time.ZoneId; +import java.time.ZonedDateTime; import java.time.temporal.ChronoUnit; import java.util.Date; import java.util.Locale; diff --git a/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java b/java-dates/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java rename to java-dates/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/zoneddatetime/OffsetDateTimeExampleUnitTest.java b/java-dates/src/test/java/com/baeldung/zoneddatetime/OffsetDateTimeExampleUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/zoneddatetime/OffsetDateTimeExampleUnitTest.java rename to java-dates/src/test/java/com/baeldung/zoneddatetime/OffsetDateTimeExampleUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/zoneddatetime/OffsetTimeExampleUnitTest.java b/java-dates/src/test/java/com/baeldung/zoneddatetime/OffsetTimeExampleUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/zoneddatetime/OffsetTimeExampleUnitTest.java rename to java-dates/src/test/java/com/baeldung/zoneddatetime/OffsetTimeExampleUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/zoneddatetime/ZoneDateTimeExampleUnitTest.java b/java-dates/src/test/java/com/baeldung/zoneddatetime/ZoneDateTimeExampleUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/zoneddatetime/ZoneDateTimeExampleUnitTest.java rename to java-dates/src/test/java/com/baeldung/zoneddatetime/ZoneDateTimeExampleUnitTest.java diff --git a/java-numbers/README.md b/java-numbers/README.md index 1138d9a74c..2b1131f325 100644 --- a/java-numbers/README.md +++ b/java-numbers/README.md @@ -13,3 +13,9 @@ - [Find All Pairs of Numbers in an Array That Add Up to a Given Sum](http://www.baeldung.com/java-algorithm-number-pairs-sum) - [Java – Random Long, Float, Integer and Double](http://www.baeldung.com/java-generate-random-long-float-integer-double) - [Using Math.sin with Degrees](https://www.baeldung.com/java-math-sin-degrees) +- [A Practical Guide to DecimalFormat](http://www.baeldung.com/java-decimalformat) +- [Calculating the nth Root in Java](https://www.baeldung.com/java-nth-root) +- [Convert Double to String, Removing Decimal Places](https://www.baeldung.com/java-double-to-string) +- [Changing the Order in a Sum Operation Can Produce Different Results?](https://www.baeldung.com/java-floating-point-sum-order) +- [Calculate the Area of a Circle in Java](https://www.baeldung.com/java-calculate-circle-area) +- [A Guide to the Java Math Class](https://www.baeldung.com/java-lang-math) \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/area/circle/Circle.java b/java-numbers/src/main/java/com/baeldung/area/circle/Circle.java similarity index 100% rename from core-java/src/main/java/com/baeldung/area/circle/Circle.java rename to java-numbers/src/main/java/com/baeldung/area/circle/Circle.java diff --git a/core-java/src/main/java/com/baeldung/area/circle/CircleArea.java b/java-numbers/src/main/java/com/baeldung/area/circle/CircleArea.java similarity index 100% rename from core-java/src/main/java/com/baeldung/area/circle/CircleArea.java rename to java-numbers/src/main/java/com/baeldung/area/circle/CircleArea.java diff --git a/core-java/src/main/java/com/baeldung/nth/root/calculator/NthRootCalculator.java b/java-numbers/src/main/java/com/baeldung/nth/root/calculator/NthRootCalculator.java similarity index 100% rename from core-java/src/main/java/com/baeldung/nth/root/calculator/NthRootCalculator.java rename to java-numbers/src/main/java/com/baeldung/nth/root/calculator/NthRootCalculator.java diff --git a/core-java/src/main/java/com/baeldung/nth/root/main/Main.java b/java-numbers/src/main/java/com/baeldung/nth/root/main/Main.java similarity index 100% rename from core-java/src/main/java/com/baeldung/nth/root/main/Main.java rename to java-numbers/src/main/java/com/baeldung/nth/root/main/Main.java diff --git a/core-java/src/test/java/com/baeldung/decimalformat/DecimalFormatExamplesUnitTest.java b/java-numbers/src/test/java/com/baeldung/decimalformat/DecimalFormatExamplesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/decimalformat/DecimalFormatExamplesUnitTest.java rename to java-numbers/src/test/java/com/baeldung/decimalformat/DecimalFormatExamplesUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java/math/MathUnitTest.java b/java-numbers/src/test/java/com/baeldung/java/math/MathUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java/math/MathUnitTest.java rename to java-numbers/src/test/java/com/baeldung/java/math/MathUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java b/java-numbers/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java rename to java-numbers/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/nth/root/main/MainUnitTest.java b/java-numbers/src/test/java/com/baeldung/nth/root/main/MainUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/nth/root/main/MainUnitTest.java rename to java-numbers/src/test/java/com/baeldung/nth/root/main/MainUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsManualTest.java b/java-numbers/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsManualTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsManualTest.java rename to java-numbers/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsManualTest.java diff --git a/core-java/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsUnitTest.java b/java-numbers/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsUnitTest.java rename to java-numbers/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsUnitTest.java diff --git a/java-strings/README.md b/java-strings/README.md index 60131e392d..fa048dbb5a 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -45,3 +45,5 @@ - [Remove or Replace part of a String in Java](https://www.baeldung.com/java-remove-replace-string-part) - [Replace a Character at a Specific Index in a String in Java](https://www.baeldung.com/java-replace-character-at-index) - [Convert a Comma Separated String to a List in Java](https://www.baeldung.com/java-string-with-separator-to-list) +- [Guide to java.util.Formatter](http://www.baeldung.com/java-string-formatter) +- [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/string/AppendCharAtPositionX.java b/java-strings/src/main/java/com/baeldung/string/AppendCharAtPositionX.java similarity index 100% rename from core-java/src/main/java/com/baeldung/string/AppendCharAtPositionX.java rename to java-strings/src/main/java/com/baeldung/string/AppendCharAtPositionX.java diff --git a/core-java/src/test/java/com/baeldung/string/AppendCharAtPositionXUnitTest.java b/java-strings/src/test/java/com/baeldung/string/AppendCharAtPositionXUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/string/AppendCharAtPositionXUnitTest.java rename to java-strings/src/test/java/com/baeldung/string/AppendCharAtPositionXUnitTest.java diff --git a/java-strings/src/test/java/com/baeldung/string/formatter/DateToStringFormatterUnitTest.java b/java-strings/src/test/java/com/baeldung/string/formatter/DateToStringFormatterUnitTest.java index f236c641c3..d760510c73 100644 --- a/java-strings/src/test/java/com/baeldung/string/formatter/DateToStringFormatterUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/string/formatter/DateToStringFormatterUnitTest.java @@ -1,7 +1,6 @@ package com.baeldung.string.formatter; -import org.junit.BeforeClass; -import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -11,9 +10,11 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Calendar; import java.util.Date; +import java.util.Locale; import java.util.TimeZone; -import static org.junit.Assert.assertEquals; +import org.junit.BeforeClass; +import org.junit.Test; public class DateToStringFormatterUnitTest { @@ -40,7 +41,7 @@ public class DateToStringFormatterUnitTest { @Test public void whenDateConvertedUsingDateFormatToString_thenCorrect() { String formattedDate = DateFormat - .getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT) + .getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.US) .format(date); assertEquals(EXPECTED_STRING_DATE, formattedDate); From de80339a2a03ce98ba1b0c189a3e953d03ad4686 Mon Sep 17 00:00:00 2001 From: Emily Cheyne Date: Sun, 30 Dec 2018 09:12:21 -0700 Subject: [PATCH 089/271] BAEL-2090 update readme --- persistence-modules/spring-data-jpa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/spring-data-jpa/README.md b/persistence-modules/spring-data-jpa/README.md index e240ae6d33..3c71600565 100644 --- a/persistence-modules/spring-data-jpa/README.md +++ b/persistence-modules/spring-data-jpa/README.md @@ -17,6 +17,7 @@ - [Spring Data – CrudRepository save() Method](https://www.baeldung.com/spring-data-crud-repository-save) - [Limiting Query Results with JPA and Spring Data JPA](https://www.baeldung.com/jpa-limit-query-results) - [Sorting Query Results with Spring Data](https://www.baeldung.com/spring-data-sorting) +- [INSERT Statement in JPA](https://www.baeldung.com/jpa-insert) ### Eclipse Config After importing the project into Eclipse, you may see the following error: From 3bdd542dbf78acb998d64527ba49120c6eea3c9a Mon Sep 17 00:00:00 2001 From: Erhan KARAKAYA Date: Mon, 31 Dec 2018 03:48:20 +0300 Subject: [PATCH 090/271] Added @Value for map examples --- .../java/com/baeldung/value/ValuesApp.java | 28 +++++++++++++++++++ .../src/main/resources/values.properties | 3 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/spring-core/src/main/java/com/baeldung/value/ValuesApp.java b/spring-core/src/main/java/com/baeldung/value/ValuesApp.java index f525dfde89..33592ae38a 100644 --- a/spring-core/src/main/java/com/baeldung/value/ValuesApp.java +++ b/spring-core/src/main/java/com/baeldung/value/ValuesApp.java @@ -45,6 +45,27 @@ public class ValuesApp { @Value("#{'${listOfValues}'.split(',')}") private List valuesList; + + @Value("#{${valuesMap}}") + private Map valuesMap; + + @Value("#{${valuesMap}.key1}") + private Integer valuesMapKey1; + + @Value("#{${valuesMap}['unknownKey']}") + private Integer unknownMapKey; + + @Value("#{${unknownMap : {key1:'1', key2 : '2'}}}") + private Map unknownMap; + + @Value("#{${valuesMap}['unknownKey'] ?: 5}") + private Integer unknownMapKeyWithDefaultValue; + + @Value("#{${valuesMap}.?[value>'1']}") + private Map valuesMapFiltered; + + @Value("#{systemProperties}") + private Map systemPropertiesMap; public static void main(String[] args) { System.setProperty("systemValue", "Some system parameter value"); @@ -69,5 +90,12 @@ public class ValuesApp { System.out.println(spelSomeDefault); System.out.println(someBeanValue); System.out.println(valuesList); + System.out.println(valuesMap); + System.out.println(valuesMapKey1); + System.out.println(unknownMapKey); + System.out.println(unknownMap); + System.out.println(unknownMapKeyWithDefaultValue); + System.out.println(valuesMapFiltered); + System.out.println(systemPropertiesMap); } } diff --git a/spring-core/src/main/resources/values.properties b/spring-core/src/main/resources/values.properties index d7d61b8ee8..c6db5873fb 100644 --- a/spring-core/src/main/resources/values.properties +++ b/spring-core/src/main/resources/values.properties @@ -1,3 +1,4 @@ value.from.file=Value got from the file priority=Properties file -listOfValues=A,B,C \ No newline at end of file +listOfValues=A,B,C +valuesMap={key1:'1', key2 : '2', key3 : '3'} \ No newline at end of file From 90037051b917432008c0a39eca55cc6d86e109cb Mon Sep 17 00:00:00 2001 From: Erhan KARAKAYA Date: Mon, 31 Dec 2018 04:01:27 +0300 Subject: [PATCH 091/271] Added missing import --- spring-core/src/main/java/com/baeldung/value/ValuesApp.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-core/src/main/java/com/baeldung/value/ValuesApp.java b/spring-core/src/main/java/com/baeldung/value/ValuesApp.java index 33592ae38a..80893c1adf 100644 --- a/spring-core/src/main/java/com/baeldung/value/ValuesApp.java +++ b/spring-core/src/main/java/com/baeldung/value/ValuesApp.java @@ -2,6 +2,7 @@ package com.baeldung.value; import java.util.Arrays; import java.util.List; +import java.util.Map; import javax.annotation.PostConstruct; From 6c6046200060f121f040c16db6c8d7bdf7fa1922 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Mon, 31 Dec 2018 10:07:38 +0100 Subject: [PATCH 092/271] added README --- akka-http/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 akka-http/README.md diff --git a/akka-http/README.md b/akka-http/README.md new file mode 100644 index 0000000000..583d2efa74 --- /dev/null +++ b/akka-http/README.md @@ -0,0 +1,3 @@ +### Relevant articles + +- [Introduction to Akka HTTP](https://www.baeldung.com/akka-http) From 0cf67f5dbef3d8c1ef17d2478654469f17fb2472 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Mon, 31 Dec 2018 13:45:58 +0100 Subject: [PATCH 093/271] BAEL-2435 Change dependency Change the autoconfigure dependency to the starter dependency of Axon --- axon/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/axon/pom.xml b/axon/pom.xml index 03d2499a99..598dc820e5 100644 --- a/axon/pom.xml +++ b/axon/pom.xml @@ -16,7 +16,7 @@ org.axonframework - axon-spring-boot-autoconfigure + axon-spring-boot-starter ${axon.version} From f757eba28b25d8d7807a23c1748230a096f7df97 Mon Sep 17 00:00:00 2001 From: DOHA Date: Mon, 31 Dec 2018 16:50:19 +0200 Subject: [PATCH 094/271] adding security for testing purpose --- spring-boot-testing/pom.xml | 32 +++++++++++++----- .../com/baeldung/boot/SecurityConfig.java | 32 ++++++++++++++++++ .../boot/controller/rest/HomeController.java | 14 ++++++++ .../src/main/resources/application.properties | 4 +++ ...oovy => LoadContextIntegrationTest.groovy} | 2 +- ...vy => WebControllerIntegrationTest.groovy} | 6 ++-- .../boot/WebControllerTest.groovy alias | Bin 0 -> 217036 bytes 7 files changed, 78 insertions(+), 12 deletions(-) create mode 100644 spring-boot-testing/src/main/java/com/baeldung/boot/SecurityConfig.java create mode 100644 spring-boot-testing/src/main/java/com/baeldung/boot/controller/rest/HomeController.java create mode 100644 spring-boot-testing/src/main/resources/application.properties rename spring-boot-testing/src/test/groovy/com/baeldung/boot/{LoadContextTest.groovy => LoadContextIntegrationTest.groovy} (91%) rename spring-boot-testing/src/test/groovy/com/baeldung/boot/{WebControllerTest.groovy => WebControllerIntegrationTest.groovy} (94%) create mode 100644 spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerTest.groovy alias diff --git a/spring-boot-testing/pom.xml b/spring-boot-testing/pom.xml index 2a498e54c5..dd40789604 100644 --- a/spring-boot-testing/pom.xml +++ b/spring-boot-testing/pom.xml @@ -23,6 +23,10 @@ org.springframework.boot spring-boot-starter-tomcat + + org.springframework.boot + spring-boot-starter-security + org.springframework.boot spring-boot-starter-test @@ -43,6 +47,13 @@ ${spock.version} test + + + io.rest-assured + rest-assured + test + + @@ -99,13 +110,23 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*IntegrationTest.java + + + + - autoconfiguration + integration @@ -118,13 +139,8 @@ test - - **/*LiveTest.java - **/*IntegrationTest.java - **/*IntTest.java - - **/AutoconfigurationTest.java + **/*IntegrationTest.java @@ -142,7 +158,7 @@ - org.baeldung.boot.Application + com.baeldung.boot.Application 2.2.4 1.2-groovy-2.4 diff --git a/spring-boot-testing/src/main/java/com/baeldung/boot/SecurityConfig.java b/spring-boot-testing/src/main/java/com/baeldung/boot/SecurityConfig.java new file mode 100644 index 0000000000..61e86d01c5 --- /dev/null +++ b/spring-boot-testing/src/main/java/com/baeldung/boot/SecurityConfig.java @@ -0,0 +1,32 @@ +//package com.baeldung.boot; +// +//import org.springframework.context.annotation.Configuration; +//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +//import org.springframework.security.config.annotation.web.builders.HttpSecurity; +//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +// +// +//@Configuration +//@EnableWebSecurity +//public class SecurityConfig extends WebSecurityConfigurerAdapter { +// +// @Override +// protected void configure(AuthenticationManagerBuilder auth) throws Exception { +// auth.inMemoryAuthentication() +// .withUser("john") +// .password("{noop}123") +// .roles("USER"); +// } +// +// @Override +// protected void configure(HttpSecurity http) throws Exception { +// http.authorizeRequests() +// .antMatchers("/hello") +// .permitAll() +// .anyRequest() +// .authenticated() +// .and() +// .httpBasic(); +// } +//} \ No newline at end of file diff --git a/spring-boot-testing/src/main/java/com/baeldung/boot/controller/rest/HomeController.java b/spring-boot-testing/src/main/java/com/baeldung/boot/controller/rest/HomeController.java new file mode 100644 index 0000000000..595c34254b --- /dev/null +++ b/spring-boot-testing/src/main/java/com/baeldung/boot/controller/rest/HomeController.java @@ -0,0 +1,14 @@ +package com.baeldung.boot.controller.rest; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HomeController { + + @GetMapping("/") + public String salutation() { + return "Welcome !"; + } + +} \ No newline at end of file diff --git a/spring-boot-testing/src/main/resources/application.properties b/spring-boot-testing/src/main/resources/application.properties new file mode 100644 index 0000000000..e378aacdd5 --- /dev/null +++ b/spring-boot-testing/src/main/resources/application.properties @@ -0,0 +1,4 @@ + +# security +spring.security.user.name=john +spring.security.user.password=123 \ No newline at end of file diff --git a/spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextTest.groovy b/spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextIntegrationTest.groovy similarity index 91% rename from spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextTest.groovy rename to spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextIntegrationTest.groovy index 85b0a4b89b..8bfc86685c 100644 --- a/spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextTest.groovy +++ b/spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextIntegrationTest.groovy @@ -10,7 +10,7 @@ import spock.lang.Title @Title("Application Specification") @Narrative("Specification which beans are expected") @SpringBootTest -class LoadContextTest extends Specification { +class LoadContextIntegrationTest extends Specification { @Autowired(required = false) private WebController webController diff --git a/spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerTest.groovy b/spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerIntegrationTest.groovy similarity index 94% rename from spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerTest.groovy rename to spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerIntegrationTest.groovy index 119992acc3..17c60376ed 100644 --- a/spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerTest.groovy +++ b/spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerIntegrationTest.groovy @@ -12,9 +12,9 @@ import spock.lang.Title @Title("WebController Specification") @Narrative("The Specification of the behaviour of the WebController. It can greet a person, change the name and reset it to 'world'") -@AutoConfigureMockMvc -@WebMvcTest -class WebControllerTest extends Specification { +@AutoConfigureMockMvc(secure=false) +@WebMvcTest() +class WebControllerIntegrationTest extends Specification { @Autowired private MockMvc mvc diff --git a/spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerTest.groovy alias b/spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerTest.groovy alias new file mode 100644 index 0000000000000000000000000000000000000000..f2fc2f48e27bcf946a76f67ec7bacd1a2c3dd394 GIT binary patch literal 217036 zcmeFa2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q=WRd@v$R(1H?K<_~!q>w?K?K z@`nh65mNt&lorJ9NB+k^9Cn1+L0o=>IY69rggHU{^au-sc;W~nK>Rm;szv~~apcbq zV(`-MgQF1uY>xb?2L5;WV<4tE3IkgK05I6^Lm0$YkJ5Pp#Ly!Q90CB>(S`p74 Date: Mon, 31 Dec 2018 16:51:27 +0200 Subject: [PATCH 095/271] exclude auto-configuration --- .../resources/application-test.properties | 3 ++ .../ExcludeAutoConfig1IntegrationTest.java | 26 ++++++++++++++++ .../ExcludeAutoConfig2IntegrationTest.java | 26 ++++++++++++++++ .../ExcludeAutoConfig3IntegrationTest.java | 27 +++++++++++++++++ .../ExcludeAutoConfig4IntegrationTest.java | 22 ++++++++++++++ .../autoconfig/exclude/TestApplication.java | 13 ++++++++ .../boot/SpringContextIntegrationTest.java | 15 ++++++++++ .../autoconfig/AutoConfigIntegrationTest.java | 30 +++++++++++++++++++ 8 files changed, 162 insertions(+) create mode 100644 spring-boot-testing/src/main/resources/application-test.properties create mode 100644 spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig1IntegrationTest.java create mode 100644 spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig2IntegrationTest.java create mode 100644 spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig3IntegrationTest.java create mode 100644 spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig4IntegrationTest.java create mode 100644 spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/TestApplication.java create mode 100644 spring-boot-testing/src/test/java/com/baeldung/boot/SpringContextIntegrationTest.java create mode 100644 spring-boot-testing/src/test/java/com/baeldung/boot/autoconfig/AutoConfigIntegrationTest.java diff --git a/spring-boot-testing/src/main/resources/application-test.properties b/spring-boot-testing/src/main/resources/application-test.properties new file mode 100644 index 0000000000..8d5e86ba26 --- /dev/null +++ b/spring-boot-testing/src/main/resources/application-test.properties @@ -0,0 +1,3 @@ + +# test properties +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration \ No newline at end of file diff --git a/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig1IntegrationTest.java b/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig1IntegrationTest.java new file mode 100644 index 0000000000..a4a29cddf3 --- /dev/null +++ b/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig1IntegrationTest.java @@ -0,0 +1,26 @@ +package com.baeldung.autoconfig.exclude; + +import static org.junit.Assert.assertEquals; +import io.restassured.RestAssured; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.http.HttpStatus; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.DEFINED_PORT) +@TestPropertySource(properties = "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration") +public class ExcludeAutoConfig1IntegrationTest { + + @Test + public void givenSecurityConfigExcluded_whenAccessHome_thenNoAuthenticationRequired() { + int statusCode = RestAssured.get("http://localhost:8080/").statusCode(); + assertEquals(HttpStatus.OK.value(), statusCode); + } +} diff --git a/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig2IntegrationTest.java b/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig2IntegrationTest.java new file mode 100644 index 0000000000..cdf79b159c --- /dev/null +++ b/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig2IntegrationTest.java @@ -0,0 +1,26 @@ +package com.baeldung.autoconfig.exclude; + +import static org.junit.Assert.assertEquals; +import io.restassured.RestAssured; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.http.HttpStatus; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.DEFINED_PORT) +@ActiveProfiles("test") +public class ExcludeAutoConfig2IntegrationTest { + + @Test + public void givenSecurityConfigExcluded_whenAccessHome_thenNoAuthenticationRequired() { + int statusCode = RestAssured.get("http://localhost:8080/").statusCode(); + assertEquals(HttpStatus.OK.value(), statusCode); + } +} diff --git a/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig3IntegrationTest.java b/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig3IntegrationTest.java new file mode 100644 index 0000000000..0e45d1e9e5 --- /dev/null +++ b/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig3IntegrationTest.java @@ -0,0 +1,27 @@ +package com.baeldung.autoconfig.exclude; + +import static org.junit.Assert.assertEquals; +import io.restassured.RestAssured; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.http.HttpStatus; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.DEFINED_PORT) +@EnableAutoConfiguration(exclude=SecurityAutoConfiguration.class) +public class ExcludeAutoConfig3IntegrationTest { + + @Test + public void givenSecurityConfigExcluded_whenAccessHome_thenNoAuthenticationRequired() { + int statusCode = RestAssured.get("http://localhost:8080/").statusCode(); + assertEquals(HttpStatus.OK.value(), statusCode); + } +} diff --git a/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig4IntegrationTest.java b/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig4IntegrationTest.java new file mode 100644 index 0000000000..8429aed6cd --- /dev/null +++ b/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/ExcludeAutoConfig4IntegrationTest.java @@ -0,0 +1,22 @@ +package com.baeldung.autoconfig.exclude; + +import static org.junit.Assert.assertEquals; +import io.restassured.RestAssured; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.http.HttpStatus; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = WebEnvironment.DEFINED_PORT) +public class ExcludeAutoConfig4IntegrationTest { + + @Test + public void givenSecurityConfigExcluded_whenAccessHome_thenNoAuthenticationRequired() { + int statusCode = RestAssured.get("http://localhost:8080/").statusCode(); + assertEquals(HttpStatus.OK.value(), statusCode); + } +} diff --git a/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/TestApplication.java b/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/TestApplication.java new file mode 100644 index 0000000000..7c162f85ab --- /dev/null +++ b/spring-boot-testing/src/test/java/com/baeldung/autoconfig/exclude/TestApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.autoconfig.exclude; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; + +@SpringBootApplication(scanBasePackages="com.baeldung.boot", exclude=SecurityAutoConfiguration.class) +public class TestApplication { + + public static void main(String[] args) { + SpringApplication.run(TestApplication.class, args); + } +} diff --git a/spring-boot-testing/src/test/java/com/baeldung/boot/SpringContextIntegrationTest.java b/spring-boot-testing/src/test/java/com/baeldung/boot/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..63ab07fdb7 --- /dev/null +++ b/spring-boot-testing/src/test/java/com/baeldung/boot/SpringContextIntegrationTest.java @@ -0,0 +1,15 @@ +package com.baeldung.boot; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-testing/src/test/java/com/baeldung/boot/autoconfig/AutoConfigIntegrationTest.java b/spring-boot-testing/src/test/java/com/baeldung/boot/autoconfig/AutoConfigIntegrationTest.java new file mode 100644 index 0000000000..fe71f44ddf --- /dev/null +++ b/spring-boot-testing/src/test/java/com/baeldung/boot/autoconfig/AutoConfigIntegrationTest.java @@ -0,0 +1,30 @@ +package com.baeldung.boot.autoconfig; + +import static org.junit.Assert.assertEquals; +import io.restassured.RestAssured; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.http.HttpStatus; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.DEFINED_PORT) +public class AutoConfigIntegrationTest { + + @Test + public void givenNoAuthentication_whenAccessHome_thenUnauthorized() { + int statusCode = RestAssured.get("http://localhost:8080/").statusCode(); + assertEquals(HttpStatus.UNAUTHORIZED.value(), statusCode); + } + + @Test + public void givenAuthentication_whenAccessHome_thenOK() { + int statusCode = RestAssured.given().auth().basic("john", "123").get("http://localhost:8080/").statusCode(); + assertEquals(HttpStatus.OK.value(), statusCode); + } +} From 1ed8fcf9dcbed1aa5424715c0207bbeaf669773a Mon Sep 17 00:00:00 2001 From: Urvy Agrawal Date: Tue, 1 Jan 2019 02:56:19 +0530 Subject: [PATCH 096/271] BAEL-2323 Java Native Keyword (#6038) -Moved files to core-java-lang module --- .../native/nativedatetimeutils.dll | Bin .../com/baeldung/nativekeyword/DateTimeUtils.java | 0 .../com/baeldung/nativekeyword/NativeMainApp.java | 0 .../nativekeyword/DateTimeUtilsManualTest.java | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {core-java => core-java-lang}/native/nativedatetimeutils.dll (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/nativekeyword/DateTimeUtils.java (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/nativekeyword/NativeMainApp.java (100%) rename {core-java => core-java-lang}/src/test/java/com/baeldung/nativekeyword/DateTimeUtilsManualTest.java (100%) diff --git a/core-java/native/nativedatetimeutils.dll b/core-java-lang/native/nativedatetimeutils.dll similarity index 100% rename from core-java/native/nativedatetimeutils.dll rename to core-java-lang/native/nativedatetimeutils.dll diff --git a/core-java/src/main/java/com/baeldung/nativekeyword/DateTimeUtils.java b/core-java-lang/src/main/java/com/baeldung/nativekeyword/DateTimeUtils.java similarity index 100% rename from core-java/src/main/java/com/baeldung/nativekeyword/DateTimeUtils.java rename to core-java-lang/src/main/java/com/baeldung/nativekeyword/DateTimeUtils.java diff --git a/core-java/src/main/java/com/baeldung/nativekeyword/NativeMainApp.java b/core-java-lang/src/main/java/com/baeldung/nativekeyword/NativeMainApp.java similarity index 100% rename from core-java/src/main/java/com/baeldung/nativekeyword/NativeMainApp.java rename to core-java-lang/src/main/java/com/baeldung/nativekeyword/NativeMainApp.java diff --git a/core-java/src/test/java/com/baeldung/nativekeyword/DateTimeUtilsManualTest.java b/core-java-lang/src/test/java/com/baeldung/nativekeyword/DateTimeUtilsManualTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/nativekeyword/DateTimeUtilsManualTest.java rename to core-java-lang/src/test/java/com/baeldung/nativekeyword/DateTimeUtilsManualTest.java From c39fe1c85ca175a028521f8bf77ef9a906e24a6f Mon Sep 17 00:00:00 2001 From: Markus Gulden <> Date: Tue, 1 Jan 2019 15:40:15 +0100 Subject: [PATCH 097/271] BAEL-2321 --- .../04_Custom/connect-distributed.properties | 88 ----------------- .../04_Custom/connect-mongodb-sink.json | 30 +++--- .../04_Custom/connect-mqtt-source.json | 8 +- .../04_Custom/docker-compose.yaml | 94 +++++++++++++++++++ 4 files changed, 110 insertions(+), 110 deletions(-) delete mode 100644 libraries-data/src/main/kafka-connect/04_Custom/connect-distributed.properties create mode 100644 libraries-data/src/main/kafka-connect/04_Custom/docker-compose.yaml diff --git a/libraries-data/src/main/kafka-connect/04_Custom/connect-distributed.properties b/libraries-data/src/main/kafka-connect/04_Custom/connect-distributed.properties deleted file mode 100644 index 5b91baddbd..0000000000 --- a/libraries-data/src/main/kafka-connect/04_Custom/connect-distributed.properties +++ /dev/null @@ -1,88 +0,0 @@ -## -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -## - -# This file contains some of the configurations for the Kafka Connect distributed worker. This file is intended -# to be used with the examples, and some settings may differ from those used in a production system, especially -# the `bootstrap.servers` and those specifying replication factors. - -# A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. -bootstrap.servers=localhost:9092 - -# unique name for the cluster, used in forming the Connect cluster group. Note that this must not conflict with consumer group IDs -group.id=connect-cluster - -# The converters specify the format of data in Kafka and how to translate it into Connect data. Every Connect user will -# need to configure these based on the format they want their data in when loaded from or stored into Kafka -key.converter=org.apache.kafka.connect.json.JsonConverter -value.converter=org.apache.kafka.connect.json.JsonConverter -# Converter-specific settings can be passed in by prefixing the Converter's setting with the converter we want to apply -# it to -key.converter.schemas.enable=true -value.converter.schemas.enable=true - -# Topic to use for storing offsets. This topic should have many partitions and be replicated and compacted. -# Kafka Connect will attempt to create the topic automatically when needed, but you can always manually create -# the topic before starting Kafka Connect if a specific topic configuration is needed. -# Most users will want to use the built-in default replication factor of 3 or in some cases even specify a larger value. -# Since this means there must be at least as many brokers as the maximum replication factor used, we'd like to be able -# to run this example on a single-broker cluster and so here we instead set the replication factor to 1. -offset.storage.topic=connect-offsets -offset.storage.replication.factor=1 -#offset.storage.partitions=25 - -# Topic to use for storing connector and task configurations; note that this should be a single partition, highly replicated, -# and compacted topic. Kafka Connect will attempt to create the topic automatically when needed, but you can always manually create -# the topic before starting Kafka Connect if a specific topic configuration is needed. -# Most users will want to use the built-in default replication factor of 3 or in some cases even specify a larger value. -# Since this means there must be at least as many brokers as the maximum replication factor used, we'd like to be able -# to run this example on a single-broker cluster and so here we instead set the replication factor to 1. -config.storage.topic=connect-configs -config.storage.replication.factor=1 - -# Topic to use for storing statuses. This topic can have multiple partitions and should be replicated and compacted. -# Kafka Connect will attempt to create the topic automatically when needed, but you can always manually create -# the topic before starting Kafka Connect if a specific topic configuration is needed. -# Most users will want to use the built-in default replication factor of 3 or in some cases even specify a larger value. -# Since this means there must be at least as many brokers as the maximum replication factor used, we'd like to be able -# to run this example on a single-broker cluster and so here we instead set the replication factor to 1. -status.storage.topic=connect-status -status.storage.replication.factor=1 -#status.storage.partitions=5 - -# Flush much faster than normal, which is useful for testing/debugging -offset.flush.interval.ms=10000 - -# These are provided to inform the user about the presence of the REST host and port configs -# Hostname & Port for the REST API to listen on. If this is set, it will bind to the interface used to listen to requests. -#rest.host.name= -#rest.port=8083 - -# The Hostname & Port that will be given out to other workers to connect to i.e. URLs that are routable from other servers. -#rest.advertised.host.name= -#rest.advertised.port= - -# Set to a list of filesystem paths separated by commas (,) to enable class loading isolation for plugins -# (connectors, converters, transformations). The list should consist of top level directories that include -# any combination of: -# a) directories immediately containing jars with plugins and their dependencies -# b) uber-jars with plugins and their dependencies -# c) directories immediately containing the package directory structure of classes of plugins and their dependencies -# Examples: -# plugin.path=/usr/local/share/java,/usr/local/share/kafka/plugins,/opt/connectors, -# Replace the relative path below with an absolute path if you are planning to start Kafka Connect from within a -# directory other than the home directory of Confluent Platform. -plugin.path=./share/java diff --git a/libraries-data/src/main/kafka-connect/04_Custom/connect-mongodb-sink.json b/libraries-data/src/main/kafka-connect/04_Custom/connect-mongodb-sink.json index 333768e4b7..852f400fc6 100644 --- a/libraries-data/src/main/kafka-connect/04_Custom/connect-mongodb-sink.json +++ b/libraries-data/src/main/kafka-connect/04_Custom/connect-mongodb-sink.json @@ -1,22 +1,14 @@ { - "firstName": "John", - "lastName": "Smith", - "age": 25, - "address": { - "streetAddress": "21 2nd Street", - "city": "New York", - "state": "NY", - "postalCode": "10021" - }, - "phoneNumber": [{ - "type": "home", - "number": "212 555-1234" - }, { - "type": "fax", - "number": "646 555-4567" - } - ], - "gender": { - "type": "male" + "name": "mongodb-sink", + "config": { + "connector.class": "at.grahsl.kafka.connect.mongodb.MongoDbSinkConnector", + "tasks.max": 1, + "topics": "connect-custom", + "mongodb.connection.uri": "mongodb://mongo-db/test?retryWrites=true", + "mongodb.collection": "MyCollection", + "key.converter": "org.apache.kafka.connect.json.JsonConverter", + "key.converter.schemas.enable": false, + "value.converter": "org.apache.kafka.connect.json.JsonConverter", + "value.converter.schemas.enable": false } } diff --git a/libraries-data/src/main/kafka-connect/04_Custom/connect-mqtt-source.json b/libraries-data/src/main/kafka-connect/04_Custom/connect-mqtt-source.json index 02d87c5ad7..c76d326c0a 100644 --- a/libraries-data/src/main/kafka-connect/04_Custom/connect-mqtt-source.json +++ b/libraries-data/src/main/kafka-connect/04_Custom/connect-mqtt-source.json @@ -3,9 +3,11 @@ "config": { "connector.class": "io.confluent.connect.mqtt.MqttSourceConnector", "tasks.max": 1, - "mqtt.server.uri": "ws://broker.hivemq.com:8000/mqtt", + "mqtt.server.uri": "tcp://mosquitto:1883", "mqtt.topics": "baeldung", "kafka.topic": "connect-custom", - "value.converter": "org.apache.kafka.connect.converters.ByteArrayConverter" + "value.converter": "org.apache.kafka.connect.converters.ByteArrayConverter", + "confluent.topic.bootstrap.servers": "kafka:9092", + "confluent.topic.replication.factor": 1 } -} +} \ No newline at end of file diff --git a/libraries-data/src/main/kafka-connect/04_Custom/docker-compose.yaml b/libraries-data/src/main/kafka-connect/04_Custom/docker-compose.yaml new file mode 100644 index 0000000000..26cd653335 --- /dev/null +++ b/libraries-data/src/main/kafka-connect/04_Custom/docker-compose.yaml @@ -0,0 +1,94 @@ +version: '3.3' + +services: + mosquitto: + image: eclipse-mosquitto:1.5.5 + hostname: mosquitto + container_name: mosquitto + expose: + - "1883" + ports: + - "1883:1883" + zookeeper: + image: zookeeper:3.4.9 + restart: unless-stopped + hostname: zookeeper + container_name: zookeeper + ports: + - "2181:2181" + environment: + ZOO_MY_ID: 1 + ZOO_PORT: 2181 + ZOO_SERVERS: server.1=zookeeper:2888:3888 + volumes: + - ./zookeeper/data:/data + - ./zookeeper/datalog:/datalog + kafka: + image: confluentinc/cp-kafka:5.1.0 + hostname: kafka + container_name: kafka + ports: + - "9092:9092" + environment: + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092 + KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181" + KAFKA_BROKER_ID: 1 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + volumes: + - ./kafka/data:/var/lib/kafka/data + depends_on: + - zookeeper + kafka-connect: + image: confluentinc/cp-kafka-connect:5.1.0 + hostname: kafka-connect + container_name: kafka-connect + ports: + - "8083:8083" + environment: + CONNECT_BOOTSTRAP_SERVERS: "kafka:9092" + CONNECT_REST_ADVERTISED_HOST_NAME: connect + CONNECT_REST_PORT: 8083 + CONNECT_GROUP_ID: compose-connect-group + CONNECT_CONFIG_STORAGE_TOPIC: docker-connect-configs + CONNECT_OFFSET_STORAGE_TOPIC: docker-connect-offsets + CONNECT_STATUS_STORAGE_TOPIC: docker-connect-status + CONNECT_KEY_CONVERTER: org.apache.kafka.connect.json.JsonConverter + CONNECT_VALUE_CONVERTER: org.apache.kafka.connect.json.JsonConverter + CONNECT_INTERNAL_KEY_CONVERTER: "org.apache.kafka.connect.json.JsonConverter" + CONNECT_INTERNAL_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter" + CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: "1" + CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: "1" + CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: "1" + CONNECT_PLUGIN_PATH: '/usr/share/java,/etc/kafka-connect/jars' + CONNECT_CONFLUENT_TOPIC_REPLICATION_FACTOR: 1 + volumes: + - /tmp/custom/jars:/etc/kafka-connect/jars + depends_on: + - zookeeper + - kafka + - mosquitto + mongo-db: + image: mongo:4.0.5 + hostname: mongo-db + container_name: mongo-db + expose: + - "27017" + ports: + - "27017:27017" + command: --bind_ip_all --smallfiles + volumes: + - ./mongo-db:/data + mongoclient: + image: mongoclient/mongoclient:2.2.0 + container_name: mongoclient + hostname: mongoclient + depends_on: + - mongo-db + ports: + - 3000:3000 + environment: + MONGO_URL: "mongodb://mongo-db:27017" + PORT: 3000 + expose: + - "3000" \ No newline at end of file From c560a37b70907834f90d73eca63c612e27cd1826 Mon Sep 17 00:00:00 2001 From: Loredana Date: Tue, 1 Jan 2019 22:44:53 +0200 Subject: [PATCH 098/271] add start class --- spring-boot-security/pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-boot-security/pom.xml b/spring-boot-security/pom.xml index d5c7976ba2..b87189757a 100644 --- a/spring-boot-security/pom.xml +++ b/spring-boot-security/pom.xml @@ -66,4 +66,8 @@ + + com.baeldung.springbootsecurity.basic_auth.SpringBootSecurityApplication + + From 0d5483e1bf74b0d00aa314d7f8a84f5feb710e81 Mon Sep 17 00:00:00 2001 From: rahusriv Date: Wed, 2 Jan 2019 08:26:43 +0530 Subject: [PATCH 099/271] Rahul/multidimensional/pr3 (#6040) * Making examples simple * Changing variable names * Modificatons in naming * Giving extra spaces --- .../ArrayListOfArrayList.java | 21 ++++++++++--------- .../ThreeDimensionalArrayList.java | 10 ++++----- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java b/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java index 2c3da7b1fc..e11f8e8ba0 100644 --- a/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java +++ b/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java @@ -6,11 +6,11 @@ public class ArrayListOfArrayList { public static void main(String args[]) { - int numVertices = 3; - ArrayList> graph = new ArrayList<>(numVertices); + int vertexCount = 3; + ArrayList> graph = new ArrayList<>(vertexCount); //Initializing each element of ArrayList with ArrayList - for(int i=0; i< numVertices; i++) { + for(int i = 0; i< vertexCount; i++) { graph.add(new ArrayList()); } @@ -21,13 +21,14 @@ public class ArrayListOfArrayList { graph.get(1).add(0); graph.get(2).add(1); graph.get(0).add(2); - - //Printing all the edges - for(int vertexNo=0; vertexNo listOfVertices = graph.get(vertexNo); - for(int i=0; i > > space = new ArrayList<>(x_axis_length); //Initializing each element of ArrayList with ArrayList< ArrayList > - for(int i=0; i< x_axis_length; i++) { + for(int i = 0; i < x_axis_length; i++) { space.add(new ArrayList< ArrayList >(y_axis_length)); - for(int j =0; j< y_axis_length; j++) { + for(int j = 0; j < y_axis_length; j++) { space.get(i).add(new ArrayList(z_axis_length)); } } @@ -33,9 +33,9 @@ public class ThreeDimensionalArrayList { space.get(1).get(1).add(1,"Yellow"); //Printing colors for all the points - for(int i=0; i Date: Wed, 2 Jan 2019 13:36:50 +0200 Subject: [PATCH 100/271] Update README.md --- core-java/README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/core-java/README.md b/core-java/README.md index 3c5d1941d6..03b77186b0 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -22,7 +22,6 @@ - [Difference between URL and URI](http://www.baeldung.com/java-url-vs-uri) - [Creating a Java Compiler Plugin](http://www.baeldung.com/java-build-compiler-plugin) - [Quick Guide to Java Stack](http://www.baeldung.com/java-stack) -- [Guide to java.util.Formatter](http://www.baeldung.com/java-string-formatter) - [Compiling Java *.class Files with javac](http://www.baeldung.com/javac) - [Introduction to Javadoc](http://www.baeldung.com/javadoc) - [Guide to the Externalizable Interface in Java](http://www.baeldung.com/java-externalizable) @@ -40,13 +39,7 @@ - [Common Java Exceptions](http://www.baeldung.com/java-common-exceptions) - [Throw Exception in Optional in Java 8](https://www.baeldung.com/java-optional-throw-exception) - [Merging java.util.Properties Objects](https://www.baeldung.com/java-merging-properties) -- [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) -- [Calculating the nth Root in Java](https://www.baeldung.com/java-nth-root) -- [Convert Double to String, Removing Decimal Places](https://www.baeldung.com/java-double-to-string) -- [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset) - [Merging java.util.Properties Objects](https://www.baeldung.com/java-merging-properties) -- [A Guide to SimpleDateFormat](https://www.baeldung.com/java-simple-date-format) -- [Changing the Order in a Sum Operation Can Produce Different Results?](https://www.baeldung.com/java-floating-point-sum-order) - [Java – Try with Resources](https://www.baeldung.com/java-try-with-resources) - [Abstract Classes in Java](https://www.baeldung.com/java-abstract-class) - [Guide to Character Encoding](https://www.baeldung.com/java-char-encoding) From e464591902afaa61de6035486a8240a87e046b38 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 2 Jan 2019 14:39:01 +0200 Subject: [PATCH 101/271] Update README.md --- core-java-collections/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index 71d4e6b614..1a90d01a82 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -29,4 +29,4 @@ - [Sorting in Java](http://www.baeldung.com/java-sorting) - [Join and Split Arrays and Collections in Java](http://www.baeldung.com/java-join-and-split) - [A Guide to EnumMap](https://www.baeldung.com/java-enum-map) -- [A Guide to Iterator in Java](http://www.baeldung.com/java-iterator) \ No newline at end of file +- [A Guide to Iterator in Java](http://www.baeldung.com/java-iterator) From 1db24b5c06076b85d4a2c3ab4b3caddd74df8154 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 2 Jan 2019 15:45:28 +0200 Subject: [PATCH 102/271] Update README.md --- core-java-8/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core-java-8/README.md b/core-java-8/README.md index e5fa953cc7..f9af585ab3 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -33,3 +33,7 @@ - [Java Primitives versus Objects](https://www.baeldung.com/java-primitives-vs-objects) - [How to Use if/else Logic in Java 8 Streams](https://www.baeldung.com/java-8-streams-if-else-logic) - [How to Replace Many if Statements in Java](https://www.baeldung.com/java-replace-if-statements) +- [Java @Override Annotation](https://www.baeldung.com/java-override) +- [Java @SuppressWarnings Annotation](https://www.baeldung.com/java-suppresswarnings) +- [Java @SafeVarargs Annotation](https://www.baeldung.com/java-safevarargs) +- [Java @Deprecated Annotation](https://www.baeldung.com/java-deprecated) From 66016332f82446179aaae1ed5bd41c15b26773c0 Mon Sep 17 00:00:00 2001 From: Mikhail Chugunov Date: Wed, 2 Jan 2019 19:09:00 +0300 Subject: [PATCH 103/271] BAEL-2475: Add sample code and tests --- .../immutable/MaritalAwarePerson.java | 58 +++++++++++++++++++ .../deserialization/immutable/Person.java | 24 ++++++++ ...mmutableObjectDeserializationUnitTest.java | 40 +++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/MaritalAwarePerson.java create mode 100644 jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java create mode 100644 jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/MaritalAwarePerson.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/MaritalAwarePerson.java new file mode 100644 index 0000000000..cb593b3bb7 --- /dev/null +++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/MaritalAwarePerson.java @@ -0,0 +1,58 @@ +package com.baeldung.jackson.deserialization.immutable; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; + +@JsonDeserialize(builder = MaritalAwarePerson.Builder.class) +public class MaritalAwarePerson { + + private final String name; + private final int age; + private final Boolean married; + + private MaritalAwarePerson(String name, int age, Boolean married) { + this.name = name; + this.age = age; + this.married = married; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } + + public Boolean getMarried() { + return married; + } + + @JsonPOJOBuilder + static class Builder { + String name; + int age; + Boolean married; + + Builder withName(String name) { + this.name = name; + return this; + } + + Builder withAge(int age) { + this.age = age; + return this; + } + + Builder withMarried(boolean married) { + this.married = married; + return this; + } + + public MaritalAwarePerson build() { + return new MaritalAwarePerson(name, age, married); + } + + + } +} diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java new file mode 100644 index 0000000000..0214f93ca9 --- /dev/null +++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java @@ -0,0 +1,24 @@ +package com.baeldung.jackson.deserialization.immutable; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Person { + + private final String name; + private final int age; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + public Person(@JsonProperty("name") String name, @JsonProperty("age") int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } +} diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java new file mode 100644 index 0000000000..348ece4a09 --- /dev/null +++ b/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java @@ -0,0 +1,40 @@ +package com.baeldung.jackson.deserialization.immutable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.Test; + +import java.io.IOException; + +import static org.junit.Assert.*; + +public class ImmutableObjectDeserializationUnitTest { + + @Test + public void testPublicConstructor() throws IOException { + final String json = "{\"name\":\"Frank\",\"age\":50}"; + Person person = new ObjectMapper().readValue(json, Person.class); + + assertEquals("Frank", person.getName()); + assertEquals(50, person.getAge()); + } + + @Test + public void testBuilderNullField() throws IOException { + final String json = "{\"name\":\"Frank\",\"age\":50}"; + MaritalAwarePerson person = new ObjectMapper().readValue(json, MaritalAwarePerson.class); + + assertEquals("Frank", person.getName()); + assertEquals(50, person.getAge()); + assertNull(person.getMarried()); + } + + @Test + public void testBuilderAllFields() throws IOException { + final String json = "{\"name\":\"Frank\",\"age\":50,\"married\":true}"; + MaritalAwarePerson person = new ObjectMapper().readValue(json, MaritalAwarePerson.class); + + assertEquals("Frank", person.getName()); + assertEquals(50, person.getAge()); + assertTrue(person.getMarried()); + } +} From 2e436ce3e8e31c6791257f624b9661b4ba3368b3 Mon Sep 17 00:00:00 2001 From: Mikhail Chugunov Date: Wed, 2 Jan 2019 19:14:09 +0300 Subject: [PATCH 104/271] BAEL-2475: Rename tests --- .../immutable/ImmutableObjectDeserializationUnitTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java index 348ece4a09..5c33a2da26 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java @@ -10,7 +10,7 @@ import static org.junit.Assert.*; public class ImmutableObjectDeserializationUnitTest { @Test - public void testPublicConstructor() throws IOException { + public void whenPublicConstructorIsUsed_thenObjectIsDeserialized() throws IOException { final String json = "{\"name\":\"Frank\",\"age\":50}"; Person person = new ObjectMapper().readValue(json, Person.class); @@ -19,7 +19,7 @@ public class ImmutableObjectDeserializationUnitTest { } @Test - public void testBuilderNullField() throws IOException { + public void whenBuilderIsUsedAndFieldIsNull_thenObjectIsDeserialized() throws IOException { final String json = "{\"name\":\"Frank\",\"age\":50}"; MaritalAwarePerson person = new ObjectMapper().readValue(json, MaritalAwarePerson.class); @@ -29,7 +29,7 @@ public class ImmutableObjectDeserializationUnitTest { } @Test - public void testBuilderAllFields() throws IOException { + public void whenBuilderIsUsedAndAllFieldsPresent_thenObjectIsDeserialized() throws IOException { final String json = "{\"name\":\"Frank\",\"age\":50,\"married\":true}"; MaritalAwarePerson person = new ObjectMapper().readValue(json, MaritalAwarePerson.class); From 75bf7ba5155da5fd1b8240080e35c4f0adb8781f Mon Sep 17 00:00:00 2001 From: Varun Jain Date: Wed, 2 Jan 2019 22:11:21 +0530 Subject: [PATCH 105/271] BAEL-2536-check-for-a-panagram-string --- .../java/com/baeldung/string/Panagram.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 java-strings/src/main/java/com/baeldung/string/Panagram.java diff --git a/java-strings/src/main/java/com/baeldung/string/Panagram.java b/java-strings/src/main/java/com/baeldung/string/Panagram.java new file mode 100644 index 0000000000..d000b4455e --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/Panagram.java @@ -0,0 +1,60 @@ +package com.baeldung.string; + +import java.util.Arrays; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class Panagram { + + public static boolean isPanagram(String str) { + if (str == null) + return false; + Boolean[] alphabetMarker = new Boolean[26]; + Arrays.fill(alphabetMarker, false); + int alphabetIndex = 0; + str = str.toUpperCase(); + for (int i = 0; i < str.length(); i++) { + if ('A' <= str.charAt(i) && str.charAt(i) <= 'Z') { + alphabetIndex = str.charAt(i) - 'A'; + alphabetMarker[alphabetIndex] = true; + } + } + for (boolean index : alphabetMarker) { + if (!index) + return false; + } + return true; + } + + public static boolean isPanagramWithStreams(String str) { + if (str == null) + return false; + + // filtered character stream + str = str.toUpperCase(); + Stream filteredCharStream = str.chars() + .filter(item -> ((item >= 'A' && item <= 'Z') || (item >= 'a' && item <= 'z'))) + .mapToObj(c -> (char) c); + Map alphabetMap = filteredCharStream.collect(Collectors.toMap(item -> item, k -> Boolean.TRUE, (p1, p2) -> p1)); + + return (alphabetMap.size() == 26); + } + + public static boolean isPerfectPanagram(String str) { + if (str == null) + return false; + + // filtered character stream + str = str.toUpperCase(); + Stream filteredCharStream = str.chars() + .filter(item -> ((item >= 'A' && item <= 'Z') || (item >= 'a' && item <= 'z'))) + .mapToObj(c -> (char) c); + Map alphabetFrequencyMap = filteredCharStream.collect(Collectors.groupingBy(Function.identity(), Collectors.counting())); + + return (alphabetFrequencyMap.size() == 26 && alphabetFrequencyMap.values() + .stream() + .allMatch(item -> item == 1)); + } +} From 725076b8ee4593c3dbccd6b5006edc657e0c0bbb Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Wed, 2 Jan 2019 22:18:53 +0400 Subject: [PATCH 106/271] performance tests tune up --- .../com/baeldung/performance/ArrayListBenchmark.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java b/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java index 1eeb17df87..331ae8d908 100644 --- a/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java +++ b/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java @@ -9,7 +9,7 @@ import java.util.*; import java.util.concurrent.TimeUnit; @BenchmarkMode(Mode.AverageTime) -@OutputTimeUnit(TimeUnit.MICROSECONDS) +@OutputTimeUnit(TimeUnit.NANOSECONDS) @Warmup(iterations = 10) public class ArrayListBenchmark { @@ -63,6 +63,7 @@ public class ArrayListBenchmark { public Employee testGet(ArrayListBenchmark.MyState state) { return state.employeeList.get(state.employeeIndex); } + @Benchmark public Employee testVectorGet(ArrayListBenchmark.MyState state) { return state.employeeVector.get(state.employeeIndex); @@ -78,14 +79,9 @@ public class ArrayListBenchmark { state.employeeList.add(new Employee(state.iterations + 1, "John")); } - @Benchmark - public void testAddVector(ArrayListBenchmark.MyState state) { - state.employeeVector.add(new Employee(state.iterations + 1, "John")); - } - public static void main(String[] args) throws Exception { Options options = new OptionsBuilder() - .include(ArrayListBenchmark.class.getSimpleName()).threads(1) + .include(ArrayListBenchmark.class.getSimpleName()).threads(3) .forks(1).shouldFailOnError(true) .shouldDoGC(true) .jvmArgs("-server").build(); From 9a8e006d73870b24c3116575ad56b97b319ab8ee Mon Sep 17 00:00:00 2001 From: Loredana Date: Wed, 2 Jan 2019 21:58:02 +0200 Subject: [PATCH 107/271] fix abstract factory ex --- .../creational/abstractfactory/AbstractFactory.java | 5 ++--- .../abstractfactory/AbstractPatternDriver.java | 4 ++-- .../creational/abstractfactory/AnimalFactory.java | 9 ++------- .../creational/abstractfactory/ColorFactory.java | 9 ++------- .../abstractfactory/AbstractPatternIntegrationTest.java | 4 ++-- 5 files changed, 10 insertions(+), 21 deletions(-) diff --git a/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/AbstractFactory.java b/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/AbstractFactory.java index 5b4bf08006..88e819c066 100644 --- a/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/AbstractFactory.java +++ b/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/AbstractFactory.java @@ -1,6 +1,5 @@ package com.baeldung.creational.abstractfactory; -public interface AbstractFactory { - Animal getAnimal(String toyType) ; - Color getColor(String colorType); +public interface AbstractFactory { + T create(String type) ; } \ No newline at end of file diff --git a/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/AbstractPatternDriver.java b/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/AbstractPatternDriver.java index 68759d5aff..c1501091c5 100644 --- a/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/AbstractPatternDriver.java +++ b/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/AbstractPatternDriver.java @@ -6,10 +6,10 @@ public class AbstractPatternDriver { //creating a brown toy dog abstractFactory = FactoryProvider.getFactory("Toy"); - Animal toy = abstractFactory.getAnimal("Dog"); + Animal toy =(Animal) abstractFactory.create("Dog"); abstractFactory = FactoryProvider.getFactory("Color"); - Color color = abstractFactory.getColor("Brown"); + Color color =(Color) abstractFactory.create("Brown"); String result = "A " + toy.getType() + " with " + color.getColor() + " color " + toy.makeSound(); diff --git a/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/AnimalFactory.java b/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/AnimalFactory.java index bbc3eb7a82..4b46261571 100644 --- a/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/AnimalFactory.java +++ b/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/AnimalFactory.java @@ -1,9 +1,9 @@ package com.baeldung.creational.abstractfactory; -public class AnimalFactory implements AbstractFactory { +public class AnimalFactory implements AbstractFactory { @Override - public Animal getAnimal(String animalType) { + public Animal create(String animalType) { if ("Dog".equalsIgnoreCase(animalType)) { return new Dog(); } else if ("Duck".equalsIgnoreCase(animalType)) { @@ -13,9 +13,4 @@ public class AnimalFactory implements AbstractFactory { return null; } - @Override - public Color getColor(String color) { - throw new UnsupportedOperationException(); - } - } diff --git a/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/ColorFactory.java b/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/ColorFactory.java index 8b7e4f8086..3d9c5c18a3 100644 --- a/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/ColorFactory.java +++ b/patterns/design-patterns/src/main/java/com/baeldung/creational/abstractfactory/ColorFactory.java @@ -1,9 +1,9 @@ package com.baeldung.creational.abstractfactory; -public class ColorFactory implements AbstractFactory { +public class ColorFactory implements AbstractFactory { @Override - public Color getColor(String colorType) { + public Color create(String colorType) { if ("Brown".equalsIgnoreCase(colorType)) { return new Brown(); } else if ("White".equalsIgnoreCase(colorType)) { @@ -13,9 +13,4 @@ public class ColorFactory implements AbstractFactory { return null; } - @Override - public Animal getAnimal(String toyType) { - throw new UnsupportedOperationException(); - } - } diff --git a/patterns/design-patterns/src/test/java/com/baeldung/creational/abstractfactory/AbstractPatternIntegrationTest.java b/patterns/design-patterns/src/test/java/com/baeldung/creational/abstractfactory/AbstractPatternIntegrationTest.java index 6d1a4ad8fd..4f02249a4b 100644 --- a/patterns/design-patterns/src/test/java/com/baeldung/creational/abstractfactory/AbstractPatternIntegrationTest.java +++ b/patterns/design-patterns/src/test/java/com/baeldung/creational/abstractfactory/AbstractPatternIntegrationTest.java @@ -11,10 +11,10 @@ public class AbstractPatternIntegrationTest { //creating a brown toy dog abstractFactory = FactoryProvider.getFactory("Toy"); - Animal toy = abstractFactory.getAnimal("Dog"); + Animal toy = (Animal) abstractFactory.create("Dog"); abstractFactory = FactoryProvider.getFactory("Color"); - Color color = abstractFactory.getColor("Brown"); + Color color =(Color) abstractFactory.create("Brown"); String result = "A " + toy.getType() + " with " + color.getColor() + " color " + toy.makeSound(); assertEquals("A Dog with brown color Barks", result); From e0a063a932aead8d7b664eed674672b5bea4387f Mon Sep 17 00:00:00 2001 From: DOHA Date: Wed, 2 Jan 2019 22:25:14 +0200 Subject: [PATCH 108/271] remove unused SecurityConfig --- .../com/baeldung/boot/SecurityConfig.java | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 spring-boot-testing/src/main/java/com/baeldung/boot/SecurityConfig.java diff --git a/spring-boot-testing/src/main/java/com/baeldung/boot/SecurityConfig.java b/spring-boot-testing/src/main/java/com/baeldung/boot/SecurityConfig.java deleted file mode 100644 index 61e86d01c5..0000000000 --- a/spring-boot-testing/src/main/java/com/baeldung/boot/SecurityConfig.java +++ /dev/null @@ -1,32 +0,0 @@ -//package com.baeldung.boot; -// -//import org.springframework.context.annotation.Configuration; -//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -//import org.springframework.security.config.annotation.web.builders.HttpSecurity; -//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -// -// -//@Configuration -//@EnableWebSecurity -//public class SecurityConfig extends WebSecurityConfigurerAdapter { -// -// @Override -// protected void configure(AuthenticationManagerBuilder auth) throws Exception { -// auth.inMemoryAuthentication() -// .withUser("john") -// .password("{noop}123") -// .roles("USER"); -// } -// -// @Override -// protected void configure(HttpSecurity http) throws Exception { -// http.authorizeRequests() -// .antMatchers("/hello") -// .permitAll() -// .anyRequest() -// .authenticated() -// .and() -// .httpBasic(); -// } -//} \ No newline at end of file From 23de38295f0efe7c3f7767b4cee3ce92bd3ce43b Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 2 Jan 2019 22:49:58 +0200 Subject: [PATCH 109/271] Update README.md --- core-java-8/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-8/README.md b/core-java-8/README.md index f9af585ab3..892dc71f76 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -37,3 +37,4 @@ - [Java @SuppressWarnings Annotation](https://www.baeldung.com/java-suppresswarnings) - [Java @SafeVarargs Annotation](https://www.baeldung.com/java-safevarargs) - [Java @Deprecated Annotation](https://www.baeldung.com/java-deprecated) +- [Java 8 Predicate Chain](https://www.baeldung.com/java-predicate-chain) From f912eaf5d98c8d51f444b9cca4ecd9523f89bf94 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 2 Jan 2019 22:50:52 +0200 Subject: [PATCH 110/271] Update README.md --- core-java-lang/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-lang/README.md b/core-java-lang/README.md index 52dfe708a3..f7aa47008d 100644 --- a/core-java-lang/README.md +++ b/core-java-lang/README.md @@ -33,3 +33,4 @@ - [How to Separate Double into Integer and Decimal Parts](https://www.baeldung.com/java-separate-double-into-integer-decimal-parts) - [“Sneaky Throws” in Java](http://www.baeldung.com/java-sneaky-throws) - [Retrieving a Class Name in Java](https://www.baeldung.com/java-class-name) +- [Guide to Java Packages](https://www.baeldung.com/java-packages) From 53b0c016fff0863cc47342edb2c1892ef89bb9bf Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 2 Jan 2019 22:53:09 +0200 Subject: [PATCH 111/271] Update README.md --- persistence-modules/hibernate5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index 2b948a683a..e973907248 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -23,3 +23,4 @@ - [Difference Between @JoinColumn and mappedBy](https://www.baeldung.com/jpa-joincolumn-vs-mappedby) - [Hibernate 5 Bootstrapping API](https://www.baeldung.com/hibernate-5-bootstrapping-api) - [Criteria Queries Using JPA Metamodel](https://www.baeldung.com/hibernate-criteria-queries-metamodel) +- [Guide to the Hibernate EntityManager](https://www.baeldung.com/hibernate-entitymanager) From 13e4081fc7a22111cfbf4c075dfd87eaab3471f1 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 2 Jan 2019 22:53:54 +0200 Subject: [PATCH 112/271] Update README.md --- java-collections-maps/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-collections-maps/README.md b/java-collections-maps/README.md index a6037a3c57..0b76ca1959 100644 --- a/java-collections-maps/README.md +++ b/java-collections-maps/README.md @@ -17,3 +17,4 @@ - [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max) - [Merging Two Maps with Java 8](https://www.baeldung.com/java-merge-maps) - [How to Check If a Key Exists in a Map](https://www.baeldung.com/java-map-key-exists) +- [Comparing Two HashMaps in Java](https://www.baeldung.com/java-compare-hashmaps) From 1a76da2f8f589204f57fc1d7a6e9b7bf45c37c72 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 2 Jan 2019 22:54:36 +0200 Subject: [PATCH 113/271] Update README.md --- core-java-lang/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-lang/README.md b/core-java-lang/README.md index 52dfe708a3..d5ad7d8e7c 100644 --- a/core-java-lang/README.md +++ b/core-java-lang/README.md @@ -33,3 +33,4 @@ - [How to Separate Double into Integer and Decimal Parts](https://www.baeldung.com/java-separate-double-into-integer-decimal-parts) - [“Sneaky Throws” in Java](http://www.baeldung.com/java-sneaky-throws) - [Retrieving a Class Name in Java](https://www.baeldung.com/java-class-name) +- [Java Compound Operators](https://www.baeldung.com/java-compound-operators) From 7b666654ec11d8e4b524d3fc44be572f6101d8ed Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 2 Jan 2019 22:56:06 +0200 Subject: [PATCH 114/271] Update README.md --- persistence-modules/java-jpa/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md index 9a90216519..2eea5e60b4 100644 --- a/persistence-modules/java-jpa/README.md +++ b/persistence-modules/java-jpa/README.md @@ -2,4 +2,5 @@ - [A Guide to SqlResultSetMapping](http://www.baeldung.com/jpa-sql-resultset-mapping) - [A Guide to Stored Procedures with JPA](http://www.baeldung.com/jpa-stored-procedures) -- [Fixing the JPA error “java.lang.String cannot be cast to [Ljava.lang.String;”](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) +- [Fixing the JPA error “java.lang.String cannot be cast to Ljava.lang.String;”](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) +- [JPA Entity Graph](https://www.baeldung.com/jpa-entity-graph) From 6903a0c2bbdd72081fa8cac9f16d35f78bd05340 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 2 Jan 2019 22:56:48 +0200 Subject: [PATCH 115/271] Update README.md --- spring-5-security-oauth/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-5-security-oauth/README.md b/spring-5-security-oauth/README.md index f13925992b..5a444d4784 100644 --- a/spring-5-security-oauth/README.md +++ b/spring-5-security-oauth/README.md @@ -2,3 +2,4 @@ - [Spring Security 5 -OAuth2 Login](http://www.baeldung.com/spring-security-5-oauth2-login) - [Extracting Principal and Authorities using Spring Security OAuth](https://www.baeldung.com/spring-security-oauth-principal-authorities-extractor) +- [Customizing Authorization and Token Requests with Spring Security 5.1 Client](https://www.baeldung.com/spring-security-custom-oauth-requests) From 2ec62d9091c005a8783f71a8af63076e18f12c73 Mon Sep 17 00:00:00 2001 From: DOHA Date: Wed, 2 Jan 2019 23:16:14 +0200 Subject: [PATCH 116/271] minor clean up --- spring-boot-testing/pom.xml | 44 +------------------ ...tionTest.groovy => LoadContextTest.groovy} | 2 +- ...onTest.groovy => WebControllerTest.groovy} | 2 +- 3 files changed, 3 insertions(+), 45 deletions(-) rename spring-boot-testing/src/test/groovy/com/baeldung/boot/{LoadContextIntegrationTest.groovy => LoadContextTest.groovy} (91%) rename spring-boot-testing/src/test/groovy/com/baeldung/boot/{WebControllerIntegrationTest.groovy => WebControllerTest.groovy} (97%) diff --git a/spring-boot-testing/pom.xml b/spring-boot-testing/pom.xml index dd40789604..c2c886a4fe 100644 --- a/spring-boot-testing/pom.xml +++ b/spring-boot-testing/pom.xml @@ -109,53 +109,11 @@ - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*IntegrationTest.java - - - - + - - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*IntegrationTest.java - - - - - - - json - - - - - - - - com.baeldung.boot.Application diff --git a/spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextIntegrationTest.groovy b/spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextTest.groovy similarity index 91% rename from spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextIntegrationTest.groovy rename to spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextTest.groovy index 8bfc86685c..85b0a4b89b 100644 --- a/spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextIntegrationTest.groovy +++ b/spring-boot-testing/src/test/groovy/com/baeldung/boot/LoadContextTest.groovy @@ -10,7 +10,7 @@ import spock.lang.Title @Title("Application Specification") @Narrative("Specification which beans are expected") @SpringBootTest -class LoadContextIntegrationTest extends Specification { +class LoadContextTest extends Specification { @Autowired(required = false) private WebController webController diff --git a/spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerIntegrationTest.groovy b/spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerTest.groovy similarity index 97% rename from spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerIntegrationTest.groovy rename to spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerTest.groovy index 17c60376ed..d8b4e03adc 100644 --- a/spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerIntegrationTest.groovy +++ b/spring-boot-testing/src/test/groovy/com/baeldung/boot/WebControllerTest.groovy @@ -14,7 +14,7 @@ import spock.lang.Title @Narrative("The Specification of the behaviour of the WebController. It can greet a person, change the name and reset it to 'world'") @AutoConfigureMockMvc(secure=false) @WebMvcTest() -class WebControllerIntegrationTest extends Specification { +class WebControllerTest extends Specification { @Autowired private MockMvc mvc From bbb6c93598e4c401ee000392a69f96a8badaa4b6 Mon Sep 17 00:00:00 2001 From: Ger Roza Date: Wed, 2 Jan 2019 22:13:35 -0200 Subject: [PATCH 117/271] [BAEL-2315] spring-5-reactive-oauth & spring-5-security-oauth | WebClient and OAuth2 support (#6053) * Cleaned shared properties in spring-5-security-oauth module, and made some final tunings on authorization service and the resource server * Added and modified example for webclient-oauth2 * Cleaned authorization service and resource service for webclient and oauth2 article * Added examples for auth code with client and with login cleaned properties and packages * Added examples fow webclient + oauth2 --- .../Spring5ReactiveOauthApplication.java | 2 + .../OauthClientApplication.java | 24 +++++++ .../configuration/WebClientConfig.java | 20 ++++++ .../configuration/WebSecurityConfig.java | 22 ++++++ .../web/ClientRestController.java | 53 +++++++++++++++ .../OauthClientApplication.java | 24 +++++++ .../configuration/WebClientConfig.java | 31 +++++++++ .../configuration/WebSecurityConfig.java | 20 ++++++ .../web/ClientRestController.java | 68 +++++++++++++++++++ .../ClientCredentialsOauthApplication.java | 26 +++++++ .../configuration/WebClientConfig.java | 22 ++++++ .../service/WebClientChonJob.java | 33 +++++++++ .../ManualRequestApplication.java | 23 +++++++ .../configure/WebClientConfig.java | 16 +++++ .../configure/WebSecurityConfig.java | 17 +++++ .../web/ManualOauthRequestController.java | 57 ++++++++++++++++ .../src/main/resources/application.yml | 23 +------ .../main/resources/default-application.yml | 20 ++++++ ...nt-auth-code-client-application.properties | 10 +++ ...ent-auth-code-login-application.properties | 10 +++ ...t-credentials-oauth-application.properties | 4 ++ .../OAuth2ClientCredentialsLiveTest.java | 52 ++++++++++++++ .../OAuth2ManualRequestLiveTest.java | 43 ++++++++++++ .../webclient/utils/ListAppender.java | 25 +++++++ .../src/test/resources/logback-test.xml | 16 +++++ .../oauth2/SpringOAuthApplication.java | 2 + .../ExtractorsApplication.java | 2 + .../AuthorizationServerApplication.java | 17 +++++ .../configuration/WebSecurityConfig.java | 26 +++++++ .../ResourceServerApplication.java | 17 +++++ .../configuration/AuthorizationConfigs.java | 29 ++++++++ .../web/ResourceRestController.java | 23 +++++++ .../src/main/resources/application.properties | 2 - .../resources/default-application.properties | 1 + ...lient-authorization-application.properties | 13 ++++ ...webclient-resources-application.properties | 6 ++ 36 files changed, 777 insertions(+), 22 deletions(-) create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/OauthClientApplication.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/configuration/WebClientConfig.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/configuration/WebSecurityConfig.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/web/ClientRestController.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/OauthClientApplication.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/configuration/WebClientConfig.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/configuration/WebSecurityConfig.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/web/ClientRestController.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/ClientCredentialsOauthApplication.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/configuration/WebClientConfig.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/service/WebClientChonJob.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/ManualRequestApplication.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/configure/WebClientConfig.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/configure/WebSecurityConfig.java create mode 100644 spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/web/ManualOauthRequestController.java create mode 100644 spring-5-reactive-oauth/src/main/resources/default-application.yml create mode 100644 spring-5-reactive-oauth/src/main/resources/webclient-auth-code-client-application.properties create mode 100644 spring-5-reactive-oauth/src/main/resources/webclient-auth-code-login-application.properties create mode 100644 spring-5-reactive-oauth/src/main/resources/webclient-client-credentials-oauth-application.properties create mode 100644 spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/clientcredentials/OAuth2ClientCredentialsLiveTest.java create mode 100644 spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/manualrequest/OAuth2ManualRequestLiveTest.java create mode 100644 spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/utils/ListAppender.java create mode 100644 spring-5-reactive-oauth/src/test/resources/logback-test.xml create mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/AuthorizationServerApplication.java create mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/configuration/WebSecurityConfig.java create mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/ResourceServerApplication.java create mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/configuration/AuthorizationConfigs.java create mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/web/ResourceRestController.java create mode 100644 spring-5-security-oauth/src/main/resources/default-application.properties create mode 100644 spring-5-security-oauth/src/main/resources/webclient-authorization-application.properties create mode 100644 spring-5-security-oauth/src/main/resources/webclient-resources-application.properties diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/Spring5ReactiveOauthApplication.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/Spring5ReactiveOauthApplication.java index 602ded6b9e..b95517200e 100644 --- a/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/Spring5ReactiveOauthApplication.java +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/Spring5ReactiveOauthApplication.java @@ -3,11 +3,13 @@ package com.baeldung.reactive.oauth; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.PropertySource; import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository; import org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction; import org.springframework.security.oauth2.client.web.server.ServerOAuth2AuthorizedClientRepository; import org.springframework.web.reactive.function.client.WebClient; +@PropertySource("classpath:default-application.yml") @SpringBootApplication public class Spring5ReactiveOauthApplication { diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/OauthClientApplication.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/OauthClientApplication.java new file mode 100644 index 0000000000..7bae78bb14 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/OauthClientApplication.java @@ -0,0 +1,24 @@ +package com.baeldung.webclient.authorizationcodeclient; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; + +/** + * + * Note: This app is configured to use the authorization service and the resource service located in module spring-5-security-oauth + * + * As we usually do with other well-known auth providers (github/facebook/...) we have to log-in using user credentials (bael-user/bael-password) and client configurations (bael-client-id/bael-secret) handled by the auth server + * + * @author rozagerardo + * + */ +@PropertySource("classpath:webclient-auth-code-client-application.properties") +@SpringBootApplication +public class OauthClientApplication { + + public static void main(String[] args) { + SpringApplication.run(OauthClientApplication.class, args); + } + +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/configuration/WebClientConfig.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/configuration/WebClientConfig.java new file mode 100644 index 0000000000..884a3c145d --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/configuration/WebClientConfig.java @@ -0,0 +1,20 @@ +package com.baeldung.webclient.authorizationcodeclient.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository; +import org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction; +import org.springframework.security.oauth2.client.web.server.ServerOAuth2AuthorizedClientRepository; +import org.springframework.web.reactive.function.client.WebClient; + +@Configuration +public class WebClientConfig { + + @Bean + WebClient webClientForAuthorized(ReactiveClientRegistrationRepository clientRegistrations, ServerOAuth2AuthorizedClientRepository authorizedClients) { + ServerOAuth2AuthorizedClientExchangeFilterFunction oauth = new ServerOAuth2AuthorizedClientExchangeFilterFunction(clientRegistrations, authorizedClients); + return WebClient.builder() + .filter(oauth) + .build(); + } +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/configuration/WebSecurityConfig.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/configuration/WebSecurityConfig.java new file mode 100644 index 0000000000..4271ae96cf --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/configuration/WebSecurityConfig.java @@ -0,0 +1,22 @@ +package com.baeldung.webclient.authorizationcodeclient.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.web.server.SecurityWebFilterChain; + +@Configuration +public class WebSecurityConfig { + @Bean + public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { + http.authorizeExchange() + .anyExchange() + .authenticated() + .and() + .oauth2Client() + .and() + .formLogin(); + return http.build(); + } + +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/web/ClientRestController.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/web/ClientRestController.java new file mode 100644 index 0000000000..c36b7d1dea --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/web/ClientRestController.java @@ -0,0 +1,53 @@ +package com.baeldung.webclient.authorizationcodeclient.web; + +import static org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId; +import static org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.oauth2.client.OAuth2AuthorizedClient; +import org.springframework.security.oauth2.client.annotation.RegisteredOAuth2AuthorizedClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.reactive.function.client.WebClient; + +import reactor.core.publisher.Mono; + +@RestController +public class ClientRestController { + + private static final String RESOURCE_URI = "http://localhost:8084/retrieve-resource"; + + @Autowired + WebClient webClient; + + @GetMapping("/auth-code") + Mono useOauthWithAuthCode() { + Mono retrievedResource = webClient.get() + .uri(RESOURCE_URI) + .retrieve() + .bodyToMono(String.class); + return retrievedResource.map(string -> "We retrieved the following resource using Oauth: " + string); + } + + @GetMapping("/auth-code-annotated") + Mono useOauthWithAuthCodeAndAnnotation(@RegisteredOAuth2AuthorizedClient("bael") OAuth2AuthorizedClient authorizedClient) { + Mono retrievedResource = webClient.get() + .uri(RESOURCE_URI) + .attributes(oauth2AuthorizedClient(authorizedClient)) + .retrieve() + .bodyToMono(String.class); + return retrievedResource.map(string -> "We retrieved the following resource using Oauth: " + string + ". Principal associated: " + authorizedClient.getPrincipalName() + ". Token will expire at: " + authorizedClient.getAccessToken() + .getExpiresAt()); + } + + @GetMapping("/auth-code-explicit-client") + Mono useOauthWithExpicitClient() { + Mono retrievedResource = webClient.get() + .uri(RESOURCE_URI) + .attributes(clientRegistrationId("bael")) + .retrieve() + .bodyToMono(String.class); + return retrievedResource.map(string -> "We retrieved the following resource using Oauth: " + string); + } + +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/OauthClientApplication.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/OauthClientApplication.java new file mode 100644 index 0000000000..9dd6dd1bde --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/OauthClientApplication.java @@ -0,0 +1,24 @@ +package com.baeldung.webclient.authorizationcodelogin; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; + +/** + * + * Note: This app is configured to use the authorization service and the resource service located in module spring-5-security-oauth + * + * As we usually do with other well-known auth providers (github/facebook/...) we have to log-in using user credentials (bael-user/bael-password) and client configurations (bael-client-id/bael-secret) handled by the auth server + * + * @author rozagerardo + * + */ +@PropertySource("classpath:webclient-auth-code-login-application.properties") +@SpringBootApplication +public class OauthClientApplication { + + public static void main(String[] args) { + SpringApplication.run(OauthClientApplication.class, args); + } + +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/configuration/WebClientConfig.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/configuration/WebClientConfig.java new file mode 100644 index 0000000000..15458cc60a --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/configuration/WebClientConfig.java @@ -0,0 +1,31 @@ +package com.baeldung.webclient.authorizationcodelogin.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository; +import org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction; +import org.springframework.security.oauth2.client.web.server.ServerOAuth2AuthorizedClientRepository; +import org.springframework.web.reactive.function.client.WebClient; + +@Configuration +public class WebClientConfig { + + @Bean + @Primary + WebClient webClientForAuthorized(ReactiveClientRegistrationRepository clientRegistrations, ServerOAuth2AuthorizedClientRepository authorizedClients) { + ServerOAuth2AuthorizedClientExchangeFilterFunction oauth = new ServerOAuth2AuthorizedClientExchangeFilterFunction(clientRegistrations, authorizedClients); + oauth.setDefaultOAuth2AuthorizedClient(true); + return WebClient.builder() + .filter(oauth) + .build(); + } + + @Bean + WebClient otherWebClient(ReactiveClientRegistrationRepository clientRegistrations, ServerOAuth2AuthorizedClientRepository authorizedClients) { + ServerOAuth2AuthorizedClientExchangeFilterFunction oauth = new ServerOAuth2AuthorizedClientExchangeFilterFunction(clientRegistrations, authorizedClients); + return WebClient.builder() + .filter(oauth) + .build(); + } +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/configuration/WebSecurityConfig.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/configuration/WebSecurityConfig.java new file mode 100644 index 0000000000..f45fc09222 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/configuration/WebSecurityConfig.java @@ -0,0 +1,20 @@ +package com.baeldung.webclient.authorizationcodelogin.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.web.server.SecurityWebFilterChain; + +@Configuration +public class WebSecurityConfig { + @Bean + public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { + http.authorizeExchange() + .anyExchange() + .authenticated() + .and() + .oauth2Login(); + return http.build(); + } + +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/web/ClientRestController.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/web/ClientRestController.java new file mode 100644 index 0000000000..55e0096525 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/web/ClientRestController.java @@ -0,0 +1,68 @@ +package com.baeldung.webclient.authorizationcodelogin.web; + +import static org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId; +import static org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.security.oauth2.client.OAuth2AuthorizedClient; +import org.springframework.security.oauth2.client.annotation.RegisteredOAuth2AuthorizedClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.reactive.function.client.WebClient; + +import reactor.core.publisher.Mono; + +@RestController +public class ClientRestController { + + private static final String RESOURCE_URI = "http://localhost:8084/retrieve-resource"; + + @Autowired + WebClient webClient; + + @Autowired + @Qualifier("otherWebClient") + WebClient otherWebClient; + + @GetMapping("/auth-code") + Mono useOauthWithAuthCode() { + Mono retrievedResource = webClient.get() + .uri(RESOURCE_URI) + .retrieve() + .bodyToMono(String.class); + return retrievedResource.map(string -> "We retrieved the following resource using Oauth: " + string); + } + + @GetMapping("/auth-code-no-client") + Mono useOauthWithNoClient() { + // This call will fail, since we don't have the client properly set for this webClient + Mono retrievedResource = otherWebClient.get() + .uri(RESOURCE_URI) + .retrieve() + .bodyToMono(String.class); + return retrievedResource.map(string -> "We retrieved the following resource using Oauth: " + string); + } + + @GetMapping("/auth-code-annotated") + Mono useOauthWithAuthCodeAndAnnotation(@RegisteredOAuth2AuthorizedClient("bael") OAuth2AuthorizedClient authorizedClient) { + Mono retrievedResource = otherWebClient.get() + .uri(RESOURCE_URI) + .attributes(oauth2AuthorizedClient(authorizedClient)) + .retrieve() + .bodyToMono(String.class); + return retrievedResource.map(string -> "We retrieved the following resource using Oauth: " + string + ". Principal associated: " + authorizedClient.getPrincipalName() + ". Token will expire at: " + authorizedClient.getAccessToken() + .getExpiresAt()); + } + + @GetMapping("/auth-code-explicit-client") + Mono useOauthWithExpicitClient() { + Mono retrievedResource = otherWebClient.get() + .uri(RESOURCE_URI) + .attributes(clientRegistrationId("bael")) + .retrieve() + .bodyToMono(String.class); + return retrievedResource.map(string -> "We retrieved the following resource using Oauth: " + string); + } + +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/ClientCredentialsOauthApplication.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/ClientCredentialsOauthApplication.java new file mode 100644 index 0000000000..d1b9f7f744 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/ClientCredentialsOauthApplication.java @@ -0,0 +1,26 @@ +package com.baeldung.webclient.clientcredentials; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; +import org.springframework.scheduling.annotation.EnableScheduling; + +/** + * + * Note: This app is configured to use the authorization service and the resource service located in module spring-5-security-oauth + * + * As we usually do with other well-known auth providers (github/facebook/...) we have to log-in using credentials handled by the auth server (bael-user/bael-password) + * + * @author rozagerardo + * + */ +@PropertySource("classpath:webclient-client-credentials-oauth-application.properties") +@EnableScheduling +@SpringBootApplication +public class ClientCredentialsOauthApplication { + + public static void main(String[] args) { + SpringApplication.run(ClientCredentialsOauthApplication.class, args); + } + +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/configuration/WebClientConfig.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/configuration/WebClientConfig.java new file mode 100644 index 0000000000..8ffc92b4cd --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/configuration/WebClientConfig.java @@ -0,0 +1,22 @@ +package com.baeldung.webclient.clientcredentials.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository; +import org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction; +import org.springframework.security.oauth2.client.web.server.UnAuthenticatedServerOAuth2AuthorizedClientRepository; +import org.springframework.web.reactive.function.client.WebClient; + +@Configuration +public class WebClientConfig { + + @Bean + WebClient webClient(ReactiveClientRegistrationRepository clientRegistrations) { + ServerOAuth2AuthorizedClientExchangeFilterFunction oauth = new ServerOAuth2AuthorizedClientExchangeFilterFunction(clientRegistrations, new UnAuthenticatedServerOAuth2AuthorizedClientRepository()); + oauth.setDefaultClientRegistrationId("bael"); + return WebClient.builder() + .filter(oauth) + .build(); + } + +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/service/WebClientChonJob.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/service/WebClientChonJob.java new file mode 100644 index 0000000000..dc38ce3f9e --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/service/WebClientChonJob.java @@ -0,0 +1,33 @@ +package com.baeldung.webclient.clientcredentials.service; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.security.oauth2.client.OAuth2AuthorizedClient; +import org.springframework.security.oauth2.client.annotation.RegisteredOAuth2AuthorizedClient; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.client.WebClient; + +@Component +public class WebClientChonJob { + + Logger logger = LoggerFactory.getLogger(WebClientChonJob.class); + + private static final String RESOURCE_URI = "http://localhost:8084/retrieve-resource"; + + @Autowired + private WebClient webClient; + + @Scheduled(fixedRate = 1000) + public void logResourceServiceResponse() { + + webClient.get() + .uri(RESOURCE_URI) + .retrieve() + .bodyToMono(String.class) + .map(string -> "We retrieved the following resource using Client Credentials Grant Type: " + string) + .subscribe(logger::info); + } + +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/ManualRequestApplication.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/ManualRequestApplication.java new file mode 100644 index 0000000000..c2762ad559 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/ManualRequestApplication.java @@ -0,0 +1,23 @@ +package com.baeldung.webclient.manualrequest; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; + +/** + * + * Note: This app is configured to use the authorization service and the resource service located in module spring-5-security-oauth + * + * As we usually do with other well-known auth providers (github/facebook/...) we have to log-in using user credentials (bael-user/bael-password) and client configurations (bael-client-id/bael-secret) handled by the auth server + * + * @author rozagerardo + * + */ +@SpringBootApplication +public class ManualRequestApplication { + + public static void main(String[] args) { + SpringApplication.run(ManualRequestApplication.class, args); + } + +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/configure/WebClientConfig.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/configure/WebClientConfig.java new file mode 100644 index 0000000000..51fc60821a --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/configure/WebClientConfig.java @@ -0,0 +1,16 @@ +package com.baeldung.webclient.manualrequest.configure; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.reactive.function.client.WebClient; + +@Configuration +public class WebClientConfig { + + @Bean + public WebClient configureWebClient() { + return WebClient.builder() + .build(); + }; + +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/configure/WebSecurityConfig.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/configure/WebSecurityConfig.java new file mode 100644 index 0000000000..1753681db8 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/configure/WebSecurityConfig.java @@ -0,0 +1,17 @@ +package com.baeldung.webclient.manualrequest.configure; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.web.server.SecurityWebFilterChain; + +@Configuration +public class WebSecurityConfig { + @Bean + public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { + http.authorizeExchange() + .anyExchange() + .permitAll(); + return http.build(); + } +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/web/ManualOauthRequestController.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/web/ManualOauthRequestController.java new file mode 100644 index 0000000000..9f9d6d3167 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/web/ManualOauthRequestController.java @@ -0,0 +1,57 @@ +package com.baeldung.webclient.manualrequest.web; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames; +import org.springframework.util.Base64Utils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.reactive.function.BodyInserters; +import org.springframework.web.reactive.function.client.WebClient; + +import com.fasterxml.jackson.databind.JsonNode; +import com.nimbusds.oauth2.sdk.GrantType; + +import reactor.core.publisher.Mono; + +@RestController +public class ManualOauthRequestController { + + private static Logger logger = LoggerFactory.getLogger(ManualOauthRequestController.class); + + private static final String TOKEN_ENDPOINT = "localhost:8085/oauth/token"; + private static final String RESOURCE_ENDPOINT = "localhost:8084/retrieve-resource"; + private static final String CLIENT_ID = "bael-client-id"; + private static final String CLIENT_SECRET = "bael-secret"; + + @Autowired + WebClient client; + + @GetMapping("/manual-request-oauth") + public Mono obtainSecuredResource() { + logger.info("Creating web client..."); + Mono resource = client.post() + .uri(TOKEN_ENDPOINT) + .header(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString((CLIENT_ID + ":" + CLIENT_SECRET).getBytes())) + .body(BodyInserters.fromFormData(OAuth2ParameterNames.GRANT_TYPE, GrantType.CLIENT_CREDENTIALS.getValue())) + .retrieve() + .bodyToMono(JsonNode.class) + .flatMap(tokenResponse -> { + String accessTokenValue = tokenResponse.get("access_token") + .textValue(); + logger.info("Retrieved the following access token: {}", accessTokenValue); + return client.get() + .uri(RESOURCE_ENDPOINT) + .headers(h -> h.setBearerAuth(accessTokenValue)) + .retrieve() + .bodyToMono(String.class); + }); + logger.info("non-blocking Oauth calls registered..."); + return resource.map(res -> "Retrieved the resource using a manual approach: " + res); + + } + +} diff --git a/spring-5-reactive-oauth/src/main/resources/application.yml b/spring-5-reactive-oauth/src/main/resources/application.yml index e35e19b344..bec62fdd33 100644 --- a/spring-5-reactive-oauth/src/main/resources/application.yml +++ b/spring-5-reactive-oauth/src/main/resources/application.yml @@ -1,20 +1,3 @@ -spring: - security: - oauth2: - client: - registration: - google: - client-id: YOUR_APP_CLIENT_ID - client-secret: YOUR_APP_CLIENT_SECRET - custom: - client-id: fooClientIdPassword - client-secret: secret - scopes: read,foo - authorization-grant-type: authorization_code - redirect-uri-template: http://localhost:8080/login/oauth2/code/custom - provider: - custom: - authorization-uri: http://localhost:8081/spring-security-oauth-server/oauth/authorize - token-uri: http://localhost:8081/spring-security-oauth-server/oauth/token - user-info-uri: http://localhost:8088/spring-security-oauth-resource/users/extra - user-name-attribute: user_name \ No newline at end of file +logging: + level: + root: DEBUG \ No newline at end of file diff --git a/spring-5-reactive-oauth/src/main/resources/default-application.yml b/spring-5-reactive-oauth/src/main/resources/default-application.yml new file mode 100644 index 0000000000..e35e19b344 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/resources/default-application.yml @@ -0,0 +1,20 @@ +spring: + security: + oauth2: + client: + registration: + google: + client-id: YOUR_APP_CLIENT_ID + client-secret: YOUR_APP_CLIENT_SECRET + custom: + client-id: fooClientIdPassword + client-secret: secret + scopes: read,foo + authorization-grant-type: authorization_code + redirect-uri-template: http://localhost:8080/login/oauth2/code/custom + provider: + custom: + authorization-uri: http://localhost:8081/spring-security-oauth-server/oauth/authorize + token-uri: http://localhost:8081/spring-security-oauth-server/oauth/token + user-info-uri: http://localhost:8088/spring-security-oauth-resource/users/extra + user-name-attribute: user_name \ No newline at end of file diff --git a/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-client-application.properties b/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-client-application.properties new file mode 100644 index 0000000000..612777a06d --- /dev/null +++ b/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-client-application.properties @@ -0,0 +1,10 @@ +spring.security.oauth2.client.registration.bael.client-name=bael +spring.security.oauth2.client.registration.bael.client-id=bael-client-id +spring.security.oauth2.client.registration.bael.client-secret=bael-secret +spring.security.oauth2.client.registration.bael.authorization-grant-type=authorization_code +spring.security.oauth2.client.registration.bael.redirect-uri=http://localhost:8080/authorize/oauth2/code/bael + +spring.security.oauth2.client.provider.bael.token-uri=http://localhost:8085/oauth/token +spring.security.oauth2.client.provider.bael.authorization-uri=http://localhost:8085/oauth/authorize + +spring.security.user.password=pass diff --git a/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-login-application.properties b/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-login-application.properties new file mode 100644 index 0000000000..edd5b80b13 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-login-application.properties @@ -0,0 +1,10 @@ +spring.security.oauth2.client.registration.bael.client-name=bael +spring.security.oauth2.client.registration.bael.client-id=bael-client-id +spring.security.oauth2.client.registration.bael.client-secret=bael-secret +spring.security.oauth2.client.registration.bael.authorization-grant-type=authorization_code +spring.security.oauth2.client.registration.bael.redirect-uri=http://localhost:8080/login/oauth2/code/bael + +spring.security.oauth2.client.provider.bael.token-uri=http://localhost:8085/oauth/token +spring.security.oauth2.client.provider.bael.authorization-uri=http://localhost:8085/oauth/authorize +spring.security.oauth2.client.provider.bael.user-info-uri=http://localhost:8084/user +spring.security.oauth2.client.provider.bael.user-name-attribute=name diff --git a/spring-5-reactive-oauth/src/main/resources/webclient-client-credentials-oauth-application.properties b/spring-5-reactive-oauth/src/main/resources/webclient-client-credentials-oauth-application.properties new file mode 100644 index 0000000000..f82f74ec48 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/resources/webclient-client-credentials-oauth-application.properties @@ -0,0 +1,4 @@ +spring.security.oauth2.client.registration.bael.authorization-grant-type=client_credentials +spring.security.oauth2.client.registration.bael.client-id=bael-client-id +spring.security.oauth2.client.registration.bael.client-secret=bael-secret +spring.security.oauth2.client.provider.bael.token-uri=http://localhost:8085/oauth/token diff --git a/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/clientcredentials/OAuth2ClientCredentialsLiveTest.java b/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/clientcredentials/OAuth2ClientCredentialsLiveTest.java new file mode 100644 index 0000000000..e31815c3f8 --- /dev/null +++ b/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/clientcredentials/OAuth2ClientCredentialsLiveTest.java @@ -0,0 +1,52 @@ +package com.baeldung.webclient.clientcredentials; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Collection; +import java.util.stream.Collectors; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.webclient.clientcredentials.service.WebClientChonJob; +import com.baeldung.webclient.utils.ListAppender; + +import ch.qos.logback.classic.spi.ILoggingEvent; + +/** + * + * Note: this Live test requires the Authorization Service and the Resource service located in the spring-5-security-oauth module + * + * @author ger + * + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = { ClientCredentialsOauthApplication.class }) +public class OAuth2ClientCredentialsLiveTest { + + @Autowired + WebClientChonJob service; + + @Before + public void clearLogList() { + ListAppender.clearEventList(); + } + + @Test + public void givenFooWithNullId_whenProcessFoo_thenLogsWithDebugTrace() throws Exception { + service.logResourceServiceResponse(); + + Thread.sleep(3000); + + Collection allLoggedEntries = ListAppender.getEvents() + .stream() + .map(ILoggingEvent::getFormattedMessage) + .collect(Collectors.toList()); + assertThat(allLoggedEntries).anyMatch(entry -> entry.contains("We retrieved the following resource using Client Credentials Grant Type: This is the resource!")); + } + +} diff --git a/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/manualrequest/OAuth2ManualRequestLiveTest.java b/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/manualrequest/OAuth2ManualRequestLiveTest.java new file mode 100644 index 0000000000..94aa580f0a --- /dev/null +++ b/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/manualrequest/OAuth2ManualRequestLiveTest.java @@ -0,0 +1,43 @@ +package com.baeldung.webclient.manualrequest; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.test.web.reactive.server.WebTestClient; +import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; + +/** + * + * Note: this Live test requires not only the corresponding application running, + * but also the Authorization Service and the Resource service located in the spring-5-security-oauth module. + * + * + * @author ger + * + */ +public class OAuth2ManualRequestLiveTest { + + private static final String BASE_URL = "http://localhost:8080"; + private static final String MANUAL_REQUEST_URI = "/manual-request-oauth"; + + private static WebTestClient client; + + @Before + public void setup() { + client = WebTestClient.bindToServer() + .baseUrl(BASE_URL) + .build(); + } + + @Test + public void whenRequestingDebugHookOn_thenObtainExpectedMessage() { + ResponseSpec response = client.get() + .uri(MANUAL_REQUEST_URI) + .exchange(); + + response.expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("Retrieved the resource using a manual approach: This is the resource!"); + } + +} diff --git a/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/utils/ListAppender.java b/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/utils/ListAppender.java new file mode 100644 index 0000000000..6f8fbe004a --- /dev/null +++ b/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/utils/ListAppender.java @@ -0,0 +1,25 @@ +package com.baeldung.webclient.utils; + +import java.util.ArrayList; +import java.util.List; + +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.AppenderBase; + +public class ListAppender extends AppenderBase { + + static private List events = new ArrayList<>(); + + @Override + protected void append(ILoggingEvent eventObject) { + events.add(eventObject); + } + + public static List getEvents() { + return events; + } + + public static void clearEventList() { + events.clear(); + } +} \ No newline at end of file diff --git a/spring-5-reactive-oauth/src/test/resources/logback-test.xml b/spring-5-reactive-oauth/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..891c54bfd3 --- /dev/null +++ b/spring-5-reactive-oauth/src/test/resources/logback-test.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SpringOAuthApplication.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SpringOAuthApplication.java index 557c23b368..1478b03d2e 100644 --- a/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SpringOAuthApplication.java +++ b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SpringOAuthApplication.java @@ -2,7 +2,9 @@ package com.baeldung.oauth2; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; +@PropertySource("classpath:default-application.properties") @SpringBootApplication public class SpringOAuthApplication { diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java index 6ab4d525bf..174e5b0fdf 100644 --- a/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java +++ b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java @@ -3,10 +3,12 @@ package com.baeldung.oauth2extractors; import org.apache.logging.log4j.util.Strings; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.AbstractEnvironment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +@PropertySource("classpath:default-application.properties") @SpringBootApplication @Controller public class ExtractorsApplication { diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/AuthorizationServerApplication.java b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/AuthorizationServerApplication.java new file mode 100644 index 0000000000..d72704386c --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/AuthorizationServerApplication.java @@ -0,0 +1,17 @@ +package com.baeldung.webclient.authorizationserver; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; +import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; + +@EnableAuthorizationServer +@PropertySource("classpath:webclient-authorization-application.properties") +@SpringBootApplication +public class AuthorizationServerApplication { + + public static void main(String[] args) { + SpringApplication.run(AuthorizationServerApplication.class, args); + } + +} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/configuration/WebSecurityConfig.java b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/configuration/WebSecurityConfig.java new file mode 100644 index 0000000000..5dd15f1b8c --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/configuration/WebSecurityConfig.java @@ -0,0 +1,26 @@ +package com.baeldung.webclient.authorizationserver.configuration; + +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@EnableWebSecurity +@Configuration +public class WebSecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeRequests() + .antMatchers("/login", "/user") + .permitAll() + .and() + .authorizeRequests() + .anyRequest() + .authenticated() + .and() + .formLogin() + .and() + .httpBasic(); + } +} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/ResourceServerApplication.java b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/ResourceServerApplication.java new file mode 100644 index 0000000000..50ad293ef8 --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/ResourceServerApplication.java @@ -0,0 +1,17 @@ +package com.baeldung.webclient.resourceserver; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; +import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; + +@EnableResourceServer +@PropertySource("webclient-resources-application.properties") +@SpringBootApplication +public class ResourceServerApplication { + + public static void main(String[] args) { + SpringApplication.run(ResourceServerApplication.class, args); + } + +} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/configuration/AuthorizationConfigs.java b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/configuration/AuthorizationConfigs.java new file mode 100644 index 0000000000..5aea1983db --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/configuration/AuthorizationConfigs.java @@ -0,0 +1,29 @@ +package com.baeldung.webclient.resourceserver.configuration; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.oauth2.provider.token.RemoteTokenServices; +import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; + +@Configuration +public class AuthorizationConfigs { + + @Value("${oauth.authserver.client-id}") + String clientId; + + @Value("${oauth.authserver.client-secret}") + String clientSecret; + + @Value("${oauth.authserver.check-token-endpoint}") + String checkTokenEndpoint; + + @Bean + public ResourceServerTokenServices tokenSvc() { + RemoteTokenServices remoteService = new RemoteTokenServices(); + remoteService.setCheckTokenEndpointUrl(checkTokenEndpoint); + remoteService.setClientId(clientId); + remoteService.setClientSecret(clientSecret); + return remoteService; + } +} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/web/ResourceRestController.java b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/web/ResourceRestController.java new file mode 100644 index 0000000000..aef0fb4d7d --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/web/ResourceRestController.java @@ -0,0 +1,23 @@ +package com.baeldung.webclient.resourceserver.web; + +import java.security.Principal; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class ResourceRestController { + + @GetMapping("/retrieve-resource") + public String retrieveResource() { + return "This is the resource!"; + } + + @GetMapping("/user") + @ResponseBody + public Principal user(Principal user) { + return user; + } + +} diff --git a/spring-5-security-oauth/src/main/resources/application.properties b/spring-5-security-oauth/src/main/resources/application.properties index 5912b0f755..c84e745918 100644 --- a/spring-5-security-oauth/src/main/resources/application.properties +++ b/spring-5-security-oauth/src/main/resources/application.properties @@ -1,5 +1,3 @@ -server.port=8081 - logging.level.root=INFO logging.level.com.baeldung.dsl.ClientErrorLoggingFilter=DEBUG \ No newline at end of file diff --git a/spring-5-security-oauth/src/main/resources/default-application.properties b/spring-5-security-oauth/src/main/resources/default-application.properties new file mode 100644 index 0000000000..bafddced85 --- /dev/null +++ b/spring-5-security-oauth/src/main/resources/default-application.properties @@ -0,0 +1 @@ +server.port=8081 \ No newline at end of file diff --git a/spring-5-security-oauth/src/main/resources/webclient-authorization-application.properties b/spring-5-security-oauth/src/main/resources/webclient-authorization-application.properties new file mode 100644 index 0000000000..9531045359 --- /dev/null +++ b/spring-5-security-oauth/src/main/resources/webclient-authorization-application.properties @@ -0,0 +1,13 @@ +server.port=8085 + +security.oauth2.client.client-id=bael-client-id +security.oauth2.client.client-secret=bael-secret +security.oauth2.client.scope=read,write + +security.oauth2.authorization.check-token-access=isAuthenticated() + +spring.security.user.name=bael-user +spring.security.user.password=bael-password + +security.oauth2.client.registered-redirect-uri=http://localhost:8080/login/oauth2/code/bael, http://localhost:8080/authorize/oauth2/code/bael +security.oauth2.client.use-current-uri=false \ No newline at end of file diff --git a/spring-5-security-oauth/src/main/resources/webclient-resources-application.properties b/spring-5-security-oauth/src/main/resources/webclient-resources-application.properties new file mode 100644 index 0000000000..1cfb9ca12d --- /dev/null +++ b/spring-5-security-oauth/src/main/resources/webclient-resources-application.properties @@ -0,0 +1,6 @@ +server.port=8084 + +#spring.security.oauth2.resourceserver.jwt.issuer-uri=localhost:8085 +oauth.authserver.client-id=bael-client-id +oauth.authserver.client-secret=bael-secret +oauth.authserver.check-token-endpoint=http://localhost:8085/oauth/check_token From eacc84a450dad6e85354ea7e3acf72e902dcae19 Mon Sep 17 00:00:00 2001 From: Varun Jain Date: Thu, 3 Jan 2019 08:08:25 +0530 Subject: [PATCH 118/271] BAEL-2536-added-unit-tests-for-panagram --- .../com/baeldung/string/PanagramUnitTest.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 java-strings/src/test/java/com/baeldung/string/PanagramUnitTest.java diff --git a/java-strings/src/test/java/com/baeldung/string/PanagramUnitTest.java b/java-strings/src/test/java/com/baeldung/string/PanagramUnitTest.java new file mode 100644 index 0000000000..81d46956e2 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/PanagramUnitTest.java @@ -0,0 +1,44 @@ +package com.baeldung.string; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + + +public class PanagramUnitTest { + + @Test + public void givenValidString_isPanagram_shouldReturnSuccess() { + String input = "Two driven jocks help fax my big quiz"; + assertTrue(Panagram.isPanagram(input)); + assertTrue(Panagram.isPanagramWithStreams(input)); + } + + @Test + public void givenNullString_isPanagram_shouldReturnFailure() { + String input = null; + assertFalse(Panagram.isPanagram(input)); + assertFalse(Panagram.isPanagramWithStreams(input)); + assertFalse(Panagram.isPerfectPanagram(input)); + } + + @Test + public void givenPerfectPanagramString_isPerfectPanagram_shouldReturnSuccess() { + String input = "abcdefghijklmNoPqrStuVwxyz"; + assertTrue(Panagram.isPerfectPanagram(input)); + } + + @Test + public void givenNonPanagramString_isPanagram_shouldReturnFailure() { + String input = "invalid panagram"; + assertFalse(Panagram.isPanagram(input)); + assertFalse(Panagram.isPanagramWithStreams(input)); + } + + @Test + public void givenPanagram_isPerfectPanagram_shouldReturnFailure() { + String input = "Two driven jocks help fax my big quiz"; + assertFalse(Panagram.isPerfectPanagram(input)); + } + +} From 34b90a33aac7df4feae5867355d72bb54ed4a045 Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Thu, 3 Jan 2019 14:15:43 +0100 Subject: [PATCH 119/271] BAEL-2483 --- .../java/com/baeldung/annotation/MyBean.java | 26 +++++++++++++++++++ .../com/baeldung/annotation/TestBean.java | 8 ++++++ 2 files changed, 34 insertions(+) create mode 100644 spring-core/src/main/java/com/baeldung/annotation/MyBean.java create mode 100644 spring-core/src/main/java/com/baeldung/annotation/TestBean.java diff --git a/spring-core/src/main/java/com/baeldung/annotation/MyBean.java b/spring-core/src/main/java/com/baeldung/annotation/MyBean.java new file mode 100644 index 0000000000..9a1fd3beec --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/annotation/MyBean.java @@ -0,0 +1,26 @@ +package com.baeldung.annotation; + +import org.springframework.stereotype.Component; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; + +@Component +public class MyBean { + + private final TestBean testBean; + + public MyBean(TestBean testBean) { + this.testBean = testBean; + System.out.println("Hello from constructor"); + } + + @PostConstruct + private void postConstruct() { + System.out.println("Hello from @PostConstruct method"); + } + + @PreDestroy + public void preDestroy() { + System.out.println("Bean is being destroyed"); + } +} \ No newline at end of file diff --git a/spring-core/src/main/java/com/baeldung/annotation/TestBean.java b/spring-core/src/main/java/com/baeldung/annotation/TestBean.java new file mode 100644 index 0000000000..0539e10751 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/annotation/TestBean.java @@ -0,0 +1,8 @@ +package com.baeldung.annotation; + +import org.springframework.stereotype.Component; + +@Component +public class TestBean { + +} \ No newline at end of file From bdcc961542282c5411d2ad7e6196dccccb9e075f Mon Sep 17 00:00:00 2001 From: ramansahasi Date: Thu, 3 Jan 2019 20:19:51 +0530 Subject: [PATCH 120/271] BAEL-2392_Java_String_interview_questions second commit (#6064) --- .../string/interview/LocaleUnitTest.java | 19 +++++++++++ .../interview/StringAnagramUnitTest.java | 29 +++++++++++++++++ .../interview/StringChangeCaseUnitTest.java | 20 ++++++++++++ .../StringCountOccurrencesUnitTest.java | 28 ++++++++++++++++ .../interview/StringFormatUnitTest.java | 14 ++++++++ .../interview/StringInternUnitTest.java | 17 ++++++++++ .../interview/StringJoinerUnitTest.java | 18 +++++++++++ .../interview/StringPalindromeUnitTest.java | 29 +++++++++++++++++ .../interview/StringReverseUnitTest.java | 13 ++++++++ .../string/interview/StringSplitUnitTest.java | 32 +++++++++++++++++++ .../interview/StringToByteArrayUnitTest.java | 24 ++++++++++++++ .../interview/StringToCharArrayUnitTest.java | 17 ++++++++++ .../interview/StringToIntegerUnitTest.java | 15 +++++++++ 13 files changed, 275 insertions(+) create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/LocaleUnitTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/StringAnagramUnitTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/StringChangeCaseUnitTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/StringCountOccurrencesUnitTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/StringFormatUnitTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/StringInternUnitTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/StringJoinerUnitTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/StringPalindromeUnitTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/StringReverseUnitTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/StringSplitUnitTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/StringToByteArrayUnitTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/StringToCharArrayUnitTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/interview/StringToIntegerUnitTest.java diff --git a/java-strings/src/test/java/com/baeldung/string/interview/LocaleUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/LocaleUnitTest.java new file mode 100644 index 0000000000..1d221056fd --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/LocaleUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.string.interview; + +import java.math.BigDecimal; +import java.text.NumberFormat; +import java.util.Locale; +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class LocaleUnitTest { + @Test + public void whenUsingLocal_thenCorrectResultsForDifferentLocale() { + Locale usLocale = Locale.US; + BigDecimal number = new BigDecimal(102_300.456d); + + NumberFormat usNumberFormat = NumberFormat.getCurrencyInstance(usLocale); + assertEquals(usNumberFormat.format(number), "$102,300.46"); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/interview/StringAnagramUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/StringAnagramUnitTest.java new file mode 100644 index 0000000000..aadfade737 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/StringAnagramUnitTest.java @@ -0,0 +1,29 @@ +package com.baeldung.string.interview; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Arrays; + +import org.junit.Test; + +public class StringAnagramUnitTest { + public boolean isAnagram(String s1, String s2) { + if(s1.length() != s2.length()) + return false; + + char[] arr1 = s1.toCharArray(); + char[] arr2 = s2.toCharArray(); + + Arrays.sort(arr1); + Arrays.sort(arr2); + + return Arrays.equals(arr1, arr2); + } + + @Test + public void whenTestAnagrams_thenTestingCorrectly() { + assertThat(isAnagram("car", "arc")).isTrue(); + assertThat(isAnagram("west", "stew")).isTrue(); + assertThat(isAnagram("west", "east")).isFalse(); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/interview/StringChangeCaseUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/StringChangeCaseUnitTest.java new file mode 100644 index 0000000000..2c7ec500fe --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/StringChangeCaseUnitTest.java @@ -0,0 +1,20 @@ +package com.baeldung.string.interview; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class StringChangeCaseUnitTest { + @Test + public void givenString_whenChangingToUppercase_thenCaseChanged() { + String s = "Welcome to Baeldung!"; + assertEquals("WELCOME TO BAELDUNG!", s.toUpperCase()); + } + + + @Test + public void givenString_whenChangingToLowerrcase_thenCaseChanged() { + String s = "Welcome to Baeldung!"; + assertEquals("welcome to baeldung!", s.toLowerCase()); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/interview/StringCountOccurrencesUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/StringCountOccurrencesUnitTest.java new file mode 100644 index 0000000000..6c17643ac8 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/StringCountOccurrencesUnitTest.java @@ -0,0 +1,28 @@ +package com.baeldung.string.interview; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class StringCountOccurrencesUnitTest { + public int countOccurrences(String s, char c) { + int count = 0; + for (int i = 0; i < s.length(); i++) { + if (s.charAt(i) == c) { + count++; + } + } + return count; + } + + @Test + public void givenString_whenCountingFrequencyOfChar_thenCountCorrect() { + assertEquals(3, countOccurrences("united states", 't')); + } + + public void givenString_whenUsingJava8_thenCountingOfCharCorrect() { + String str = "united states"; + long count = str.chars().filter(ch -> (char)ch == 't').count(); + assertEquals(3, count); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/interview/StringFormatUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/StringFormatUnitTest.java new file mode 100644 index 0000000000..787017791c --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/StringFormatUnitTest.java @@ -0,0 +1,14 @@ +package com.baeldung.string.interview; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class StringFormatUnitTest { + @Test + public void givenString_whenUsingStringFormat_thenStringFormatted() { + String title = "Baeldung"; + String formatted = String.format("Title is %s", title); + assertEquals(formatted, "Title is Baeldung"); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/interview/StringInternUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/StringInternUnitTest.java new file mode 100644 index 0000000000..c5bffb7573 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/StringInternUnitTest.java @@ -0,0 +1,17 @@ +package com.baeldung.string.interview; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; + +public class StringInternUnitTest { + @Test + public void whenCallingStringIntern_thenStringsInterned() { + String s1 = "Baeldung"; + String s2 = new String("Baeldung"); + String s3 = new String("Baeldung").intern(); + + assertThat(s1 == s2).isFalse(); + assertThat(s1 == s3).isTrue(); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/interview/StringJoinerUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/StringJoinerUnitTest.java new file mode 100644 index 0000000000..d44c7478e4 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/StringJoinerUnitTest.java @@ -0,0 +1,18 @@ +package com.baeldung.string.interview; + +import java.util.StringJoiner; +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class StringJoinerUnitTest { + @Test + public void whenUsingStringJoiner_thenStringsJoined() { + StringJoiner joiner = new StringJoiner(",", "[", "]"); + joiner.add("Red") + .add("Green") + .add("Blue"); + + assertEquals(joiner.toString(), "[Red,Green,Blue]"); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/interview/StringPalindromeUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/StringPalindromeUnitTest.java new file mode 100644 index 0000000000..79ed14cd99 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/StringPalindromeUnitTest.java @@ -0,0 +1,29 @@ +package com.baeldung.string.interview; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; + +public class StringPalindromeUnitTest { + + public boolean isPalindrome(String text) { + int forward = 0; + int backward = text.length() - 1; + while (backward > forward) { + char forwardChar = text.charAt(forward++); + char backwardChar = text.charAt(backward--); + if (forwardChar != backwardChar) + return false; + } + return true; + } + + @Test + public void givenIsPalindromeMethod_whenCheckingString_thenFindIfPalindrome() { + assertThat(isPalindrome("madam")).isTrue(); + assertThat(isPalindrome("radar")).isTrue(); + assertThat(isPalindrome("level")).isTrue(); + + assertThat(isPalindrome("baeldung")).isFalse(); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/interview/StringReverseUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/StringReverseUnitTest.java new file mode 100644 index 0000000000..bb9b45dc97 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/StringReverseUnitTest.java @@ -0,0 +1,13 @@ +package com.baeldung.string.interview; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class StringReverseUnitTest { + @Test + public void whenUsingInbuildMethods_thenStringReversed() { + String reversed = new StringBuilder("baeldung").reverse().toString(); + assertEquals("gnudleab", reversed); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/interview/StringSplitUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/StringSplitUnitTest.java new file mode 100644 index 0000000000..e1cea62462 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/StringSplitUnitTest.java @@ -0,0 +1,32 @@ +package com.baeldung.string.interview; + +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; +import static org.junit.Assert.assertArrayEquals; + +public class StringSplitUnitTest { + @Test + public void givenCoreJava_whenSplittingStrings_thenSplitted() { + String expected[] = { + "john", + "peter", + "mary" + }; + + String[] splitted = "john,peter,mary".split(","); + assertArrayEquals( expected, splitted ); + } + + @Test + public void givenApacheCommons_whenSplittingStrings_thenSplitted() { + String expected[] = { + "john", + "peter", + "mary" + }; + String[] splitted = StringUtils.split("john peter mary"); + assertArrayEquals( expected, splitted ); + } + + +} diff --git a/java-strings/src/test/java/com/baeldung/string/interview/StringToByteArrayUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/StringToByteArrayUnitTest.java new file mode 100644 index 0000000000..aee4eedcd6 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/StringToByteArrayUnitTest.java @@ -0,0 +1,24 @@ +package com.baeldung.string.interview; + +import static org.junit.Assert.assertArrayEquals; + +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; + +import org.junit.Test; + +public class StringToByteArrayUnitTest { + @Test + public void whenGetBytes_thenCorrect() throws UnsupportedEncodingException { + byte[] byteArray1 = "abcd".getBytes(); + byte[] byteArray2 = "efgh".getBytes(StandardCharsets.US_ASCII); + byte[] byteArray3 = "ijkl".getBytes("UTF-8"); + byte[] expected1 = new byte[] { 97, 98, 99, 100 }; + byte[] expected2 = new byte[] { 101, 102, 103, 104 }; + byte[] expected3 = new byte[] { 105, 106, 107, 108 }; + + assertArrayEquals(expected1, byteArray1); + assertArrayEquals(expected2, byteArray2); + assertArrayEquals(expected3, byteArray3); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/interview/StringToCharArrayUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/StringToCharArrayUnitTest.java new file mode 100644 index 0000000000..1322d0fa82 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/StringToCharArrayUnitTest.java @@ -0,0 +1,17 @@ +package com.baeldung.string.interview; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; + +import org.junit.Test; + +public class StringToCharArrayUnitTest { + @Test + public void whenConvertingStringToCharArray_thenConversionSuccessful() { + String beforeConvStr = "hello"; + char[] afterConvCharArr = { 'h', 'e', 'l', 'l', 'o' }; + + assertEquals(Arrays.equals(beforeConvStr.toCharArray(), afterConvCharArr), true); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/interview/StringToIntegerUnitTest.java b/java-strings/src/test/java/com/baeldung/string/interview/StringToIntegerUnitTest.java new file mode 100644 index 0000000000..a905438a84 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/interview/StringToIntegerUnitTest.java @@ -0,0 +1,15 @@ +package com.baeldung.string.interview; + +import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; + +public class StringToIntegerUnitTest { + @Test + public void givenString_whenParsingInt_shouldConvertToInt() { + String givenString = "42"; + + int result = Integer.parseInt(givenString); + + assertThat(result).isEqualTo(42); + } +} From 4eb3f2943038f3b0635e8267b7e9a666af6281d9 Mon Sep 17 00:00:00 2001 From: Varun Jain Date: Thu, 3 Jan 2019 22:42:26 +0530 Subject: [PATCH 121/271] BAEL-2536-addressed review comments --- .../string/{Panagram.java => Pangram.java} | 21 ++++++++++--------- ...gramUnitTest.java => PangramUnitTest.java} | 20 +++++++++--------- 2 files changed, 21 insertions(+), 20 deletions(-) rename java-strings/src/main/java/com/baeldung/string/{Panagram.java => Pangram.java} (71%) rename java-strings/src/test/java/com/baeldung/string/{PanagramUnitTest.java => PangramUnitTest.java} (61%) diff --git a/java-strings/src/main/java/com/baeldung/string/Panagram.java b/java-strings/src/main/java/com/baeldung/string/Pangram.java similarity index 71% rename from java-strings/src/main/java/com/baeldung/string/Panagram.java rename to java-strings/src/main/java/com/baeldung/string/Pangram.java index d000b4455e..48e31b2157 100644 --- a/java-strings/src/main/java/com/baeldung/string/Panagram.java +++ b/java-strings/src/main/java/com/baeldung/string/Pangram.java @@ -6,12 +6,13 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; -public class Panagram { +public class Pangram { + private static final int ALPHABET_COUNT = 26; public static boolean isPanagram(String str) { if (str == null) return false; - Boolean[] alphabetMarker = new Boolean[26]; + Boolean[] alphabetMarker = new Boolean[ALPHABET_COUNT]; Arrays.fill(alphabetMarker, false); int alphabetIndex = 0; str = str.toUpperCase(); @@ -33,13 +34,13 @@ public class Panagram { return false; // filtered character stream - str = str.toUpperCase(); - Stream filteredCharStream = str.chars() - .filter(item -> ((item >= 'A' && item <= 'Z') || (item >= 'a' && item <= 'z'))) + String strUpper = str.toUpperCase(); + Stream filteredCharStream = strUpper.chars() + .filter(item -> ((item >= 'A' && item <= 'Z'))) .mapToObj(c -> (char) c); Map alphabetMap = filteredCharStream.collect(Collectors.toMap(item -> item, k -> Boolean.TRUE, (p1, p2) -> p1)); - return (alphabetMap.size() == 26); + return (alphabetMap.size() == ALPHABET_COUNT); } public static boolean isPerfectPanagram(String str) { @@ -47,13 +48,13 @@ public class Panagram { return false; // filtered character stream - str = str.toUpperCase(); - Stream filteredCharStream = str.chars() - .filter(item -> ((item >= 'A' && item <= 'Z') || (item >= 'a' && item <= 'z'))) + String strUpper = str.toUpperCase(); + Stream filteredCharStream = strUpper.chars() + .filter(item -> ((item >= 'A' && item <= 'Z'))) .mapToObj(c -> (char) c); Map alphabetFrequencyMap = filteredCharStream.collect(Collectors.groupingBy(Function.identity(), Collectors.counting())); - return (alphabetFrequencyMap.size() == 26 && alphabetFrequencyMap.values() + return (alphabetFrequencyMap.size() == ALPHABET_COUNT && alphabetFrequencyMap.values() .stream() .allMatch(item -> item == 1)); } diff --git a/java-strings/src/test/java/com/baeldung/string/PanagramUnitTest.java b/java-strings/src/test/java/com/baeldung/string/PangramUnitTest.java similarity index 61% rename from java-strings/src/test/java/com/baeldung/string/PanagramUnitTest.java rename to java-strings/src/test/java/com/baeldung/string/PangramUnitTest.java index 81d46956e2..150f27d7c0 100644 --- a/java-strings/src/test/java/com/baeldung/string/PanagramUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/string/PangramUnitTest.java @@ -5,40 +5,40 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; -public class PanagramUnitTest { +public class PangramUnitTest { @Test public void givenValidString_isPanagram_shouldReturnSuccess() { String input = "Two driven jocks help fax my big quiz"; - assertTrue(Panagram.isPanagram(input)); - assertTrue(Panagram.isPanagramWithStreams(input)); + assertTrue(Pangram.isPanagram(input)); + assertTrue(Pangram.isPanagramWithStreams(input)); } @Test public void givenNullString_isPanagram_shouldReturnFailure() { String input = null; - assertFalse(Panagram.isPanagram(input)); - assertFalse(Panagram.isPanagramWithStreams(input)); - assertFalse(Panagram.isPerfectPanagram(input)); + assertFalse(Pangram.isPanagram(input)); + assertFalse(Pangram.isPanagramWithStreams(input)); + assertFalse(Pangram.isPerfectPanagram(input)); } @Test public void givenPerfectPanagramString_isPerfectPanagram_shouldReturnSuccess() { String input = "abcdefghijklmNoPqrStuVwxyz"; - assertTrue(Panagram.isPerfectPanagram(input)); + assertTrue(Pangram.isPerfectPanagram(input)); } @Test public void givenNonPanagramString_isPanagram_shouldReturnFailure() { String input = "invalid panagram"; - assertFalse(Panagram.isPanagram(input)); - assertFalse(Panagram.isPanagramWithStreams(input)); + assertFalse(Pangram.isPanagram(input)); + assertFalse(Pangram.isPanagramWithStreams(input)); } @Test public void givenPanagram_isPerfectPanagram_shouldReturnFailure() { String input = "Two driven jocks help fax my big quiz"; - assertFalse(Panagram.isPerfectPanagram(input)); + assertFalse(Pangram.isPerfectPanagram(input)); } } From 693da95f44bdd66609acc103824ad49b38f91141 Mon Sep 17 00:00:00 2001 From: Varun Jain Date: Thu, 3 Jan 2019 22:44:52 +0530 Subject: [PATCH 122/271] BAEL-2536-updated Panagram to Pangram --- .../main/java/com/baeldung/string/Pangram.java | 10 +++++----- .../com/baeldung/string/PangramUnitTest.java | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/java-strings/src/main/java/com/baeldung/string/Pangram.java b/java-strings/src/main/java/com/baeldung/string/Pangram.java index 48e31b2157..8498a7074a 100644 --- a/java-strings/src/main/java/com/baeldung/string/Pangram.java +++ b/java-strings/src/main/java/com/baeldung/string/Pangram.java @@ -9,7 +9,7 @@ import java.util.stream.Stream; public class Pangram { private static final int ALPHABET_COUNT = 26; - public static boolean isPanagram(String str) { + public static boolean isPangram(String str) { if (str == null) return false; Boolean[] alphabetMarker = new Boolean[ALPHABET_COUNT]; @@ -29,10 +29,10 @@ public class Pangram { return true; } - public static boolean isPanagramWithStreams(String str) { + public static boolean isPangramWithStreams(String str) { if (str == null) return false; - + // filtered character stream String strUpper = str.toUpperCase(); Stream filteredCharStream = strUpper.chars() @@ -43,10 +43,10 @@ public class Pangram { return (alphabetMap.size() == ALPHABET_COUNT); } - public static boolean isPerfectPanagram(String str) { + public static boolean isPerfectPangram(String str) { if (str == null) return false; - + // filtered character stream String strUpper = str.toUpperCase(); Stream filteredCharStream = strUpper.chars() diff --git a/java-strings/src/test/java/com/baeldung/string/PangramUnitTest.java b/java-strings/src/test/java/com/baeldung/string/PangramUnitTest.java index 150f27d7c0..67523a4524 100644 --- a/java-strings/src/test/java/com/baeldung/string/PangramUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/string/PangramUnitTest.java @@ -10,35 +10,35 @@ public class PangramUnitTest { @Test public void givenValidString_isPanagram_shouldReturnSuccess() { String input = "Two driven jocks help fax my big quiz"; - assertTrue(Pangram.isPanagram(input)); - assertTrue(Pangram.isPanagramWithStreams(input)); + assertTrue(Pangram.isPangram(input)); + assertTrue(Pangram.isPangramWithStreams(input)); } @Test public void givenNullString_isPanagram_shouldReturnFailure() { String input = null; - assertFalse(Pangram.isPanagram(input)); - assertFalse(Pangram.isPanagramWithStreams(input)); - assertFalse(Pangram.isPerfectPanagram(input)); + assertFalse(Pangram.isPangram(input)); + assertFalse(Pangram.isPangramWithStreams(input)); + assertFalse(Pangram.isPerfectPangram(input)); } @Test public void givenPerfectPanagramString_isPerfectPanagram_shouldReturnSuccess() { String input = "abcdefghijklmNoPqrStuVwxyz"; - assertTrue(Pangram.isPerfectPanagram(input)); + assertTrue(Pangram.isPerfectPangram(input)); } @Test public void givenNonPanagramString_isPanagram_shouldReturnFailure() { String input = "invalid panagram"; - assertFalse(Pangram.isPanagram(input)); - assertFalse(Pangram.isPanagramWithStreams(input)); + assertFalse(Pangram.isPangram(input)); + assertFalse(Pangram.isPangramWithStreams(input)); } @Test public void givenPanagram_isPerfectPanagram_shouldReturnFailure() { String input = "Two driven jocks help fax my big quiz"; - assertFalse(Pangram.isPerfectPanagram(input)); + assertFalse(Pangram.isPerfectPangram(input)); } } From cd3f0fcb1f1a4e782a470ad66da197be0a2aab1b Mon Sep 17 00:00:00 2001 From: Dhananjay Singh Date: Fri, 4 Jan 2019 05:10:26 +0530 Subject: [PATCH 123/271] BAEL-2391 Two pointer technique * two pointer technique * Corrected two sum * Changed asserts in unit test --- .../LinkedListFindMiddle.java | 16 ++++++ .../twopointertechnique/MyNode.java | 20 +++++++ .../twopointertechnique/RotateArray.java | 22 ++++++++ .../twopointertechnique/TwoSum.java | 38 +++++++++++++ .../LinkedListFindMiddleUnitTest.java | 37 ++++++++++++ .../RotateArrayUnitTest.java | 26 +++++++++ .../twopointertechnique/TwoSumUnitTest.java | 56 +++++++++++++++++++ 7 files changed, 215 insertions(+) create mode 100644 algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/LinkedListFindMiddle.java create mode 100644 algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/MyNode.java create mode 100644 algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/RotateArray.java create mode 100644 algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/TwoSum.java create mode 100644 algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/twopointertechnique/LinkedListFindMiddleUnitTest.java create mode 100644 algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/twopointertechnique/RotateArrayUnitTest.java create mode 100644 algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/twopointertechnique/TwoSumUnitTest.java diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/LinkedListFindMiddle.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/LinkedListFindMiddle.java new file mode 100644 index 0000000000..a7031f4fba --- /dev/null +++ b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/LinkedListFindMiddle.java @@ -0,0 +1,16 @@ +package com.baeldung.algorithms.twopointertechnique; + +public class LinkedListFindMiddle { + + public T findMiddle(MyNode head) { + MyNode slowPointer = head; + MyNode fastPointer = head; + + while (fastPointer.next != null && fastPointer.next.next != null) { + fastPointer = fastPointer.next.next; + slowPointer = slowPointer.next; + } + return slowPointer.data; + } + +} diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/MyNode.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/MyNode.java new file mode 100644 index 0000000000..7d93f03ef9 --- /dev/null +++ b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/MyNode.java @@ -0,0 +1,20 @@ +package com.baeldung.algorithms.twopointertechnique; + +public class MyNode { + MyNode next; + E data; + + public MyNode(E value) { + data = value; + next = null; + } + + public MyNode(E value, MyNode n) { + data = value; + next = n; + } + + public void setNext(MyNode n) { + next = n; + } +} diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/RotateArray.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/RotateArray.java new file mode 100644 index 0000000000..b4e3698c01 --- /dev/null +++ b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/RotateArray.java @@ -0,0 +1,22 @@ +package com.baeldung.algorithms.twopointertechnique; + +public class RotateArray { + + public void rotate(int[] input, int step) { + step %= input.length; + reverse(input, 0, input.length - 1); + reverse(input, 0, step - 1); + reverse(input, step, input.length - 1); + } + + private void reverse(int[] input, int start, int end) { + while (start < end) { + int temp = input[start]; + input[start] = input[end]; + input[end] = temp; + start++; + end--; + } + } + +} diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/TwoSum.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/TwoSum.java new file mode 100644 index 0000000000..14eceaa1bd --- /dev/null +++ b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/twopointertechnique/TwoSum.java @@ -0,0 +1,38 @@ +package com.baeldung.algorithms.twopointertechnique; + +public class TwoSum { + + public boolean twoSum(int[] input, int targetValue) { + + int pointerOne = 0; + int pointerTwo = input.length - 1; + + while (pointerOne < pointerTwo) { + int sum = input[pointerOne] + input[pointerTwo]; + + if (sum == targetValue) { + return true; + } else if (sum < targetValue) { + pointerOne++; + } else { + pointerTwo--; + } + } + + return false; + } + + public boolean twoSumSlow(int[] input, int targetValue) { + + for (int i = 0; i < input.length; i++) { + for (int j = 1; j < input.length; j++) { + if (input[i] + input[j] == targetValue) { + return true; + } + } + } + + return false; + } + +} diff --git a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/twopointertechnique/LinkedListFindMiddleUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/twopointertechnique/LinkedListFindMiddleUnitTest.java new file mode 100644 index 0000000000..422a53fa3e --- /dev/null +++ b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/twopointertechnique/LinkedListFindMiddleUnitTest.java @@ -0,0 +1,37 @@ +package com.baeldung.algorithms.twopointertechnique; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; + +public class LinkedListFindMiddleUnitTest { + + LinkedListFindMiddle linkedListFindMiddle = new LinkedListFindMiddle(); + + @Test + public void givenLinkedListOfMyNodes_whenLinkedListFindMiddle_thenCorrect() { + + MyNode head = createNodesList(8); + + assertThat(linkedListFindMiddle.findMiddle(head)).isEqualTo("4"); + + head = createNodesList(9); + + assertThat(linkedListFindMiddle.findMiddle(head)).isEqualTo("5"); + } + + private static MyNode createNodesList(int n) { + + MyNode head = new MyNode("1"); + MyNode current = head; + + for (int i = 2; i <= n; i++) { + MyNode newNode = new MyNode(String.valueOf(i)); + current.setNext(newNode); + current = newNode; + } + + return head; + } + +} diff --git a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/twopointertechnique/RotateArrayUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/twopointertechnique/RotateArrayUnitTest.java new file mode 100644 index 0000000000..da227ae751 --- /dev/null +++ b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/twopointertechnique/RotateArrayUnitTest.java @@ -0,0 +1,26 @@ +package com.baeldung.algorithms.twopointertechnique; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; + +public class RotateArrayUnitTest { + + private RotateArray rotateArray = new RotateArray(); + + private int[] inputArray; + + private int step; + + @Test + public void givenAnArrayOfIntegers_whenRotateKsteps_thenCorrect() { + + inputArray = new int[] { 1, 2, 3, 4, 5, 6, 7 }; + step = 4; + + rotateArray.rotate(inputArray, step); + + assertThat(inputArray).containsExactly(new int[] { 4, 5, 6, 7, 1, 2, 3 }); + } + +} diff --git a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/twopointertechnique/TwoSumUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/twopointertechnique/TwoSumUnitTest.java new file mode 100644 index 0000000000..aa76f8e1cf --- /dev/null +++ b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/twopointertechnique/TwoSumUnitTest.java @@ -0,0 +1,56 @@ +package com.baeldung.algorithms.twopointertechnique; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class TwoSumUnitTest { + + private TwoSum twoSum = new TwoSum(); + + private int[] sortedArray; + + private int targetValue; + + @Test + public void givenASortedArrayOfIntegers_whenTwoSumSlow_thenPairExists() { + + sortedArray = new int[] { 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9 }; + + targetValue = 12; + + assertTrue(twoSum.twoSumSlow(sortedArray, targetValue)); + } + + @Test + public void givenASortedArrayOfIntegers_whenTwoSumSlow_thenPairDoesNotExists() { + + sortedArray = new int[] { 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9 }; + + targetValue = 20; + + assertFalse(twoSum.twoSumSlow(sortedArray, targetValue)); + } + + @Test + public void givenASortedArrayOfIntegers_whenTwoSum_thenPairExists() { + + sortedArray = new int[] { 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9 }; + + targetValue = 12; + + assertTrue(twoSum.twoSum(sortedArray, targetValue)); + } + + @Test + public void givenASortedArrayOfIntegers_whenTwoSum_thenPairDoesNotExists() { + + sortedArray = new int[] { 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9 }; + + targetValue = 20; + + assertFalse(twoSum.twoSum(sortedArray, targetValue)); + } + +} From b62edd2503d91dca0096f7a39379bb03f7cdbbf7 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:16:51 +0530 Subject: [PATCH 124/271] backlink added --- core-kotlin/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-kotlin/README.md b/core-kotlin/README.md index 05f07e7e7e..de989ce141 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -47,3 +47,4 @@ - [Dependency Injection for Kotlin with Injekt](https://www.baeldung.com/kotlin-dependency-injection-with-injekt) - [Implementing a Binary Tree in Kotlin](https://www.baeldung.com/kotlin-binary-tree) - [Generate a Random Alphanumeric String in Kotlin](https://www.baeldung.com/kotlin-random-alphanumeric-string) +- [Kotlin Contracts](https://www.baeldung.com/kotlin-contracts) From 8d3e2c9b0791cc48dc9c5141974d2f792eb16983 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:20:24 +0530 Subject: [PATCH 125/271] backlink added --- core-kotlin/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-kotlin/README.md b/core-kotlin/README.md index de989ce141..609a30a1a8 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -48,3 +48,4 @@ - [Implementing a Binary Tree in Kotlin](https://www.baeldung.com/kotlin-binary-tree) - [Generate a Random Alphanumeric String in Kotlin](https://www.baeldung.com/kotlin-random-alphanumeric-string) - [Kotlin Contracts](https://www.baeldung.com/kotlin-contracts) +- [Operator Overloading in Kotlin](https://www.baeldung.com/kotlin-operator-overloading) From 58ddffc6cb344776aee93a625bf9804068934a7d Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:24:15 +0530 Subject: [PATCH 126/271] backlink-added --- persistence-modules/hibernate5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index e973907248..d1ebff1d8a 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -24,3 +24,4 @@ - [Hibernate 5 Bootstrapping API](https://www.baeldung.com/hibernate-5-bootstrapping-api) - [Criteria Queries Using JPA Metamodel](https://www.baeldung.com/hibernate-criteria-queries-metamodel) - [Guide to the Hibernate EntityManager](https://www.baeldung.com/hibernate-entitymanager) +- [Get All Data from a Table with Hibernate](https://www.baeldung.com/hibernate-select-all) From b2d0f6cc832bb310028d755f4dc45f3e8df9fb1c Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:26:20 +0530 Subject: [PATCH 127/271] backlink added --- java-strings/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java-strings/README.md b/java-strings/README.md index fa048dbb5a..a86f6e73c3 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -46,4 +46,5 @@ - [Replace a Character at a Specific Index in a String in Java](https://www.baeldung.com/java-replace-character-at-index) - [Convert a Comma Separated String to a List in Java](https://www.baeldung.com/java-string-with-separator-to-list) - [Guide to java.util.Formatter](http://www.baeldung.com/java-string-formatter) -- [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) \ No newline at end of file +- [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) +- [Remove Leading and Trailing Characters from a String](https://www.baeldung.com/java-remove-trailing-characters) From 703890941d21986f26504f52eea68484446c960a Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:28:11 +0530 Subject: [PATCH 128/271] back-link added --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index 03b77186b0..5aee69d9a9 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -45,3 +45,4 @@ - [Guide to Character Encoding](https://www.baeldung.com/java-char-encoding) - [Graphs in Java](https://www.baeldung.com/java-graphs) - [Console I/O in Java](http://www.baeldung.com/java-console-input-output) +- [Formatting with printf() in Java](https://www.baeldung.com/java-printstream-printf) From 48f3db9713b4797973df4092e1500f1d5d315aed Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:30:45 +0530 Subject: [PATCH 129/271] back-link added --- java-collections-maps/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-collections-maps/README.md b/java-collections-maps/README.md index 0b76ca1959..b4ab270448 100644 --- a/java-collections-maps/README.md +++ b/java-collections-maps/README.md @@ -18,3 +18,4 @@ - [Merging Two Maps with Java 8](https://www.baeldung.com/java-merge-maps) - [How to Check If a Key Exists in a Map](https://www.baeldung.com/java-map-key-exists) - [Comparing Two HashMaps in Java](https://www.baeldung.com/java-compare-hashmaps) +- [Immutable Map Implementations in Java](https://www.baeldung.com/java-immutable-maps) From e20cf9ac43a05ae558d68aba8cf031c0cd459264 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:32:02 +0530 Subject: [PATCH 130/271] back-link added --- algorithms-miscellaneous-1/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/algorithms-miscellaneous-1/README.md b/algorithms-miscellaneous-1/README.md index a725bbd141..59765588b0 100644 --- a/algorithms-miscellaneous-1/README.md +++ b/algorithms-miscellaneous-1/README.md @@ -12,4 +12,5 @@ - [Check If a String Contains All The Letters of The Alphabet](https://www.baeldung.com/java-string-contains-all-letters) - [Find the Middle Element of a Linked List](http://www.baeldung.com/java-linked-list-middle-element) - [Calculate Factorial in Java](https://www.baeldung.com/java-calculate-factorial) -- [Find Substrings That Are Palindromes in Java](https://www.baeldung.com/java-palindrome-substrings) \ No newline at end of file +- [Find Substrings That Are Palindromes in Java](https://www.baeldung.com/java-palindrome-substrings) +- [Find the Longest Substring without Repeating Characters](https://www.baeldung.com/java-longest-substring-without-repeated-characters) From 129630109b387ace7543e0d000d7bdd9d2ff5d7d Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:35:15 +0530 Subject: [PATCH 131/271] back-link added --- persistence-modules/hibernate5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index d1ebff1d8a..5f826eec73 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -25,3 +25,4 @@ - [Criteria Queries Using JPA Metamodel](https://www.baeldung.com/hibernate-criteria-queries-metamodel) - [Guide to the Hibernate EntityManager](https://www.baeldung.com/hibernate-entitymanager) - [Get All Data from a Table with Hibernate](https://www.baeldung.com/hibernate-select-all) +- [One-to-One Relationship in JPA](https://www.baeldung.com/jpa-one-to-one) From c91211b4e67841dac61be31bd823f3a7831103a9 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:36:49 +0530 Subject: [PATCH 132/271] back-link added --- persistence-modules/hibernate5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index 5f826eec73..fbcf1c94bb 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -26,3 +26,4 @@ - [Guide to the Hibernate EntityManager](https://www.baeldung.com/hibernate-entitymanager) - [Get All Data from a Table with Hibernate](https://www.baeldung.com/hibernate-select-all) - [One-to-One Relationship in JPA](https://www.baeldung.com/jpa-one-to-one) +- [Hibernate Named Query](https://www.baeldung.com/hibernate-named-query) From ca08f5ff9d0c1c2c2502e501aa9d57927e65562d Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:38:08 +0530 Subject: [PATCH 133/271] back-link added --- spring-5-reactive/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-5-reactive/README.md b/spring-5-reactive/README.md index 2a4ee017f4..c39bb616f8 100644 --- a/spring-5-reactive/README.md +++ b/spring-5-reactive/README.md @@ -18,3 +18,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Validation for Functional Endpoints in Spring 5](https://www.baeldung.com/spring-functional-endpoints-validation) - [Logging a Reactive Sequence](https://www.baeldung.com/spring-reactive-sequence-logging) - [Testing Reactive Streams Using StepVerifier and TestPublisher](https://www.baeldung.com/reactive-streams-step-verifier-test-publisher) +- [Debugging Reactive Streams in Spring 5](https://www.baeldung.com/spring-debugging-reactive-streams) From 52269334d931b748fbb0e338cbfdf2394487050f Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:41:30 +0530 Subject: [PATCH 134/271] back-link added --- java-streams/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-streams/README.md b/java-streams/README.md index 2550f08650..33ca2619a8 100644 --- a/java-streams/README.md +++ b/java-streams/README.md @@ -14,3 +14,4 @@ - [Primitive Type Streams in Java 8](http://www.baeldung.com/java-8-primitive-streams) - [Stream Ordering in Java](https://www.baeldung.com/java-stream-ordering) - [Introduction to Protonpack](https://www.baeldung.com/java-protonpack) +- [Java Stream Filter with Lambda Expression](https://www.baeldung.com/java-stream-filter-lambda) From 45924c75ead9d0add259a42b2ad6927440aaece5 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:42:37 +0530 Subject: [PATCH 135/271] backlink added --- persistence-modules/hibernate5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index fbcf1c94bb..512370e853 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -27,3 +27,4 @@ - [Get All Data from a Table with Hibernate](https://www.baeldung.com/hibernate-select-all) - [One-to-One Relationship in JPA](https://www.baeldung.com/jpa-one-to-one) - [Hibernate Named Query](https://www.baeldung.com/hibernate-named-query) +- [Using c3p0 with Hibernate](https://www.baeldung.com/hibernate-c3p0) From c5ddf0178f658ac74cd6e5c6f625722b7f824be9 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:44:10 +0530 Subject: [PATCH 136/271] backlink added --- spring-boot-ops/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-ops/README.md b/spring-boot-ops/README.md index c125c96c36..553b02ebf0 100644 --- a/spring-boot-ops/README.md +++ b/spring-boot-ops/README.md @@ -9,4 +9,4 @@ - [Shutdown a Spring Boot Application](http://www.baeldung.com/spring-boot-shutdown) - [Spring Boot Console Application](http://www.baeldung.com/spring-boot-console-app) - [Comparing Embedded Servlet Containers in Spring Boot](http://www.baeldung.com/spring-boot-servlet-containers) - + - [Programmatically Restarting a Spring Boot Application](https://www.baeldung.com/java-restart-spring-boot-app) From 83795f942119caae01148be5417690a0d6d8cc81 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:46:02 +0530 Subject: [PATCH 137/271] Backlink added --- persistence-modules/spring-data-jpa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/spring-data-jpa/README.md b/persistence-modules/spring-data-jpa/README.md index 3c71600565..976a692699 100644 --- a/persistence-modules/spring-data-jpa/README.md +++ b/persistence-modules/spring-data-jpa/README.md @@ -18,6 +18,7 @@ - [Limiting Query Results with JPA and Spring Data JPA](https://www.baeldung.com/jpa-limit-query-results) - [Sorting Query Results with Spring Data](https://www.baeldung.com/spring-data-sorting) - [INSERT Statement in JPA](https://www.baeldung.com/jpa-insert) +- [Pagination and Sorting using Spring Data JPA](https://www.baeldung.com/spring-data-jpa-pagination-sorting) ### Eclipse Config After importing the project into Eclipse, you may see the following error: From 25eed099f34cb085a08b4a2a027677fb36051b60 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:47:44 +0530 Subject: [PATCH 138/271] backlink added --- core-kotlin/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-kotlin/README.md b/core-kotlin/README.md index 609a30a1a8..0ce4b74d91 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -49,3 +49,4 @@ - [Generate a Random Alphanumeric String in Kotlin](https://www.baeldung.com/kotlin-random-alphanumeric-string) - [Kotlin Contracts](https://www.baeldung.com/kotlin-contracts) - [Operator Overloading in Kotlin](https://www.baeldung.com/kotlin-operator-overloading) +- [Inline Classes in Kotlin](https://www.baeldung.com/kotlin-inline-classes) From 1c120d1886b8399f8ce9c2d287d3b25c09245fa0 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:49:44 +0530 Subject: [PATCH 139/271] backlink added --- core-java-11/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-11/README.md b/core-java-11/README.md index 181ada3f45..c8039f4bc5 100644 --- a/core-java-11/README.md +++ b/core-java-11/README.md @@ -2,4 +2,4 @@ - [Java 11 Single File Source Code](https://www.baeldung.com/java-single-file-source-code) - [Java 11 Local Variable Syntax for Lambda Parameters](https://www.baeldung.com/java-var-lambda-params) - +- [Java 11 String API Additions](https://www.baeldung.com/java-11-string-api) From cd5d9da8c072a9bf86d2552d0a36cac7c415cca1 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:53:20 +0530 Subject: [PATCH 140/271] Backlink added --- lombok-custom/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 lombok-custom/README.md diff --git a/lombok-custom/README.md b/lombok-custom/README.md new file mode 100644 index 0000000000..bfc784ea7e --- /dev/null +++ b/lombok-custom/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Implementing a Custom Lombok Annotation](https://www.baeldung.com/lombok-custom-annotation) From c8fcad8b6a0bda2fae75090d0171e7799921e2b8 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:54:37 +0530 Subject: [PATCH 141/271] backlink added --- core-java-arrays/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-arrays/README.md b/core-java-arrays/README.md index 56110585ac..400dd7793c 100644 --- a/core-java-arrays/README.md +++ b/core-java-arrays/README.md @@ -13,3 +13,4 @@ - [How to Invert an Array in Java](http://www.baeldung.com/java-invert-array) - [Array Operations in Java](http://www.baeldung.com/java-common-array-operations) - [Intersection Between two Integer Arrays](https://www.baeldung.com/java-array-intersection) +- [Sorting Arrays in Java](https://www.baeldung.com/java-sorting-arrays) From e67486cf739cf245ede5757332bc84c340e6c6b3 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:55:40 +0530 Subject: [PATCH 142/271] backlink added --- gson/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/gson/README.md b/gson/README.md index e1eb155f43..4edd7158d4 100644 --- a/gson/README.md +++ b/gson/README.md @@ -9,3 +9,4 @@ - [Exclude Fields from Serialization in Gson](http://www.baeldung.com/gson-exclude-fields-serialization) - [Save Data to a JSON File with Gson](https://www.baeldung.com/gson-save-file) - [Convert JSON to a Map Using Gson](https://www.baeldung.com/gson-json-to-map) +- [Working with Primitive Values in Gson](https://www.baeldung.com/java-gson-primitives) From e67dae8b6b0483791aab0a1c7e151a2a91bdf6c1 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:56:40 +0530 Subject: [PATCH 143/271] backlink added --- jee-7/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/jee-7/README.md b/jee-7/README.md index a2493e561b..a783e7860e 100644 --- a/jee-7/README.md +++ b/jee-7/README.md @@ -5,3 +5,4 @@ - [Introduction to JAX-WS](http://www.baeldung.com/jax-ws) - [A Guide to Java EE Web-Related Annotations](http://www.baeldung.com/javaee-web-annotations) - [Introduction to Testing with Arquillian](http://www.baeldung.com/arquillian) +- [Java EE 7 Batch Processing](https://www.baeldung.com/java-ee-7-batch-processing) From c31163f54f5ecd7dfd79ced4c761b5dbf28168a9 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:57:55 +0530 Subject: [PATCH 144/271] backlink added --- core-kotlin/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-kotlin/README.md b/core-kotlin/README.md index 0ce4b74d91..225ad87e87 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -50,3 +50,4 @@ - [Kotlin Contracts](https://www.baeldung.com/kotlin-contracts) - [Operator Overloading in Kotlin](https://www.baeldung.com/kotlin-operator-overloading) - [Inline Classes in Kotlin](https://www.baeldung.com/kotlin-inline-classes) +- [Creating Java static final Equivalents in Kotlin](https://www.baeldung.com/kotlin-java-static-final) From 5e7ca37b760c7e570ede5b0f1cd25bf103d6007d Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:58:56 +0530 Subject: [PATCH 145/271] Backlink added --- spring-cloud/spring-cloud-kubernetes/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-cloud/spring-cloud-kubernetes/README.md b/spring-cloud/spring-cloud-kubernetes/README.md index 295ead1c2f..2387758626 100644 --- a/spring-cloud/spring-cloud-kubernetes/README.md +++ b/spring-cloud/spring-cloud-kubernetes/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Running Spring Boot Applications With Minikube](https://www.baeldung.com/spring-boot-minikube) +- [Self-Healing Applications with Kubernetes and Spring Boot](https://www.baeldung.com/spring-boot-kubernetes-self-healing-apps) From eaa57758366e7d08d788929b59528fa112179824 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 18:00:24 +0530 Subject: [PATCH 146/271] backlink added --- persistence-modules/hibernate5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index 512370e853..03bdd9b759 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -28,3 +28,4 @@ - [One-to-One Relationship in JPA](https://www.baeldung.com/jpa-one-to-one) - [Hibernate Named Query](https://www.baeldung.com/hibernate-named-query) - [Using c3p0 with Hibernate](https://www.baeldung.com/hibernate-c3p0) +- [Persist a JSON Object Using Hibernate](https://www.baeldung.com/hibernate-persist-json-object) From 6afe91c171f28aa0c6f70e2afc9c2252b82652e3 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 18:01:35 +0530 Subject: [PATCH 147/271] backlink added --- core-java-collections/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index 1a90d01a82..f549adaa4f 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -30,3 +30,4 @@ - [Join and Split Arrays and Collections in Java](http://www.baeldung.com/java-join-and-split) - [A Guide to EnumMap](https://www.baeldung.com/java-enum-map) - [A Guide to Iterator in Java](http://www.baeldung.com/java-iterator) +- [Intersection of Two Lists in Java](https://www.baeldung.com/java-lists-intersection) From 8b2af060dfb5befd3c2d0423aee9052f5d707b81 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 18:03:13 +0530 Subject: [PATCH 148/271] backlink added --- akka-http/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 akka-http/README.md diff --git a/akka-http/README.md b/akka-http/README.md new file mode 100644 index 0000000000..3831b5079f --- /dev/null +++ b/akka-http/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Introduction to Akka HTTP](https://www.baeldung.com/akka-http) From 35744e704426ddc034a5248c62c912e243c02722 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 18:04:15 +0530 Subject: [PATCH 149/271] backlink added --- core-java-collections/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index f549adaa4f..bde0f9fdb9 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -31,3 +31,4 @@ - [A Guide to EnumMap](https://www.baeldung.com/java-enum-map) - [A Guide to Iterator in Java](http://www.baeldung.com/java-iterator) - [Intersection of Two Lists in Java](https://www.baeldung.com/java-lists-intersection) +- [Differences Between HashMap and Hashtable](https://www.baeldung.com/hashmap-hashtable-differences) From dd45e825d455ffa6d5d41869f144030202feb576 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Fri, 4 Jan 2019 18:06:27 +0530 Subject: [PATCH 150/271] backlink added --- java-strings/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-strings/README.md b/java-strings/README.md index a86f6e73c3..08fbec35ab 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -48,3 +48,4 @@ - [Guide to java.util.Formatter](http://www.baeldung.com/java-string-formatter) - [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) - [Remove Leading and Trailing Characters from a String](https://www.baeldung.com/java-remove-trailing-characters) +- [Concatenating Strings In Java](https://www.baeldung.com/java-strings-concatenation) From d5ab82475deb7e451db519bfbd37092f1e6f6f5b Mon Sep 17 00:00:00 2001 From: Olaniyi Anjola Date: Fri, 4 Jan 2019 11:44:24 -0500 Subject: [PATCH 151/271] BAEL-2452: Using curl from Java (#6043) * BAEL-2452: Using curl from Java * A re-do of the examples using tests, instead of main class * Fix un-used variable --- .../baeldung/curltojava/JavaCurlExamples.java | 29 ++++++++++ .../curltojava/JavaCurlExamplesUnitTest.java | 55 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/curltojava/JavaCurlExamples.java create mode 100644 core-java/src/test/java/com/baeldung/curltojava/JavaCurlExamplesUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/curltojava/JavaCurlExamples.java b/core-java/src/main/java/com/baeldung/curltojava/JavaCurlExamples.java new file mode 100644 index 0000000000..166b0ecb13 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/curltojava/JavaCurlExamples.java @@ -0,0 +1,29 @@ +package com.baeldung.curltojava; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class JavaCurlExamples { + + public static String inputStreamToString(InputStream inputStream) { + final int bufferSize = 8 * 1024; + byte[] buffer = new byte[bufferSize]; + final StringBuilder builder = new StringBuilder(); + try (BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, bufferSize)) { + while (bufferedInputStream.read(buffer) != -1) { + builder.append(new String(buffer)); + } + } catch (IOException ex) { + Logger.getLogger(JavaCurlExamples.class.getName()).log(Level.SEVERE, null, ex); + } + return builder.toString(); + } + + public static void consumeInputStream(InputStream inputStream) { + inputStreamToString(inputStream); + } + +} diff --git a/core-java/src/test/java/com/baeldung/curltojava/JavaCurlExamplesUnitTest.java b/core-java/src/test/java/com/baeldung/curltojava/JavaCurlExamplesUnitTest.java new file mode 100644 index 0000000000..4e82059f2b --- /dev/null +++ b/core-java/src/test/java/com/baeldung/curltojava/JavaCurlExamplesUnitTest.java @@ -0,0 +1,55 @@ +package com.baeldung.curltojava; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.Assert; +import org.junit.Test; + +public class JavaCurlExamplesUnitTest { + + + @Test + public void givenCommand_whenCalled_thenProduceZeroExitCode() throws IOException { + String command = "curl --location --request GET \"https://postman-echo.com/get?foo1=bar1&foo2=bar2\""; + ProcessBuilder processBuilder = new ProcessBuilder(command.replaceAll("\"", "").split(" ")); + processBuilder.directory(new File("/home/")); + Process process = processBuilder.start(); + InputStream inputStream = process.getInputStream(); + // Consume the inputStream so the process can exit + JavaCurlExamples.consumeInputStream(inputStream); + int exitCode = process.exitValue(); + + Assert.assertEquals(0, exitCode); + } + + @Test + public void givenNewCommands_whenCalled_thenCheckIfIsAlive() throws IOException { + String command = "curl --location --request GET \"https://postman-echo.com/get?foo1=bar1&foo2=bar2\""; + ProcessBuilder processBuilder = new ProcessBuilder(command.replaceAll("\"", "").split(" ")); + processBuilder.directory(new File("/home/")); + Process process = processBuilder.start(); + + // Re-use processBuilder + processBuilder.command(new String[]{"newCommand", "arguments"}); + + Assert.assertEquals(true, process.isAlive()); + } + + @Test + public void whenRequestGet_thenReturnSuccessResponseCode() throws IOException { + String url = "https://postman-echo.com/get?foo1=bar1&foo2=bar2"; + URL urlObj = new URL(url); + HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection(); + connection.setDoOutput(true); + connection.setInstanceFollowRedirects(false); + connection.setRequestMethod("GET"); + connection.connect(); + + Assert.assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode()); + } + +} From 082724abecd4bc514baadc96b4a3046570254609 Mon Sep 17 00:00:00 2001 From: Varun Jain Date: Sat, 5 Jan 2019 10:38:13 +0530 Subject: [PATCH 152/271] BAEL-2536-addressed review comments --- .../java/com/baeldung/string/Pangram.java | 6 ++-- .../com/baeldung/string/PangramUnitTest.java | 29 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/java-strings/src/main/java/com/baeldung/string/Pangram.java b/java-strings/src/main/java/com/baeldung/string/Pangram.java index 8498a7074a..c09b0c1d29 100644 --- a/java-strings/src/main/java/com/baeldung/string/Pangram.java +++ b/java-strings/src/main/java/com/baeldung/string/Pangram.java @@ -15,10 +15,10 @@ public class Pangram { Boolean[] alphabetMarker = new Boolean[ALPHABET_COUNT]; Arrays.fill(alphabetMarker, false); int alphabetIndex = 0; - str = str.toUpperCase(); + String strUpper = str.toUpperCase(); for (int i = 0; i < str.length(); i++) { - if ('A' <= str.charAt(i) && str.charAt(i) <= 'Z') { - alphabetIndex = str.charAt(i) - 'A'; + if ('A' <= strUpper.charAt(i) && strUpper.charAt(i) <= 'Z') { + alphabetIndex = strUpper.charAt(i) - 'A'; alphabetMarker[alphabetIndex] = true; } } diff --git a/java-strings/src/test/java/com/baeldung/string/PangramUnitTest.java b/java-strings/src/test/java/com/baeldung/string/PangramUnitTest.java index 67523a4524..36e603b535 100644 --- a/java-strings/src/test/java/com/baeldung/string/PangramUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/string/PangramUnitTest.java @@ -4,39 +4,38 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; - public class PangramUnitTest { - + @Test - public void givenValidString_isPanagram_shouldReturnSuccess() { + public void givenValidString_isPangram_shouldReturnSuccess() { String input = "Two driven jocks help fax my big quiz"; - assertTrue(Pangram.isPangram(input)); - assertTrue(Pangram.isPangramWithStreams(input)); + assertTrue(Pangram.isPangram(input)); + assertTrue(Pangram.isPangramWithStreams(input)); } - + @Test - public void givenNullString_isPanagram_shouldReturnFailure() { + public void givenNullString_isPangram_shouldReturnFailure() { String input = null; assertFalse(Pangram.isPangram(input)); assertFalse(Pangram.isPangramWithStreams(input)); assertFalse(Pangram.isPerfectPangram(input)); } - + @Test - public void givenPerfectPanagramString_isPerfectPanagram_shouldReturnSuccess() { + public void givenPerfectPangramString_isPerfectPangram_shouldReturnSuccess() { String input = "abcdefghijklmNoPqrStuVwxyz"; - assertTrue(Pangram.isPerfectPangram(input)); + assertTrue(Pangram.isPerfectPangram(input)); } - + @Test - public void givenNonPanagramString_isPanagram_shouldReturnFailure() { - String input = "invalid panagram"; + public void givenNonPangramString_isPangram_shouldReturnFailure() { + String input = "invalid pangram"; assertFalse(Pangram.isPangram(input)); assertFalse(Pangram.isPangramWithStreams(input)); } - + @Test - public void givenPanagram_isPerfectPanagram_shouldReturnFailure() { + public void givenPangram_isPerfectPangram_shouldReturnFailure() { String input = "Two driven jocks help fax my big quiz"; assertFalse(Pangram.isPerfectPangram(input)); } From 833285f2ba1407fda131542e2c261d5763f2f656 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 5 Jan 2019 11:12:31 +0200 Subject: [PATCH 153/271] Update README.md --- core-java-collections-list/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-collections-list/README.md b/core-java-collections-list/README.md index aba53f5b30..a35e714006 100644 --- a/core-java-collections-list/README.md +++ b/core-java-collections-list/README.md @@ -24,4 +24,5 @@ - [Java List Initialization in One Line](https://www.baeldung.com/java-init-list-one-line) - [Ways to Iterate Over a List in Java](https://www.baeldung.com/java-iterate-list) - [ClassCastException: Arrays$ArrayList cannot be cast to ArrayList](https://www.baeldung.com/java-classcastexception-arrays-arraylist) -- [Flattening Nested Collections in Java](http://www.baeldung.com/java-flatten-nested-collections) \ No newline at end of file +- [Flattening Nested Collections in Java](http://www.baeldung.com/java-flatten-nested-collections) +- [Intersection of Two Lists in Java](https://www.baeldung.com/java-lists-intersection) From ceb41607f0d406080bffe30fad8f450feab0f06f Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 5 Jan 2019 11:13:39 +0200 Subject: [PATCH 154/271] Update README.md --- core-java-collections/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index bde0f9fdb9..be83621429 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -30,5 +30,4 @@ - [Join and Split Arrays and Collections in Java](http://www.baeldung.com/java-join-and-split) - [A Guide to EnumMap](https://www.baeldung.com/java-enum-map) - [A Guide to Iterator in Java](http://www.baeldung.com/java-iterator) -- [Intersection of Two Lists in Java](https://www.baeldung.com/java-lists-intersection) - [Differences Between HashMap and Hashtable](https://www.baeldung.com/hashmap-hashtable-differences) From b1352b58e08542038ab4973a16617a205e1b3226 Mon Sep 17 00:00:00 2001 From: Kumar Chandrakant Date: Sat, 5 Jan 2019 17:52:23 +0530 Subject: [PATCH 155/271] Adding files for the tutorial BAEL-2301 (#6066) --- apache-spark/pom.xml | 68 ++++++++- .../java/com/baeldung/data/pipeline/Word.java | 25 ++++ .../data/pipeline/WordCountingApp.java | 116 +++++++++++++++ .../WordCountingAppWithCheckpoint.java | 140 ++++++++++++++++++ 4 files changed, 345 insertions(+), 4 deletions(-) create mode 100644 apache-spark/src/main/java/com/baeldung/data/pipeline/Word.java create mode 100644 apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingApp.java create mode 100644 apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingAppWithCheckpoint.java diff --git a/apache-spark/pom.xml b/apache-spark/pom.xml index 290b63a14d..b05b97198d 100644 --- a/apache-spark/pom.xml +++ b/apache-spark/pom.xml @@ -15,16 +15,76 @@ - org.apache.spark - spark-core_2.10 + spark-core_2.11 ${org.apache.spark.spark-core.version} + provided + + org.apache.spark + spark-sql_2.11 + ${org.apache.spark.spark-sql.version} + provided + + + org.apache.spark + spark-streaming_2.11 + ${org.apache.spark.spark-streaming.version} + provided + + + org.apache.spark + spark-streaming-kafka-0-10_2.11 + ${org.apache.spark.spark-streaming-kafka.version} + + + com.datastax.spark + spark-cassandra-connector_2.11 + ${com.datastax.spark.spark-cassandra-connector.version} + + + com.datastax.spark + spark-cassandra-connector-java_2.11 + ${com.datastax.spark.spark-cassandra-connector-java.version} + - + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.2 + + 1.8 + 1.8 + + + + maven-assembly-plugin + + + package + + single + + + + + + jar-with-dependencies + + + + + - 2.2.0 + 2.3.0 + 2.3.0 + 2.3.0 + 2.3.0 + 2.3.0 + 1.5.2 diff --git a/apache-spark/src/main/java/com/baeldung/data/pipeline/Word.java b/apache-spark/src/main/java/com/baeldung/data/pipeline/Word.java new file mode 100644 index 0000000000..b0caa468b1 --- /dev/null +++ b/apache-spark/src/main/java/com/baeldung/data/pipeline/Word.java @@ -0,0 +1,25 @@ +package com.baeldung.data.pipeline; + +import java.io.Serializable; + +public class Word implements Serializable { + private static final long serialVersionUID = 1L; + private String word; + private int count; + Word(String word, int count) { + this.word = word; + this.count = count; + } + public String getWord() { + return word; + } + public void setWord(String word) { + this.word = word; + } + public int getCount() { + return count; + } + public void setCount(int count) { + this.count = count; + } +} \ No newline at end of file diff --git a/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingApp.java b/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingApp.java new file mode 100644 index 0000000000..08695b3631 --- /dev/null +++ b/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingApp.java @@ -0,0 +1,116 @@ +package com.baeldung.data.pipeline; + +import static com.datastax.spark.connector.japi.CassandraJavaUtil.javaFunctions; +import static com.datastax.spark.connector.japi.CassandraJavaUtil.mapToRow; + +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.apache.kafka.common.serialization.StringDeserializer; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.spark.SparkConf; +import org.apache.spark.api.java.JavaPairRDD; +import org.apache.spark.api.java.JavaRDD; +import org.apache.spark.api.java.function.FlatMapFunction; +import org.apache.spark.api.java.function.Function; +import org.apache.spark.api.java.function.Function2; +import org.apache.spark.api.java.function.PairFunction; +import org.apache.spark.api.java.function.VoidFunction; +import org.apache.spark.streaming.Durations; +import org.apache.spark.streaming.api.java.JavaDStream; +import org.apache.spark.streaming.api.java.JavaInputDStream; +import org.apache.spark.streaming.api.java.JavaPairDStream; +import org.apache.spark.streaming.api.java.JavaStreamingContext; +import org.apache.spark.streaming.kafka010.ConsumerStrategies; +import org.apache.spark.streaming.kafka010.KafkaUtils; +import org.apache.spark.streaming.kafka010.LocationStrategies; + +import scala.Tuple2; + +public class WordCountingApp { + + @SuppressWarnings("serial") + public static void main(String[] args) throws InterruptedException { + Logger.getLogger("org") + .setLevel(Level.OFF); + Logger.getLogger("akka") + .setLevel(Level.OFF); + + Map kafkaParams = new HashMap<>(); + kafkaParams.put("bootstrap.servers", "localhost:9092"); + kafkaParams.put("key.deserializer", StringDeserializer.class); + kafkaParams.put("value.deserializer", StringDeserializer.class); + kafkaParams.put("group.id", "use_a_separate_group_id_for_each_stream"); + kafkaParams.put("auto.offset.reset", "latest"); + kafkaParams.put("enable.auto.commit", false); + + Collection topics = Arrays.asList("messages"); + + SparkConf sparkConf = new SparkConf(); + sparkConf.setMaster("local[2]"); + sparkConf.setAppName("WordCountingApp"); + sparkConf.set("spark.cassandra.connection.host", "127.0.0.1"); + + JavaStreamingContext streamingContext = new JavaStreamingContext(sparkConf, Durations.seconds(1)); + + JavaInputDStream> messages = KafkaUtils.createDirectStream(streamingContext, LocationStrategies.PreferConsistent(), ConsumerStrategies. Subscribe(topics, kafkaParams)); + + JavaPairDStream results = messages.mapToPair(new PairFunction, String, String>() { + @Override + public Tuple2 call(ConsumerRecord record) { + return new Tuple2<>(record.key(), record.value()); + } + }); + + JavaDStream lines = results.map(new Function, String>() { + @Override + public String call(Tuple2 tuple2) { + return tuple2._2(); + } + }); + + JavaDStream words = lines.flatMap(new FlatMapFunction() { + @Override + public Iterator call(String x) { + return Arrays.asList(x.split("\\s+")) + .iterator(); + } + }); + + JavaPairDStream wordCounts = words.mapToPair(new PairFunction() { + @Override + public Tuple2 call(String s) { + return new Tuple2<>(s, 1); + } + }) + .reduceByKey(new Function2() { + @Override + public Integer call(Integer i1, Integer i2) { + return i1 + i2; + } + }); + + wordCounts.foreachRDD(new VoidFunction>() { + @Override + public void call(JavaPairRDD javaRdd) throws Exception { + Map wordCountMap = javaRdd.collectAsMap(); + for (String key : wordCountMap.keySet()) { + List words = Arrays.asList(new Word(key, wordCountMap.get(key))); + JavaRDD rdd = streamingContext.sparkContext() + .parallelize(words); + javaFunctions(rdd).writerBuilder("vocabulary", "words", mapToRow(Word.class)) + .saveToCassandra(); + } + } + }); + + streamingContext.start(); + streamingContext.awaitTermination(); + } +} \ No newline at end of file diff --git a/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingAppWithCheckpoint.java b/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingAppWithCheckpoint.java new file mode 100644 index 0000000000..e20b910635 --- /dev/null +++ b/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingAppWithCheckpoint.java @@ -0,0 +1,140 @@ +package com.baeldung.data.pipeline; + +import static com.datastax.spark.connector.japi.CassandraJavaUtil.javaFunctions; +import static com.datastax.spark.connector.japi.CassandraJavaUtil.mapToRow; + +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.apache.kafka.common.serialization.StringDeserializer; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.spark.SparkConf; +import org.apache.spark.api.java.JavaPairRDD; +import org.apache.spark.api.java.JavaRDD; +import org.apache.spark.api.java.JavaSparkContext; +import org.apache.spark.api.java.Optional; +import org.apache.spark.api.java.function.FlatMapFunction; +import org.apache.spark.api.java.function.Function; +import org.apache.spark.api.java.function.Function2; +import org.apache.spark.api.java.function.Function3; +import org.apache.spark.api.java.function.PairFunction; +import org.apache.spark.api.java.function.VoidFunction; +import org.apache.spark.streaming.Durations; +import org.apache.spark.streaming.State; +import org.apache.spark.streaming.StateSpec; +import org.apache.spark.streaming.api.java.JavaDStream; +import org.apache.spark.streaming.api.java.JavaInputDStream; +import org.apache.spark.streaming.api.java.JavaMapWithStateDStream; +import org.apache.spark.streaming.api.java.JavaPairDStream; +import org.apache.spark.streaming.api.java.JavaStreamingContext; +import org.apache.spark.streaming.kafka010.ConsumerStrategies; +import org.apache.spark.streaming.kafka010.KafkaUtils; +import org.apache.spark.streaming.kafka010.LocationStrategies; + +import scala.Tuple2; + +public class WordCountingAppWithCheckpoint { + + public static JavaSparkContext sparkContext; + + @SuppressWarnings("serial") + public static void main(String[] args) throws InterruptedException { + + Logger.getLogger("org") + .setLevel(Level.OFF); + Logger.getLogger("akka") + .setLevel(Level.OFF); + + Map kafkaParams = new HashMap<>(); + kafkaParams.put("bootstrap.servers", "localhost:9092"); + kafkaParams.put("key.deserializer", StringDeserializer.class); + kafkaParams.put("value.deserializer", StringDeserializer.class); + kafkaParams.put("group.id", "use_a_separate_group_id_for_each_stream"); + kafkaParams.put("auto.offset.reset", "latest"); + kafkaParams.put("enable.auto.commit", false); + + Collection topics = Arrays.asList("messages"); + + SparkConf sparkConf = new SparkConf(); + sparkConf.setMaster("local[2]"); + sparkConf.setAppName("WordCountingAppWithCheckpoint"); + sparkConf.set("spark.cassandra.connection.host", "127.0.0.1"); + + JavaStreamingContext streamingContext = new JavaStreamingContext(sparkConf, Durations.seconds(1)); + + sparkContext = streamingContext.sparkContext(); + + streamingContext.checkpoint("./.checkpoint"); + + JavaInputDStream> messages = KafkaUtils.createDirectStream(streamingContext, LocationStrategies.PreferConsistent(), ConsumerStrategies. Subscribe(topics, kafkaParams)); + + JavaPairDStream results = messages.mapToPair(new PairFunction, String, String>() { + @Override + public Tuple2 call(ConsumerRecord record) { + return new Tuple2<>(record.key(), record.value()); + } + }); + + JavaDStream lines = results.map(new Function, String>() { + @Override + public String call(Tuple2 tuple2) { + return tuple2._2(); + } + }); + + JavaDStream words = lines.flatMap(new FlatMapFunction() { + @Override + public Iterator call(String x) { + return Arrays.asList(x.split("\\s+")) + .iterator(); + } + }); + + JavaPairDStream wordCounts = words.mapToPair(new PairFunction() { + @Override + public Tuple2 call(String s) { + return new Tuple2<>(s, 1); + } + }) + .reduceByKey(new Function2() { + @Override + public Integer call(Integer i1, Integer i2) { + return i1 + i2; + } + }); + + Function3, State, Tuple2> mappingFunc = (word, one, state) -> { + int sum = one.orElse(0) + (state.exists() ? state.get() : 0); + Tuple2 output = new Tuple2<>(word, sum); + state.update(sum); + return output; + }; + + JavaPairRDD initialRDD = JavaPairRDD.fromJavaRDD(sparkContext.emptyRDD()); + + JavaMapWithStateDStream> cumulativeWordCounts = wordCounts.mapWithState(StateSpec.function(mappingFunc) + .initialState(initialRDD)); + + cumulativeWordCounts.foreachRDD(new VoidFunction>>() { + @Override + public void call(JavaRDD> javaRdd) throws Exception { + List> wordCountList = javaRdd.collect(); + for (Tuple2 tuple : wordCountList) { + List words = Arrays.asList(new Word(tuple._1, tuple._2)); + JavaRDD rdd = sparkContext.parallelize(words); + javaFunctions(rdd).writerBuilder("vocabulary", "words", mapToRow(Word.class)) + .saveToCassandra(); + } + } + }); + + streamingContext.start(); + streamingContext.awaitTermination(); + } +} \ No newline at end of file From e3e1c84b24458a2a37799568fcdfe06acf3453e6 Mon Sep 17 00:00:00 2001 From: Maiklins Date: Sat, 5 Jan 2019 13:27:25 +0100 Subject: [PATCH 156/271] BAEL-2485 Permutations of an array in Java (#6027) --- .../algorithms/permutation/Permutation.java | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/permutation/Permutation.java diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/permutation/Permutation.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/permutation/Permutation.java new file mode 100644 index 0000000000..7fedd78ffb --- /dev/null +++ b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/permutation/Permutation.java @@ -0,0 +1,123 @@ +package com.baeldung.algorithms.permutation; + +import java.util.Arrays; +import java.util.Collections; + +public class Permutation { + + public static void printAllRecursive(T[] elements, char delimiter) { + printAllRecursive(elements.length, elements, delimiter); + } + + public static void printAllRecursive(int n, T[] elements, char delimiter) { + + if(n == 1) { + printArray(elements, delimiter); + } else { + for(int i = 0; i < n-1; i++) { + printAllRecursive(n - 1, elements, delimiter); + if(n % 2 == 0) { + swap(elements, i, n-1); + } else { + swap(elements, 0, n-1); + } + } + printAllRecursive(n - 1, elements, delimiter); + } + } + + public static void printAllIterative(int n, T[] elements, char delimiter) { + + int[] indexes = new int[n]; + for (int i = 0; i < n; i++) { + indexes[i] = 0; + } + + printArray(elements, delimiter); + + int i = 0; + while (i < n) { + if (indexes[i] < i) { + swap(elements, i % 2 == 0 ? 0: indexes[i], i); + printArray(elements, delimiter); + indexes[i]++; + i = 0; + } + else { + indexes[i] = 0; + i++; + } + } + } + + public static > void printAllOrdered(T[] elements, char delimiter) { + + Arrays.sort(elements); + boolean hasNext = true; + + while(hasNext) { + printArray(elements, delimiter); + int k = 0, l = 0; + hasNext = false; + for (int i = elements.length - 1; i > 0; i--) { + if (elements[i].compareTo(elements[i - 1]) > 0) { + k = i - 1; + hasNext = true; + break; + } + } + + for (int i = elements.length - 1; i > k; i--) { + if (elements[i].compareTo(elements[k]) > 0) { + l = i; + break; + } + } + + swap(elements, k, l); + Collections.reverse(Arrays.asList(elements).subList(k + 1, elements.length)); + } + } + + public static void printRandom(T[] elements, char delimiter) { + + Collections.shuffle(Arrays.asList(elements)); + printArray(elements, delimiter); + } + + private static void swap(T[] elements, int a, int b) { + + T tmp = elements[a]; + elements[a] = elements[b]; + elements[b] = tmp; + } + + private static void printArray(T[] elements, char delimiter) { + + String delimiterSpace = delimiter + " "; + for(int i = 0; i < elements.length; i++) { + System.out.print(elements[i] + delimiterSpace); + } + System.out.print('\n'); + } + + public static void main(String[] argv) { + + Integer[] elements = {1,2,3,4}; + + System.out.println("Rec:"); + printAllRecursive(elements, ';'); + + System.out.println("Iter:"); + printAllIterative(elements.length, elements, ';'); + + System.out.println("Orderes:"); + printAllOrdered(elements, ';'); + + System.out.println("Random:"); + printRandom(elements, ';'); + + System.out.println("Random:"); + printRandom(elements, ';'); + } +} From cceb6a022e41bc84b7aa0ddd8a9cb8ea538d9019 Mon Sep 17 00:00:00 2001 From: pcoates33 Date: Sat, 5 Jan 2019 12:39:43 +0000 Subject: [PATCH 157/271] spring-boot ehcache example added (#6012) --- pom.xml | 3 + spring-ehcache/.gitignore | 13 +++ spring-ehcache/README.md | 7 ++ spring-ehcache/checkstyle.xml | 11 +++ spring-ehcache/pom.xml | 87 +++++++++++++++++++ .../com/baeldung/cachetest/Application.java | 13 +++ .../cachetest/config/CacheConfig.java | 57 ++++++++++++ .../cachetest/config/CacheEventLogger.java | 18 ++++ .../cachetest/rest/NumberController.java | 29 +++++++ .../cachetest/service/NumberService.java | 22 +++++ 10 files changed, 260 insertions(+) create mode 100644 spring-ehcache/.gitignore create mode 100644 spring-ehcache/README.md create mode 100644 spring-ehcache/checkstyle.xml create mode 100644 spring-ehcache/pom.xml create mode 100644 spring-ehcache/src/main/java/com/baeldung/cachetest/Application.java create mode 100644 spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheConfig.java create mode 100644 spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java create mode 100644 spring-ehcache/src/main/java/com/baeldung/cachetest/rest/NumberController.java create mode 100644 spring-ehcache/src/main/java/com/baeldung/cachetest/service/NumberService.java diff --git a/pom.xml b/pom.xml index e8ff86665c..4dba0da173 100644 --- a/pom.xml +++ b/pom.xml @@ -663,6 +663,7 @@ spring-dispatcher-servlet spring-drools + spring-ehcache spring-ejb spring-exceptions @@ -882,6 +883,7 @@ spring-data-rest spring-dispatcher-servlet spring-drools + spring-ehcache spring-freemarker persistence-modules/spring-hibernate-3 persistence-modules/spring-hibernate4 @@ -1370,6 +1372,7 @@ spring-dispatcher-servlet spring-drools + spring-ehcache spring-ejb spring-exceptions diff --git a/spring-ehcache/.gitignore b/spring-ehcache/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/spring-ehcache/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/spring-ehcache/README.md b/spring-ehcache/README.md new file mode 100644 index 0000000000..749441375e --- /dev/null +++ b/spring-ehcache/README.md @@ -0,0 +1,7 @@ +## Spring Ehcache Example Project + +A simple example of using ehcache with spring-boot. + +### Relevant Articles: +- [Spring Boot Ehcache Example](http://www.baeldung.com/spring-ehcache) + diff --git a/spring-ehcache/checkstyle.xml b/spring-ehcache/checkstyle.xml new file mode 100644 index 0000000000..85063a7570 --- /dev/null +++ b/spring-ehcache/checkstyle.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/spring-ehcache/pom.xml b/spring-ehcache/pom.xml new file mode 100644 index 0000000000..b8378617c5 --- /dev/null +++ b/spring-ehcache/pom.xml @@ -0,0 +1,87 @@ + + 4.0.0 + spring-ehcache + 0.1-SNAPSHOT + spring-ehcache + jar + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-cache + + + javax.cache + cache-api + + + org.ehcache + ehcache + + + + + spring-ehcache + + + src/main/resources + true + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${checkstyle-maven-plugin.version} + + checkstyle.xml + + + + + check + + + + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${checkstyle-maven-plugin.version} + + checkstyle.xml + + + + + + + + 3.0.0 + false + + + diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/Application.java b/spring-ehcache/src/main/java/com/baeldung/cachetest/Application.java new file mode 100644 index 0000000000..a1ce7a5317 --- /dev/null +++ b/spring-ehcache/src/main/java/com/baeldung/cachetest/Application.java @@ -0,0 +1,13 @@ +package com.baeldung.cachetest; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} \ No newline at end of file diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheConfig.java b/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheConfig.java new file mode 100644 index 0000000000..3cf2309cb9 --- /dev/null +++ b/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheConfig.java @@ -0,0 +1,57 @@ +package com.baeldung.cachetest.config; + +import java.math.BigDecimal; +import java.time.Duration; + +import javax.cache.CacheManager; + +import org.ehcache.config.CacheConfiguration; +import org.ehcache.config.ResourcePools; +import org.ehcache.config.builders.CacheConfigurationBuilder; +import org.ehcache.config.builders.CacheEventListenerConfigurationBuilder; +import org.ehcache.config.builders.ExpiryPolicyBuilder; +import org.ehcache.config.builders.ResourcePoolsBuilder; +import org.ehcache.config.units.EntryUnit; +import org.ehcache.config.units.MemoryUnit; +import org.ehcache.event.EventType; +import org.ehcache.jsr107.Eh107Configuration; +import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableCaching +public class CacheConfig { + + private static final int ON_HEAP_CACHE_SIZE_ENTRIES = 2; + private static final int OFF_HEAP_CACHE_SIZE_MB = 10; + private static final int CACHE_EXPIRY_SECONDS = 30; + + @Bean + public JCacheManagerCustomizer jcacheManagerCustomizer() { + return new JCacheManagerCustomizer() { + + @Override + public void customize(CacheManager cacheManager) { + ResourcePools resourcePools = ResourcePoolsBuilder.newResourcePoolsBuilder() + .heap(ON_HEAP_CACHE_SIZE_ENTRIES, EntryUnit.ENTRIES) + .offheap(OFF_HEAP_CACHE_SIZE_MB, MemoryUnit.MB).build(); + + CacheEventListenerConfigurationBuilder eventLoggerConfig = CacheEventListenerConfigurationBuilder + .newEventListenerConfiguration(new CacheEventLogger(), EventType.CREATED, EventType.EXPIRED) + .unordered().asynchronous(); + + CacheConfiguration cacheConfiguration = CacheConfigurationBuilder + .newCacheConfigurationBuilder(Long.class, BigDecimal.class, resourcePools) + .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(CACHE_EXPIRY_SECONDS))) + .add(eventLoggerConfig).build(); + + cacheManager.createCache("squareCache", + Eh107Configuration.fromEhcacheCacheConfiguration(cacheConfiguration)); + + } + }; + } + +} diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java b/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java new file mode 100644 index 0000000000..c8ead85f1e --- /dev/null +++ b/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java @@ -0,0 +1,18 @@ +package com.baeldung.cachetest.config; + +import org.ehcache.event.CacheEvent; +import org.ehcache.event.CacheEventListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CacheEventLogger implements CacheEventListener { + + private static final Logger log = LoggerFactory.getLogger(CacheEventLogger.class); + + @Override + public void onEvent(CacheEvent cacheEvent) { + log.info("Cache event {} for item with key {}. Old value = {}, New value = {}", cacheEvent.getType(), + cacheEvent.getKey(), cacheEvent.getOldValue(), cacheEvent.getNewValue()); + } + +} diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/rest/NumberController.java b/spring-ehcache/src/main/java/com/baeldung/cachetest/rest/NumberController.java new file mode 100644 index 0000000000..4115c34cc4 --- /dev/null +++ b/spring-ehcache/src/main/java/com/baeldung/cachetest/rest/NumberController.java @@ -0,0 +1,29 @@ +package com.baeldung.cachetest.rest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.cachetest.service.NumberService; + +@RestController +@RequestMapping(path = "/number", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) +public class NumberController { + + private final static Logger log = LoggerFactory.getLogger(NumberController.class); + + @Autowired + private NumberService numberService; + + @GetMapping(path = "/square/{number}") + public String getThing(@PathVariable Long number) { + log.info("call numberService to square {}", number); + return String.format("{\"square\": %s}", numberService.square(number)); + } + +} diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/service/NumberService.java b/spring-ehcache/src/main/java/com/baeldung/cachetest/service/NumberService.java new file mode 100644 index 0000000000..bcd930f5e1 --- /dev/null +++ b/spring-ehcache/src/main/java/com/baeldung/cachetest/service/NumberService.java @@ -0,0 +1,22 @@ +package com.baeldung.cachetest.service; + +import java.math.BigDecimal; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class NumberService { + + private final static Logger log = LoggerFactory.getLogger(NumberService.class); + + @Cacheable(value = "squareCache", key = "#number", condition = "#number>10") + public BigDecimal square(Long number) { + BigDecimal square = BigDecimal.valueOf(number).multiply(BigDecimal.valueOf(number)); + log.info("square of {} is {}", number, square); + return square; + } + +} From b5c29f0e1b556229ad9f29412cbecdcd62da7bb7 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 5 Jan 2019 20:11:29 +0530 Subject: [PATCH 158/271] [BAEL-11403] - Moved DoubleToString and DoubleToStringUnitTest to java-numbers module --- .../src/main/java/com/baeldung/string/DoubleToString.java | 0 .../src/test/java/com/baeldung/string/DoubleToStringUnitTest.java | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {core-java => java-numbers}/src/main/java/com/baeldung/string/DoubleToString.java (100%) rename {core-java => java-numbers}/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java (100%) diff --git a/core-java/src/main/java/com/baeldung/string/DoubleToString.java b/java-numbers/src/main/java/com/baeldung/string/DoubleToString.java similarity index 100% rename from core-java/src/main/java/com/baeldung/string/DoubleToString.java rename to java-numbers/src/main/java/com/baeldung/string/DoubleToString.java diff --git a/core-java/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java b/java-numbers/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java rename to java-numbers/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java From bcc848f6a71688ead0c5d61d32abe3a53a984982 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 5 Jan 2019 18:35:47 +0200 Subject: [PATCH 159/271] Update DoubleToString.java --- .../src/main/java/com/baeldung/string/DoubleToString.java | 1 + 1 file changed, 1 insertion(+) diff --git a/java-numbers/src/main/java/com/baeldung/string/DoubleToString.java b/java-numbers/src/main/java/com/baeldung/string/DoubleToString.java index d26d26f3df..dd55ba51ad 100644 --- a/java-numbers/src/main/java/com/baeldung/string/DoubleToString.java +++ b/java-numbers/src/main/java/com/baeldung/string/DoubleToString.java @@ -38,4 +38,5 @@ public class DoubleToString { return df.format(d); } + } From 9c45b7eda8e7f2eea9bc9ef8fd45d28fd9608db1 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 5 Jan 2019 18:44:33 +0200 Subject: [PATCH 160/271] Update README.MD --- spring-boot-testing/README.MD | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-testing/README.MD b/spring-boot-testing/README.MD index a609b5bf09..144c3581f7 100644 --- a/spring-boot-testing/README.MD +++ b/spring-boot-testing/README.MD @@ -4,3 +4,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: - [Testing with Spring and Spock](https://www.baeldung.com/spring-spock-testing) +- [Exclude Auto-Configuration Classes in Spring Boot Tests](https://www.baeldung.com/spring-boot-exclude-auto-configuration-test) From 994cb303a0595e96c0ec699a70e323391fe9366a Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sat, 5 Jan 2019 19:03:14 +0100 Subject: [PATCH 161/271] [BAEL-2424] Added classes and tests --- .../com/baeldung/reflection/Employee.java | 7 + .../baeldung/reflection/MonthEmployee.java | 7 + .../java/com/baeldung/reflection/Person.java | 8 ++ .../PersonAndEmployeeReflectionTest.java | 128 ++++++++++++++++++ 4 files changed, 150 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/reflection/Employee.java create mode 100644 core-java/src/main/java/com/baeldung/reflection/MonthEmployee.java create mode 100644 core-java/src/main/java/com/baeldung/reflection/Person.java create mode 100644 core-java/src/test/java/com/baeldung/reflection/PersonAndEmployeeReflectionTest.java diff --git a/core-java/src/main/java/com/baeldung/reflection/Employee.java b/core-java/src/main/java/com/baeldung/reflection/Employee.java new file mode 100644 index 0000000000..833cf26b14 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/reflection/Employee.java @@ -0,0 +1,7 @@ +package com.baeldung.reflection; + +public class Employee extends Person { + + public int employeeId; + +} diff --git a/core-java/src/main/java/com/baeldung/reflection/MonthEmployee.java b/core-java/src/main/java/com/baeldung/reflection/MonthEmployee.java new file mode 100644 index 0000000000..697ecc1500 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/reflection/MonthEmployee.java @@ -0,0 +1,7 @@ +package com.baeldung.reflection; + +public class MonthEmployee extends Employee { + + private double reward; + +} diff --git a/core-java/src/main/java/com/baeldung/reflection/Person.java b/core-java/src/main/java/com/baeldung/reflection/Person.java new file mode 100644 index 0000000000..23b312cdd9 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/reflection/Person.java @@ -0,0 +1,8 @@ +package com.baeldung.reflection; + +public class Person { + + public String lastName; + private String firstName; + +} diff --git a/core-java/src/test/java/com/baeldung/reflection/PersonAndEmployeeReflectionTest.java b/core-java/src/test/java/com/baeldung/reflection/PersonAndEmployeeReflectionTest.java new file mode 100644 index 0000000000..034e54ee93 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/reflection/PersonAndEmployeeReflectionTest.java @@ -0,0 +1,128 @@ +package com.baeldung.reflection; + +import org.junit.Test; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static org.junit.Assert.*; + +public class PersonAndEmployeeReflectionTest { + + // Fields names + private static final String LAST_NAME_FIELD = "lastName"; + private static final String FIRST_NAME_FIELD = "firstName"; + private static final String EMPLOYEE_ID_FIELD = "employeeId"; + private static final String MONTH_EMPLOYEE_REWARD_FIELD = "reward"; + + @Test + public void givenPersonClass_whenGetDeclaredFields_thenTwoFields() { + // When + Field[] allFields = Person.class.getDeclaredFields(); + + // Then + assertEquals(2, allFields.length); + + Field lastNameField = allFields[0]; + assertEquals(LAST_NAME_FIELD, lastNameField.getName()); + assertEquals(String.class, lastNameField.getType()); + + Field firstNameField = allFields[1]; + assertEquals(FIRST_NAME_FIELD, firstNameField.getName()); + assertEquals(String.class, firstNameField.getType()); + } + + @Test + public void givenEmployeeClass_whenSuperClassGetDeclaredFields_thenOneField() { + // When + Field[] allFields = Employee.class.getSuperclass().getDeclaredFields(); + + // Then + assertEquals(2, allFields.length); + + Field lastNameField = allFields[0]; + assertEquals(LAST_NAME_FIELD, lastNameField.getName()); + assertEquals(String.class, lastNameField.getType()); + + Field firstNameField = allFields[1]; + assertEquals(FIRST_NAME_FIELD, firstNameField.getName()); + assertEquals(String.class, firstNameField.getType()); + } + + @Test + public void givenEmployeeClass_whenGetDeclaredFields_thenOneField() { + // When + Field[] allFields = Employee.class.getDeclaredFields(); + + // Then + assertEquals(1, allFields.length); + + Field employeeIdField = allFields[0]; + assertEquals(EMPLOYEE_ID_FIELD, employeeIdField.getName()); + assertEquals(int.class, employeeIdField.getType()); + } + + @Test + public void givenEmployeeClass_whenGetDeclaredFieldsOnBothClasses_thenThreeFields() { + // When + Field[] personFields = Employee.class.getSuperclass().getDeclaredFields(); + Field[] employeeFields = Employee.class.getDeclaredFields(); + Field[] allFields = new Field[employeeFields.length + personFields.length]; + Arrays.setAll(allFields, i -> (i < personFields.length ? personFields[i] : employeeFields[i - personFields.length])); + + // Then + assertEquals(3, allFields.length); + + Field lastNameField = allFields[0]; + assertEquals(LAST_NAME_FIELD, lastNameField.getName()); + assertEquals(String.class, lastNameField.getType()); + + Field firstNameField = allFields[1]; + assertEquals(FIRST_NAME_FIELD, firstNameField.getName()); + assertEquals(String.class, firstNameField.getType()); + + Field employeeIdField = allFields[2]; + assertEquals(EMPLOYEE_ID_FIELD, employeeIdField.getName()); + assertEquals(int.class, employeeIdField.getType()); + } + + @Test + public void givenMonthEmployeeClass_whenGetAllFields_thenFourFields() { + // When + List allFields = getAllFields(MonthEmployee.class); + + // Then + assertEquals(4, allFields.size()); + + Field lastNameField = allFields.get(0); + assertEquals(LAST_NAME_FIELD, lastNameField.getName()); + assertEquals(String.class, lastNameField.getType()); + + Field firstNameField = allFields.get(1); + assertEquals(FIRST_NAME_FIELD, firstNameField.getName()); + assertEquals(String.class, firstNameField.getType()); + + Field employeeIdField = allFields.get(2); + assertEquals(EMPLOYEE_ID_FIELD, employeeIdField.getName()); + assertEquals(int.class, employeeIdField.getType()); + + Field monthEmployeeRewardField = allFields.get(3); + assertEquals(MONTH_EMPLOYEE_REWARD_FIELD, monthEmployeeRewardField.getName()); + assertEquals(double.class, monthEmployeeRewardField.getType()); + } + + public List getAllFields(Class clazz) { + if (clazz == null) { + return Collections.emptyList(); + } + + List result = new ArrayList<>(); + result.addAll(getAllFields(clazz.getSuperclass())); + result.addAll(Arrays.asList(clazz.getDeclaredFields())); + return result; + } + +} \ No newline at end of file From fe44881bb15a18497d1fb8f25c78db52dd4cf91d Mon Sep 17 00:00:00 2001 From: pandachris Date: Sun, 6 Jan 2019 01:21:28 +0700 Subject: [PATCH 162/271] BAEL-2565 (#6077) * BAEL-2565 * BAEL-2565 Test code consistency --- .../com/baeldung/enums/values/Element1.java | 17 ++++ .../com/baeldung/enums/values/Element2.java | 52 ++++++++++ .../com/baeldung/enums/values/Element3.java | 63 ++++++++++++ .../com/baeldung/enums/values/Element4.java | 95 +++++++++++++++++++ .../com/baeldung/enums/values/Labeled.java | 5 + .../enums/values/Element1UnitTest.java | 48 ++++++++++ .../enums/values/Element2UnitTest.java | 59 ++++++++++++ .../enums/values/Element3UnitTest.java | 57 +++++++++++ .../enums/values/Element4UnitTest.java | 71 ++++++++++++++ 9 files changed, 467 insertions(+) create mode 100644 core-java-8/src/main/java/com/baeldung/enums/values/Element1.java create mode 100644 core-java-8/src/main/java/com/baeldung/enums/values/Element2.java create mode 100644 core-java-8/src/main/java/com/baeldung/enums/values/Element3.java create mode 100644 core-java-8/src/main/java/com/baeldung/enums/values/Element4.java create mode 100644 core-java-8/src/main/java/com/baeldung/enums/values/Labeled.java create mode 100644 core-java-8/src/test/java/com/baeldung/enums/values/Element1UnitTest.java create mode 100644 core-java-8/src/test/java/com/baeldung/enums/values/Element2UnitTest.java create mode 100644 core-java-8/src/test/java/com/baeldung/enums/values/Element3UnitTest.java create mode 100644 core-java-8/src/test/java/com/baeldung/enums/values/Element4UnitTest.java diff --git a/core-java-8/src/main/java/com/baeldung/enums/values/Element1.java b/core-java-8/src/main/java/com/baeldung/enums/values/Element1.java new file mode 100644 index 0000000000..6c80adacb1 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/enums/values/Element1.java @@ -0,0 +1,17 @@ +package com.baeldung.enums.values; + +/** + * This is a simple enum of periodic table elements + */ +public enum Element1 { + H, + HE, + LI, + BE, + B, + C, + N, + O, + F, + NE +} diff --git a/core-java-8/src/main/java/com/baeldung/enums/values/Element2.java b/core-java-8/src/main/java/com/baeldung/enums/values/Element2.java new file mode 100644 index 0000000000..28bf3a475a --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/enums/values/Element2.java @@ -0,0 +1,52 @@ +package com.baeldung.enums.values; + +/** + * The simple enum has been enhanced to add the name of the element. + */ +public enum Element2 { + H("Hydrogen"), + HE("Helium"), + LI("Lithium"), + BE("Beryllium"), + B("Boron"), + C("Carbon"), + N("Nitrogen"), + O("Oxygen"), + F("Flourine"), + NE("Neon"); + + /** a final variable to store the label, which can't be changed */ + public final String label; + + /** + * A private constructor that sets the label. + * @param label + */ + private Element2(String label) { + this.label = label; + } + + /** + * Look up Element2 instances by the label field. This implementation iterates through + * the values() list to find the label. + * @param label The label to look up + * @return The Element2 instance with the label, or null if not found. + */ + public static Element2 valueOfLabel(String label) { + for (Element2 e2 : values()) { + if (e2.label.equals(label)) { + return e2; + } + } + return null; + } + + /** + * Override the toString() method to return the label instead of the declared name. + * @return + */ + @Override + public String toString() { + return this.label; + } +} diff --git a/core-java-8/src/main/java/com/baeldung/enums/values/Element3.java b/core-java-8/src/main/java/com/baeldung/enums/values/Element3.java new file mode 100644 index 0000000000..cb98695de8 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/enums/values/Element3.java @@ -0,0 +1,63 @@ +package com.baeldung.enums.values; + +import java.util.HashMap; +import java.util.Map; + +/** + * A Map has been added to cache labels for faster lookup. + */ +public enum Element3 { + H("Hydrogen"), + HE("Helium"), + LI("Lithium"), + BE("Beryllium"), + B("Boron"), + C("Carbon"), + N("Nitrogen"), + O("Oxygen"), + F("Flourine"), + NE("Neon"); + + /** + * A map to cache labels and their associated Element3 instances. + * Note that this only works if the labels are all unique! + */ + private static final Map BY_LABEL = new HashMap<>(); + + /** populate the BY_LABEL cache */ + static { + for (Element3 e3 : values()) { + BY_LABEL.put(e3.label, e3); + } + } + + /** a final variable to store the label, which can't be changed */ + public final String label; + + /** + * A private constructor that sets the label. + * @param label + */ + private Element3(String label) { + this.label = label; + } + + /** + * Look up Element2 instances by the label field. This implementation finds the + * label in the BY_LABEL cache. + * @param label The label to look up + * @return The Element3 instance with the label, or null if not found. + */ + public static Element3 valueOfLabel(String label) { + return BY_LABEL.get(label); + } + + /** + * Override the toString() method to return the label instead of the declared name. + * @return + */ + @Override + public String toString() { + return this.label; + } +} diff --git a/core-java-8/src/main/java/com/baeldung/enums/values/Element4.java b/core-java-8/src/main/java/com/baeldung/enums/values/Element4.java new file mode 100644 index 0000000000..89c45f9d1b --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/enums/values/Element4.java @@ -0,0 +1,95 @@ +package com.baeldung.enums.values; + +import java.util.HashMap; +import java.util.Map; + +/** + * Multiple fields have been added and the Labeled interface is implemented. + */ +public enum Element4 implements Labeled { + H("Hydrogen", 1, 1.008f), + HE("Helium", 2, 4.0026f), + LI("Lithium", 3, 6.94f), + BE("Beryllium", 4, 9.01722f), + B("Boron", 5, 10.81f), + C("Carbon", 6, 12.011f), + N("Nitrogen", 7, 14.007f), + O("Oxygen", 8, 15.999f), + F("Flourine", 9, 18.998f), + NE("Neon", 10, 20.180f); + /** + * Maps cache labels and their associated Element3 instances. + * Note that this only works if the values are all unique! + */ + private static final Map BY_LABEL = new HashMap<>(); + private static final Map BY_ATOMIC_NUMBER = new HashMap<>(); + private static final Map BY_ATOMIC_WEIGHT = new HashMap<>(); + + /** populate the caches */ + static { + for (Element4 e4 : values()) { + BY_LABEL.put(e4.label, e4); + BY_ATOMIC_NUMBER.put(e4.atomicNumber, e4); + BY_ATOMIC_WEIGHT.put(e4.atomicWeight, e4); + } + } + + /** final variables to store the values, which can't be changed */ + public final String label; + public final int atomicNumber; + public final float atomicWeight; + + private Element4(String label, int atomicNumber, float atomicWeight) { + this.label = label; + this.atomicNumber = atomicNumber; + this.atomicWeight = atomicWeight; + } + + /** + * Implement the Labeled interface. + * @return the label value + */ + @Override + public String label() { + return label; + } + + /** + * Look up Element2 instances by the label field. This implementation finds the + * label in the BY_LABEL cache. + * @param label The label to look up + * @return The Element4 instance with the label, or null if not found. + */ + public static Element4 valueOfLabel(String label) { + return BY_LABEL.get(label); + } + + /** + * Look up Element2 instances by the atomicNumber field. This implementation finds the + * atomicNUmber in the cache. + * @param number The atomicNumber to look up + * @return The Element4 instance with the label, or null if not found. + */ + public static Element4 valueOfAtomicNumber(int number) { + return BY_ATOMIC_NUMBER.get(number); + } + + /** + * Look up Element2 instances by the atomicWeight field. This implementation finds the + * atomic weight in the cache. + * @param weight the atomic weight to look up + * @return The Element4 instance with the label, or null if not found. + */ + public static Element4 valueOfAtomicWeight(float weight) { + return BY_ATOMIC_WEIGHT.get(weight); + } + + /** + * Override the toString() method to return the label instead of the declared name. + * @return + */ + @Override + public String toString() { + return this.label; + } +} diff --git a/core-java-8/src/main/java/com/baeldung/enums/values/Labeled.java b/core-java-8/src/main/java/com/baeldung/enums/values/Labeled.java new file mode 100644 index 0000000000..e41d6525f1 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/enums/values/Labeled.java @@ -0,0 +1,5 @@ +package com.baeldung.enums.values; + +public interface Labeled { + String label(); +} diff --git a/core-java-8/src/test/java/com/baeldung/enums/values/Element1UnitTest.java b/core-java-8/src/test/java/com/baeldung/enums/values/Element1UnitTest.java new file mode 100644 index 0000000000..ab3e684230 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/enums/values/Element1UnitTest.java @@ -0,0 +1,48 @@ +package com.baeldung.enums.values; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author chris + */ +public class Element1UnitTest { + + public Element1UnitTest() { + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void whenAccessingToString_thenItShouldEqualName() { + for (Element1 e1 : Element1.values()) { + assertEquals(e1.name(), e1.toString()); + } + } + + @Test + public void whenCallingValueOf_thenReturnTheCorrectEnum() { + for (Element1 e1 : Element1.values()) { + assertSame(e1, Element1.valueOf(e1.name())); + } + } +} diff --git a/core-java-8/src/test/java/com/baeldung/enums/values/Element2UnitTest.java b/core-java-8/src/test/java/com/baeldung/enums/values/Element2UnitTest.java new file mode 100644 index 0000000000..02995a2f41 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/enums/values/Element2UnitTest.java @@ -0,0 +1,59 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.baeldung.enums.values; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author chris + */ +public class Element2UnitTest { + private static final Logger LOGGER = LoggerFactory.getLogger(Element2UnitTest.class); + + public Element2UnitTest() { + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void whenLocatebyLabel_thenReturnCorrectValue() { + for (Element2 e2 : Element2.values()) { + assertSame(e2, Element2.valueOfLabel(e2.label)); + } + } + + /** + * Test of toString method, of class Element2. + */ + @Test + public void whenCallingToString_thenReturnLabel() { + for (Element2 e2 : Element2.values()) { + assertEquals(e2.label, e2.toString()); + } + } +} diff --git a/core-java-8/src/test/java/com/baeldung/enums/values/Element3UnitTest.java b/core-java-8/src/test/java/com/baeldung/enums/values/Element3UnitTest.java new file mode 100644 index 0000000000..40c76a97b1 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/enums/values/Element3UnitTest.java @@ -0,0 +1,57 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.baeldung.enums.values; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author chris + */ +public class Element3UnitTest { + + public Element3UnitTest() { + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void whenLocatebyLabel_thenReturnCorrectValue() { + for (Element3 e3 : Element3.values()) { + assertSame(e3, Element3.valueOfLabel(e3.label)); + } + } + + /** + * Test of toString method, of class Element3. + */ + @Test + public void whenCallingToString_thenReturnLabel() { + for (Element3 e3 : Element3.values()) { + assertEquals(e3.label, e3.toString()); + } + } + +} diff --git a/core-java-8/src/test/java/com/baeldung/enums/values/Element4UnitTest.java b/core-java-8/src/test/java/com/baeldung/enums/values/Element4UnitTest.java new file mode 100644 index 0000000000..d349dcef72 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/enums/values/Element4UnitTest.java @@ -0,0 +1,71 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.baeldung.enums.values; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author chris + */ +public class Element4UnitTest { + + public Element4UnitTest() { + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void whenLocatebyLabel_thenReturnCorrectValue() { + for (Element4 e4 : Element4.values()) { + assertSame(e4, Element4.valueOfLabel(e4.label)); + } + } + + @Test + public void whenLocatebyAtmNum_thenReturnCorrectValue() { + for (Element4 e4 : Element4.values()) { + assertSame(e4, Element4.valueOfAtomicNumber(e4.atomicNumber)); + } + } + + @Test + public void whenLocatebyAtmWt_thenReturnCorrectValue() { + for (Element4 e4 : Element4.values()) { + assertSame(e4, Element4.valueOfAtomicWeight(e4.atomicWeight)); + } + } + + /** + * Test of toString method, of class Element4. + */ + @Test + public void whenCallingToString_thenReturnLabel() { + for (Element4 e4 : Element4.values()) { + assertEquals(e4.label, e4.toString()); + } + } + +} From 2d8ea6d287b2542ba7b4e5a13e3711d613b65ea8 Mon Sep 17 00:00:00 2001 From: kyleandari <44148335+kyleandari@users.noreply.github.com> Date: Sat, 5 Jan 2019 13:25:22 -0500 Subject: [PATCH 163/271] Bael 2431 (#6073) * Adding code to java core and deleting it from java-8 * removing failed unittest * removing space --- .../com/baeldung/interfaces/Electronic.java | 22 ---------------- .../com/baeldung/interfaces/Motorcycle.java | 10 ------- .../java/com/baeldung/interfaces/Truck.java | 8 ------ .../java/com/baeldung/interfaces/Vehicle.java | 6 ----- .../interfaces/multiinheritance/Vehicle.java | 13 ---------- .../interfaces/polymorphysim/Circle.java | 25 ------------------ .../polymorphysim/DisplayShape.java | 26 ------------------- .../polymorphysim/FunctionalMain.java | 23 ---------------- .../polymorphysim/MainPolymorphic.java | 15 ----------- .../interfaces/polymorphysim/Shape.java | 9 ------- .../interfaces/polymorphysim/Square.java | 25 ------------------ .../interfaces/PolymorphysimUnitTest.java | 26 ------------------- .../java/com/baeldung/interfaces/Box.java | 5 ++++ .../com/baeldung/interfaces/Employee.java | 1 - .../interfaces/EmployeeSalaryComparator.java | 7 +++-- .../com/baeldung/interfaces/HasColor.java | 3 +-- .../interfaces/multiinheritance/Car.java | 3 ++- .../interfaces/multiinheritance/Fly.java | 3 ++- .../multiinheritance/Transform.java | 0 .../interfaces/multiinheritance/Vehicle.java | 4 +++ .../interfaces/polymorphysim/Circle.java | 9 +++++++ .../polymorphysim/MainTestClass.java | 20 ++++++++++++++ .../interfaces/polymorphysim/Shape.java | 6 +++++ .../interfaces/polymorphysim/Square.java | 9 +++++++ 24 files changed, 61 insertions(+), 217 deletions(-) delete mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/Electronic.java delete mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/Motorcycle.java delete mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/Truck.java delete mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/Vehicle.java delete mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java delete mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java delete mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/DisplayShape.java delete mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/FunctionalMain.java delete mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/MainPolymorphic.java delete mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java delete mode 100644 core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java delete mode 100644 core-java-8/src/test/java/com/baeldung/interfaces/PolymorphysimUnitTest.java create mode 100644 core-java/src/main/java/com/baeldung/interfaces/Box.java rename {core-java-8 => core-java}/src/main/java/com/baeldung/interfaces/Employee.java (99%) rename {core-java-8 => core-java}/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java (67%) rename {core-java-8 => core-java}/src/main/java/com/baeldung/interfaces/HasColor.java (66%) rename {core-java-8 => core-java}/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java (84%) rename {core-java-8 => core-java}/src/main/java/com/baeldung/interfaces/multiinheritance/Fly.java (69%) rename {core-java-8 => core-java}/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java (100%) create mode 100644 core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java create mode 100644 core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java create mode 100644 core-java/src/main/java/com/baeldung/interfaces/polymorphysim/MainTestClass.java create mode 100644 core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java create mode 100644 core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/Electronic.java b/core-java-8/src/main/java/com/baeldung/interfaces/Electronic.java deleted file mode 100644 index bfbc381483..0000000000 --- a/core-java-8/src/main/java/com/baeldung/interfaces/Electronic.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.interfaces; - -public interface Electronic { - //Constant variable - public static final String LED = "LED"; - - //Abstract method - public int getElectricityUse(); - - // Static method - public static boolean isEnergyEfficient(String electtronicType) { - if (electtronicType.equals(LED)) { - return true; - } - return false; - } - - //Default method - public default void printDescription() { - System.out.println("Electronic Description"); - } -} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/Motorcycle.java b/core-java-8/src/main/java/com/baeldung/interfaces/Motorcycle.java deleted file mode 100644 index 6003f476a3..0000000000 --- a/core-java-8/src/main/java/com/baeldung/interfaces/Motorcycle.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.interfaces; - -import com.baeldung.interfaces.multiinheritance.Transform; - -public class Motorcycle implements Transform { - @Override - public void transform() { - // Implementation - } -} \ No newline at end of file diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/Truck.java b/core-java-8/src/main/java/com/baeldung/interfaces/Truck.java deleted file mode 100644 index d78de23371..0000000000 --- a/core-java-8/src/main/java/com/baeldung/interfaces/Truck.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.interfaces; - -public class Truck extends Vehicle { - @Override - public void transform() { - // implementation - } -} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/Vehicle.java b/core-java-8/src/main/java/com/baeldung/interfaces/Vehicle.java deleted file mode 100644 index 8b4662e1a3..0000000000 --- a/core-java-8/src/main/java/com/baeldung/interfaces/Vehicle.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.baeldung.interfaces; - -import com.baeldung.interfaces.multiinheritance.Transform; - -public abstract class Vehicle implements Transform { -} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java b/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java deleted file mode 100644 index fb0d36e3e0..0000000000 --- a/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.interfaces.multiinheritance; - -public class Vehicle implements Fly, Transform { - @Override - public void fly() { - System.out.println("I can Fly!!"); - } - - @Override - public void transform() { - System.out.println("I can Transform!!"); - } -} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java deleted file mode 100644 index afb3142d96..0000000000 --- a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.interfaces.polymorphysim; - -public class Circle implements Shape { - - private double radius; - - public Circle(double radius){ - this.radius = radius; - } - - @Override - public String name() { - return "Circle"; - } - - @Override - public double area() { - return Math.PI * (radius * radius); - } - - @Override - public String getColor() { - return "green"; - } -} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/DisplayShape.java b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/DisplayShape.java deleted file mode 100644 index d9c9dd107a..0000000000 --- a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/DisplayShape.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baeldung.interfaces.polymorphysim; - -import java.util.ArrayList; - -public class DisplayShape { - - private ArrayList shapes; - - public ArrayList getShapes() { - return shapes; - } - - public DisplayShape() { - shapes = new ArrayList<>(); - } - - public void add(Shape shape) { - shapes.add(shape); - } - - public void display() { - for (Shape shape : shapes) { - System.out.println(shape.name() + " area: " + shape.area()); - } - } -} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/FunctionalMain.java b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/FunctionalMain.java deleted file mode 100644 index 5316dd7db7..0000000000 --- a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/FunctionalMain.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baeldung.interfaces.polymorphysim; - -import java.util.function.Predicate; - -public class FunctionalMain { - -public static void main(String[] args) { - Shape circleShape = new Circle(2); - Shape squareShape = new Square(2); - - DisplayShape DisplayShape = new DisplayShape(); - DisplayShape.add(circleShape); - DisplayShape.add(squareShape); - - Predicate checkArea = (shape) -> shape.area() < 5; - - for (Shape shape : DisplayShape.getShapes()) { - if (checkArea.test(shape)) { - System.out.println(shape.name() + " " + shape.area()); - } - } -} -} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/MainPolymorphic.java b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/MainPolymorphic.java deleted file mode 100644 index cc43c1300b..0000000000 --- a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/MainPolymorphic.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.interfaces.polymorphysim; - -public class MainPolymorphic { - public static void main(String[] args){ - - Shape circleShape = new Circle(2); - Shape squareShape = new Square(2); - - DisplayShape displayShape = new DisplayShape(); - displayShape.add(circleShape); - displayShape.add(squareShape); - - displayShape.display(); - } -} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java deleted file mode 100644 index 560e07a80a..0000000000 --- a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.interfaces.polymorphysim; - -import com.baeldung.interfaces.HasColor; - -public interface Shape extends HasColor { - - public abstract String name(); - public abstract double area(); -} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java b/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java deleted file mode 100644 index 00b75ace20..0000000000 --- a/core-java-8/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.interfaces.polymorphysim; - -public class Square implements Shape { - - private double width; - - public Square(double width) { - this.width = width; - } - - @Override - public String name() { - return "Square"; - } - - @Override - public double area() { - return width * width; - } - - @Override - public String getColor() { - return "red"; - } -} diff --git a/core-java-8/src/test/java/com/baeldung/interfaces/PolymorphysimUnitTest.java b/core-java-8/src/test/java/com/baeldung/interfaces/PolymorphysimUnitTest.java deleted file mode 100644 index 7ded5e6621..0000000000 --- a/core-java-8/src/test/java/com/baeldung/interfaces/PolymorphysimUnitTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baeldung.interfaces; - -import com.baeldung.interfaces.polymorphysim.Circle; -import com.baeldung.interfaces.polymorphysim.Shape; -import com.baeldung.interfaces.polymorphysim.Square; -import org.assertj.core.api.Assertions; -import org.junit.Test; - -public class PolymorphysimUnitTest { - - @Test - public void whenInterfacePointsToCircle_CircleAreaMethodisBeingCalled(){ - double expectedArea = 12.566370614359172; - Shape circle = new Circle(2); - double actualArea = circle.area(); - Assertions.assertThat(actualArea).isEqualTo(expectedArea); - } - - @Test - public void whenInterfacePointsToSquare_SquareAreaMethodisBeingCalled(){ - double expectedArea = 4; - Shape square = new Square(2); - double actualArea = square.area(); - Assertions.assertThat(actualArea).isEqualTo(expectedArea); - } -} diff --git a/core-java/src/main/java/com/baeldung/interfaces/Box.java b/core-java/src/main/java/com/baeldung/interfaces/Box.java new file mode 100644 index 0000000000..0bb6560465 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/interfaces/Box.java @@ -0,0 +1,5 @@ +package com.baeldung.interfaces; + +public interface Box extends HasColor { + int getHeight(); +} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/Employee.java b/core-java/src/main/java/com/baeldung/interfaces/Employee.java similarity index 99% rename from core-java-8/src/main/java/com/baeldung/interfaces/Employee.java rename to core-java/src/main/java/com/baeldung/interfaces/Employee.java index 903bc81e6f..8c6bd3f7f3 100644 --- a/core-java-8/src/main/java/com/baeldung/interfaces/Employee.java +++ b/core-java/src/main/java/com/baeldung/interfaces/Employee.java @@ -11,5 +11,4 @@ public class Employee { public void setSalary(double salary) { this.salary = salary; } - } diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java b/core-java/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java similarity index 67% rename from core-java-8/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java rename to core-java/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java index cfa4226c1a..5c841b7c2b 100644 --- a/core-java-8/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java +++ b/core-java/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java @@ -6,12 +6,11 @@ public class EmployeeSalaryComparator implements Comparator { @Override public int compare(Employee employeeA, Employee employeeB) { - - if(employeeA.getSalary() < employeeB.getSalary()){ + if (employeeA.getSalary() < employeeB.getSalary()) { return -1; - }else if(employeeA.getSalary() > employeeB.getSalary()){ + } else if (employeeA.getSalary() > employeeB.getSalary()) { return 1; - }else{ + } else { return 0; } } diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/HasColor.java b/core-java/src/main/java/com/baeldung/interfaces/HasColor.java similarity index 66% rename from core-java-8/src/main/java/com/baeldung/interfaces/HasColor.java rename to core-java/src/main/java/com/baeldung/interfaces/HasColor.java index 6eface2d47..d9688ea866 100644 --- a/core-java-8/src/main/java/com/baeldung/interfaces/HasColor.java +++ b/core-java/src/main/java/com/baeldung/interfaces/HasColor.java @@ -1,5 +1,4 @@ package com.baeldung.interfaces; public interface HasColor { - public String getColor(); -} \ No newline at end of file +} diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java b/core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java similarity index 84% rename from core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java rename to core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java index b951fc0273..d9b30a1e7b 100644 --- a/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java +++ b/core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java @@ -1,6 +1,7 @@ package com.baeldung.interfaces.multiinheritance; -public class Car implements Fly, Transform { +public class Car implements Fly,Transform { + @Override public void fly() { System.out.println("I can Fly!!"); diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Fly.java b/core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Fly.java similarity index 69% rename from core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Fly.java rename to core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Fly.java index d84182aec6..611e51c67b 100644 --- a/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Fly.java +++ b/core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Fly.java @@ -1,5 +1,6 @@ package com.baeldung.interfaces.multiinheritance; -public abstract interface Fly{ +public interface Fly { + void fly(); } diff --git a/core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java b/core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java rename to core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java b/core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java new file mode 100644 index 0000000000..be25e112ee --- /dev/null +++ b/core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java @@ -0,0 +1,4 @@ +package com.baeldung.interfaces.multiinheritance; + +public abstract class Vehicle implements Transform { +} diff --git a/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java b/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java new file mode 100644 index 0000000000..b4d97bd53a --- /dev/null +++ b/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java @@ -0,0 +1,9 @@ +package com.baeldung.interfaces.polymorphysim; + +public class Circle implements Shape { + + @Override + public String name() { + return "Circle"; + } +} diff --git a/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/MainTestClass.java b/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/MainTestClass.java new file mode 100644 index 0000000000..5cce3c3af0 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/MainTestClass.java @@ -0,0 +1,20 @@ +package com.baeldung.interfaces.polymorphysim; + +import java.util.ArrayList; +import java.util.List; + +public class MainTestClass { + + public static void main(String[] args) { + List shapes = new ArrayList<>(); + Shape circleShape = new Circle(); + Shape squareShape = new Square(); + + shapes.add(circleShape); + shapes.add(squareShape); + + for (Shape shape : shapes) { + System.out.println(shape.name()); + } + } +} diff --git a/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java b/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java new file mode 100644 index 0000000000..885dc73de2 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java @@ -0,0 +1,6 @@ +package com.baeldung.interfaces.polymorphysim; + +public interface Shape { + + String name(); +} diff --git a/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java b/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java new file mode 100644 index 0000000000..c17bdd902d --- /dev/null +++ b/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java @@ -0,0 +1,9 @@ +package com.baeldung.interfaces.polymorphysim; + +public class Square implements Shape { + + @Override + public String name() { + return "Square"; + } +} From 1d14de6b4b2a2fba456967a38a9e9623e925d5a2 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 5 Jan 2019 22:39:29 +0200 Subject: [PATCH 164/271] Update and rename PersonAndEmployeeReflectionTest.java to PersonAndEmployeeReflectionUnitTest.java --- ...tionTest.java => PersonAndEmployeeReflectionUnitTest.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename core-java/src/test/java/com/baeldung/reflection/{PersonAndEmployeeReflectionTest.java => PersonAndEmployeeReflectionUnitTest.java} (98%) diff --git a/core-java/src/test/java/com/baeldung/reflection/PersonAndEmployeeReflectionTest.java b/core-java/src/test/java/com/baeldung/reflection/PersonAndEmployeeReflectionUnitTest.java similarity index 98% rename from core-java/src/test/java/com/baeldung/reflection/PersonAndEmployeeReflectionTest.java rename to core-java/src/test/java/com/baeldung/reflection/PersonAndEmployeeReflectionUnitTest.java index 034e54ee93..c051f165f1 100644 --- a/core-java/src/test/java/com/baeldung/reflection/PersonAndEmployeeReflectionTest.java +++ b/core-java/src/test/java/com/baeldung/reflection/PersonAndEmployeeReflectionUnitTest.java @@ -10,7 +10,7 @@ import java.util.List; import static org.junit.Assert.*; -public class PersonAndEmployeeReflectionTest { +public class PersonAndEmployeeReflectionUnitTest { // Fields names private static final String LAST_NAME_FIELD = "lastName"; @@ -125,4 +125,4 @@ public class PersonAndEmployeeReflectionTest { return result; } -} \ No newline at end of file +} From cd4be8ce9eba7905eecb78dd1195bc2ca7936ac5 Mon Sep 17 00:00:00 2001 From: kyleandari <44148335+kyleandari@users.noreply.github.com> Date: Sat, 5 Jan 2019 15:56:01 -0500 Subject: [PATCH 165/271] moving code from java-core to java-core-lang (#6084) --- .../src/main/java/com/baeldung/interfaces/Box.java | 0 .../src/main/java/com/baeldung/interfaces/Employee.java | 0 .../java/com/baeldung/interfaces/EmployeeSalaryComparator.java | 0 .../src/main/java/com/baeldung/interfaces/HasColor.java | 0 .../main/java/com/baeldung/interfaces/multiinheritance/Car.java | 0 .../main/java/com/baeldung/interfaces/multiinheritance/Fly.java | 0 .../java/com/baeldung/interfaces/multiinheritance/Transform.java | 0 .../java/com/baeldung/interfaces/multiinheritance/Vehicle.java | 0 .../main/java/com/baeldung/interfaces/polymorphysim/Circle.java | 0 .../java/com/baeldung/interfaces/polymorphysim/MainTestClass.java | 0 .../main/java/com/baeldung/interfaces/polymorphysim/Shape.java | 0 .../main/java/com/baeldung/interfaces/polymorphysim/Square.java | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename {core-java => core-java-lang}/src/main/java/com/baeldung/interfaces/Box.java (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/interfaces/Employee.java (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/interfaces/HasColor.java (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/interfaces/multiinheritance/Fly.java (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/interfaces/polymorphysim/MainTestClass.java (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java (100%) rename {core-java => core-java-lang}/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java (100%) diff --git a/core-java/src/main/java/com/baeldung/interfaces/Box.java b/core-java-lang/src/main/java/com/baeldung/interfaces/Box.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/Box.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/Box.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/Employee.java b/core-java-lang/src/main/java/com/baeldung/interfaces/Employee.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/Employee.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/Employee.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java b/core-java-lang/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/EmployeeSalaryComparator.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/HasColor.java b/core-java-lang/src/main/java/com/baeldung/interfaces/HasColor.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/HasColor.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/HasColor.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java b/core-java-lang/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/multiinheritance/Car.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Fly.java b/core-java-lang/src/main/java/com/baeldung/interfaces/multiinheritance/Fly.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Fly.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/multiinheritance/Fly.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java b/core-java-lang/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/multiinheritance/Transform.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java b/core-java-lang/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/multiinheritance/Vehicle.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java b/core-java-lang/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/polymorphysim/Circle.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/MainTestClass.java b/core-java-lang/src/main/java/com/baeldung/interfaces/polymorphysim/MainTestClass.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/polymorphysim/MainTestClass.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/polymorphysim/MainTestClass.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java b/core-java-lang/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/polymorphysim/Shape.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java b/core-java-lang/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/polymorphysim/Square.java From 20e8886165192cd55e5151120b07ff0029242e28 Mon Sep 17 00:00:00 2001 From: Kumar Chandrakant Date: Sun, 6 Jan 2019 19:26:21 +0530 Subject: [PATCH 166/271] Kafka spark cassandra (#6078) * Adding files for the tutorial BAEL-2301 * Incorporating review comments on the article. --- .../data/pipeline/WordCountingApp.java | 58 ++++------------ .../WordCountingAppWithCheckpoint.java | 66 +++++-------------- 2 files changed, 29 insertions(+), 95 deletions(-) diff --git a/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingApp.java b/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingApp.java index 08695b3631..1155644e1e 100644 --- a/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingApp.java +++ b/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingApp.java @@ -6,7 +6,6 @@ import static com.datastax.spark.connector.japi.CassandraJavaUtil.mapToRow; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -35,7 +34,6 @@ import scala.Tuple2; public class WordCountingApp { - @SuppressWarnings("serial") public static void main(String[] args) throws InterruptedException { Logger.getLogger("org") .setLevel(Level.OFF); @@ -61,52 +59,24 @@ public class WordCountingApp { JavaInputDStream> messages = KafkaUtils.createDirectStream(streamingContext, LocationStrategies.PreferConsistent(), ConsumerStrategies. Subscribe(topics, kafkaParams)); - JavaPairDStream results = messages.mapToPair(new PairFunction, String, String>() { - @Override - public Tuple2 call(ConsumerRecord record) { - return new Tuple2<>(record.key(), record.value()); - } - }); + JavaPairDStream results = messages.mapToPair((PairFunction, String, String>) record -> new Tuple2<>(record.key(), record.value())); - JavaDStream lines = results.map(new Function, String>() { - @Override - public String call(Tuple2 tuple2) { - return tuple2._2(); - } - }); + JavaDStream lines = results.map((Function, String>) tuple2 -> tuple2._2()); - JavaDStream words = lines.flatMap(new FlatMapFunction() { - @Override - public Iterator call(String x) { - return Arrays.asList(x.split("\\s+")) - .iterator(); - } - }); + JavaDStream words = lines.flatMap((FlatMapFunction) x -> Arrays.asList(x.split("\\s+")) + .iterator()); - JavaPairDStream wordCounts = words.mapToPair(new PairFunction() { - @Override - public Tuple2 call(String s) { - return new Tuple2<>(s, 1); - } - }) - .reduceByKey(new Function2() { - @Override - public Integer call(Integer i1, Integer i2) { - return i1 + i2; - } - }); + JavaPairDStream wordCounts = words.mapToPair((PairFunction) s -> new Tuple2<>(s, 1)) + .reduceByKey((Function2) (i1, i2) -> i1 + i2); - wordCounts.foreachRDD(new VoidFunction>() { - @Override - public void call(JavaPairRDD javaRdd) throws Exception { - Map wordCountMap = javaRdd.collectAsMap(); - for (String key : wordCountMap.keySet()) { - List words = Arrays.asList(new Word(key, wordCountMap.get(key))); - JavaRDD rdd = streamingContext.sparkContext() - .parallelize(words); - javaFunctions(rdd).writerBuilder("vocabulary", "words", mapToRow(Word.class)) - .saveToCassandra(); - } + wordCounts.foreachRDD((VoidFunction>) javaRdd -> { + Map wordCountMap = javaRdd.collectAsMap(); + for (String key : wordCountMap.keySet()) { + List wordList = Arrays.asList(new Word(key, wordCountMap.get(key))); + JavaRDD rdd = streamingContext.sparkContext() + .parallelize(wordList); + javaFunctions(rdd).writerBuilder("vocabulary", "words", mapToRow(Word.class)) + .saveToCassandra(); } }); diff --git a/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingAppWithCheckpoint.java b/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingAppWithCheckpoint.java index e20b910635..79e21f7209 100644 --- a/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingAppWithCheckpoint.java +++ b/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingAppWithCheckpoint.java @@ -6,7 +6,6 @@ import static com.datastax.spark.connector.japi.CassandraJavaUtil.mapToRow; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -15,7 +14,6 @@ import org.apache.kafka.common.serialization.StringDeserializer; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.spark.SparkConf; -import org.apache.spark.api.java.JavaPairRDD; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.Optional; @@ -43,7 +41,6 @@ public class WordCountingAppWithCheckpoint { public static JavaSparkContext sparkContext; - @SuppressWarnings("serial") public static void main(String[] args) throws InterruptedException { Logger.getLogger("org") @@ -74,63 +71,30 @@ public class WordCountingAppWithCheckpoint { JavaInputDStream> messages = KafkaUtils.createDirectStream(streamingContext, LocationStrategies.PreferConsistent(), ConsumerStrategies. Subscribe(topics, kafkaParams)); - JavaPairDStream results = messages.mapToPair(new PairFunction, String, String>() { - @Override - public Tuple2 call(ConsumerRecord record) { - return new Tuple2<>(record.key(), record.value()); - } - }); + JavaPairDStream results = messages.mapToPair((PairFunction, String, String>) record -> new Tuple2<>(record.key(), record.value())); - JavaDStream lines = results.map(new Function, String>() { - @Override - public String call(Tuple2 tuple2) { - return tuple2._2(); - } - }); + JavaDStream lines = results.map((Function, String>) tuple2 -> tuple2._2()); - JavaDStream words = lines.flatMap(new FlatMapFunction() { - @Override - public Iterator call(String x) { - return Arrays.asList(x.split("\\s+")) - .iterator(); - } - }); + JavaDStream words = lines.flatMap((FlatMapFunction) x -> Arrays.asList(x.split("\\s+")) + .iterator()); - JavaPairDStream wordCounts = words.mapToPair(new PairFunction() { - @Override - public Tuple2 call(String s) { - return new Tuple2<>(s, 1); - } - }) - .reduceByKey(new Function2() { - @Override - public Integer call(Integer i1, Integer i2) { - return i1 + i2; - } - }); + JavaPairDStream wordCounts = words.mapToPair((PairFunction) s -> new Tuple2<>(s, 1)) + .reduceByKey((Function2) (i1, i2) -> i1 + i2); - Function3, State, Tuple2> mappingFunc = (word, one, state) -> { + JavaMapWithStateDStream> cumulativeWordCounts = wordCounts.mapWithState(StateSpec.function((Function3, State, Tuple2>) (word, one, state) -> { int sum = one.orElse(0) + (state.exists() ? state.get() : 0); Tuple2 output = new Tuple2<>(word, sum); state.update(sum); return output; - }; + })); - JavaPairRDD initialRDD = JavaPairRDD.fromJavaRDD(sparkContext.emptyRDD()); - - JavaMapWithStateDStream> cumulativeWordCounts = wordCounts.mapWithState(StateSpec.function(mappingFunc) - .initialState(initialRDD)); - - cumulativeWordCounts.foreachRDD(new VoidFunction>>() { - @Override - public void call(JavaRDD> javaRdd) throws Exception { - List> wordCountList = javaRdd.collect(); - for (Tuple2 tuple : wordCountList) { - List words = Arrays.asList(new Word(tuple._1, tuple._2)); - JavaRDD rdd = sparkContext.parallelize(words); - javaFunctions(rdd).writerBuilder("vocabulary", "words", mapToRow(Word.class)) - .saveToCassandra(); - } + cumulativeWordCounts.foreachRDD((VoidFunction>>) javaRdd -> { + List> wordCountList = javaRdd.collect(); + for (Tuple2 tuple : wordCountList) { + List wordList = Arrays.asList(new Word(tuple._1, tuple._2)); + JavaRDD rdd = sparkContext.parallelize(wordList); + javaFunctions(rdd).writerBuilder("vocabulary", "words", mapToRow(Word.class)) + .saveToCassandra(); } }); From 731a3cd2298232d75ce41fd2ab194f091bca4e36 Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Sun, 6 Jan 2019 16:15:09 +0200 Subject: [PATCH 167/271] BAEL-2104: Spring Boot deployment to AWS Beanstalk (#5951) --- spring-boot-bootstrap/pom.xml | 21 +++++++++++++++++++ .../application-beanstalk.properties | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 spring-boot-bootstrap/src/main/resources/application-beanstalk.properties diff --git a/spring-boot-bootstrap/pom.xml b/spring-boot-bootstrap/pom.xml index 7cafc5aa24..0ffc1820b8 100644 --- a/spring-boot-bootstrap/pom.xml +++ b/spring-boot-bootstrap/pom.xml @@ -57,6 +57,27 @@ + + beanstalk + + ${project.name}-eb + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + + **/cloud/config/*.java + + + + + + openshift diff --git a/spring-boot-bootstrap/src/main/resources/application-beanstalk.properties b/spring-boot-bootstrap/src/main/resources/application-beanstalk.properties new file mode 100644 index 0000000000..de03a3b5bb --- /dev/null +++ b/spring-boot-bootstrap/src/main/resources/application-beanstalk.properties @@ -0,0 +1,3 @@ +spring.datasource.url=jdbc:mysql://${rds.hostname}:${rds.port}/${rds.db.name} +spring.datasource.username=${rds.username} +spring.datasource.password=${rds.password} \ No newline at end of file From e89c0948d8b33be57cecf099b189748c2dc7cc29 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 5 Jan 2019 19:58:09 +0530 Subject: [PATCH 168/271] [BAEL-11415] - Initial commit with sparing-kafka version and topic creation configuration onstatup --- spring-kafka/pom.xml | 2 +- .../spring/kafka/KafkaApplication.java | 18 +++++- .../spring/kafka/KafkaTopicConfig.java | 57 +++++++++++++++++++ .../org/baeldung/SpringContextLiveTest.java | 17 ++++++ 4 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaTopicConfig.java create mode 100644 spring-kafka/src/test/java/org/baeldung/SpringContextLiveTest.java diff --git a/spring-kafka/pom.xml b/spring-kafka/pom.xml index 5c370880b4..b76d4f10c0 100644 --- a/spring-kafka/pom.xml +++ b/spring-kafka/pom.xml @@ -33,7 +33,7 @@ - 1.1.3.RELEASE + 2.2.2.RELEASE 2.9.7 diff --git a/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java b/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java index 4ee7f40335..b313eafdb9 100644 --- a/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java +++ b/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java @@ -13,8 +13,11 @@ import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.annotation.TopicPartition; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.support.KafkaHeaders; +import org.springframework.kafka.support.SendResult; import org.springframework.messaging.handler.annotation.Header; import org.springframework.messaging.handler.annotation.Payload; +import org.springframework.util.concurrent.ListenableFuture; +import org.springframework.util.concurrent.ListenableFutureCallback; @SpringBootApplication public class KafkaApplication { @@ -98,7 +101,20 @@ public class KafkaApplication { private String greetingTopicName; public void sendMessage(String message) { - kafkaTemplate.send(topicName, message); + + ListenableFuture> future = kafkaTemplate.send(topicName, message); + + future.addCallback(new ListenableFutureCallback>() { + + @Override + public void onSuccess(SendResult result) { + System.out.println("Sent message=[" + message + "] with offset=[" + result.getRecordMetadata().offset() + "]"); + } + @Override + public void onFailure(Throwable ex) { + System.out.println("Unable to send message=[" + message + "] due to : " + ex.getMessage()); + } + }); } public void sendMessageToPartion(String message, int partition) { diff --git a/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaTopicConfig.java b/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaTopicConfig.java new file mode 100644 index 0000000000..a3426e78a3 --- /dev/null +++ b/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaTopicConfig.java @@ -0,0 +1,57 @@ +package com.baeldung.spring.kafka; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.kafka.clients.admin.AdminClientConfig; +import org.apache.kafka.clients.admin.NewTopic; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.kafka.core.KafkaAdmin; + +@Configuration +public class KafkaTopicConfig { + + @Value(value = "${kafka.bootstrapAddress}") + private String bootstrapAddress; + + @Value(value = "${message.topic.name}") + private String topicName; + + @Value(value = "${partitioned.topic.name}") + private String partionedTopicName; + + @Value(value = "${filtered.topic.name}") + private String filteredTopicName; + + @Value(value = "${greeting.topic.name}") + private String greetingTopicName; + + @Bean + public KafkaAdmin kafkaAdmin() { + Map configs = new HashMap<>(); + configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress); + return new KafkaAdmin(configs); + } + + @Bean + public NewTopic topic1() { + return new NewTopic(topicName, 1, (short) 1); + } + + @Bean + public NewTopic topic2() { + return new NewTopic(partionedTopicName, 6, (short) 1); + } + + @Bean + public NewTopic topic3() { + return new NewTopic(filteredTopicName, 1, (short) 1); + } + + @Bean + public NewTopic topic4() { + return new NewTopic(greetingTopicName, 1, (short) 1); + } +} diff --git a/spring-kafka/src/test/java/org/baeldung/SpringContextLiveTest.java b/spring-kafka/src/test/java/org/baeldung/SpringContextLiveTest.java new file mode 100644 index 0000000000..d8fb3131f5 --- /dev/null +++ b/spring-kafka/src/test/java/org/baeldung/SpringContextLiveTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.kafka.KafkaApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = KafkaApplication.class) +public class SpringContextLiveTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} From 6f1e14b649b821cb1ab38c9ae3a3b3e24eb8d05d Mon Sep 17 00:00:00 2001 From: Andrey Shcherbakov Date: Sun, 6 Jan 2019 21:31:51 +0100 Subject: [PATCH 169/271] Code for article BAEL-2386 (#5958) * Add code for the article 'Java Primitives versus Objects' * Use JMH for benchmarking the primitive and wrapper classes * Uncomment the benchmarks and remove unused class * Add a binary search tree implementation * Add an example of how to use the binary tree class * Adjust the print statements * Add a code for article #BAEL-2386 --- .../flightrecorder/FlightRecorder.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/flightrecorder/FlightRecorder.java diff --git a/core-java/src/main/java/com/baeldung/flightrecorder/FlightRecorder.java b/core-java/src/main/java/com/baeldung/flightrecorder/FlightRecorder.java new file mode 100644 index 0000000000..02c3e96124 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/flightrecorder/FlightRecorder.java @@ -0,0 +1,32 @@ +package com.baeldung.flightrecorder; + +import java.util.ArrayList; +import java.util.List; + +/** + * Simple program that illustrates how to use Java Flight Recorder. + * + * This programs creates a list, inserts objects in it until + * an OutOfMemoryError is thrown. + * + */ +public class FlightRecorder { + + public static void main(String[] args) { + List items = new ArrayList<>(1); + try { + while (true) { + items.add(new Object()); + } + } catch (OutOfMemoryError e) { + System.out.println(e.getMessage()); + } + assert items.size() > 0; + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + System.out.println(e.getMessage()); + } + } + +} From 65b9909fed4ab0a002cdb8554e0b86c91ae714a1 Mon Sep 17 00:00:00 2001 From: Rajesh Bhojwani Date: Mon, 7 Jan 2019 14:01:13 +0530 Subject: [PATCH 170/271] username:rajeshbhojwani "Java toString() method" (#6047) * Check in code for Java toString method * fix formatting issues * Fix formatting issues * Fix formatting issues * Fix formatting issues * Fix formatting issues * Fix formatting issues * replacing orders with order * Update formatting * Fix formatting * Fix formatting * Fix formatting * Fix formatting * Fix formatting --- .../baeldung/string/tostring/Customer.java | 19 ++++++++ .../tostring/CustomerArrayToString.java | 19 ++++++++ .../CustomerComplexObjectToString.java | 19 ++++++++ .../tostring/CustomerPrimitiveToString.java | 19 ++++++++ .../tostring/CustomerReflectionToString.java | 41 +++++++++++++++++ .../CustomerWrapperCollectionToString.java | 39 ++++++++++++++++ .../com/baeldung/string/tostring/Order.java | 46 +++++++++++++++++++ .../tostring/CustomerArrayToStringTest.java | 26 +++++++++++ .../CustomerComplexObjectToStringTest.java | 25 ++++++++++ .../CustomerPrimitiveToStringTest.java | 22 +++++++++ .../CustomerReflectionToStringTest.java | 32 +++++++++++++ ...CustomerWrapperCollectionToStringTest.java | 33 +++++++++++++ 12 files changed, 340 insertions(+) create mode 100644 java-strings/src/main/java/com/baeldung/string/tostring/Customer.java create mode 100644 java-strings/src/main/java/com/baeldung/string/tostring/CustomerArrayToString.java create mode 100644 java-strings/src/main/java/com/baeldung/string/tostring/CustomerComplexObjectToString.java create mode 100644 java-strings/src/main/java/com/baeldung/string/tostring/CustomerPrimitiveToString.java create mode 100644 java-strings/src/main/java/com/baeldung/string/tostring/CustomerReflectionToString.java create mode 100644 java-strings/src/main/java/com/baeldung/string/tostring/CustomerWrapperCollectionToString.java create mode 100644 java-strings/src/main/java/com/baeldung/string/tostring/Order.java create mode 100644 java-strings/src/test/java/com/baeldung/string/tostring/CustomerArrayToStringTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/tostring/CustomerComplexObjectToStringTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/tostring/CustomerPrimitiveToStringTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringTest.java create mode 100644 java-strings/src/test/java/com/baeldung/string/tostring/CustomerWrapperCollectionToStringTest.java diff --git a/java-strings/src/main/java/com/baeldung/string/tostring/Customer.java b/java-strings/src/main/java/com/baeldung/string/tostring/Customer.java new file mode 100644 index 0000000000..e914a83f0e --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/tostring/Customer.java @@ -0,0 +1,19 @@ +package com.baeldung.string.tostring; + +public class Customer { + private String firstName; + private String lastName; + + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + public String getLastName() { + return lastName; + } + public void setLastName(String lastName) { + this.lastName = lastName; + } +} diff --git a/java-strings/src/main/java/com/baeldung/string/tostring/CustomerArrayToString.java b/java-strings/src/main/java/com/baeldung/string/tostring/CustomerArrayToString.java new file mode 100644 index 0000000000..1736657276 --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/tostring/CustomerArrayToString.java @@ -0,0 +1,19 @@ +package com.baeldung.string.tostring; + +import java.util.Arrays; + +public class CustomerArrayToString extends Customer { + private Order[] orders; + + public Order[] getOrders() { + return orders; + } + public void setOrders(Order[] orders) { + this.orders = orders; + } + @Override + public String toString() { + return "Customer [orders=" + Arrays.toString(orders) + ", getFirstName()=" + getFirstName() + + ", getLastName()=" + getLastName() + "]"; + } +} diff --git a/java-strings/src/main/java/com/baeldung/string/tostring/CustomerComplexObjectToString.java b/java-strings/src/main/java/com/baeldung/string/tostring/CustomerComplexObjectToString.java new file mode 100644 index 0000000000..9bede1b3fc --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/tostring/CustomerComplexObjectToString.java @@ -0,0 +1,19 @@ +package com.baeldung.string.tostring; + +public class CustomerComplexObjectToString extends Customer { + private Order order; + + public Order getOrder() { + return order; + } + + public void setOrder(Order order) { + this.order = order; + } + + @Override + public String toString() { + return "Customer [order=" + order + ", getFirstName()=" + getFirstName() + + ", getLastName()=" + getLastName() + "]"; + } +} \ No newline at end of file diff --git a/java-strings/src/main/java/com/baeldung/string/tostring/CustomerPrimitiveToString.java b/java-strings/src/main/java/com/baeldung/string/tostring/CustomerPrimitiveToString.java new file mode 100644 index 0000000000..86e08ca447 --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/tostring/CustomerPrimitiveToString.java @@ -0,0 +1,19 @@ +package com.baeldung.string.tostring; + +public class CustomerPrimitiveToString extends Customer { + private long balance; + + public long getBalance() { + return balance; + } + + public void setBalance(long balance) { + this.balance = balance; + } + + @Override + public String toString() { + return "Customer [balance=" + balance + ", getFirstName()=" + getFirstName() + + ", getLastName()=" + getLastName() + "]"; + } +} diff --git a/java-strings/src/main/java/com/baeldung/string/tostring/CustomerReflectionToString.java b/java-strings/src/main/java/com/baeldung/string/tostring/CustomerReflectionToString.java new file mode 100644 index 0000000000..2da1163c63 --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/tostring/CustomerReflectionToString.java @@ -0,0 +1,41 @@ +package com.baeldung.string.tostring; + +import java.util.List; + +import org.apache.commons.lang3.builder.ReflectionToStringBuilder; + +public class CustomerReflectionToString extends Customer{ + + private Integer score; + private List orders; + private StringBuffer fullname; + + public Integer getScore() { + return score; + } + + public void setScore(Integer score) { + this.score = score; + } + + public List getOrders() { + return orders; + } + + public void setOrders(List orders) { + this.orders = orders; + } + + public StringBuffer getFullname() { + return fullname; + } + + public void setFullname(StringBuffer fullname) { + this.fullname = fullname; + } + + @Override + public String toString() { + return ReflectionToStringBuilder.toString(this); + } +} diff --git a/java-strings/src/main/java/com/baeldung/string/tostring/CustomerWrapperCollectionToString.java b/java-strings/src/main/java/com/baeldung/string/tostring/CustomerWrapperCollectionToString.java new file mode 100644 index 0000000000..6c7b999045 --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/tostring/CustomerWrapperCollectionToString.java @@ -0,0 +1,39 @@ +package com.baeldung.string.tostring; + +import java.util.List; + +public class CustomerWrapperCollectionToString extends Customer { + private Integer score; + private List orders; + private StringBuffer fullname; + + public Integer getScore() { + return score; + } + + public void setScore(Integer score) { + this.score = score; + } + + public List getOrders() { + return orders; + } + + public void setOrders(List orders) { + this.orders = orders; + } + + public StringBuffer getFullname() { + return fullname; + } + + public void setFullname(StringBuffer fullname) { + this.fullname = fullname; + } + + @Override + public String toString() { + return "Customer [score=" + score + ", orders=" + orders + ", fullname=" + fullname + + ", getFirstName()=" + getFirstName() + ", getLastName()=" + getLastName() + "]"; + } +} diff --git a/java-strings/src/main/java/com/baeldung/string/tostring/Order.java b/java-strings/src/main/java/com/baeldung/string/tostring/Order.java new file mode 100644 index 0000000000..017e2d9bc8 --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/tostring/Order.java @@ -0,0 +1,46 @@ +package com.baeldung.string.tostring; + +public class Order { + + private String orderId; + private String desc; + private long value; + private String status; + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public long getValue() { + return value; + } + + public void setValue(long value) { + this.value = value; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + @Override + public String toString() { + return "Order [orderId=" + orderId + ", desc=" + desc + ", value=" + value + "]"; + } + +} diff --git a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerArrayToStringTest.java b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerArrayToStringTest.java new file mode 100644 index 0000000000..31e268b4a3 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerArrayToStringTest.java @@ -0,0 +1,26 @@ +package com.baeldung.string.tostring; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +public class CustomerArrayToStringTest { + private static final String CUSTOMER_ARRAY_TO_STRING + = "Customer [orders=[Order [orderId=A1111, desc=Game, value=0]], getFirstName()=Rajesh, getLastName()=Bhojwani]"; + + @Test + public void givenArray_whenToString_thenCustomerDetails() { + CustomerArrayToString customer = new CustomerArrayToString(); + customer.setFirstName("Rajesh"); + customer.setLastName("Bhojwani"); + Order[] orders = new Order[1]; + orders[0] = new Order(); + orders[0].setOrderId("A1111"); + orders[0].setDesc("Game"); + orders[0].setStatus("In-Shiping"); + customer.setOrders(orders); + + assertEquals(CUSTOMER_ARRAY_TO_STRING, customer.toString()); + } + +} diff --git a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerComplexObjectToStringTest.java b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerComplexObjectToStringTest.java new file mode 100644 index 0000000000..3c98394f85 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerComplexObjectToStringTest.java @@ -0,0 +1,25 @@ +package com.baeldung.string.tostring; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +public class CustomerComplexObjectToStringTest { + private static final String CUSTOMER_COMPLEX_TO_STRING + = "Customer [order=Order [orderId=A1111, desc=Game, value=0], getFirstName()=Rajesh, getLastName()=Bhojwani]"; + + @Test + public void givenComplex_whenToString_thenCustomerDetails() { + CustomerComplexObjectToString customer = new CustomerComplexObjectToString(); + customer.setFirstName("Rajesh"); + customer.setLastName("Bhojwani"); + Order order = new Order(); + order.setOrderId("A1111"); + order.setDesc("Game"); + order.setStatus("In-Shiping"); + customer.setOrder(order); + + assertEquals(CUSTOMER_COMPLEX_TO_STRING, customer.toString()); + } + +} diff --git a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerPrimitiveToStringTest.java b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerPrimitiveToStringTest.java new file mode 100644 index 0000000000..2a29cb93d8 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerPrimitiveToStringTest.java @@ -0,0 +1,22 @@ +package com.baeldung.string.tostring; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +public class CustomerPrimitiveToStringTest { + + private static final String CUSTOMER_PRIMITIVE_TO_STRING + = "Customer [balance=110, getFirstName()=Rajesh, getLastName()=Bhojwani]"; + + @Test + public void givenPrimitive_whenToString_thenCustomerDetails() { + CustomerPrimitiveToString customer = new CustomerPrimitiveToString(); + customer.setFirstName("Rajesh"); + customer.setLastName("Bhojwani"); + customer.setBalance(110); + + assertEquals(CUSTOMER_PRIMITIVE_TO_STRING, customer.toString()); + } +} + diff --git a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringTest.java b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringTest.java new file mode 100644 index 0000000000..290bef7133 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringTest.java @@ -0,0 +1,32 @@ +package com.baeldung.string.tostring; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.jupiter.api.Test; + +public class CustomerReflectionToStringTest { + private static final String CUSTOMER_REFLECTION_TO_STRING = "com.baeldung.string.tostring.CustomerReflectionToString"; + + @Test + public void givenWrapperCollectionStrBuffer_whenReflectionToString_thenCustomerDetails() { + CustomerReflectionToString customer = new CustomerReflectionToString(); + customer.setFirstName("Rajesh"); + customer.setLastName("Bhojwani"); + customer.setScore(8); + + List orders = new ArrayList(); + orders.add("Book"); + orders.add("Pen"); + customer.setOrders(orders); + + StringBuffer fullname = new StringBuffer(); + fullname.append(customer.getLastName()+", "+ customer.getFirstName()); + customer.setFullname(fullname); + + assertTrue(customer.toString().contains(CUSTOMER_REFLECTION_TO_STRING)); + } + +} diff --git a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerWrapperCollectionToStringTest.java b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerWrapperCollectionToStringTest.java new file mode 100644 index 0000000000..c80969d453 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerWrapperCollectionToStringTest.java @@ -0,0 +1,33 @@ +package com.baeldung.string.tostring; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.jupiter.api.Test; + +public class CustomerWrapperCollectionToStringTest { + private static final String CUSTOMER_WRAPPER_COLLECTION_TO_STRING + = "Customer [score=8, orders=[Book, Pen], fullname=Bhojwani, Rajesh, getFirstName()=Rajesh, getLastName()=Bhojwani]"; + + @Test + public void givenWrapperCollectionStrBuffer_whenToString_thenCustomerDetails() { + CustomerWrapperCollectionToString customer = new CustomerWrapperCollectionToString(); + customer.setFirstName("Rajesh"); + customer.setLastName("Bhojwani"); + customer.setScore(8); + + List orders = new ArrayList(); + orders.add("Book"); + orders.add("Pen"); + customer.setOrders(orders); + + StringBuffer fullname = new StringBuffer(); + fullname.append(customer.getLastName()+", "+ customer.getFirstName()); + customer.setFullname(fullname); + + assertEquals(CUSTOMER_WRAPPER_COLLECTION_TO_STRING, customer.toString()); + } + +} From 04743892db4547edada008b617ff6202da583da2 Mon Sep 17 00:00:00 2001 From: Alejandro Gervasio Date: Mon, 7 Jan 2019 08:17:52 -0300 Subject: [PATCH 171/271] What is thread-safety and how to achieve it Issue: BAEL-2416 --- .../threadsafety/application/Application.java | 86 +++++++++++++++++++ .../callables/AtomicCounterCallable.java | 19 ++++ .../callables/CounterCallable.java | 19 ++++ .../ExtrinsicLockCounterCallable.java | 19 ++++ .../callables/MessageServiceCallable.java | 19 ++++ .../ReentranReadWriteLockCounterCallable.java | 20 +++++ .../ReentrantLockCounterCallable.java | 19 ++++ .../threadsafety/mathutils/MathUtils.java | 14 +++ .../threadsafety/services/AtomicCounter.java | 18 ++++ .../threadsafety/services/Counter.java | 18 ++++ .../services/ExtrinsicLockCounter.java | 23 +++++ .../threadsafety/services/MessageService.java | 14 +++ .../services/ReentrantLockCounter.java | 26 ++++++ .../ReentrantReadWriteLockCounter.java | 34 ++++++++ .../threadsafety/services/StateHolder.java | 14 +++ .../threadsafety/tests/CounterTest.java | 23 +++++ .../tests/ExtrinsicLockCounterTest.java | 23 +++++ .../threadsafety/tests/MathUtilsTest.java | 13 +++ .../tests/MessageServiceTest.java | 23 +++++ .../tests/ReentrantLockCounterTest.java | 23 +++++ .../ReentrantReadWriteLockCounterTest.java | 24 ++++++ 21 files changed, 491 insertions(+) create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/application/Application.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/AtomicCounterCallable.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/CounterCallable.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/ExtrinsicLockCounterCallable.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/MessageServiceCallable.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/ReentranReadWriteLockCounterCallable.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/ReentrantLockCounterCallable.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/mathutils/MathUtils.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/AtomicCounter.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/Counter.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/ExtrinsicLockCounter.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/MessageService.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/ReentrantLockCounter.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/ReentrantReadWriteLockCounter.java create mode 100644 core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/StateHolder.java create mode 100644 core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/CounterTest.java create mode 100644 core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/ExtrinsicLockCounterTest.java create mode 100644 core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/MathUtilsTest.java create mode 100644 core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/MessageServiceTest.java create mode 100644 core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/ReentrantLockCounterTest.java create mode 100644 core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/ReentrantReadWriteLockCounterTest.java diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/application/Application.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/application/Application.java new file mode 100644 index 0000000000..0c5caba8a0 --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/application/Application.java @@ -0,0 +1,86 @@ +package com.baeldung.concurrent.threadsafety.application; + +import com.baeldung.concurrent.threadsafety.callables.AtomicCounterCallable; +import com.baeldung.concurrent.threadsafety.mathutils.MathUtils; +import com.baeldung.concurrent.threadsafety.callables.CounterCallable; +import com.baeldung.concurrent.threadsafety.callables.ExtrinsicLockCounterCallable; +import com.baeldung.concurrent.threadsafety.callables.MessageServiceCallable; +import com.baeldung.concurrent.threadsafety.callables.ReentranReadWriteLockCounterCallable; +import com.baeldung.concurrent.threadsafety.callables.ReentrantLockCounterCallable; +import com.baeldung.concurrent.threadsafety.services.AtomicCounter; +import com.baeldung.concurrent.threadsafety.services.Counter; +import com.baeldung.concurrent.threadsafety.services.ExtrinsicLockCounter; +import com.baeldung.concurrent.threadsafety.services.MessageService; +import com.baeldung.concurrent.threadsafety.services.ReentrantLockCounter; +import com.baeldung.concurrent.threadsafety.services.ReentrantReadWriteLockCounter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +public class Application { + + public static void main(String[] args) throws InterruptedException, ExecutionException { + + new Thread(() -> { + System.out.println(MathUtils.factorial(10)); + }).start(); + new Thread(() -> { + System.out.println(MathUtils.factorial(5)); + }).start(); + + ExecutorService executorService = Executors.newFixedThreadPool(10); + MessageService messageService = new MessageService("Welcome to Baeldung!"); + Future future1 = (Future) executorService.submit(new MessageServiceCallable(messageService)); + Future future2 = (Future) executorService.submit(new MessageServiceCallable(messageService)); + System.out.println(future1.get()); + System.out.println(future2.get()); + + Counter counter = new Counter(); + Future future3 = (Future) executorService.submit(new CounterCallable(counter)); + Future future4 = (Future) executorService.submit(new CounterCallable(counter)); + System.out.println(future3.get()); + System.out.println(future4.get()); + + ExtrinsicLockCounter extrinsicLockCounter = new ExtrinsicLockCounter(); + Future future5 = (Future) executorService.submit(new ExtrinsicLockCounterCallable(extrinsicLockCounter)); + Future future6 = (Future) executorService.submit(new ExtrinsicLockCounterCallable(extrinsicLockCounter)); + System.out.println(future5.get()); + System.out.println(future6.get()); + + ReentrantLockCounter reentrantLockCounter = new ReentrantLockCounter(); + Future future7 = (Future) executorService.submit(new ReentrantLockCounterCallable(reentrantLockCounter)); + Future future8 = (Future) executorService.submit(new ReentrantLockCounterCallable(reentrantLockCounter)); + System.out.println(future7.get()); + System.out.println(future8.get()); + + ReentrantReadWriteLockCounter reentrantReadWriteLockCounter = new ReentrantReadWriteLockCounter(); + Future future9 = (Future) executorService.submit(new ReentranReadWriteLockCounterCallable(reentrantReadWriteLockCounter)); + Future future10 = (Future) executorService.submit(new ReentranReadWriteLockCounterCallable(reentrantReadWriteLockCounter)); + System.out.println(future9.get()); + System.out.println(future10.get()); + + AtomicCounter atomicCounter = new AtomicCounter(); + Future future11 = (Future) executorService.submit(new AtomicCounterCallable(atomicCounter)); + Future future12 = (Future) executorService.submit(new AtomicCounterCallable(atomicCounter)); + System.out.println(future11.get()); + System.out.println(future12.get()); + + Collection syncCollection = Collections.synchronizedCollection(new ArrayList<>()); + Thread thread11 = new Thread(() -> syncCollection.addAll(Arrays.asList(1, 2, 3, 4, 5, 6))); + Thread thread12 = new Thread(() -> syncCollection.addAll(Arrays.asList(1, 2, 3, 4, 5, 6))); + thread11.start(); + thread12.start(); + + Map concurrentMap = new ConcurrentHashMap<>(); + concurrentMap.put("1", "one"); + concurrentMap.put("2", "two"); + concurrentMap.put("3", "three"); + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/AtomicCounterCallable.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/AtomicCounterCallable.java new file mode 100644 index 0000000000..d711299b5c --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/AtomicCounterCallable.java @@ -0,0 +1,19 @@ +package com.baeldung.concurrent.threadsafety.callables; + +import com.baeldung.concurrent.threadsafety.services.AtomicCounter; +import java.util.concurrent.Callable; + +public class AtomicCounterCallable implements Callable { + + private final AtomicCounter counter; + + public AtomicCounterCallable(AtomicCounter counter) { + this.counter = counter; + } + + @Override + public Integer call() throws Exception { + counter.incrementCounter(); + return counter.getCounter(); + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/CounterCallable.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/CounterCallable.java new file mode 100644 index 0000000000..cdcd84a17b --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/CounterCallable.java @@ -0,0 +1,19 @@ +package com.baeldung.concurrent.threadsafety.callables; + +import com.baeldung.concurrent.threadsafety.services.Counter; +import java.util.concurrent.Callable; + +public class CounterCallable implements Callable { + + private final Counter counter; + + public CounterCallable(Counter counter) { + this.counter = counter; + } + + @Override + public Integer call() throws Exception { + counter.incrementCounter(); + return counter.getCounter(); + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/ExtrinsicLockCounterCallable.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/ExtrinsicLockCounterCallable.java new file mode 100644 index 0000000000..29533e7630 --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/ExtrinsicLockCounterCallable.java @@ -0,0 +1,19 @@ +package com.baeldung.concurrent.threadsafety.callables; + +import com.baeldung.concurrent.threadsafety.services.ExtrinsicLockCounter; +import java.util.concurrent.Callable; + +public class ExtrinsicLockCounterCallable implements Callable { + + private final ExtrinsicLockCounter counter; + + public ExtrinsicLockCounterCallable(ExtrinsicLockCounter counter) { + this.counter = counter; + } + + @Override + public Integer call() throws Exception { + counter.incrementCounter(); + return counter.getCounter(); + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/MessageServiceCallable.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/MessageServiceCallable.java new file mode 100644 index 0000000000..84e8c7bb51 --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/MessageServiceCallable.java @@ -0,0 +1,19 @@ +package com.baeldung.concurrent.threadsafety.callables; + +import com.baeldung.concurrent.threadsafety.services.MessageService; +import java.util.concurrent.Callable; + +public class MessageServiceCallable implements Callable { + + private final MessageService messageService; + + public MessageServiceCallable(MessageService messageService) { + this.messageService = messageService; + + } + + @Override + public String call() { + return messageService.getMesssage(); + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/ReentranReadWriteLockCounterCallable.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/ReentranReadWriteLockCounterCallable.java new file mode 100644 index 0000000000..e806460d50 --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/ReentranReadWriteLockCounterCallable.java @@ -0,0 +1,20 @@ +package com.baeldung.concurrent.threadsafety.callables; + +import com.baeldung.concurrent.threadsafety.services.ReentrantReadWriteLockCounter; +import java.util.concurrent.Callable; + +public class ReentranReadWriteLockCounterCallable implements Callable { + + private final ReentrantReadWriteLockCounter counter; + + public ReentranReadWriteLockCounterCallable(ReentrantReadWriteLockCounter counter) { + this.counter = counter; + } + + @Override + public Integer call() throws Exception { + counter.incrementCounter(); + return counter.getCounter(); + } + +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/ReentrantLockCounterCallable.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/ReentrantLockCounterCallable.java new file mode 100644 index 0000000000..3511a98c60 --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/callables/ReentrantLockCounterCallable.java @@ -0,0 +1,19 @@ +package com.baeldung.concurrent.threadsafety.callables; + +import com.baeldung.concurrent.threadsafety.services.ReentrantLockCounter; +import java.util.concurrent.Callable; + +public class ReentrantLockCounterCallable implements Callable { + + private final ReentrantLockCounter counter; + + public ReentrantLockCounterCallable(ReentrantLockCounter counter) { + this.counter = counter; + } + + @Override + public Integer call() throws Exception { + counter.incrementCounter(); + return counter.getCounter(); + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/mathutils/MathUtils.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/mathutils/MathUtils.java new file mode 100644 index 0000000000..f560cd4281 --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/mathutils/MathUtils.java @@ -0,0 +1,14 @@ +package com.baeldung.concurrent.threadsafety.mathutils; + +import java.math.BigInteger; + +public class MathUtils { + + public static BigInteger factorial(int number) { + BigInteger f = new BigInteger("1"); + for (int i = 2; i <= number; i++) { + f = f.multiply(BigInteger.valueOf(i)); + } + return f; + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/AtomicCounter.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/AtomicCounter.java new file mode 100644 index 0000000000..32a373495c --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/AtomicCounter.java @@ -0,0 +1,18 @@ +package com.baeldung.concurrent.threadsafety.services; + +import java.util.concurrent.atomic.AtomicInteger; + +public class AtomicCounter { + + private final AtomicInteger counter = new AtomicInteger(); + + public AtomicCounter() {} + + public void incrementCounter() { + counter.incrementAndGet(); + } + + public synchronized int getCounter() { + return counter.get(); + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/Counter.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/Counter.java new file mode 100644 index 0000000000..f7dbc05639 --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/Counter.java @@ -0,0 +1,18 @@ +package com.baeldung.concurrent.threadsafety.services; + +public class Counter { + + private volatile int counter; + + public Counter() { + this.counter = 0; + } + + public synchronized void incrementCounter() { + counter += 1; + } + + public int getCounter() { + return counter; + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/ExtrinsicLockCounter.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/ExtrinsicLockCounter.java new file mode 100644 index 0000000000..8ab431fbc3 --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/ExtrinsicLockCounter.java @@ -0,0 +1,23 @@ +package com.baeldung.concurrent.threadsafety.services; + +public class ExtrinsicLockCounter { + + private int counter; + private final Object lock = new Object(); + + public ExtrinsicLockCounter() { + this.counter = 0; + } + + public void incrementCounter() { + synchronized (lock) { + counter += 1; + } + } + + public int getCounter() { + synchronized (lock) { + return counter; + } + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/MessageService.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/MessageService.java new file mode 100644 index 0000000000..33981381ea --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/MessageService.java @@ -0,0 +1,14 @@ +package com.baeldung.concurrent.threadsafety.services; + +public class MessageService { + + private final String message; + + public MessageService(String message) { + this.message = message; + } + + public String getMesssage() { + return message; + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/ReentrantLockCounter.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/ReentrantLockCounter.java new file mode 100644 index 0000000000..717f0717af --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/ReentrantLockCounter.java @@ -0,0 +1,26 @@ +package com.baeldung.concurrent.threadsafety.services; + +import java.util.concurrent.locks.ReentrantLock; + +public class ReentrantLockCounter { + + private int counter; + private final ReentrantLock reLock = new ReentrantLock(true); + + public ReentrantLockCounter() { + this.counter = 0; + } + + public void incrementCounter() { + reLock.lock(); + try { + counter += 1; + } finally { + reLock.unlock(); + } + } + + public int getCounter() { + return counter; + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/ReentrantReadWriteLockCounter.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/ReentrantReadWriteLockCounter.java new file mode 100644 index 0000000000..f740c938b1 --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/ReentrantReadWriteLockCounter.java @@ -0,0 +1,34 @@ +package com.baeldung.concurrent.threadsafety.services; + +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +public class ReentrantReadWriteLockCounter { + + private int counter; + private final ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock(); + private final Lock readLock = rwLock.readLock(); + private final Lock writeLock = rwLock.writeLock(); + + public ReentrantReadWriteLockCounter() { + this.counter = 0; + } + + public void incrementCounter() { + writeLock.lock(); + try { + counter += 1; + } finally { + writeLock.unlock(); + } + } + + public int getCounter() { + readLock.lock(); + try { + return counter; + } finally { + readLock.unlock(); + } + } +} diff --git a/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/StateHolder.java b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/StateHolder.java new file mode 100644 index 0000000000..5bbff9f39c --- /dev/null +++ b/core-java-concurrency-basic/src/main/java/com/baeldung/concurrent/threadsafety/services/StateHolder.java @@ -0,0 +1,14 @@ +package com.baeldung.concurrent.threadsafety.services; + +public class StateHolder { + + private final String state; + + public StateHolder(String state) { + this.state = state; + } + + public String getState() { + return state; + } +} diff --git a/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/CounterTest.java b/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/CounterTest.java new file mode 100644 index 0000000000..3abbb1bdad --- /dev/null +++ b/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/CounterTest.java @@ -0,0 +1,23 @@ +package com.baeldung.concurrent.threadsafety.tests; + +import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; +import com.baeldung.concurrent.threadsafety.callables.CounterCallable; +import com.baeldung.concurrent.threadsafety.services.Counter; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +public class CounterTest { + + @Test + public void whenCalledIncrementCounter_thenCorrect() throws Exception { + ExecutorService executorService = Executors.newFixedThreadPool(2); + Counter counter = new Counter(); + Future future1 = (Future) executorService.submit(new CounterCallable(counter)); + Future future2 = (Future) executorService.submit(new CounterCallable(counter)); + + assertThat(future1.get()).isEqualTo(1); + assertThat(future2.get()).isEqualTo(2); + } +} diff --git a/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/ExtrinsicLockCounterTest.java b/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/ExtrinsicLockCounterTest.java new file mode 100644 index 0000000000..dba90f5b74 --- /dev/null +++ b/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/ExtrinsicLockCounterTest.java @@ -0,0 +1,23 @@ +package com.baeldung.concurrent.threadsafety.tests; + +import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; +import com.baeldung.concurrent.threadsafety.callables.ExtrinsicLockCounterCallable; +import com.baeldung.concurrent.threadsafety.services.ExtrinsicLockCounter; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +public class ExtrinsicLockCounterTest { + + @Test + public void whenCalledIncrementCounter_thenCorrect() throws Exception { + ExecutorService executorService = Executors.newFixedThreadPool(2); + ExtrinsicLockCounter counter = new ExtrinsicLockCounter(); + Future future1 = (Future) executorService.submit(new ExtrinsicLockCounterCallable(counter)); + Future future2 = (Future) executorService.submit(new ExtrinsicLockCounterCallable(counter)); + + assertThat(future1.get()).isEqualTo(1); + assertThat(future2.get()).isEqualTo(2); + } +} diff --git a/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/MathUtilsTest.java b/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/MathUtilsTest.java new file mode 100644 index 0000000000..8f3f574b03 --- /dev/null +++ b/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/MathUtilsTest.java @@ -0,0 +1,13 @@ +package com.baeldung.concurrent.threadsafety.tests; + +import com.baeldung.concurrent.threadsafety.mathutils.MathUtils; +import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; + +public class MathUtilsTest { + + @Test + public void whenCalledFactorialMethod_thenCorrect() { + assertThat(MathUtils.factorial(2)).isEqualTo(2); + } +} diff --git a/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/MessageServiceTest.java b/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/MessageServiceTest.java new file mode 100644 index 0000000000..8f1f1a8754 --- /dev/null +++ b/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/MessageServiceTest.java @@ -0,0 +1,23 @@ +package com.baeldung.concurrent.threadsafety.tests; + +import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; +import com.baeldung.concurrent.threadsafety.callables.MessageServiceCallable; +import com.baeldung.concurrent.threadsafety.services.MessageService; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +public class MessageServiceTest { + + @Test + public void whenCalledgetMessage_thenCorrect() throws Exception { + ExecutorService executorService = Executors.newFixedThreadPool(2); + MessageService messageService = new MessageService("Welcome to Baeldung!"); + Future future1 = (Future) executorService.submit(new MessageServiceCallable(messageService)); + Future future2 = (Future) executorService.submit(new MessageServiceCallable(messageService)); + + assertThat(future1.get()).isEqualTo("Welcome to Baeldung!"); + assertThat(future2.get()).isEqualTo("Welcome to Baeldung!"); + } +} diff --git a/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/ReentrantLockCounterTest.java b/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/ReentrantLockCounterTest.java new file mode 100644 index 0000000000..05c721ab26 --- /dev/null +++ b/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/ReentrantLockCounterTest.java @@ -0,0 +1,23 @@ +package com.baeldung.concurrent.threadsafety.tests; + +import com.baeldung.concurrent.threadsafety.callables.ReentrantLockCounterCallable; +import com.baeldung.concurrent.threadsafety.services.ReentrantLockCounter; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + +public class ReentrantLockCounterTest { + + @Test + public void whenCalledIncrementCounter_thenCorrect() throws Exception { + ExecutorService executorService = Executors.newFixedThreadPool(2); + ReentrantLockCounter counter = new ReentrantLockCounter(); + Future future1 = (Future) executorService.submit(new ReentrantLockCounterCallable(counter)); + Future future2 = (Future) executorService.submit(new ReentrantLockCounterCallable(counter)); + + assertThat(future1.get()).isEqualTo(1); + assertThat(future2.get()).isEqualTo(2); + } +} diff --git a/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/ReentrantReadWriteLockCounterTest.java b/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/ReentrantReadWriteLockCounterTest.java new file mode 100644 index 0000000000..c56137ce04 --- /dev/null +++ b/core-java-concurrency-basic/src/test/com/baeldung/concurrent/threadsafety/tests/ReentrantReadWriteLockCounterTest.java @@ -0,0 +1,24 @@ +package com.baeldung.concurrent.threadsafety.tests; + +import com.baeldung.concurrent.threadsafety.callables.ReentranReadWriteLockCounterCallable; +import com.baeldung.concurrent.threadsafety.services.ReentrantReadWriteLockCounter; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + +public class ReentrantReadWriteLockCounterTest { + + @Test + public void whenCalledIncrementCounter_thenCorrect() throws Exception { + ExecutorService executorService = Executors.newFixedThreadPool(2); + ReentrantReadWriteLockCounter counter = new ReentrantReadWriteLockCounter(); + Future future1 = (Future) executorService.submit(new ReentranReadWriteLockCounterCallable(counter)); + Future future2 = (Future) executorService.submit(new ReentranReadWriteLockCounterCallable(counter)); + + assertThat(future1.get()).isEqualTo(1); + assertThat(future2.get()).isEqualTo(2); + } + +} From 0e69cd5ab47d61ac4c18cac73e9d516e1c7ca8db Mon Sep 17 00:00:00 2001 From: Surapaneni Venkata Kiran Date: Mon, 7 Jan 2019 09:02:58 -0500 Subject: [PATCH 172/271] Changes to enable TLSv1.2 on Java 7 Issue: BAEL-2500 --- .../java/com/baeldung/ssl/EnableTLSv12.java | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 core-java-security/src/main/java/com/baeldung/ssl/EnableTLSv12.java diff --git a/core-java-security/src/main/java/com/baeldung/ssl/EnableTLSv12.java b/core-java-security/src/main/java/com/baeldung/ssl/EnableTLSv12.java new file mode 100644 index 0000000000..aa70b11584 --- /dev/null +++ b/core-java-security/src/main/java/com/baeldung/ssl/EnableTLSv12.java @@ -0,0 +1,115 @@ +package com.baeldung.ssl; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.net.URL; +import java.net.UnknownHostException; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; + +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLParameters; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class EnableTLSv12 { + + private final Logger logger = LoggerFactory.getLogger(EnableTLSv12.class); + + public String url = ""; + public Integer port = null; + + public EnableTLSv12() { + } + + public static void main(String[] args) throws IOException, KeyManagementException, NoSuchAlgorithmException { + EnableTLSv12 enableTLSv12 = new EnableTLSv12(); + if (args.length != 2) { + System.out.println("Provide the server url and the secure port:"); + System.exit(-1); + } + enableTLSv12.setHost(args); + enableTLSv12.setPort(args); + enableTLSv12.enableTLSv12UsingHttpConnection(); + enableTLSv12.enableTLSv12UsingProtocol(); + enableTLSv12.enableTLSv12UsingSSLContext(); + enableTLSv12.enableTLSv12UsingSSLParameters(); + } + + private void setPort(String[] args) { + url = args[0]; + } + + private void setHost(String[] args) { + String portNumber = args[1]; + port = Integer.parseInt(portNumber); + } + + private void handleCommunication(SSLSocket socket, String usedTLSProcess) throws IOException { + logger.debug("Enabled TLS v1.2 on " + usedTLSProcess); + try (PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()))); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()))) { + out.println("GET / HTTP/1.0"); + out.println(); + out.flush(); + if (out.checkError()) { + logger.error("SSLSocketClient: java.io.PrintWriter error"); + return; + } + + String inputLine; + while ((inputLine = in.readLine()) != null) + logger.info(inputLine); + } + } + + public void enableTLSv12UsingSSLParameters() throws UnknownHostException, IOException { + SSLSocketFactory socketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault(); + SSLSocket sslSocket = (SSLSocket) socketFactory.createSocket(url.trim(), port); + SSLParameters params = new SSLParameters(); + params.setProtocols(new String[] { "TLSv1.2" }); + sslSocket.setSSLParameters(params); + sslSocket.startHandshake(); + handleCommunication(sslSocket, "SSLSocketFactory-SSLParameters"); + } + + public void enableTLSv12UsingProtocol() throws IOException { + SSLSocketFactory socketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault(); + SSLSocket sslSocket = (SSLSocket) socketFactory.createSocket(url, port); + sslSocket.setEnabledProtocols(new String[] { "TLSv1.2" }); + sslSocket.startHandshake(); + handleCommunication(sslSocket, "SSLSocketFactory-EnabledProtocols"); + } + + public void enableTLSv12UsingHttpConnection() throws IOException, NoSuchAlgorithmException, KeyManagementException { + URL urls = new URL("https://" + url + ":" + port); + SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); + sslContext.init(null, null, new SecureRandom()); + HttpsURLConnection connection = (HttpsURLConnection) urls.openConnection(); + connection.setSSLSocketFactory(sslContext.getSocketFactory()); + try (BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { + String input; + while ((input = br.readLine()) != null) { + logger.info(input); + } + } + logger.debug("Created TLSv1.2 connection on HttpsURLConnection"); + } + + public void enableTLSv12UsingSSLContext() throws NoSuchAlgorithmException, KeyManagementException, UnknownHostException, IOException { + SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); + sslContext.init(null, null, new SecureRandom()); + SSLSocketFactory socketFactory = sslContext.getSocketFactory(); + SSLSocket socket = (SSLSocket) socketFactory.createSocket(url, port); + handleCommunication(socket, "SSLContext"); + } + +} From 115a52a124ce455bbe1c844a6cea93ed3d56cae8 Mon Sep 17 00:00:00 2001 From: Urvy Agrawal Date: Mon, 7 Jan 2019 22:03:52 +0530 Subject: [PATCH 173/271] Adding files for BAEL-2543 --- .../java/com/baeldung/keyword/Circle.java | 4 ++ .../main/java/com/baeldung/keyword/Ring.java | 4 ++ .../main/java/com/baeldung/keyword/Round.java | 4 ++ .../main/java/com/baeldung/keyword/Shape.java | 4 ++ .../java/com/baeldung/keyword/Triangle.java | 4 ++ .../keyword/test/InstanceOfUnitTest.java | 49 +++++++++++++++++++ 6 files changed, 69 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/keyword/Circle.java create mode 100644 core-java/src/main/java/com/baeldung/keyword/Ring.java create mode 100644 core-java/src/main/java/com/baeldung/keyword/Round.java create mode 100644 core-java/src/main/java/com/baeldung/keyword/Shape.java create mode 100644 core-java/src/main/java/com/baeldung/keyword/Triangle.java create mode 100644 core-java/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/keyword/Circle.java b/core-java/src/main/java/com/baeldung/keyword/Circle.java new file mode 100644 index 0000000000..4ec91d1b8a --- /dev/null +++ b/core-java/src/main/java/com/baeldung/keyword/Circle.java @@ -0,0 +1,4 @@ +package com.baeldung.keyword; + +public class Circle extends Round implements Shape { +} diff --git a/core-java/src/main/java/com/baeldung/keyword/Ring.java b/core-java/src/main/java/com/baeldung/keyword/Ring.java new file mode 100644 index 0000000000..99873f9640 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/keyword/Ring.java @@ -0,0 +1,4 @@ +package com.baeldung.keyword; + +public class Ring extends Round { +} diff --git a/core-java/src/main/java/com/baeldung/keyword/Round.java b/core-java/src/main/java/com/baeldung/keyword/Round.java new file mode 100644 index 0000000000..0e2cc2c8c7 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/keyword/Round.java @@ -0,0 +1,4 @@ +package com.baeldung.keyword; + +public class Round { +} diff --git a/core-java/src/main/java/com/baeldung/keyword/Shape.java b/core-java/src/main/java/com/baeldung/keyword/Shape.java new file mode 100644 index 0000000000..8d00c165a3 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/keyword/Shape.java @@ -0,0 +1,4 @@ +package com.baeldung.keyword; + +public interface Shape { +} diff --git a/core-java/src/main/java/com/baeldung/keyword/Triangle.java b/core-java/src/main/java/com/baeldung/keyword/Triangle.java new file mode 100644 index 0000000000..406b8f23e5 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/keyword/Triangle.java @@ -0,0 +1,4 @@ +package com.baeldung.keyword; + +public class Triangle implements Shape { +} diff --git a/core-java/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java b/core-java/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java new file mode 100644 index 0000000000..fbeec3a077 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java @@ -0,0 +1,49 @@ +package com.baeldung.keyword.test; + +import org.junit.Assert; +import org.junit.jupiter.api.Test; + +import com.baeldung.keyword.Circle; +import com.baeldung.keyword.Ring; +import com.baeldung.keyword.Round; +import com.baeldung.keyword.Shape; +import com.baeldung.keyword.Triangle; + +public class InstanceOfUnitTest { + + @Test + public void giveWhenInstanceIsCorrect_thenReturnTrue() { + Ring ring = new Ring(); + Assert.assertTrue("ring is instance of Round ", ring instanceof Round); + } + + @Test + public void giveWhenObjectIsInstanceOfType_thenReturnTrue() { + Circle circle = new Circle(); + Assert.assertTrue("circle is instance of Circle ", circle instanceof Circle); + } + + + @Test + public void giveWhenInstanceIsOfSubtype_thenReturnTrue() { + Circle circle = new Circle(); + Assert.assertTrue("circle is instance of Round", circle instanceof Round); + } + + @Test + public void giveWhenTypeIsInterface_thenReturnTrue() { + Circle circle = new Circle(); + Assert.assertTrue("circle is instance of Shape", circle instanceof Shape); + } + + @Test + public void giveWhenInstanceValueIsNull_thenReturnFalse() { + Circle circle = null; + Assert.assertFalse("circle is instance of Round", circle instanceof Round); + } + + @Test + public void giveWhenComparingClassInDiffHierarchy_thenCompilationError() { + // Assert.assertFalse("circle is instance of Triangle", circle instanceof Triangle); + } +} From 43b0770e134802ad328b6282c86af8ac2a729954 Mon Sep 17 00:00:00 2001 From: Emily Cheyne Date: Mon, 7 Jan 2019 18:36:15 -0700 Subject: [PATCH 174/271] Update readme (#6095) --- algorithms-miscellaneous-1/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/algorithms-miscellaneous-1/README.md b/algorithms-miscellaneous-1/README.md index 59765588b0..6f18396005 100644 --- a/algorithms-miscellaneous-1/README.md +++ b/algorithms-miscellaneous-1/README.md @@ -14,3 +14,4 @@ - [Calculate Factorial in Java](https://www.baeldung.com/java-calculate-factorial) - [Find Substrings That Are Palindromes in Java](https://www.baeldung.com/java-palindrome-substrings) - [Find the Longest Substring without Repeating Characters](https://www.baeldung.com/java-longest-substring-without-repeated-characters) +- [Java Two Pointer Technique](https://www.baeldung.com/java-two-pointer-technique) From ea1a4678929221680fcf15005ff9c1cfad775bae Mon Sep 17 00:00:00 2001 From: eric-martin Date: Mon, 7 Jan 2019 20:32:55 -0600 Subject: [PATCH 175/271] BAEL-2386: Moved FlightRecorder from core-java to core-java-perf --- .../src/main/java/com/baeldung/flightrecorder/FlightRecorder.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {core-java => core-java-perf}/src/main/java/com/baeldung/flightrecorder/FlightRecorder.java (100%) diff --git a/core-java/src/main/java/com/baeldung/flightrecorder/FlightRecorder.java b/core-java-perf/src/main/java/com/baeldung/flightrecorder/FlightRecorder.java similarity index 100% rename from core-java/src/main/java/com/baeldung/flightrecorder/FlightRecorder.java rename to core-java-perf/src/main/java/com/baeldung/flightrecorder/FlightRecorder.java From 59fa72d45bdbed9936cd5e9e669f1c88bb5229a8 Mon Sep 17 00:00:00 2001 From: eric-martin Date: Mon, 7 Jan 2019 21:51:47 -0600 Subject: [PATCH 176/271] Fix PMD violations in java-strings *ToStringTest --- ...rrayToStringTest.java => CustomerArrayToStringUnitTest.java} | 2 +- ...ringTest.java => CustomerComplexObjectToStringUnitTest.java} | 2 +- ...ToStringTest.java => CustomerPrimitiveToStringUnitTest.java} | 2 +- ...oStringTest.java => CustomerReflectionToStringUnitTest.java} | 2 +- ...Test.java => CustomerWrapperCollectionToStringUnitTest.java} | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename java-strings/src/test/java/com/baeldung/string/tostring/{CustomerArrayToStringTest.java => CustomerArrayToStringUnitTest.java} (94%) rename java-strings/src/test/java/com/baeldung/string/tostring/{CustomerComplexObjectToStringTest.java => CustomerComplexObjectToStringUnitTest.java} (94%) rename java-strings/src/test/java/com/baeldung/string/tostring/{CustomerPrimitiveToStringTest.java => CustomerPrimitiveToStringUnitTest.java} (92%) rename java-strings/src/test/java/com/baeldung/string/tostring/{CustomerReflectionToStringTest.java => CustomerReflectionToStringUnitTest.java} (95%) rename java-strings/src/test/java/com/baeldung/string/tostring/{CustomerWrapperCollectionToStringTest.java => CustomerWrapperCollectionToStringUnitTest.java} (94%) diff --git a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerArrayToStringTest.java b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerArrayToStringUnitTest.java similarity index 94% rename from java-strings/src/test/java/com/baeldung/string/tostring/CustomerArrayToStringTest.java rename to java-strings/src/test/java/com/baeldung/string/tostring/CustomerArrayToStringUnitTest.java index 31e268b4a3..9a88416179 100644 --- a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerArrayToStringTest.java +++ b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerArrayToStringUnitTest.java @@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; -public class CustomerArrayToStringTest { +public class CustomerArrayToStringUnitTest { private static final String CUSTOMER_ARRAY_TO_STRING = "Customer [orders=[Order [orderId=A1111, desc=Game, value=0]], getFirstName()=Rajesh, getLastName()=Bhojwani]"; diff --git a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerComplexObjectToStringTest.java b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerComplexObjectToStringUnitTest.java similarity index 94% rename from java-strings/src/test/java/com/baeldung/string/tostring/CustomerComplexObjectToStringTest.java rename to java-strings/src/test/java/com/baeldung/string/tostring/CustomerComplexObjectToStringUnitTest.java index 3c98394f85..5ffb0d0e58 100644 --- a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerComplexObjectToStringTest.java +++ b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerComplexObjectToStringUnitTest.java @@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; -public class CustomerComplexObjectToStringTest { +public class CustomerComplexObjectToStringUnitTest { private static final String CUSTOMER_COMPLEX_TO_STRING = "Customer [order=Order [orderId=A1111, desc=Game, value=0], getFirstName()=Rajesh, getLastName()=Bhojwani]"; diff --git a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerPrimitiveToStringTest.java b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerPrimitiveToStringUnitTest.java similarity index 92% rename from java-strings/src/test/java/com/baeldung/string/tostring/CustomerPrimitiveToStringTest.java rename to java-strings/src/test/java/com/baeldung/string/tostring/CustomerPrimitiveToStringUnitTest.java index 2a29cb93d8..d43733bc60 100644 --- a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerPrimitiveToStringTest.java +++ b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerPrimitiveToStringUnitTest.java @@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; -public class CustomerPrimitiveToStringTest { +public class CustomerPrimitiveToStringUnitTest { private static final String CUSTOMER_PRIMITIVE_TO_STRING = "Customer [balance=110, getFirstName()=Rajesh, getLastName()=Bhojwani]"; diff --git a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringTest.java b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringUnitTest.java similarity index 95% rename from java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringTest.java rename to java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringUnitTest.java index 290bef7133..77dcab52e6 100644 --- a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringTest.java +++ b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringUnitTest.java @@ -7,7 +7,7 @@ import java.util.List; import org.junit.jupiter.api.Test; -public class CustomerReflectionToStringTest { +public class CustomerReflectionToStringUnitTest { private static final String CUSTOMER_REFLECTION_TO_STRING = "com.baeldung.string.tostring.CustomerReflectionToString"; @Test diff --git a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerWrapperCollectionToStringTest.java b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerWrapperCollectionToStringUnitTest.java similarity index 94% rename from java-strings/src/test/java/com/baeldung/string/tostring/CustomerWrapperCollectionToStringTest.java rename to java-strings/src/test/java/com/baeldung/string/tostring/CustomerWrapperCollectionToStringUnitTest.java index c80969d453..e04512ff75 100644 --- a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerWrapperCollectionToStringTest.java +++ b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerWrapperCollectionToStringUnitTest.java @@ -7,7 +7,7 @@ import java.util.List; import org.junit.jupiter.api.Test; -public class CustomerWrapperCollectionToStringTest { +public class CustomerWrapperCollectionToStringUnitTest { private static final String CUSTOMER_WRAPPER_COLLECTION_TO_STRING = "Customer [score=8, orders=[Book, Pen], fullname=Bhojwani, Rajesh, getFirstName()=Rajesh, getLastName()=Bhojwani]"; From ffcb8f586625f20ada94658ebeba6cd92e965b80 Mon Sep 17 00:00:00 2001 From: Graham Cox Date: Tue, 8 Jan 2019 10:44:18 +0000 Subject: [PATCH 177/271] Kovert (#6092) * Kovert examples * Moved the Kovert examples to kotlin-libraries --- kotlin-libraries/pom.xml | 19 ++++- .../com/baeldung/kovert/AnnotatedServer.kt | 73 ++++++++++++++++++ .../kotlin/com/baeldung/kovert/ErrorServer.kt | 75 ++++++++++++++++++ .../kotlin/com/baeldung/kovert/JsonServer.kt | 76 +++++++++++++++++++ .../kotlin/com/baeldung/kovert/NoopServer.kt | 57 ++++++++++++++ .../com/baeldung/kovert/SecuredServer.kt | 68 +++++++++++++++++ .../com/baeldung/kovert/SimpleServer.kt | 65 ++++++++++++++++ .../src/main/resources/kovert.conf | 15 ++++ 8 files changed, 447 insertions(+), 1 deletion(-) create mode 100644 kotlin-libraries/src/main/kotlin/com/baeldung/kovert/AnnotatedServer.kt create mode 100644 kotlin-libraries/src/main/kotlin/com/baeldung/kovert/ErrorServer.kt create mode 100644 kotlin-libraries/src/main/kotlin/com/baeldung/kovert/JsonServer.kt create mode 100644 kotlin-libraries/src/main/kotlin/com/baeldung/kovert/NoopServer.kt create mode 100644 kotlin-libraries/src/main/kotlin/com/baeldung/kovert/SecuredServer.kt create mode 100644 kotlin-libraries/src/main/kotlin/com/baeldung/kovert/SimpleServer.kt create mode 100644 kotlin-libraries/src/main/resources/kovert.conf diff --git a/kotlin-libraries/pom.xml b/kotlin-libraries/pom.xml index ae77a9aa2d..507e5820d4 100644 --- a/kotlin-libraries/pom.xml +++ b/kotlin-libraries/pom.xml @@ -95,6 +95,23 @@ 0.7.3 + + uy.kohesive.kovert + kovert-vertx + [1.5.0,1.6.0) + + + nl.komponents.kovenant + kovenant + + + + + nl.komponents.kovenant + kovenant + 3.3.0 + pom + @@ -110,4 +127,4 @@ 0.10.4 - \ No newline at end of file + diff --git a/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/AnnotatedServer.kt b/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/AnnotatedServer.kt new file mode 100644 index 0000000000..da2bbe4208 --- /dev/null +++ b/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/AnnotatedServer.kt @@ -0,0 +1,73 @@ +package com.baeldung.kovert + +import io.vertx.ext.web.Router +import io.vertx.ext.web.RoutingContext +import nl.komponents.kovenant.functional.bind +import org.kodein.di.Kodein +import org.kodein.di.conf.global +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import uy.klutter.config.typesafe.ClassResourceConfig +import uy.klutter.config.typesafe.ReferenceConfig +import uy.klutter.config.typesafe.kodein.importConfig +import uy.klutter.config.typesafe.loadConfig +import uy.klutter.vertx.kodein.KodeinVertx +import uy.kohesive.kovert.core.HttpVerb +import uy.kohesive.kovert.core.Location +import uy.kohesive.kovert.core.Verb +import uy.kohesive.kovert.core.VerbAlias +import uy.kohesive.kovert.vertx.bindController +import uy.kohesive.kovert.vertx.boot.KodeinKovertVertx +import uy.kohesive.kovert.vertx.boot.KovertVerticle +import uy.kohesive.kovert.vertx.boot.KovertVerticleModule +import uy.kohesive.kovert.vertx.boot.KovertVertx + + +class AnnotatedServer { + companion object { + private val LOG: Logger = LoggerFactory.getLogger(AnnotatedServer::class.java) + + @JvmStatic + fun main(args: Array) { + AnnotatedServer().start() + } + } + + @VerbAlias("show", HttpVerb.GET) + class AnnotatedController { + fun RoutingContext.showStringById(id: String) = id + + @Verb(HttpVerb.GET) + @Location("/ping/:id") + fun RoutingContext.ping(id: String) = id + } + + fun start() { + Kodein.global.addImport(Kodein.Module { + importConfig(loadConfig(ClassResourceConfig("/kovert.conf", AnnotatedServer::class.java), ReferenceConfig())) { + import("kovert.vertx", KodeinKovertVertx.configModule) + import("kovert.server", KovertVerticleModule.configModule) + } + + // includes jackson ObjectMapper to match compatibility with Vertx, app logging via Vertx facade to Slf4j + import(KodeinVertx.moduleWithLoggingToSlf4j) + // Kovert boot + import(KodeinKovertVertx.module) + import(KovertVerticleModule.module) + }) + + val initControllers = fun Router.() { + bindController(AnnotatedController(), "api") + } + + // startup asynchronously... + KovertVertx.start() bind { vertx -> + KovertVerticle.deploy(vertx, routerInit = initControllers) + } success { deploymentId -> + LOG.warn("Deployment complete.") + } fail { error -> + LOG.error("Deployment failed!", error) + } + + } +} diff --git a/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/ErrorServer.kt b/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/ErrorServer.kt new file mode 100644 index 0000000000..a596391ed8 --- /dev/null +++ b/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/ErrorServer.kt @@ -0,0 +1,75 @@ +package com.baeldung.kovert + +import io.vertx.ext.web.Router +import io.vertx.ext.web.RoutingContext +import nl.komponents.kovenant.functional.bind +import org.kodein.di.Kodein +import org.kodein.di.conf.global +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import uy.klutter.config.typesafe.ClassResourceConfig +import uy.klutter.config.typesafe.ReferenceConfig +import uy.klutter.config.typesafe.kodein.importConfig +import uy.klutter.config.typesafe.loadConfig +import uy.klutter.vertx.kodein.KodeinVertx +import uy.kohesive.kovert.core.HttpErrorCode +import uy.kohesive.kovert.core.HttpErrorCodeWithBody +import uy.kohesive.kovert.core.HttpErrorForbidden +import uy.kohesive.kovert.vertx.bindController +import uy.kohesive.kovert.vertx.boot.KodeinKovertVertx +import uy.kohesive.kovert.vertx.boot.KovertVerticle +import uy.kohesive.kovert.vertx.boot.KovertVerticleModule +import uy.kohesive.kovert.vertx.boot.KovertVertx + + +class ErrorServer { + companion object { + private val LOG: Logger = LoggerFactory.getLogger(ErrorServer::class.java) + + @JvmStatic + fun main(args: Array) { + ErrorServer().start() + } + } + + class ErrorController { + fun RoutingContext.getForbidden() { + throw HttpErrorForbidden() + } + fun RoutingContext.getError() { + throw HttpErrorCode("Something went wrong", 590) + } + fun RoutingContext.getErrorbody() { + throw HttpErrorCodeWithBody("Something went wrong", 591, "Body here") + } + } + + fun start() { + Kodein.global.addImport(Kodein.Module { + importConfig(loadConfig(ClassResourceConfig("/kovert.conf", ErrorServer::class.java), ReferenceConfig())) { + import("kovert.vertx", KodeinKovertVertx.configModule) + import("kovert.server", KovertVerticleModule.configModule) + } + + // includes jackson ObjectMapper to match compatibility with Vertx, app logging via Vertx facade to Slf4j + import(KodeinVertx.moduleWithLoggingToSlf4j) + // Kovert boot + import(KodeinKovertVertx.module) + import(KovertVerticleModule.module) + }) + + val initControllers = fun Router.() { + bindController(ErrorController(), "api") + } + + // startup asynchronously... + KovertVertx.start() bind { vertx -> + KovertVerticle.deploy(vertx, routerInit = initControllers) + } success { deploymentId -> + LOG.warn("Deployment complete.") + } fail { error -> + LOG.error("Deployment failed!", error) + } + + } +} diff --git a/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/JsonServer.kt b/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/JsonServer.kt new file mode 100644 index 0000000000..310fe2a7a0 --- /dev/null +++ b/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/JsonServer.kt @@ -0,0 +1,76 @@ +package com.baeldung.kovert + +import com.fasterxml.jackson.annotation.JsonProperty +import io.vertx.ext.web.Router +import io.vertx.ext.web.RoutingContext +import nl.komponents.kovenant.functional.bind +import org.kodein.di.Kodein +import org.kodein.di.conf.global +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import uy.klutter.config.typesafe.ClassResourceConfig +import uy.klutter.config.typesafe.ReferenceConfig +import uy.klutter.config.typesafe.kodein.importConfig +import uy.klutter.config.typesafe.loadConfig +import uy.klutter.vertx.kodein.KodeinVertx +import uy.kohesive.kovert.vertx.bindController +import uy.kohesive.kovert.vertx.boot.KodeinKovertVertx +import uy.kohesive.kovert.vertx.boot.KovertVerticle +import uy.kohesive.kovert.vertx.boot.KovertVerticleModule +import uy.kohesive.kovert.vertx.boot.KovertVertx + +class JsonServer { + companion object { + private val LOG: Logger = LoggerFactory.getLogger(JsonServer::class.java) + + @JvmStatic + fun main(args: Array) { + JsonServer().start() + } + } + + data class Person( + @JsonProperty("_id") + val id: String, + val name: String, + val job: String + ) + + class JsonController { + fun RoutingContext.getPersonById(id: String) = Person( + id = id, + name = "Tony Stark", + job = "Iron Man" + ) + fun RoutingContext.putPersonById(id: String, person: Person) = person + } + + fun start() { + Kodein.global.addImport(Kodein.Module { + importConfig(loadConfig(ClassResourceConfig("/kovert.conf", JsonServer::class.java), ReferenceConfig())) { + import("kovert.vertx", KodeinKovertVertx.configModule) + import("kovert.server", KovertVerticleModule.configModule) + } + + // includes jackson ObjectMapper to match compatibility with Vertx, app logging via Vertx facade to Slf4j + import(KodeinVertx.moduleWithLoggingToSlf4j) + // Kovert boot + import(KodeinKovertVertx.module) + import(KovertVerticleModule.module) + }) + + val initControllers = fun Router.() { + bindController(JsonController(), "api") + } + + // startup asynchronously... + KovertVertx.start() bind { vertx -> + KovertVerticle.deploy(vertx, routerInit = initControllers) + } success { deploymentId -> + LOG.warn("Deployment complete.") + } fail { error -> + LOG.error("Deployment failed!", error) + } + + } +} diff --git a/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/NoopServer.kt b/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/NoopServer.kt new file mode 100644 index 0000000000..98ce775e66 --- /dev/null +++ b/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/NoopServer.kt @@ -0,0 +1,57 @@ +package com.baeldung.kovert + +import io.vertx.ext.web.Router +import nl.komponents.kovenant.functional.bind +import org.kodein.di.Kodein +import org.kodein.di.conf.global +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import uy.klutter.config.typesafe.ClassResourceConfig +import uy.klutter.config.typesafe.ReferenceConfig +import uy.klutter.config.typesafe.kodein.importConfig +import uy.klutter.config.typesafe.loadConfig +import uy.klutter.vertx.kodein.KodeinVertx +import uy.kohesive.kovert.vertx.boot.KodeinKovertVertx +import uy.kohesive.kovert.vertx.boot.KovertVerticle +import uy.kohesive.kovert.vertx.boot.KovertVerticleModule +import uy.kohesive.kovert.vertx.boot.KovertVertx + +class NoopServer { + companion object { + private val LOG: Logger = LoggerFactory.getLogger(NoopServer::class.java) + + @JvmStatic + fun main(args: Array) { + NoopServer().start() + } + } + + + fun start() { + Kodein.global.addImport(Kodein.Module { + importConfig(loadConfig(ClassResourceConfig("/kovert.conf", NoopServer::class.java), ReferenceConfig())) { + import("kovert.vertx", KodeinKovertVertx.configModule) + import("kovert.server", KovertVerticleModule.configModule) + } + + // includes jackson ObjectMapper to match compatibility with Vertx, app logging via Vertx facade to Slf4j + import(KodeinVertx.moduleWithLoggingToSlf4j) + // Kovert boot + import(KodeinKovertVertx.module) + import(KovertVerticleModule.module) + }) + + val initControllers = fun Router.() { + } + + // startup asynchronously... + KovertVertx.start() bind { vertx -> + KovertVerticle.deploy(vertx, routerInit = initControllers) + } success { deploymentId -> + LOG.warn("Deployment complete.") + } fail { error -> + LOG.error("Deployment failed!", error) + } + + } +} diff --git a/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/SecuredServer.kt b/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/SecuredServer.kt new file mode 100644 index 0000000000..86ca482808 --- /dev/null +++ b/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/SecuredServer.kt @@ -0,0 +1,68 @@ +package com.baeldung.kovert + +import io.vertx.ext.web.Router +import io.vertx.ext.web.RoutingContext +import nl.komponents.kovenant.functional.bind +import org.kodein.di.Kodein +import org.kodein.di.conf.global +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import uy.klutter.config.typesafe.ClassResourceConfig +import uy.klutter.config.typesafe.ReferenceConfig +import uy.klutter.config.typesafe.kodein.importConfig +import uy.klutter.config.typesafe.loadConfig +import uy.klutter.vertx.kodein.KodeinVertx +import uy.kohesive.kovert.vertx.bindController +import uy.kohesive.kovert.vertx.boot.KodeinKovertVertx +import uy.kohesive.kovert.vertx.boot.KovertVerticle +import uy.kohesive.kovert.vertx.boot.KovertVerticleModule +import uy.kohesive.kovert.vertx.boot.KovertVertx + + +class SecuredServer { + companion object { + private val LOG: Logger = LoggerFactory.getLogger(SecuredServer::class.java) + + @JvmStatic + fun main(args: Array) { + SecuredServer().start() + } + } + + class SecuredContext(private val routingContext: RoutingContext) { + val authenticated = routingContext.request().getHeader("Authorization") == "Secure" + } + + class SecuredController { + fun SecuredContext.getSecured() = this.authenticated + } + + fun start() { + Kodein.global.addImport(Kodein.Module { + importConfig(loadConfig(ClassResourceConfig("/kovert.conf", SecuredServer::class.java), ReferenceConfig())) { + import("kovert.vertx", KodeinKovertVertx.configModule) + import("kovert.server", KovertVerticleModule.configModule) + } + + // includes jackson ObjectMapper to match compatibility with Vertx, app logging via Vertx facade to Slf4j + import(KodeinVertx.moduleWithLoggingToSlf4j) + // Kovert boot + import(KodeinKovertVertx.module) + import(KovertVerticleModule.module) + }) + + val initControllers = fun Router.() { + bindController(SecuredController(), "api") + } + + // startup asynchronously... + KovertVertx.start() bind { vertx -> + KovertVerticle.deploy(vertx, routerInit = initControllers) + } success { deploymentId -> + LOG.warn("Deployment complete.") + } fail { error -> + LOG.error("Deployment failed!", error) + } + + } +} diff --git a/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/SimpleServer.kt b/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/SimpleServer.kt new file mode 100644 index 0000000000..172469ab46 --- /dev/null +++ b/kotlin-libraries/src/main/kotlin/com/baeldung/kovert/SimpleServer.kt @@ -0,0 +1,65 @@ +package com.baeldung.kovert + +import io.vertx.ext.web.Router +import io.vertx.ext.web.RoutingContext +import nl.komponents.kovenant.functional.bind +import org.kodein.di.Kodein +import org.kodein.di.conf.global +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import uy.klutter.config.typesafe.ClassResourceConfig +import uy.klutter.config.typesafe.ReferenceConfig +import uy.klutter.config.typesafe.kodein.importConfig +import uy.klutter.config.typesafe.loadConfig +import uy.klutter.vertx.kodein.KodeinVertx +import uy.kohesive.kovert.vertx.bindController +import uy.kohesive.kovert.vertx.boot.KodeinKovertVertx +import uy.kohesive.kovert.vertx.boot.KovertVerticle +import uy.kohesive.kovert.vertx.boot.KovertVerticleModule +import uy.kohesive.kovert.vertx.boot.KovertVertx + + +class SimpleServer { + companion object { + private val LOG: Logger = LoggerFactory.getLogger(SimpleServer::class.java) + + @JvmStatic + fun main(args: Array) { + SimpleServer().start() + } + } + + class SimpleController { + fun RoutingContext.getStringById(id: String) = id + fun RoutingContext.get_truncatedString_by_id(id: String, length: Int = 1) = id.subSequence(0, length) + } + + fun start() { + Kodein.global.addImport(Kodein.Module { + importConfig(loadConfig(ClassResourceConfig("/kovert.conf", SimpleServer::class.java), ReferenceConfig())) { + import("kovert.vertx", KodeinKovertVertx.configModule) + import("kovert.server", KovertVerticleModule.configModule) + } + + // includes jackson ObjectMapper to match compatibility with Vertx, app logging via Vertx facade to Slf4j + import(KodeinVertx.moduleWithLoggingToSlf4j) + // Kovert boot + import(KodeinKovertVertx.module) + import(KovertVerticleModule.module) + }) + + val initControllers = fun Router.() { + bindController(SimpleController(), "api") + } + + // startup asynchronously... + KovertVertx.start() bind { vertx -> + KovertVerticle.deploy(vertx, routerInit = initControllers) + } success { deploymentId -> + LOG.warn("Deployment complete.") + } fail { error -> + LOG.error("Deployment failed!", error) + } + + } +} diff --git a/kotlin-libraries/src/main/resources/kovert.conf b/kotlin-libraries/src/main/resources/kovert.conf new file mode 100644 index 0000000000..3b08641693 --- /dev/null +++ b/kotlin-libraries/src/main/resources/kovert.conf @@ -0,0 +1,15 @@ +{ + kovert: { + vertx: { + clustered: false + } + server: { + listeners: [ + { + host: "0.0.0.0" + port: "8000" + } + ] + } + } +} From 802e2b0398f46f9939308416066fe9bfe0bf3c6c Mon Sep 17 00:00:00 2001 From: Graham Cox Date: Tue, 8 Jan 2019 14:06:25 +0000 Subject: [PATCH 178/271] Removed Kovert from core-kotlin now it's in kotlin-libraries instead (#6101) --- core-kotlin/pom.xml | 11 --- .../com/baeldung/kovert/AnnotatedServer.kt | 73 ------------------ .../kotlin/com/baeldung/kovert/ErrorServer.kt | 75 ------------------ .../kotlin/com/baeldung/kovert/JsonServer.kt | 76 ------------------- .../kotlin/com/baeldung/kovert/NoopServer.kt | 57 -------------- .../com/baeldung/kovert/SecuredServer.kt | 68 ----------------- .../com/baeldung/kovert/SimpleServer.kt | 65 ---------------- core-kotlin/src/main/resources/kovert.conf | 15 ---- 8 files changed, 440 deletions(-) delete mode 100644 core-kotlin/src/main/kotlin/com/baeldung/kovert/AnnotatedServer.kt delete mode 100644 core-kotlin/src/main/kotlin/com/baeldung/kovert/ErrorServer.kt delete mode 100644 core-kotlin/src/main/kotlin/com/baeldung/kovert/JsonServer.kt delete mode 100644 core-kotlin/src/main/kotlin/com/baeldung/kovert/NoopServer.kt delete mode 100644 core-kotlin/src/main/kotlin/com/baeldung/kovert/SecuredServer.kt delete mode 100644 core-kotlin/src/main/kotlin/com/baeldung/kovert/SimpleServer.kt delete mode 100644 core-kotlin/src/main/resources/kovert.conf diff --git a/core-kotlin/pom.xml b/core-kotlin/pom.xml index 8b871f28ee..ed79ebc01b 100644 --- a/core-kotlin/pom.xml +++ b/core-kotlin/pom.xml @@ -72,17 +72,6 @@ injekt-core 1.16.1 - - uy.kohesive.kovert - kovert-vertx - [1.5.0,1.6.0) - - - nl.komponents.kovenant - kovenant - - - diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kovert/AnnotatedServer.kt b/core-kotlin/src/main/kotlin/com/baeldung/kovert/AnnotatedServer.kt deleted file mode 100644 index da2bbe4208..0000000000 --- a/core-kotlin/src/main/kotlin/com/baeldung/kovert/AnnotatedServer.kt +++ /dev/null @@ -1,73 +0,0 @@ -package com.baeldung.kovert - -import io.vertx.ext.web.Router -import io.vertx.ext.web.RoutingContext -import nl.komponents.kovenant.functional.bind -import org.kodein.di.Kodein -import org.kodein.di.conf.global -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import uy.klutter.config.typesafe.ClassResourceConfig -import uy.klutter.config.typesafe.ReferenceConfig -import uy.klutter.config.typesafe.kodein.importConfig -import uy.klutter.config.typesafe.loadConfig -import uy.klutter.vertx.kodein.KodeinVertx -import uy.kohesive.kovert.core.HttpVerb -import uy.kohesive.kovert.core.Location -import uy.kohesive.kovert.core.Verb -import uy.kohesive.kovert.core.VerbAlias -import uy.kohesive.kovert.vertx.bindController -import uy.kohesive.kovert.vertx.boot.KodeinKovertVertx -import uy.kohesive.kovert.vertx.boot.KovertVerticle -import uy.kohesive.kovert.vertx.boot.KovertVerticleModule -import uy.kohesive.kovert.vertx.boot.KovertVertx - - -class AnnotatedServer { - companion object { - private val LOG: Logger = LoggerFactory.getLogger(AnnotatedServer::class.java) - - @JvmStatic - fun main(args: Array) { - AnnotatedServer().start() - } - } - - @VerbAlias("show", HttpVerb.GET) - class AnnotatedController { - fun RoutingContext.showStringById(id: String) = id - - @Verb(HttpVerb.GET) - @Location("/ping/:id") - fun RoutingContext.ping(id: String) = id - } - - fun start() { - Kodein.global.addImport(Kodein.Module { - importConfig(loadConfig(ClassResourceConfig("/kovert.conf", AnnotatedServer::class.java), ReferenceConfig())) { - import("kovert.vertx", KodeinKovertVertx.configModule) - import("kovert.server", KovertVerticleModule.configModule) - } - - // includes jackson ObjectMapper to match compatibility with Vertx, app logging via Vertx facade to Slf4j - import(KodeinVertx.moduleWithLoggingToSlf4j) - // Kovert boot - import(KodeinKovertVertx.module) - import(KovertVerticleModule.module) - }) - - val initControllers = fun Router.() { - bindController(AnnotatedController(), "api") - } - - // startup asynchronously... - KovertVertx.start() bind { vertx -> - KovertVerticle.deploy(vertx, routerInit = initControllers) - } success { deploymentId -> - LOG.warn("Deployment complete.") - } fail { error -> - LOG.error("Deployment failed!", error) - } - - } -} diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kovert/ErrorServer.kt b/core-kotlin/src/main/kotlin/com/baeldung/kovert/ErrorServer.kt deleted file mode 100644 index a596391ed8..0000000000 --- a/core-kotlin/src/main/kotlin/com/baeldung/kovert/ErrorServer.kt +++ /dev/null @@ -1,75 +0,0 @@ -package com.baeldung.kovert - -import io.vertx.ext.web.Router -import io.vertx.ext.web.RoutingContext -import nl.komponents.kovenant.functional.bind -import org.kodein.di.Kodein -import org.kodein.di.conf.global -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import uy.klutter.config.typesafe.ClassResourceConfig -import uy.klutter.config.typesafe.ReferenceConfig -import uy.klutter.config.typesafe.kodein.importConfig -import uy.klutter.config.typesafe.loadConfig -import uy.klutter.vertx.kodein.KodeinVertx -import uy.kohesive.kovert.core.HttpErrorCode -import uy.kohesive.kovert.core.HttpErrorCodeWithBody -import uy.kohesive.kovert.core.HttpErrorForbidden -import uy.kohesive.kovert.vertx.bindController -import uy.kohesive.kovert.vertx.boot.KodeinKovertVertx -import uy.kohesive.kovert.vertx.boot.KovertVerticle -import uy.kohesive.kovert.vertx.boot.KovertVerticleModule -import uy.kohesive.kovert.vertx.boot.KovertVertx - - -class ErrorServer { - companion object { - private val LOG: Logger = LoggerFactory.getLogger(ErrorServer::class.java) - - @JvmStatic - fun main(args: Array) { - ErrorServer().start() - } - } - - class ErrorController { - fun RoutingContext.getForbidden() { - throw HttpErrorForbidden() - } - fun RoutingContext.getError() { - throw HttpErrorCode("Something went wrong", 590) - } - fun RoutingContext.getErrorbody() { - throw HttpErrorCodeWithBody("Something went wrong", 591, "Body here") - } - } - - fun start() { - Kodein.global.addImport(Kodein.Module { - importConfig(loadConfig(ClassResourceConfig("/kovert.conf", ErrorServer::class.java), ReferenceConfig())) { - import("kovert.vertx", KodeinKovertVertx.configModule) - import("kovert.server", KovertVerticleModule.configModule) - } - - // includes jackson ObjectMapper to match compatibility with Vertx, app logging via Vertx facade to Slf4j - import(KodeinVertx.moduleWithLoggingToSlf4j) - // Kovert boot - import(KodeinKovertVertx.module) - import(KovertVerticleModule.module) - }) - - val initControllers = fun Router.() { - bindController(ErrorController(), "api") - } - - // startup asynchronously... - KovertVertx.start() bind { vertx -> - KovertVerticle.deploy(vertx, routerInit = initControllers) - } success { deploymentId -> - LOG.warn("Deployment complete.") - } fail { error -> - LOG.error("Deployment failed!", error) - } - - } -} diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kovert/JsonServer.kt b/core-kotlin/src/main/kotlin/com/baeldung/kovert/JsonServer.kt deleted file mode 100644 index 310fe2a7a0..0000000000 --- a/core-kotlin/src/main/kotlin/com/baeldung/kovert/JsonServer.kt +++ /dev/null @@ -1,76 +0,0 @@ -package com.baeldung.kovert - -import com.fasterxml.jackson.annotation.JsonProperty -import io.vertx.ext.web.Router -import io.vertx.ext.web.RoutingContext -import nl.komponents.kovenant.functional.bind -import org.kodein.di.Kodein -import org.kodein.di.conf.global -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import uy.klutter.config.typesafe.ClassResourceConfig -import uy.klutter.config.typesafe.ReferenceConfig -import uy.klutter.config.typesafe.kodein.importConfig -import uy.klutter.config.typesafe.loadConfig -import uy.klutter.vertx.kodein.KodeinVertx -import uy.kohesive.kovert.vertx.bindController -import uy.kohesive.kovert.vertx.boot.KodeinKovertVertx -import uy.kohesive.kovert.vertx.boot.KovertVerticle -import uy.kohesive.kovert.vertx.boot.KovertVerticleModule -import uy.kohesive.kovert.vertx.boot.KovertVertx - -class JsonServer { - companion object { - private val LOG: Logger = LoggerFactory.getLogger(JsonServer::class.java) - - @JvmStatic - fun main(args: Array) { - JsonServer().start() - } - } - - data class Person( - @JsonProperty("_id") - val id: String, - val name: String, - val job: String - ) - - class JsonController { - fun RoutingContext.getPersonById(id: String) = Person( - id = id, - name = "Tony Stark", - job = "Iron Man" - ) - fun RoutingContext.putPersonById(id: String, person: Person) = person - } - - fun start() { - Kodein.global.addImport(Kodein.Module { - importConfig(loadConfig(ClassResourceConfig("/kovert.conf", JsonServer::class.java), ReferenceConfig())) { - import("kovert.vertx", KodeinKovertVertx.configModule) - import("kovert.server", KovertVerticleModule.configModule) - } - - // includes jackson ObjectMapper to match compatibility with Vertx, app logging via Vertx facade to Slf4j - import(KodeinVertx.moduleWithLoggingToSlf4j) - // Kovert boot - import(KodeinKovertVertx.module) - import(KovertVerticleModule.module) - }) - - val initControllers = fun Router.() { - bindController(JsonController(), "api") - } - - // startup asynchronously... - KovertVertx.start() bind { vertx -> - KovertVerticle.deploy(vertx, routerInit = initControllers) - } success { deploymentId -> - LOG.warn("Deployment complete.") - } fail { error -> - LOG.error("Deployment failed!", error) - } - - } -} diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kovert/NoopServer.kt b/core-kotlin/src/main/kotlin/com/baeldung/kovert/NoopServer.kt deleted file mode 100644 index 98ce775e66..0000000000 --- a/core-kotlin/src/main/kotlin/com/baeldung/kovert/NoopServer.kt +++ /dev/null @@ -1,57 +0,0 @@ -package com.baeldung.kovert - -import io.vertx.ext.web.Router -import nl.komponents.kovenant.functional.bind -import org.kodein.di.Kodein -import org.kodein.di.conf.global -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import uy.klutter.config.typesafe.ClassResourceConfig -import uy.klutter.config.typesafe.ReferenceConfig -import uy.klutter.config.typesafe.kodein.importConfig -import uy.klutter.config.typesafe.loadConfig -import uy.klutter.vertx.kodein.KodeinVertx -import uy.kohesive.kovert.vertx.boot.KodeinKovertVertx -import uy.kohesive.kovert.vertx.boot.KovertVerticle -import uy.kohesive.kovert.vertx.boot.KovertVerticleModule -import uy.kohesive.kovert.vertx.boot.KovertVertx - -class NoopServer { - companion object { - private val LOG: Logger = LoggerFactory.getLogger(NoopServer::class.java) - - @JvmStatic - fun main(args: Array) { - NoopServer().start() - } - } - - - fun start() { - Kodein.global.addImport(Kodein.Module { - importConfig(loadConfig(ClassResourceConfig("/kovert.conf", NoopServer::class.java), ReferenceConfig())) { - import("kovert.vertx", KodeinKovertVertx.configModule) - import("kovert.server", KovertVerticleModule.configModule) - } - - // includes jackson ObjectMapper to match compatibility with Vertx, app logging via Vertx facade to Slf4j - import(KodeinVertx.moduleWithLoggingToSlf4j) - // Kovert boot - import(KodeinKovertVertx.module) - import(KovertVerticleModule.module) - }) - - val initControllers = fun Router.() { - } - - // startup asynchronously... - KovertVertx.start() bind { vertx -> - KovertVerticle.deploy(vertx, routerInit = initControllers) - } success { deploymentId -> - LOG.warn("Deployment complete.") - } fail { error -> - LOG.error("Deployment failed!", error) - } - - } -} diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kovert/SecuredServer.kt b/core-kotlin/src/main/kotlin/com/baeldung/kovert/SecuredServer.kt deleted file mode 100644 index 86ca482808..0000000000 --- a/core-kotlin/src/main/kotlin/com/baeldung/kovert/SecuredServer.kt +++ /dev/null @@ -1,68 +0,0 @@ -package com.baeldung.kovert - -import io.vertx.ext.web.Router -import io.vertx.ext.web.RoutingContext -import nl.komponents.kovenant.functional.bind -import org.kodein.di.Kodein -import org.kodein.di.conf.global -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import uy.klutter.config.typesafe.ClassResourceConfig -import uy.klutter.config.typesafe.ReferenceConfig -import uy.klutter.config.typesafe.kodein.importConfig -import uy.klutter.config.typesafe.loadConfig -import uy.klutter.vertx.kodein.KodeinVertx -import uy.kohesive.kovert.vertx.bindController -import uy.kohesive.kovert.vertx.boot.KodeinKovertVertx -import uy.kohesive.kovert.vertx.boot.KovertVerticle -import uy.kohesive.kovert.vertx.boot.KovertVerticleModule -import uy.kohesive.kovert.vertx.boot.KovertVertx - - -class SecuredServer { - companion object { - private val LOG: Logger = LoggerFactory.getLogger(SecuredServer::class.java) - - @JvmStatic - fun main(args: Array) { - SecuredServer().start() - } - } - - class SecuredContext(private val routingContext: RoutingContext) { - val authenticated = routingContext.request().getHeader("Authorization") == "Secure" - } - - class SecuredController { - fun SecuredContext.getSecured() = this.authenticated - } - - fun start() { - Kodein.global.addImport(Kodein.Module { - importConfig(loadConfig(ClassResourceConfig("/kovert.conf", SecuredServer::class.java), ReferenceConfig())) { - import("kovert.vertx", KodeinKovertVertx.configModule) - import("kovert.server", KovertVerticleModule.configModule) - } - - // includes jackson ObjectMapper to match compatibility with Vertx, app logging via Vertx facade to Slf4j - import(KodeinVertx.moduleWithLoggingToSlf4j) - // Kovert boot - import(KodeinKovertVertx.module) - import(KovertVerticleModule.module) - }) - - val initControllers = fun Router.() { - bindController(SecuredController(), "api") - } - - // startup asynchronously... - KovertVertx.start() bind { vertx -> - KovertVerticle.deploy(vertx, routerInit = initControllers) - } success { deploymentId -> - LOG.warn("Deployment complete.") - } fail { error -> - LOG.error("Deployment failed!", error) - } - - } -} diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kovert/SimpleServer.kt b/core-kotlin/src/main/kotlin/com/baeldung/kovert/SimpleServer.kt deleted file mode 100644 index 172469ab46..0000000000 --- a/core-kotlin/src/main/kotlin/com/baeldung/kovert/SimpleServer.kt +++ /dev/null @@ -1,65 +0,0 @@ -package com.baeldung.kovert - -import io.vertx.ext.web.Router -import io.vertx.ext.web.RoutingContext -import nl.komponents.kovenant.functional.bind -import org.kodein.di.Kodein -import org.kodein.di.conf.global -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import uy.klutter.config.typesafe.ClassResourceConfig -import uy.klutter.config.typesafe.ReferenceConfig -import uy.klutter.config.typesafe.kodein.importConfig -import uy.klutter.config.typesafe.loadConfig -import uy.klutter.vertx.kodein.KodeinVertx -import uy.kohesive.kovert.vertx.bindController -import uy.kohesive.kovert.vertx.boot.KodeinKovertVertx -import uy.kohesive.kovert.vertx.boot.KovertVerticle -import uy.kohesive.kovert.vertx.boot.KovertVerticleModule -import uy.kohesive.kovert.vertx.boot.KovertVertx - - -class SimpleServer { - companion object { - private val LOG: Logger = LoggerFactory.getLogger(SimpleServer::class.java) - - @JvmStatic - fun main(args: Array) { - SimpleServer().start() - } - } - - class SimpleController { - fun RoutingContext.getStringById(id: String) = id - fun RoutingContext.get_truncatedString_by_id(id: String, length: Int = 1) = id.subSequence(0, length) - } - - fun start() { - Kodein.global.addImport(Kodein.Module { - importConfig(loadConfig(ClassResourceConfig("/kovert.conf", SimpleServer::class.java), ReferenceConfig())) { - import("kovert.vertx", KodeinKovertVertx.configModule) - import("kovert.server", KovertVerticleModule.configModule) - } - - // includes jackson ObjectMapper to match compatibility with Vertx, app logging via Vertx facade to Slf4j - import(KodeinVertx.moduleWithLoggingToSlf4j) - // Kovert boot - import(KodeinKovertVertx.module) - import(KovertVerticleModule.module) - }) - - val initControllers = fun Router.() { - bindController(SimpleController(), "api") - } - - // startup asynchronously... - KovertVertx.start() bind { vertx -> - KovertVerticle.deploy(vertx, routerInit = initControllers) - } success { deploymentId -> - LOG.warn("Deployment complete.") - } fail { error -> - LOG.error("Deployment failed!", error) - } - - } -} diff --git a/core-kotlin/src/main/resources/kovert.conf b/core-kotlin/src/main/resources/kovert.conf deleted file mode 100644 index 3b08641693..0000000000 --- a/core-kotlin/src/main/resources/kovert.conf +++ /dev/null @@ -1,15 +0,0 @@ -{ - kovert: { - vertx: { - clustered: false - } - server: { - listeners: [ - { - host: "0.0.0.0" - port: "8000" - } - ] - } - } -} From 5faa406cb062ae194f84a19ab029eb5176ecbcb4 Mon Sep 17 00:00:00 2001 From: myluckagain Date: Tue, 8 Jan 2019 19:36:42 +0500 Subject: [PATCH 179/271] BAEL-2474 (#5997) * BAEL-2474 * rename UserRepositoryImpl.java into UserRepositoryCustomImpl.java --- .../dao/repositories/user/UserRepository.java | 3 +- .../user/UserRepositoryCustom.java | 10 ++++ .../user/UserRepositoryCustomImpl.java | 43 +++++++++++++++ .../UserRepositoryIntegrationTest.java | 55 +++++++++++++------ 4 files changed, 93 insertions(+), 18 deletions(-) create mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepositoryCustom.java create mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepositoryCustomImpl.java diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java index 5bb0232e4a..7f54254832 100644 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java @@ -1,6 +1,7 @@ package com.baeldung.dao.repositories.user; import com.baeldung.domain.user.User; + import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; @@ -13,7 +14,7 @@ import java.util.Collection; import java.util.List; import java.util.stream.Stream; -public interface UserRepository extends JpaRepository { +public interface UserRepository extends JpaRepository , UserRepositoryCustom{ Stream findAllByName(String name); diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepositoryCustom.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepositoryCustom.java new file mode 100644 index 0000000000..72c1fd5d00 --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepositoryCustom.java @@ -0,0 +1,10 @@ +package com.baeldung.dao.repositories.user; + +import java.util.List; +import java.util.Set; + +import com.baeldung.domain.user.User; + +public interface UserRepositoryCustom { + List findUserByEmails(Set emails); +} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepositoryCustomImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepositoryCustomImpl.java new file mode 100644 index 0000000000..9f841caf68 --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepositoryCustomImpl.java @@ -0,0 +1,43 @@ +package com.baeldung.dao.repositories.user; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Path; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; + +import com.baeldung.domain.user.User; + +public class UserRepositoryCustomImpl implements UserRepositoryCustom { + + @PersistenceContext + private EntityManager entityManager; + + @Override + public List findUserByEmails(Set emails) { + CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + CriteriaQuery query = cb.createQuery(User.class); + Root user = query.from(User.class); + + Path emailPath = user.get("email"); + + List predicates = new ArrayList<>(); + for (String email : emails) { + + predicates.add(cb.like(emailPath, email)); + + } + query.select(user) + .where(cb.or(predicates.toArray(new Predicate[predicates.size()]))); + + return entityManager.createQuery(query) + .getResultList(); + } + +} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java index e29161394b..b05086d00e 100644 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java +++ b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java @@ -18,7 +18,9 @@ import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; import java.util.Collection; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; @@ -274,9 +276,8 @@ public class UserRepositoryIntegrationTest { List usersSortByName = userRepository.findAll(new Sort(Sort.Direction.ASC, "name")); - assertThat(usersSortByName - .get(0) - .getName()).isEqualTo(USER_NAME_ADAM); + assertThat(usersSortByName.get(0) + .getName()).isEqualTo(USER_NAME_ADAM); } @Test(expected = PropertyReferenceException.class) @@ -289,9 +290,8 @@ public class UserRepositoryIntegrationTest { List usersSortByNameLength = userRepository.findAll(new Sort("LENGTH(name)")); - assertThat(usersSortByNameLength - .get(0) - .getName()).isEqualTo(USER_NAME_ADAM); + assertThat(usersSortByNameLength.get(0) + .getName()).isEqualTo(USER_NAME_ADAM); } @Test @@ -304,9 +304,8 @@ public class UserRepositoryIntegrationTest { List usersSortByNameLength = userRepository.findAllUsers(JpaSort.unsafe("LENGTH(name)")); - assertThat(usersSortByNameLength - .get(0) - .getName()).isEqualTo(USER_NAME_ADAM); + assertThat(usersSortByNameLength.get(0) + .getName()).isEqualTo(USER_NAME_ADAM); } @Test @@ -320,10 +319,9 @@ public class UserRepositoryIntegrationTest { Page usersPage = userRepository.findAllUsersWithPagination(new PageRequest(1, 3)); - assertThat(usersPage - .getContent() - .get(0) - .getName()).isEqualTo("SAMPLE1"); + assertThat(usersPage.getContent() + .get(0) + .getName()).isEqualTo("SAMPLE1"); } @Test @@ -337,10 +335,9 @@ public class UserRepositoryIntegrationTest { Page usersSortByNameLength = userRepository.findAllUsersWithPaginationNative(new PageRequest(1, 3)); - assertThat(usersSortByNameLength - .getContent() - .get(0) - .getName()).isEqualTo("SAMPLE1"); + assertThat(usersSortByNameLength.getContent() + .get(0) + .getName()).isEqualTo("SAMPLE1"); } @Test @@ -370,6 +367,30 @@ public class UserRepositoryIntegrationTest { assertThat(updatedUsersSize).isEqualTo(2); } + @Test + public void givenUsersInDBWhenFindByEmailsWithDynamicQueryThenReturnCollection() { + + User user1 = new User(); + user1.setEmail(USER_EMAIL); + userRepository.save(user1); + + User user2 = new User(); + user2.setEmail(USER_EMAIL2); + userRepository.save(user2); + + User user3 = new User(); + user3.setEmail(USER_EMAIL3); + userRepository.save(user3); + + Set emails = new HashSet<>(); + emails.add(USER_EMAIL2); + emails.add(USER_EMAIL3); + + Collection usersWithEmails = userRepository.findUserByEmails(emails); + + assertThat(usersWithEmails.size()).isEqualTo(2); + } + @After public void cleanUp() { userRepository.deleteAll(); From 26101769311c7de0285f23e34f00c90187e53f64 Mon Sep 17 00:00:00 2001 From: Urvy Agrawal Date: Tue, 8 Jan 2019 20:09:51 +0530 Subject: [PATCH 180/271] Review comments added --- .../java/com/baeldung/keyword/test/InstanceOfUnitTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core-java/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java b/core-java/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java index fbeec3a077..4c010e3a16 100644 --- a/core-java/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java +++ b/core-java/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java @@ -35,6 +35,12 @@ public class InstanceOfUnitTest { Circle circle = new Circle(); Assert.assertTrue("circle is instance of Shape", circle instanceof Shape); } + + @Test + public void giveWhenTypeIsOfObjectType_thenReturnTrue() { + Thread thread = new Thread(); + Assert.assertTrue("thread is instance of Object", thread instanceof Object); + } @Test public void giveWhenInstanceValueIsNull_thenReturnFalse() { From f1fa9c8253a9db826ad4de40dd71be2ec2ac7527 Mon Sep 17 00:00:00 2001 From: pandachris Date: Tue, 8 Jan 2019 22:18:47 +0700 Subject: [PATCH 181/271] BAEL-2565 move code to different project (#6099) * BAEL-2565 * BAEL-2565 Test code consistency * BAEL-2565 Move code to different project --- .../src/main/java/com/baeldung/enums/values/Element1.java | 0 .../src/main/java/com/baeldung/enums/values/Element2.java | 0 .../src/main/java/com/baeldung/enums/values/Element3.java | 0 .../src/main/java/com/baeldung/enums/values/Element4.java | 0 .../src/main/java/com/baeldung/enums/values/Labeled.java | 0 .../src/test/java/com/baeldung/enums/values/Element1UnitTest.java | 0 .../src/test/java/com/baeldung/enums/values/Element2UnitTest.java | 0 .../src/test/java/com/baeldung/enums/values/Element3UnitTest.java | 0 .../src/test/java/com/baeldung/enums/values/Element4UnitTest.java | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename {core-java-8 => core-java-lang}/src/main/java/com/baeldung/enums/values/Element1.java (100%) rename {core-java-8 => core-java-lang}/src/main/java/com/baeldung/enums/values/Element2.java (100%) rename {core-java-8 => core-java-lang}/src/main/java/com/baeldung/enums/values/Element3.java (100%) rename {core-java-8 => core-java-lang}/src/main/java/com/baeldung/enums/values/Element4.java (100%) rename {core-java-8 => core-java-lang}/src/main/java/com/baeldung/enums/values/Labeled.java (100%) rename {core-java-8 => core-java-lang}/src/test/java/com/baeldung/enums/values/Element1UnitTest.java (100%) rename {core-java-8 => core-java-lang}/src/test/java/com/baeldung/enums/values/Element2UnitTest.java (100%) rename {core-java-8 => core-java-lang}/src/test/java/com/baeldung/enums/values/Element3UnitTest.java (100%) rename {core-java-8 => core-java-lang}/src/test/java/com/baeldung/enums/values/Element4UnitTest.java (100%) diff --git a/core-java-8/src/main/java/com/baeldung/enums/values/Element1.java b/core-java-lang/src/main/java/com/baeldung/enums/values/Element1.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/enums/values/Element1.java rename to core-java-lang/src/main/java/com/baeldung/enums/values/Element1.java diff --git a/core-java-8/src/main/java/com/baeldung/enums/values/Element2.java b/core-java-lang/src/main/java/com/baeldung/enums/values/Element2.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/enums/values/Element2.java rename to core-java-lang/src/main/java/com/baeldung/enums/values/Element2.java diff --git a/core-java-8/src/main/java/com/baeldung/enums/values/Element3.java b/core-java-lang/src/main/java/com/baeldung/enums/values/Element3.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/enums/values/Element3.java rename to core-java-lang/src/main/java/com/baeldung/enums/values/Element3.java diff --git a/core-java-8/src/main/java/com/baeldung/enums/values/Element4.java b/core-java-lang/src/main/java/com/baeldung/enums/values/Element4.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/enums/values/Element4.java rename to core-java-lang/src/main/java/com/baeldung/enums/values/Element4.java diff --git a/core-java-8/src/main/java/com/baeldung/enums/values/Labeled.java b/core-java-lang/src/main/java/com/baeldung/enums/values/Labeled.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/enums/values/Labeled.java rename to core-java-lang/src/main/java/com/baeldung/enums/values/Labeled.java diff --git a/core-java-8/src/test/java/com/baeldung/enums/values/Element1UnitTest.java b/core-java-lang/src/test/java/com/baeldung/enums/values/Element1UnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/enums/values/Element1UnitTest.java rename to core-java-lang/src/test/java/com/baeldung/enums/values/Element1UnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/enums/values/Element2UnitTest.java b/core-java-lang/src/test/java/com/baeldung/enums/values/Element2UnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/enums/values/Element2UnitTest.java rename to core-java-lang/src/test/java/com/baeldung/enums/values/Element2UnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/enums/values/Element3UnitTest.java b/core-java-lang/src/test/java/com/baeldung/enums/values/Element3UnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/enums/values/Element3UnitTest.java rename to core-java-lang/src/test/java/com/baeldung/enums/values/Element3UnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/enums/values/Element4UnitTest.java b/core-java-lang/src/test/java/com/baeldung/enums/values/Element4UnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/enums/values/Element4UnitTest.java rename to core-java-lang/src/test/java/com/baeldung/enums/values/Element4UnitTest.java From c0e36d5b10ca8716390ac1954218b037e9775b83 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Wed, 9 Jan 2019 00:30:54 +0530 Subject: [PATCH 182/271] BAEL-10925 New module spring-boot-rest --- pom.xml | 6 ++- spring-boot-rest/pom.xml | 43 +++++++++++++++++++ .../web/SpringBootRestApplication.java | 13 ++++++ .../com/baeldung/web/config/WebConfig.java | 8 ++++ .../src/main/resources/application.properties | 0 .../SpringBootRestApplicationUnitTest.java | 16 +++++++ 6 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 spring-boot-rest/pom.xml create mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/SpringBootRestApplication.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/config/WebConfig.java create mode 100644 spring-boot-rest/src/main/resources/application.properties create mode 100644 spring-boot-rest/src/test/java/com/baeldung/web/SpringBootRestApplicationUnitTest.java diff --git a/pom.xml b/pom.xml index 4dba0da173..cf7eb1f394 100644 --- a/pom.xml +++ b/pom.xml @@ -645,6 +645,7 @@ spring-boot-mvc spring-boot-ops spring-boot-property-exp + spring-boot-rest spring-boot-security spring-boot-testing spring-boot-vue @@ -1356,8 +1357,11 @@ spring-boot-mvc spring-boot-ops spring-boot-property-exp + spring-boot-rest spring-boot-security + spring-boot-testing spring-boot-vue + spring-boot-libraries spring-cloud spring-cloud-bus @@ -1372,7 +1376,7 @@ spring-dispatcher-servlet spring-drools - spring-ehcache + spring-ehcache spring-ejb spring-exceptions diff --git a/spring-boot-rest/pom.xml b/spring-boot-rest/pom.xml new file mode 100644 index 0000000000..baf9d35a09 --- /dev/null +++ b/spring-boot-rest/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + com.baeldung.web + spring-boot-rest + spring-boot-rest + Spring Boot Rest Module + war + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + com.baeldung.SpringBootRestApplication + + diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/SpringBootRestApplication.java b/spring-boot-rest/src/main/java/com/baeldung/web/SpringBootRestApplication.java new file mode 100644 index 0000000000..62aae7619d --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/web/SpringBootRestApplication.java @@ -0,0 +1,13 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringBootRestApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootRestApplication.class, args); + } + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/config/WebConfig.java b/spring-boot-rest/src/main/java/com/baeldung/web/config/WebConfig.java new file mode 100644 index 0000000000..808e946218 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/web/config/WebConfig.java @@ -0,0 +1,8 @@ +package com.baeldung.web.config; + +import org.springframework.context.annotation.Configuration; + +@Configuration +public class WebConfig { + +} \ No newline at end of file diff --git a/spring-boot-rest/src/main/resources/application.properties b/spring-boot-rest/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-boot-rest/src/test/java/com/baeldung/web/SpringBootRestApplicationUnitTest.java b/spring-boot-rest/src/test/java/com/baeldung/web/SpringBootRestApplicationUnitTest.java new file mode 100644 index 0000000000..747e08f6f8 --- /dev/null +++ b/spring-boot-rest/src/test/java/com/baeldung/web/SpringBootRestApplicationUnitTest.java @@ -0,0 +1,16 @@ +package com.baeldung.spring.boot.rest; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SpringBootRestApplicationUnitTest { + + @Test + public void contextLoads() { + } + +} From 842d8573af8bef74a34b3b65d3f7bae59ffa5742 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Wed, 9 Jan 2019 00:38:14 +0530 Subject: [PATCH 183/271] Revert parent pom.xml --- pom.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index cf7eb1f394..4dba0da173 100644 --- a/pom.xml +++ b/pom.xml @@ -645,7 +645,6 @@ spring-boot-mvc spring-boot-ops spring-boot-property-exp - spring-boot-rest spring-boot-security spring-boot-testing spring-boot-vue @@ -1357,11 +1356,8 @@ spring-boot-mvc spring-boot-ops spring-boot-property-exp - spring-boot-rest spring-boot-security - spring-boot-testing spring-boot-vue - spring-boot-libraries spring-cloud spring-cloud-bus @@ -1376,7 +1372,7 @@ spring-dispatcher-servlet spring-drools - spring-ehcache + spring-ehcache spring-ejb spring-exceptions From 6cd561d91a1ef1d8b5fc52f2d10ceff16e4bcf1f Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Wed, 9 Jan 2019 00:41:57 +0530 Subject: [PATCH 184/271] Fixed pom.xml --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index 4dba0da173..324f6129db 100644 --- a/pom.xml +++ b/pom.xml @@ -644,6 +644,7 @@ spring-boot-logging-log4j2 spring-boot-mvc spring-boot-ops + spring-boot-rest spring-boot-property-exp spring-boot-security spring-boot-testing @@ -1355,6 +1356,7 @@ spring-boot-logging-log4j2 spring-boot-mvc spring-boot-ops + spring-boot-rest spring-boot-property-exp spring-boot-security spring-boot-vue From e6f28c61a3484d5cd488c1160981ac36c35e8b05 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 9 Jan 2019 00:09:02 +0200 Subject: [PATCH 185/271] Create README.md --- spring-boot-rest/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 spring-boot-rest/README.md diff --git a/spring-boot-rest/README.md b/spring-boot-rest/README.md new file mode 100644 index 0000000000..0a8d13cf76 --- /dev/null +++ b/spring-boot-rest/README.md @@ -0,0 +1,3 @@ +Module for the articles that are part of the Spring REST E-book: + +1. [Bootstrap a Web Application with Spring 5](https://www.baeldung.com/bootstraping-a-web-application-with-spring-and-java-based-configuration) From 58ed9e47b204652bae2ced49cb0b541840272f8f Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 9 Jan 2019 00:12:40 +0200 Subject: [PATCH 186/271] Update and rename SpringBootRestApplicationUnitTest.java to SpringContextIntegrationTest.java --- ...plicationUnitTest.java => SpringContextIntegrationTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-boot-rest/src/test/java/com/baeldung/web/{SpringBootRestApplicationUnitTest.java => SpringContextIntegrationTest.java} (86%) diff --git a/spring-boot-rest/src/test/java/com/baeldung/web/SpringBootRestApplicationUnitTest.java b/spring-boot-rest/src/test/java/com/baeldung/web/SpringContextIntegrationTest.java similarity index 86% rename from spring-boot-rest/src/test/java/com/baeldung/web/SpringBootRestApplicationUnitTest.java rename to spring-boot-rest/src/test/java/com/baeldung/web/SpringContextIntegrationTest.java index 747e08f6f8..0c1fdf372b 100644 --- a/spring-boot-rest/src/test/java/com/baeldung/web/SpringBootRestApplicationUnitTest.java +++ b/spring-boot-rest/src/test/java/com/baeldung/web/SpringContextIntegrationTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class SpringBootRestApplicationUnitTest { +public class SpringContextIntegrationTest { @Test public void contextLoads() { From a094e49a6292aaad494f6d66194066c69a81c43f Mon Sep 17 00:00:00 2001 From: Mikhail Chugunov Date: Wed, 9 Jan 2019 19:53:12 +0300 Subject: [PATCH 187/271] BAEL-2475: Changes after first review --- .../deserialization/immutable/Employee.java | 24 ++++++++ .../immutable/MaritalAwarePerson.java | 58 ------------------- .../deserialization/immutable/Person.java | 32 ++++++++-- ...mmutableObjectDeserializationUnitTest.java | 22 ++++--- 4 files changed, 60 insertions(+), 76 deletions(-) create mode 100644 jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Employee.java delete mode 100644 jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/MaritalAwarePerson.java diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Employee.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Employee.java new file mode 100644 index 0000000000..44b10ee39b --- /dev/null +++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Employee.java @@ -0,0 +1,24 @@ +package com.baeldung.jackson.deserialization.immutable; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Employee { + + private final long id; + private final String name; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + public Employee(@JsonProperty("id") long id, @JsonProperty("name") String name) { + this.id = id; + this.name = name; + } + + public long getId() { + return id; + } + + public String getName() { + return name; + } +} diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/MaritalAwarePerson.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/MaritalAwarePerson.java deleted file mode 100644 index cb593b3bb7..0000000000 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/MaritalAwarePerson.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.baeldung.jackson.deserialization.immutable; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; - -@JsonDeserialize(builder = MaritalAwarePerson.Builder.class) -public class MaritalAwarePerson { - - private final String name; - private final int age; - private final Boolean married; - - private MaritalAwarePerson(String name, int age, Boolean married) { - this.name = name; - this.age = age; - this.married = married; - } - - public String getName() { - return name; - } - - public int getAge() { - return age; - } - - public Boolean getMarried() { - return married; - } - - @JsonPOJOBuilder - static class Builder { - String name; - int age; - Boolean married; - - Builder withName(String name) { - this.name = name; - return this; - } - - Builder withAge(int age) { - this.age = age; - return this; - } - - Builder withMarried(boolean married) { - this.married = married; - return this; - } - - public MaritalAwarePerson build() { - return new MaritalAwarePerson(name, age, married); - } - - - } -} diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java index 0214f93ca9..d9041720b6 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java +++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java @@ -1,15 +1,15 @@ package com.baeldung.jackson.deserialization.immutable; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +@JsonDeserialize(builder = Person.Builder.class) public class Person { private final String name; - private final int age; + private final Integer age; - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - public Person(@JsonProperty("name") String name, @JsonProperty("age") int age) { + private Person(String name, Integer age) { this.name = name; this.age = age; } @@ -18,7 +18,27 @@ public class Person { return name; } - public int getAge() { + public Integer getAge() { return age; } + + @JsonPOJOBuilder + static class Builder { + String name; + Integer age; + + Builder withName(String name) { + this.name = name; + return this; + } + + Builder withAge(Integer age) { + this.age = age; + return this; + } + + Person build() { + return new Person(name, age); + } + } } diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java index 5c33a2da26..1252179e3a 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java @@ -11,30 +11,28 @@ public class ImmutableObjectDeserializationUnitTest { @Test public void whenPublicConstructorIsUsed_thenObjectIsDeserialized() throws IOException { - final String json = "{\"name\":\"Frank\",\"age\":50}"; - Person person = new ObjectMapper().readValue(json, Person.class); + final String json = "{\"name\":\"Frank\",\"id\":5000}"; + Employee employee = new ObjectMapper().readValue(json, Employee.class); - assertEquals("Frank", person.getName()); - assertEquals(50, person.getAge()); + assertEquals("Frank", employee.getName()); + assertEquals(5000, employee.getId()); } @Test public void whenBuilderIsUsedAndFieldIsNull_thenObjectIsDeserialized() throws IOException { - final String json = "{\"name\":\"Frank\",\"age\":50}"; - MaritalAwarePerson person = new ObjectMapper().readValue(json, MaritalAwarePerson.class); + final String json = "{\"name\":\"Frank\"}"; + Person person = new ObjectMapper().readValue(json, Person.class); assertEquals("Frank", person.getName()); - assertEquals(50, person.getAge()); - assertNull(person.getMarried()); + assertNull(person.getAge()); } @Test public void whenBuilderIsUsedAndAllFieldsPresent_thenObjectIsDeserialized() throws IOException { - final String json = "{\"name\":\"Frank\",\"age\":50,\"married\":true}"; - MaritalAwarePerson person = new ObjectMapper().readValue(json, MaritalAwarePerson.class); + final String json = "{\"name\":\"Frank\",\"age\":50}"; + Person person = new ObjectMapper().readValue(json, Person.class); assertEquals("Frank", person.getName()); - assertEquals(50, person.getAge()); - assertTrue(person.getMarried()); + assertEquals(50, (int) person.getAge()); } } From 44490a052ff0760b5115ba5764e53553c41ccf44 Mon Sep 17 00:00:00 2001 From: Sam Millington Date: Wed, 9 Jan 2019 18:06:47 +0000 Subject: [PATCH 188/271] BAEL2526 queue interface code (#6115) * BAEL2526 queue interface code * renamed test class to end with 'UnitTest', removed camel case from package name --- .../queueInterface/CustomBaeldungQueue.java | 48 +++++++++++++++++ .../queueInterface/PriorityQueueUnitTest.java | 53 +++++++++++++++++++ .../CustomBaeldungQueueUnitTest.java | 30 +++++++++++ 3 files changed, 131 insertions(+) create mode 100644 core-java-collections/src/main/java/com/baeldung/queueInterface/CustomBaeldungQueue.java create mode 100644 core-java-collections/src/test/java/com/baeldung/queueInterface/PriorityQueueUnitTest.java create mode 100644 core-java-collections/src/test/java/com/baeldung/queueinterface/CustomBaeldungQueueUnitTest.java diff --git a/core-java-collections/src/main/java/com/baeldung/queueInterface/CustomBaeldungQueue.java b/core-java-collections/src/main/java/com/baeldung/queueInterface/CustomBaeldungQueue.java new file mode 100644 index 0000000000..6b088a5079 --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/queueInterface/CustomBaeldungQueue.java @@ -0,0 +1,48 @@ +package com.baeldung.queueinterface; + +import java.util.AbstractQueue; +import java.util.Iterator; +import java.util.LinkedList; + +public class CustomBaeldungQueue extends AbstractQueue { + + private LinkedList elements; + + public CustomBaeldungQueue() { + this.elements = new LinkedList(); + } + + @Override + public Iterator iterator() { + return elements.iterator(); + } + + @Override + public int size() { + return elements.size(); + } + + @Override + public boolean offer(T t) { + if(t == null) return false; + elements.add(t); + return true; + } + + @Override + public T poll() { + + Iterator iter = elements.iterator(); + T t = iter.next(); + if(t != null){ + iter.remove(); + return t; + } + return null; + } + + @Override + public T peek() { + return elements.getFirst(); + } +} diff --git a/core-java-collections/src/test/java/com/baeldung/queueInterface/PriorityQueueUnitTest.java b/core-java-collections/src/test/java/com/baeldung/queueInterface/PriorityQueueUnitTest.java new file mode 100644 index 0000000000..c5b564b55b --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/queueInterface/PriorityQueueUnitTest.java @@ -0,0 +1,53 @@ +package com.baeldung.queueinterface; + +import org.junit.Before; +import org.junit.Test; + +import java.util.PriorityQueue; + +import static org.junit.Assert.assertEquals; + +public class PriorityQueueUnitTest { + + + + @Test + public void givenIntegerQueue_whenIntegersOutOfOrder_checkRetrievalOrderIsNatural() { + + PriorityQueue integerQueue = new PriorityQueue<>(); + + integerQueue.add(9); + integerQueue.add(2); + integerQueue.add(4); + + int first = integerQueue.poll(); + int second = integerQueue.poll(); + int third = integerQueue.poll(); + + assertEquals(2, first); + assertEquals(4, second); + assertEquals(9, third); + + + } + + @Test + public void givenStringQueue_whenStringsAddedOutOfNaturalOrder_checkRetrievalOrderNatural() { + + PriorityQueue stringQueue = new PriorityQueue<>(); + + stringQueue.add("banana"); + stringQueue.add("apple"); + stringQueue.add("cherry"); + + String first = stringQueue.poll(); + String second = stringQueue.poll(); + String third = stringQueue.poll(); + + assertEquals("apple", first); + assertEquals("banana", second); + assertEquals("cherry", third); + + + } +} diff --git a/core-java-collections/src/test/java/com/baeldung/queueinterface/CustomBaeldungQueueUnitTest.java b/core-java-collections/src/test/java/com/baeldung/queueinterface/CustomBaeldungQueueUnitTest.java new file mode 100644 index 0000000000..6dec768542 --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/queueinterface/CustomBaeldungQueueUnitTest.java @@ -0,0 +1,30 @@ +package com.baeldung.queueinterface; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class CustomBaeldungQueueUnitTest { + + private CustomBaeldungQueue customQueue; + + @Before + public void setUp() throws Exception { + customQueue = new CustomBaeldungQueue<>(); + } + + @Test + public void givenQueueWithTwoElements_whenElementsRetrieved_checkRetrievalCorrect() { + + customQueue.add(7); + customQueue.add(5); + + int first = customQueue.poll(); + int second = customQueue.poll(); + + assertEquals(7, first); + assertEquals(5, second); + + } +} From 128817cfebe533b21c4248f6d14099579108a52d Mon Sep 17 00:00:00 2001 From: Amy DeGregorio Date: Wed, 9 Jan 2019 15:20:47 -0500 Subject: [PATCH 189/271] example code for Article How to Write to a CSV File in Java (#6102) --- .../com/baeldung/csv/WriteCsvFileExample.java | 29 ++++++ .../csv/WriteCsvFileExampleUnitTest.java | 90 +++++++++++++++++++ .../src/test/resources/exampleOutput.csv | 2 + 3 files changed, 121 insertions(+) create mode 100644 core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java create mode 100644 core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java create mode 100644 core-java-io/src/test/resources/exampleOutput.csv diff --git a/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java b/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java new file mode 100644 index 0000000000..fd3678d2c5 --- /dev/null +++ b/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java @@ -0,0 +1,29 @@ +package com.baeldung.csv; + +import java.io.BufferedWriter; +import java.io.IOException; + +public class WriteCsvFileExample { + + public void writeLine(BufferedWriter writer, String[] data) throws IOException { + StringBuilder csvLine = new StringBuilder(); + + for (int i = 0; i < data.length; i++) { + if (i > 0) { + csvLine.append(","); + } + csvLine.append(escapeSpecialCharacters(data[i])); + } + + writer.write(csvLine.toString()); + } + + public String escapeSpecialCharacters(String data) { + String escapedData = data.replaceAll("\\R", " "); + if (data.contains(",") || data.contains("\"") || data.contains("'")) { + data = data.replace("\"", "\"\""); + escapedData = "\"" + data + "\""; + } + return escapedData; + } +} diff --git a/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java b/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java new file mode 100644 index 0000000000..4ac84f939d --- /dev/null +++ b/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java @@ -0,0 +1,90 @@ +package com.baeldung.csv; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class WriteCsvFileExampleUnitTest { + private static final Logger LOG = LoggerFactory.getLogger(WriteCsvFileExampleUnitTest.class); + + private static final String CSV_FILE_NAME = "src/test/resources/exampleOutput.csv"; + private WriteCsvFileExample csvExample; + + @Before + public void setupClass() { + csvExample = new WriteCsvFileExample(); + } + + @Test + public void givenCommaContainingData_whenEscapeSpecialCharacters_stringReturnedInQuotes() { + String data = "three,two,one"; + String escapedData = csvExample.escapeSpecialCharacters(data); + + String expectedData = "\"three,two,one\""; + assertEquals(expectedData, escapedData); + } + + @Test + public void givenQuoteContainingData_whenEscapeSpecialCharacters_stringReturnedFormatted() { + String data = "She said \"Hello\""; + String escapedData = csvExample.escapeSpecialCharacters(data); + + String expectedData = "\"She said \"\"Hello\"\"\""; + assertEquals(expectedData, escapedData); + } + + @Test + public void givenNewlineContainingData_whenEscapeSpecialCharacters_stringReturnedInQuotes() { + String dataNewline = "This contains\na newline"; + String dataCarriageReturn = "This contains\r\na newline and carriage return"; + String escapedDataNl = csvExample.escapeSpecialCharacters(dataNewline); + String escapedDataCr = csvExample.escapeSpecialCharacters(dataCarriageReturn); + + String expectedData = "This contains a newline"; + assertEquals(expectedData, escapedDataNl); + String expectedDataCr = "This contains a newline and carriage return"; + assertEquals(expectedDataCr, escapedDataCr); + } + + @Test + public void givenNonSpecialData_whenEscapeSpecialCharacters_stringReturnedUnchanged() { + String data = "This is nothing special"; + String returnedData = csvExample.escapeSpecialCharacters(data); + + assertEquals(data, returnedData); + } + + @Test + public void givenBufferedWriter_whenWriteLine_thenOutputCreated() { + List dataLines = new ArrayList(); + dataLines.add(new String[] { "John", "Doe", "38", "Comment Data\nAnother line of comment data" }); + dataLines.add(new String[] { "Jane", "Doe, Jr.", "19", "She said \"I'm being quoted\"" }); + + File csvOutputFile = new File(CSV_FILE_NAME); + try (BufferedWriter writer = new BufferedWriter(new FileWriter(csvOutputFile))) { + for (Iterator dataIterator = dataLines.iterator(); dataIterator.hasNext();) { + csvExample.writeLine(writer, dataIterator.next()); + if (dataIterator.hasNext()) { + writer.newLine(); + } + } + writer.flush(); + } catch (IOException e) { + LOG.error("IOException " + e.getMessage()); + } + + assertTrue(csvOutputFile.exists()); + } +} diff --git a/core-java-io/src/test/resources/exampleOutput.csv b/core-java-io/src/test/resources/exampleOutput.csv new file mode 100644 index 0000000000..45c37f3a3b --- /dev/null +++ b/core-java-io/src/test/resources/exampleOutput.csv @@ -0,0 +1,2 @@ +John,Doe,38,Comment Data Another line of comment data +Jane,"Doe, Jr.",19,"She said ""I'm being quoted""" \ No newline at end of file From 70a7aaa4fc25ad2d40e314d3f1c3ae8d8b760101 Mon Sep 17 00:00:00 2001 From: Kumar Chandrakant Date: Thu, 10 Jan 2019 02:20:46 +0530 Subject: [PATCH 190/271] Kafka spark cassandra (#6089) * Adding files for the tutorial BAEL-2301 * Incorporating review comments on the article. * Incorporated additional review comments on the article. --- .../data/pipeline/WordCountingApp.java | 18 ++++++------------ .../WordCountingAppWithCheckpoint.java | 19 ++++++------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingApp.java b/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingApp.java index 1155644e1e..db2a73b411 100644 --- a/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingApp.java +++ b/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingApp.java @@ -14,13 +14,7 @@ import org.apache.kafka.common.serialization.StringDeserializer; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.spark.SparkConf; -import org.apache.spark.api.java.JavaPairRDD; import org.apache.spark.api.java.JavaRDD; -import org.apache.spark.api.java.function.FlatMapFunction; -import org.apache.spark.api.java.function.Function; -import org.apache.spark.api.java.function.Function2; -import org.apache.spark.api.java.function.PairFunction; -import org.apache.spark.api.java.function.VoidFunction; import org.apache.spark.streaming.Durations; import org.apache.spark.streaming.api.java.JavaDStream; import org.apache.spark.streaming.api.java.JavaInputDStream; @@ -59,17 +53,17 @@ public class WordCountingApp { JavaInputDStream> messages = KafkaUtils.createDirectStream(streamingContext, LocationStrategies.PreferConsistent(), ConsumerStrategies. Subscribe(topics, kafkaParams)); - JavaPairDStream results = messages.mapToPair((PairFunction, String, String>) record -> new Tuple2<>(record.key(), record.value())); + JavaPairDStream results = messages.mapToPair(record -> new Tuple2<>(record.key(), record.value())); - JavaDStream lines = results.map((Function, String>) tuple2 -> tuple2._2()); + JavaDStream lines = results.map(tuple2 -> tuple2._2()); - JavaDStream words = lines.flatMap((FlatMapFunction) x -> Arrays.asList(x.split("\\s+")) + JavaDStream words = lines.flatMap(x -> Arrays.asList(x.split("\\s+")) .iterator()); - JavaPairDStream wordCounts = words.mapToPair((PairFunction) s -> new Tuple2<>(s, 1)) - .reduceByKey((Function2) (i1, i2) -> i1 + i2); + JavaPairDStream wordCounts = words.mapToPair(s -> new Tuple2<>(s, 1)) + .reduceByKey((i1, i2) -> i1 + i2); - wordCounts.foreachRDD((VoidFunction>) javaRdd -> { + wordCounts.foreachRDD(javaRdd -> { Map wordCountMap = javaRdd.collectAsMap(); for (String key : wordCountMap.keySet()) { List wordList = Arrays.asList(new Word(key, wordCountMap.get(key))); diff --git a/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingAppWithCheckpoint.java b/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingAppWithCheckpoint.java index 79e21f7209..efbe5f3851 100644 --- a/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingAppWithCheckpoint.java +++ b/apache-spark/src/main/java/com/baeldung/data/pipeline/WordCountingAppWithCheckpoint.java @@ -16,15 +16,8 @@ import org.apache.log4j.Logger; import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; -import org.apache.spark.api.java.Optional; -import org.apache.spark.api.java.function.FlatMapFunction; -import org.apache.spark.api.java.function.Function; import org.apache.spark.api.java.function.Function2; -import org.apache.spark.api.java.function.Function3; -import org.apache.spark.api.java.function.PairFunction; -import org.apache.spark.api.java.function.VoidFunction; import org.apache.spark.streaming.Durations; -import org.apache.spark.streaming.State; import org.apache.spark.streaming.StateSpec; import org.apache.spark.streaming.api.java.JavaDStream; import org.apache.spark.streaming.api.java.JavaInputDStream; @@ -71,24 +64,24 @@ public class WordCountingAppWithCheckpoint { JavaInputDStream> messages = KafkaUtils.createDirectStream(streamingContext, LocationStrategies.PreferConsistent(), ConsumerStrategies. Subscribe(topics, kafkaParams)); - JavaPairDStream results = messages.mapToPair((PairFunction, String, String>) record -> new Tuple2<>(record.key(), record.value())); + JavaPairDStream results = messages.mapToPair(record -> new Tuple2<>(record.key(), record.value())); - JavaDStream lines = results.map((Function, String>) tuple2 -> tuple2._2()); + JavaDStream lines = results.map(tuple2 -> tuple2._2()); - JavaDStream words = lines.flatMap((FlatMapFunction) x -> Arrays.asList(x.split("\\s+")) + JavaDStream words = lines.flatMap(x -> Arrays.asList(x.split("\\s+")) .iterator()); - JavaPairDStream wordCounts = words.mapToPair((PairFunction) s -> new Tuple2<>(s, 1)) + JavaPairDStream wordCounts = words.mapToPair(s -> new Tuple2<>(s, 1)) .reduceByKey((Function2) (i1, i2) -> i1 + i2); - JavaMapWithStateDStream> cumulativeWordCounts = wordCounts.mapWithState(StateSpec.function((Function3, State, Tuple2>) (word, one, state) -> { + JavaMapWithStateDStream> cumulativeWordCounts = wordCounts.mapWithState(StateSpec.function((word, one, state) -> { int sum = one.orElse(0) + (state.exists() ? state.get() : 0); Tuple2 output = new Tuple2<>(word, sum); state.update(sum); return output; })); - cumulativeWordCounts.foreachRDD((VoidFunction>>) javaRdd -> { + cumulativeWordCounts.foreachRDD(javaRdd -> { List> wordCountList = javaRdd.collect(); for (Tuple2 tuple : wordCountList) { List wordList = Arrays.asList(new Word(tuple._1, tuple._2)); From 288fc3db8af02097cd1cb7bca13aa5a2569af9de Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 10 Jan 2019 01:04:16 +0200 Subject: [PATCH 191/271] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 324f6129db..07e90cca94 100644 --- a/pom.xml +++ b/pom.xml @@ -436,7 +436,7 @@ java-collections-conversions java-collections-maps - java-ee-8-security-api + java-lite java-numbers java-rmi From c7ba38ffcd805b088e9e44d7145eb393ef162025 Mon Sep 17 00:00:00 2001 From: geroza Date: Tue, 8 Jan 2019 16:16:51 -0200 Subject: [PATCH 192/271] migrated the following modules using parent-spring-5 to spring 5.1: spring-mvc-simple spring-security-mvc-custom spring-security-mvc-login spring-security-rest spring-security-rest-basic-auth spring-static-resources spring-thymeleaf --- ethereum/pom.xml | 4 +- parent-spring-5-1/README.md | 1 + parent-spring-5-1/pom.xml | 39 +++++++++++++++++++ parent-spring-5/pom.xml | 4 +- .../spring-data-elasticsearch/pom.xml | 4 +- .../spring-data-mongodb/pom.xml | 5 +-- pom.xml | 6 +++ spring-dispatcher-servlet/pom.xml | 4 +- spring-mvc-forms-jsp/pom.xml | 4 +- spring-mvc-java/pom.xml | 4 +- spring-mvc-simple/pom.xml | 19 --------- .../java/com/baeldung/spring/MvcConfig.java | 1 - .../baeldung/client/RestTemplateFactory.java | 4 +- .../java/org/baeldung/spring/WebConfig.java | 1 - .../SpringContextIntegrationTest.java | 2 +- .../java/org/baeldung/web/FooLiveTest.java | 2 +- 16 files changed, 64 insertions(+), 40 deletions(-) create mode 100644 parent-spring-5-1/README.md create mode 100644 parent-spring-5-1/pom.xml diff --git a/ethereum/pom.xml b/ethereum/pom.xml index 85cb260670..334840edaf 100644 --- a/ethereum/pom.xml +++ b/ethereum/pom.xml @@ -7,10 +7,10 @@ ethereum - parent-spring-5 + parent-spring-5-1 com.baeldung 0.0.1-SNAPSHOT - ../parent-spring-5 + ../parent-spring-5-1 diff --git a/parent-spring-5-1/README.md b/parent-spring-5-1/README.md new file mode 100644 index 0000000000..ff12555376 --- /dev/null +++ b/parent-spring-5-1/README.md @@ -0,0 +1 @@ +## Relevant articles: diff --git a/parent-spring-5-1/pom.xml b/parent-spring-5-1/pom.xml new file mode 100644 index 0000000000..983e5e63eb --- /dev/null +++ b/parent-spring-5-1/pom.xml @@ -0,0 +1,39 @@ + + 4.0.0 + com.baeldung + parent-spring-5-1 + 0.0.1-SNAPSHOT + pom + parent-spring-5-1 + Parent for all spring 5 core modules + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + org.springframework + spring-core + ${spring.version} + + + org.junit.jupiter + junit-jupiter-engine + ${junit.jupiter.version} + test + + + + + 5.0.6.RELEASE + 5.0.2 + 2.9.6 + 2.9.6 + 5.0.6.RELEASE + + + diff --git a/parent-spring-5/pom.xml b/parent-spring-5/pom.xml index 6a15f38884..51a2c1fd1f 100644 --- a/parent-spring-5/pom.xml +++ b/parent-spring-5/pom.xml @@ -29,11 +29,11 @@ - 5.0.6.RELEASE + 5.1.2.RELEASE 5.0.2 2.9.6 2.9.6 - 5.0.6.RELEASE + 5.1.2.RELEASE \ No newline at end of file diff --git a/persistence-modules/spring-data-elasticsearch/pom.xml b/persistence-modules/spring-data-elasticsearch/pom.xml index ee9e71a1cb..c5ad9b64f9 100644 --- a/persistence-modules/spring-data-elasticsearch/pom.xml +++ b/persistence-modules/spring-data-elasticsearch/pom.xml @@ -9,9 +9,9 @@ com.baeldung - parent-spring-5 + parent-spring-5-1 0.0.1-SNAPSHOT - ../../parent-spring-5 + ../../parent-spring-5-1 diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml index 63b9c3c1b0..4da0526ca6 100644 --- a/persistence-modules/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -6,9 +6,9 @@ com.baeldung - parent-spring-5 + parent-spring-5-1 0.0.1-SNAPSHOT - ../../parent-spring-5 + ../../parent-spring-5-1 @@ -99,7 +99,6 @@ 2.1.2.RELEASE 4.1.4 1.1.3 - 5.1.0.RELEASE 1.9.2 3.2.0.RELEASE diff --git a/pom.xml b/pom.xml index 324f6129db..13b866b968 100644 --- a/pom.xml +++ b/pom.xml @@ -329,6 +329,7 @@ parent-boot-2 parent-spring-4 parent-spring-5 + parent-spring-5-1 parent-java parent-kotlin @@ -600,6 +601,7 @@ parent-boot-2 parent-spring-4 parent-spring-5 + parent-spring-5-1 parent-java parent-kotlin @@ -993,6 +995,7 @@ parent-boot-2 parent-spring-4 parent-spring-5 + parent-spring-5-1 parent-java parent-kotlin @@ -1045,6 +1048,7 @@ parent-boot-2 parent-spring-4 parent-spring-5 + parent-spring-5-1 parent-java parent-kotlin @@ -1312,6 +1316,7 @@ parent-boot-2 parent-spring-4 parent-spring-5 + parent-spring-5-1 parent-java parent-kotlin @@ -1544,6 +1549,7 @@ parent-boot-2 parent-spring-4 parent-spring-5 + parent-spring-5-1 parent-java parent-kotlin diff --git a/spring-dispatcher-servlet/pom.xml b/spring-dispatcher-servlet/pom.xml index 7ac291740e..ea5eb8845e 100644 --- a/spring-dispatcher-servlet/pom.xml +++ b/spring-dispatcher-servlet/pom.xml @@ -10,9 +10,9 @@ com.baeldung - parent-spring-5 + parent-spring-5-1 0.0.1-SNAPSHOT - ../parent-spring-5 + ../parent-spring-5-1 diff --git a/spring-mvc-forms-jsp/pom.xml b/spring-mvc-forms-jsp/pom.xml index 5536314086..80818f4e88 100644 --- a/spring-mvc-forms-jsp/pom.xml +++ b/spring-mvc-forms-jsp/pom.xml @@ -11,9 +11,9 @@ com.baeldung - parent-spring-5 + parent-spring-5-1 0.0.1-SNAPSHOT - ../parent-spring-5 + ../parent-spring-5-1 diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index 9d3e0ca1b2..b0b187ee84 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -8,10 +8,10 @@ war - parent-spring-5 + parent-spring-5-1 com.baeldung 0.0.1-SNAPSHOT - ../parent-spring-5 + ../parent-spring-5-1 diff --git a/spring-mvc-simple/pom.xml b/spring-mvc-simple/pom.xml index 65fa4339d6..087ffea46d 100644 --- a/spring-mvc-simple/pom.xml +++ b/spring-mvc-simple/pom.xml @@ -154,25 +154,6 @@ ${deploy-path} - - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - default-test - - true - - - - - - org.junit.platform - junit-platform-surefire-provider - ${junit.platform.version} - - - spring-mvc-simple diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java b/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java index a9c7e0cf15..082477c98c 100644 --- a/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java +++ b/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java @@ -1,7 +1,6 @@ package com.baeldung.spring; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/RestTemplateFactory.java b/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/RestTemplateFactory.java index 5e15648e9b..3ed0bc82b7 100644 --- a/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/RestTemplateFactory.java +++ b/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/RestTemplateFactory.java @@ -4,7 +4,7 @@ import org.apache.http.HttpHost; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.http.client.ClientHttpRequestFactory; -import org.springframework.http.client.support.BasicAuthorizationInterceptor; +import org.springframework.http.client.support.BasicAuthenticationInterceptor; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; @@ -38,7 +38,7 @@ public class RestTemplateFactory implements FactoryBean, Initializ HttpHost host = new HttpHost("localhost", 8082, "http"); final ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactoryBasicAuth(host); restTemplate = new RestTemplate(requestFactory); - restTemplate.getInterceptors().add(new BasicAuthorizationInterceptor("user1", "user1Pass")); + restTemplate.getInterceptors().add(new BasicAuthenticationInterceptor("user1", "user1Pass")); } } \ No newline at end of file diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/WebConfig.java b/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/WebConfig.java index 2305a7b6c2..5876e1307b 100644 --- a/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/WebConfig.java +++ b/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/WebConfig.java @@ -8,7 +8,6 @@ import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration @EnableWebMvc diff --git a/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 6cf624c179..31b3f2be87 100644 --- a/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -6,7 +6,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration({ "/WebSecurityConfig.xml" }) +@ContextConfiguration({ "/webSecurityConfig.xml" }) public class SpringContextIntegrationTest { @Test diff --git a/spring-security-rest/src/test/java/org/baeldung/web/FooLiveTest.java b/spring-security-rest/src/test/java/org/baeldung/web/FooLiveTest.java index 0a53da674a..86beeb46a9 100644 --- a/spring-security-rest/src/test/java/org/baeldung/web/FooLiveTest.java +++ b/spring-security-rest/src/test/java/org/baeldung/web/FooLiveTest.java @@ -29,7 +29,7 @@ public class FooLiveTest { // } // return RestAssured.given().cookie("JSESSIONID", cookie); return RestAssured.given() - .auth() + .auth().preemptive() .basic("user", "userPass"); } From cde1d1c7ad72c3d3608b97aa45c933b4ded0b86b Mon Sep 17 00:00:00 2001 From: geroza Date: Tue, 8 Jan 2019 17:17:28 -0200 Subject: [PATCH 193/271] Fixed usage of deprecated GzipResourceResolver in spring-static-resources added back spring-version modification in module that hasnt been worked yet cleaned unused classes --- persistence-modules/spring-data-mongodb/pom.xml | 1 + .../src/main/java/com/baeldung/spring/MvcConfig.java | 1 - .../src/main/java/org/baeldung/spring/MvcConfig.java | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml index 4da0526ca6..86e4b275e7 100644 --- a/persistence-modules/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -96,6 +96,7 @@ + 5.1.0.RELEASE 2.1.2.RELEASE 4.1.4 1.1.3 diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java b/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java index 082477c98c..629e203b56 100644 --- a/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java +++ b/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java @@ -1,7 +1,6 @@ package com.baeldung.spring; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; diff --git a/spring-static-resources/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-static-resources/src/main/java/org/baeldung/spring/MvcConfig.java index dbc548e028..7bd03617be 100644 --- a/spring-static-resources/src/main/java/org/baeldung/spring/MvcConfig.java +++ b/spring-static-resources/src/main/java/org/baeldung/spring/MvcConfig.java @@ -18,7 +18,7 @@ import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.i18n.CookieLocaleResolver; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; -import org.springframework.web.servlet.resource.GzipResourceResolver; +import org.springframework.web.servlet.resource.EncodedResourceResolver; import org.springframework.web.servlet.resource.PathResourceResolver; import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter; import org.springframework.web.servlet.view.InternalResourceViewResolver; @@ -57,10 +57,10 @@ public class MvcConfig implements WebMvcConfigurer { public void addResourceHandlers(ResourceHandlerRegistry registry) { // For examples using Spring 4.1.0 if ((env.getProperty("resource.handler.conf")).equals("4.1.0")) { - registry.addResourceHandler("/js/**").addResourceLocations("/js/").setCachePeriod(3600).resourceChain(true).addResolver(new GzipResourceResolver()).addResolver(new PathResourceResolver()); + registry.addResourceHandler("/js/**").addResourceLocations("/js/").setCachePeriod(3600).resourceChain(true).addResolver(new EncodedResourceResolver()).addResolver(new PathResourceResolver()); registry.addResourceHandler("/resources/**").addResourceLocations("/resources/", "classpath:/other-resources/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver()); registry.addResourceHandler("/files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver()); - registry.addResourceHandler("/other-files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new GzipResourceResolver()); + registry.addResourceHandler("/other-files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new EncodedResourceResolver()); } // For examples using Spring 4.0.7 else if ((env.getProperty("resource.handler.conf")).equals("4.0.7")) { From 74df0da304af2152a45ecf60a5f65ae77e0bc474 Mon Sep 17 00:00:00 2001 From: geroza Date: Wed, 9 Jan 2019 12:28:21 -0200 Subject: [PATCH 194/271] fixed removed import by mistake --- .../src/main/java/com/baeldung/spring/MvcConfig.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java b/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java index 629e203b56..082477c98c 100644 --- a/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java +++ b/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java @@ -1,6 +1,7 @@ package com.baeldung.spring; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; From 63258737ceb25dd435d3437920b2e8d8fff709aa Mon Sep 17 00:00:00 2001 From: geroza Date: Wed, 9 Jan 2019 13:33:39 -0200 Subject: [PATCH 195/271] modified readme file to kick off travis build --- ethereum/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ethereum/README.md b/ethereum/README.md index d06ca09636..0c7ae3d4d2 100644 --- a/ethereum/README.md +++ b/ethereum/README.md @@ -4,3 +4,4 @@ - [Introduction to EthereumJ](http://www.baeldung.com/ethereumj) - [Creating and Deploying Smart Contracts with Solidity](http://www.baeldung.com/smart-contracts-ethereum-solidity) - [Lightweight Ethereum Clients Using Web3j](http://www.baeldung.com/web3j) + From 04a4c339b767267739690c633901f911a621b46f Mon Sep 17 00:00:00 2001 From: geroza Date: Wed, 9 Jan 2019 14:53:44 -0200 Subject: [PATCH 196/271] change to kick off build --- ethereum/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/ethereum/README.md b/ethereum/README.md index 0c7ae3d4d2..d06ca09636 100644 --- a/ethereum/README.md +++ b/ethereum/README.md @@ -4,4 +4,3 @@ - [Introduction to EthereumJ](http://www.baeldung.com/ethereumj) - [Creating and Deploying Smart Contracts with Solidity](http://www.baeldung.com/smart-contracts-ethereum-solidity) - [Lightweight Ethereum Clients Using Web3j](http://www.baeldung.com/web3j) - From 39bfa04d11d34b8b3fe98deb43936854eaea9fcf Mon Sep 17 00:00:00 2001 From: geroza Date: Wed, 9 Jan 2019 23:51:39 -0200 Subject: [PATCH 197/271] change to kick off build --- ethereum/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ethereum/README.md b/ethereum/README.md index d06ca09636..7accb4cd53 100644 --- a/ethereum/README.md +++ b/ethereum/README.md @@ -4,3 +4,4 @@ - [Introduction to EthereumJ](http://www.baeldung.com/ethereumj) - [Creating and Deploying Smart Contracts with Solidity](http://www.baeldung.com/smart-contracts-ethereum-solidity) - [Lightweight Ethereum Clients Using Web3j](http://www.baeldung.com/web3j) + \ No newline at end of file From 57228dfc6b9ec1af0658f9b616056708c070bb28 Mon Sep 17 00:00:00 2001 From: Rodolfo Felipe Date: Wed, 9 Jan 2019 22:29:44 -0400 Subject: [PATCH 198/271] BAEL-2446 Unit tests for new added examples. --- .../StringReplaceAndRemoveUnitTest.java | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/java-strings/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java b/java-strings/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java index d952d2383b..d54bf09b35 100644 --- a/java-strings/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java @@ -1,15 +1,16 @@ package com.baeldung.string; - import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.RegExUtils; import org.junit.Test; +import com.sun.source.tree.AssertTree; + import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; public class StringReplaceAndRemoveUnitTest { - @Test public void givenTestStrings_whenReplace_thenProcessedString() { @@ -26,7 +27,7 @@ public class StringReplaceAndRemoveUnitTest { public void givenTestStrings_whenReplaceAll_thenProcessedString() { String master2 = "Welcome to Baeldung, Hello World Baeldung"; - String regexTarget= "(Baeldung)$"; + String regexTarget = "(Baeldung)$"; String replacement = "Java"; String processed2 = master2.replaceAll(regexTarget, replacement); assertTrue(processed2.endsWith("Java")); @@ -45,18 +46,16 @@ public class StringReplaceAndRemoveUnitTest { StringBuilder builder = new StringBuilder(master); - builder.delete(startIndex, stopIndex); - assertFalse(builder.toString().contains(target)); - + assertFalse(builder.toString() + .contains(target)); builder.replace(startIndex, stopIndex, replacement); - assertTrue(builder.toString().contains(replacement)); - + assertTrue(builder.toString() + .contains(replacement)); } - @Test public void givenTestStrings_whenStringUtilsMethods_thenProcessedStrings() { @@ -74,10 +73,20 @@ public class StringReplaceAndRemoveUnitTest { } + @Test + public void givenTestStrings_whenReplaceExactWord_thenProcessedString() { + String sentence = "A car is not the same as a carriage, and some planes can carry cars inside them!"; + String regexTarget = "\\bcar\\b"; + String exactWordReplaced = sentence.replaceAll(regexTarget, "truck"); + assertTrue("A truck is not the same as a carriage, and some planes can carry cars inside them!".equals(exactWordReplaced)); + } - - - - + @Test + public void givenTestStrings_whenReplaceExactWordUsingRegExUtilsMethod_thenProcessedString() { + String sentence = "A car is not the same as a carriage, and some planes can carry cars inside them!"; + String regexTarget = "\\bcar\\b"; + String exactWordReplaced = RegExUtils.replaceAll(sentence, regexTarget, "truck"); + assertTrue("A truck is not the same as a carriage, and some planes can carry cars inside them!".equals(exactWordReplaced)); + } } From 44a796b9e66aa8ff28fa464ecaca486bdbcf0277 Mon Sep 17 00:00:00 2001 From: Rodolfo Felipe Date: Wed, 9 Jan 2019 23:16:44 -0400 Subject: [PATCH 199/271] Deleting invalid package Package added by eclipse. Nonexistent. --- .../com/baeldung/string/StringReplaceAndRemoveUnitTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/java-strings/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java b/java-strings/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java index d54bf09b35..4d2b54241b 100644 --- a/java-strings/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java @@ -4,8 +4,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.RegExUtils; import org.junit.Test; -import com.sun.source.tree.AssertTree; - import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; From bb966c8e1461083cc6d3617242bc7cf9ac7c0fac Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 10 Jan 2019 08:51:53 +0100 Subject: [PATCH 200/271] [BAEL-2531] Directories creation tests --- .../directories/NewDirectoryUnitTest.java | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 core-java-io/src/test/java/com/baeldung/directories/NewDirectoryUnitTest.java diff --git a/core-java-io/src/test/java/com/baeldung/directories/NewDirectoryUnitTest.java b/core-java-io/src/test/java/com/baeldung/directories/NewDirectoryUnitTest.java new file mode 100644 index 0000000000..e0111c2702 --- /dev/null +++ b/core-java-io/src/test/java/com/baeldung/directories/NewDirectoryUnitTest.java @@ -0,0 +1,100 @@ +package com.baeldung.directories; + +import org.junit.Before; +import org.junit.Test; + +import java.io.File; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class NewDirectoryUnitTest { + + private static final File TEMP_DIRECTORY = new File(System.getProperty("java.io.tmpdir")); + + @Before + public void beforeEach() { + File newDirectory = new File(TEMP_DIRECTORY, "new_directory"); + File nestedInNewDirectory = new File(newDirectory, "nested_directory"); + File existingDirectory = new File(TEMP_DIRECTORY, "existing_directory"); + File existingNestedDirectory = new File(existingDirectory, "existing_nested_directory"); + File nestedInExistingDirectory = new File(existingDirectory, "nested_directory"); + + nestedInNewDirectory.delete(); + newDirectory.delete(); + nestedInExistingDirectory.delete(); + existingDirectory.mkdir(); + existingNestedDirectory.mkdir(); + } + + @Test + public void givenUnexistingDirectory_whenMkdir_thenTrue() { + File newDirectory = new File(TEMP_DIRECTORY, "new_directory"); + assertFalse(newDirectory.exists()); + + boolean directoryCreated = newDirectory.mkdir(); + + assertTrue(directoryCreated); + } + + @Test + public void givenExistingDirectory_whenMkdir_thenFalse() { + File newDirectory = new File(TEMP_DIRECTORY, "new_directory"); + newDirectory.mkdir(); + assertTrue(newDirectory.exists()); + + boolean directoryCreated = newDirectory.mkdir(); + + assertFalse(directoryCreated); + } + + @Test + public void givenUnexistingNestedDirectories_whenMkdir_thenFalse() { + File newDirectory = new File(TEMP_DIRECTORY, "new_directory"); + File nestedDirectory = new File(newDirectory, "nested_directory"); + assertFalse(newDirectory.exists()); + assertFalse(nestedDirectory.exists()); + + boolean directoriesCreated = nestedDirectory.mkdir(); + + assertFalse(directoriesCreated); + } + + @Test + public void givenUnexistingNestedDirectories_whenMkdirs_thenTrue() { + File newDirectory = new File(TEMP_DIRECTORY, "new_directory"); + File nestedDirectory = new File(newDirectory, "nested_directory"); + assertFalse(newDirectory.exists()); + assertFalse(nestedDirectory.exists()); + + boolean directoriesCreated = nestedDirectory.mkdirs(); + + assertTrue(directoriesCreated); + } + + @Test + public void givenExistingParentDirectories_whenMkdirs_thenTrue() { + File newDirectory = new File(TEMP_DIRECTORY, "existing_directory"); + newDirectory.mkdir(); + File nestedDirectory = new File(newDirectory, "nested_directory"); + assertTrue(newDirectory.exists()); + assertFalse(nestedDirectory.exists()); + + boolean directoriesCreated = nestedDirectory.mkdirs(); + + assertTrue(directoriesCreated); + } + + @Test + public void givenExistingNestedDirectories_whenMkdirs_thenFalse() { + File existingDirectory = new File(TEMP_DIRECTORY, "existing_directory"); + File existingNestedDirectory = new File(existingDirectory, "existing_nested_directory"); + assertTrue(existingDirectory.exists()); + assertTrue(existingNestedDirectory.exists()); + + boolean directoriesCreated = existingNestedDirectory.mkdirs(); + + assertFalse(directoriesCreated); + } + +} From 9b550e6554f0432f9e93a1f20273398909f17369 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Thu, 10 Jan 2019 15:00:38 +0400 Subject: [PATCH 201/271] localdate converter --- .../com/baeldung/util/LocalDateConverter.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/util/LocalDateConverter.java diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/util/LocalDateConverter.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/util/LocalDateConverter.java new file mode 100644 index 0000000000..341492d1fd --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/util/LocalDateConverter.java @@ -0,0 +1,25 @@ +package com.baeldung.util; + +import javax.persistence.AttributeConverter; +import javax.persistence.Converter; +import java.sql.Date; +import java.time.LocalDate; +import java.util.Optional; + +@Converter(autoApply = true) +public class LocalDateConverter implements AttributeConverter { + + @Override + public Date convertToDatabaseColumn(LocalDate localDateTime) { + return Optional.ofNullable(localDateTime) + .map(Date::valueOf) + .orElse(null); + } + + @Override + public LocalDate convertToEntityAttribute(Date timestamp) { + return Optional.ofNullable(timestamp) + .map(Date::toLocalDate) + .orElse(null); + } +} \ No newline at end of file From 6202b7caab30ba5db67e992925efa60c21c2a881 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Thu, 10 Jan 2019 15:18:21 +0400 Subject: [PATCH 202/271] localdate converter --- .../main/java/com/baeldung/util/LocalDateConverter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/util/LocalDateConverter.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/util/LocalDateConverter.java index 341492d1fd..00fd378b05 100644 --- a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/util/LocalDateConverter.java +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/util/LocalDateConverter.java @@ -10,15 +10,15 @@ import java.util.Optional; public class LocalDateConverter implements AttributeConverter { @Override - public Date convertToDatabaseColumn(LocalDate localDateTime) { - return Optional.ofNullable(localDateTime) + public Date convertToDatabaseColumn(LocalDate localDate) { + return Optional.ofNullable(localDate) .map(Date::valueOf) .orElse(null); } @Override - public LocalDate convertToEntityAttribute(Date timestamp) { - return Optional.ofNullable(timestamp) + public LocalDate convertToEntityAttribute(Date date) { + return Optional.ofNullable(date) .map(Date::toLocalDate) .orElse(null); } From 1ca15e59190955a5bb53c1466d7aac68a8d79859 Mon Sep 17 00:00:00 2001 From: geroza Date: Wed, 9 Jan 2019 12:23:10 -0200 Subject: [PATCH 203/271] Migrated modules using parent-spring-5: ethereum persistence-modules/spring-data-elasticsearch persistence-modules/spring-data-mongodb spring-dispatcher-servlet spring-mvc-forms-jsp spring-mvc-java --- ethereum/pom.xml | 15 ++--- .../spring-data-elasticsearch/pom.xml | 4 +- .../ElasticSearchManualTest.java | 7 ++ ...ionTest.java => GeoQueriesManualTest.java} | 10 ++- ...Test.java => ElasticSearchManualTest.java} | 9 ++- ...java => ElasticSearchQueryManualTest.java} | 9 ++- ...Test.java => SpringContextManualTest.java} | 8 ++- .../spring-data-mongodb/pom.xml | 5 +- .../aggregation/ZipsAggregationLiveTest.java | 6 ++ .../com/baeldung/gridfs/GridFSLiveTest.java | 6 ++ .../mongotemplate/DocumentQueryLiveTest.java | 6 ++ .../MongoTemplateProjectionLiveTest.java | 6 ++ .../MongoTemplateQueryLiveTest.java | 6 ++ .../repository/ActionRepositoryLiveTest.java | 6 ++ .../repository/BaseQueryLiveTest.java | 6 ++ .../baeldung/repository/DSLQueryLiveTest.java | 8 ++- .../repository/JSONQueryLiveTest.java | 6 ++ .../repository/QueryMethodsLiveTest.java | 6 ++ .../repository/UserRepositoryLiveTest.java | 6 ++ .../UserRepositoryProjectionLiveTest.java | 6 ++ .../MongoTransactionReactiveLiveTest.java | 6 ++ .../MongoTransactionTemplateLiveTest.java | 6 ++ .../MongoTransactionalLiveTest.java | 6 ++ spring-4/README.md | 1 + spring-4/pom.xml | 16 +++++ .../com/baeldung/flips/ApplicationConfig.java | 8 ++- .../com/baeldung/jsonp/JsonPApplication.java | 27 ++++++++ .../com/baeldung/jsonp/model/Company.java | 38 +++++++++++ .../web/controller/CompanyController.java | 27 ++++++++ .../jsonp/web/controller/IndexController.java | 13 ++++ .../advice/JsonpControllerAdvice.java | 5 +- .../src/main/resources/application.properties | 2 +- .../resources/jsonp-application.properties | 2 + .../src/main/webapp/WEB-INF/jsp/index.jsp | 66 +++++++++++++++++++ spring-dispatcher-servlet/pom.xml | 4 +- spring-mvc-forms-jsp/pom.xml | 4 +- spring-mvc-java/README.md | 1 - spring-mvc-java/pom.xml | 20 +++++- .../web/controller/CompanyController.java | 13 ---- .../config/HandlerMappingDefaultConfig.java | 9 +-- .../com/baeldung/htmlunit/TestConfig.java | 1 - .../ClassValidationMvcIntegrationTest.java | 1 - .../GreetControllerIntegrationTest.java | 1 - 43 files changed, 366 insertions(+), 52 deletions(-) rename persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/{GeoQueriesIntegrationTest.java => GeoQueriesManualTest.java} (97%) rename persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/{ElasticSearchIntegrationTest.java => ElasticSearchManualTest.java} (97%) rename persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/{ElasticSearchQueryIntegrationTest.java => ElasticSearchQueryManualTest.java} (98%) rename persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/{SpringContextIntegrationTest.java => SpringContextManualTest.java} (77%) create mode 100644 spring-4/src/main/java/com/baeldung/jsonp/JsonPApplication.java create mode 100644 spring-4/src/main/java/com/baeldung/jsonp/model/Company.java create mode 100644 spring-4/src/main/java/com/baeldung/jsonp/web/controller/CompanyController.java create mode 100644 spring-4/src/main/java/com/baeldung/jsonp/web/controller/IndexController.java rename {spring-mvc-java/src/main/java/com/baeldung => spring-4/src/main/java/com/baeldung/jsonp}/web/controller/advice/JsonpControllerAdvice.java (53%) create mode 100644 spring-4/src/main/resources/jsonp-application.properties create mode 100644 spring-4/src/main/webapp/WEB-INF/jsp/index.jsp diff --git a/ethereum/pom.xml b/ethereum/pom.xml index 334840edaf..c7f82eaf22 100644 --- a/ethereum/pom.xml +++ b/ethereum/pom.xml @@ -7,10 +7,10 @@ ethereum - parent-spring-5-1 + parent-spring-5 com.baeldung 0.0.1-SNAPSHOT - ../parent-spring-5-1 + ../parent-spring-5 @@ -37,17 +37,17 @@ org.springframework spring-core - ${springframework.version} + ${spring.version} org.springframework spring-web - ${springframework.version} + ${spring.version} org.springframework spring-webmvc - ${springframework.version} + ${spring.version} @@ -123,12 +123,12 @@ org.springframework spring-context - ${springframework.version} + ${spring.version} org.springframework spring-test - ${springframework.version} + ${spring.version} test @@ -212,7 +212,6 @@ 8.5.4 1.5.0-RELEASE 3.3.1 - 5.0.5.RELEASE 1.5.6.RELEASE 2.21.0 2.9.7 diff --git a/persistence-modules/spring-data-elasticsearch/pom.xml b/persistence-modules/spring-data-elasticsearch/pom.xml index c5ad9b64f9..ee9e71a1cb 100644 --- a/persistence-modules/spring-data-elasticsearch/pom.xml +++ b/persistence-modules/spring-data-elasticsearch/pom.xml @@ -9,9 +9,9 @@ com.baeldung - parent-spring-5-1 + parent-spring-5 0.0.1-SNAPSHOT - ../../parent-spring-5-1 + ../../parent-spring-5 diff --git a/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java index fbf4e5ab99..e43dcdf43e 100644 --- a/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java +++ b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java @@ -30,6 +30,13 @@ import org.junit.Test; import com.alibaba.fastjson.JSON; +/** + * + * This Manual test requires: + * * Elasticsearch instance running on host + * * with cluster name = elasticsearch + * + */ public class ElasticSearchManualTest { private List listOfPersons = new ArrayList<>(); private Client client = null; diff --git a/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesManualTest.java similarity index 97% rename from persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesManualTest.java index 1f55379418..f9a42050b6 100644 --- a/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java +++ b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesManualTest.java @@ -31,9 +31,17 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.baeldung.spring.data.es.config.Config; import com.vividsolutions.jts.geom.Coordinate; +/** + * + * This Manual test requires: + * * Elasticsearch instance running on host + * * with cluster name = elasticsearch + * * and further configurations + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = Config.class) -public class GeoQueriesIntegrationTest { +public class GeoQueriesManualTest { private static final String WONDERS_OF_WORLD = "wonders-of-world"; private static final String WONDERS = "Wonders"; diff --git a/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchManualTest.java similarity index 97% rename from persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchManualTest.java index 6ecb11cdbe..bed2e2ff25 100644 --- a/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java +++ b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchManualTest.java @@ -27,9 +27,16 @@ import com.baeldung.spring.data.es.model.Article; import com.baeldung.spring.data.es.model.Author; import com.baeldung.spring.data.es.service.ArticleService; +/** + * + * This Manual test requires: + * * Elasticsearch instance running on host + * * with cluster name = elasticsearch + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = Config.class) -public class ElasticSearchIntegrationTest { +public class ElasticSearchManualTest { @Autowired private ElasticsearchTemplate elasticsearchTemplate; diff --git a/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryManualTest.java similarity index 98% rename from persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryManualTest.java index 2348c49830..5e24d8398c 100644 --- a/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java +++ b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryManualTest.java @@ -41,9 +41,16 @@ import com.baeldung.spring.data.es.model.Article; import com.baeldung.spring.data.es.model.Author; import com.baeldung.spring.data.es.service.ArticleService; +/** + * + * This Manual test requires: + * * Elasticsearch instance running on host + * * with cluster name = elasticsearch + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = Config.class) -public class ElasticSearchQueryIntegrationTest { +public class ElasticSearchQueryManualTest { @Autowired private ElasticsearchTemplate elasticsearchTemplate; diff --git a/persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextManualTest.java similarity index 77% rename from persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextManualTest.java index 6f45039c96..c6f095eae9 100644 --- a/persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextManualTest.java @@ -7,9 +7,15 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.baeldung.spring.data.es.config.Config; +/** + * + * This Manual test requires: + * * Elasticsearch instance running on host + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = Config.class) -public class SpringContextIntegrationTest { +public class SpringContextManualTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml index 86e4b275e7..c1faf72103 100644 --- a/persistence-modules/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -6,9 +6,9 @@ com.baeldung - parent-spring-5-1 + parent-spring-5 0.0.1-SNAPSHOT - ../../parent-spring-5-1 + ../../parent-spring-5 @@ -96,7 +96,6 @@ - 5.1.0.RELEASE 2.1.2.RELEASE 4.1.4 1.1.3 diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java index 1da50d7cb4..1002dc79eb 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java @@ -44,6 +44,12 @@ import com.mongodb.MongoClient; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoDatabase; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class ZipsAggregationLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java index 3a88a1e654..d25b9ece4f 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java @@ -31,6 +31,12 @@ import com.mongodb.BasicDBObject; import com.mongodb.DBObject; import com.mongodb.client.gridfs.model.GridFSFile; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @ContextConfiguration("file:src/main/resources/mongoConfig.xml") @RunWith(SpringJUnit4ClassRunner.class) public class GridFSLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java index d05bde0f1b..e5e4a188ec 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java @@ -24,6 +24,12 @@ import com.baeldung.config.MongoConfig; import com.baeldung.model.EmailAddress; import com.baeldung.model.User; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class DocumentQueryLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java index 309f14e995..9e12997c67 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java @@ -16,6 +16,12 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = SimpleMongoConfig.class) public class MongoTemplateProjectionLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java index fc78921b75..4f62f0d7a7 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java @@ -27,6 +27,12 @@ import com.baeldung.config.MongoConfig; import com.baeldung.model.EmailAddress; import com.baeldung.model.User; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class MongoTemplateQueryLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/ActionRepositoryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/ActionRepositoryLiveTest.java index 096015ca0a..79648f1a20 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/ActionRepositoryLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/ActionRepositoryLiveTest.java @@ -15,6 +15,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.time.ZoneOffset; import java.time.ZonedDateTime; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class ActionRepositoryLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java index e4849181e5..c94bb2ae4c 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java @@ -7,6 +7,12 @@ import org.junit.Before; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.mongodb.core.MongoOperations; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ public class BaseQueryLiveTest { @Autowired diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java index f87ca5cbb5..0ccf677b3e 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java @@ -15,8 +15,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.querydsl.core.types.Predicate; - - +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class DSLQueryLiveTest extends BaseQueryLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java index 4e99c0b140..3a99407350 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java @@ -12,6 +12,12 @@ import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class JSONQueryLiveTest extends BaseQueryLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java index 47e67a6b4c..ef8ce10dd1 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java @@ -12,6 +12,12 @@ import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class QueryMethodsLiveTest extends BaseQueryLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java index 901610e42d..dd7215af7e 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java @@ -23,6 +23,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.baeldung.config.MongoConfig; import com.baeldung.model.User; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class UserRepositoryLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java index 80f4275794..8972246041 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java @@ -13,6 +13,12 @@ import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class UserRepositoryProjectionLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveLiveTest.java index 70908552fe..3fc8dcf977 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveLiveTest.java @@ -12,6 +12,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.baeldung.config.MongoReactiveConfig; import com.baeldung.model.User; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoReactiveConfig.class) public class MongoTransactionReactiveLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateLiveTest.java index 20ac6974bc..53b2c7a0e7 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateLiveTest.java @@ -24,6 +24,12 @@ import org.springframework.transaction.support.TransactionTemplate; import com.baeldung.config.MongoConfig; import com.baeldung.model.User; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class MongoTransactionTemplateLiveTest { diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalLiveTest.java index 0cf86aa43e..bafcd770ec 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalLiveTest.java @@ -24,6 +24,12 @@ import com.baeldung.model.User; import com.baeldung.repository.UserRepository; import com.mongodb.MongoCommandException; +/** + * + * This test requires: + * * mongodb instance running on the environment + * + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) diff --git a/spring-4/README.md b/spring-4/README.md index 402557eb41..57cb8c3eeb 100644 --- a/spring-4/README.md +++ b/spring-4/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [A Guide to Flips for Spring](http://www.baeldung.com/flips-spring) - [Configuring a Hikari Connection Pool with Spring Boot](https://www.baeldung.com/spring-boot-hikari) +- [Spring JSON-P with Jackson](http://www.baeldung.com/spring-jackson-jsonp) diff --git a/spring-4/pom.xml b/spring-4/pom.xml index 78939bba95..60f1555d8f 100644 --- a/spring-4/pom.xml +++ b/spring-4/pom.xml @@ -52,6 +52,21 @@ provided + + javax.servlet + jstl + + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + org.apache.tomcat.embed + tomcat-embed-jasper + provided + @@ -71,6 +86,7 @@ + com.baeldung.flips.ApplicationConfig 1.0.1 1.16.18 1.4.197 diff --git a/spring-4/src/main/java/com/baeldung/flips/ApplicationConfig.java b/spring-4/src/main/java/com/baeldung/flips/ApplicationConfig.java index 7001aeb991..1bd6ffa336 100644 --- a/spring-4/src/main/java/com/baeldung/flips/ApplicationConfig.java +++ b/spring-4/src/main/java/com/baeldung/flips/ApplicationConfig.java @@ -3,9 +3,15 @@ package com.baeldung.flips; import org.flips.describe.config.FlipWebContextConfiguration; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; +import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.context.annotation.Import; -@SpringBootApplication +@SpringBootApplication(exclude = { + DataSourceAutoConfiguration.class, + DataSourceTransactionManagerAutoConfiguration.class, + HibernateJpaAutoConfiguration.class }) @Import(FlipWebContextConfiguration.class) public class ApplicationConfig { diff --git a/spring-4/src/main/java/com/baeldung/jsonp/JsonPApplication.java b/spring-4/src/main/java/com/baeldung/jsonp/JsonPApplication.java new file mode 100644 index 0000000000..a8f3c0e102 --- /dev/null +++ b/spring-4/src/main/java/com/baeldung/jsonp/JsonPApplication.java @@ -0,0 +1,27 @@ +package com.baeldung.jsonp; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; +import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.support.SpringBootServletInitializer; +import org.springframework.context.annotation.PropertySource; + +@SpringBootApplication(exclude = { + DataSourceAutoConfiguration.class, + DataSourceTransactionManagerAutoConfiguration.class, + HibernateJpaAutoConfiguration.class }) +@PropertySource("classpath:jsonp-application.properties") +public class JsonPApplication extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(JsonPApplication.class); + } + + public static void main(String[] args) throws Exception { + SpringApplication.run(JsonPApplication.class, args); + } +} diff --git a/spring-4/src/main/java/com/baeldung/jsonp/model/Company.java b/spring-4/src/main/java/com/baeldung/jsonp/model/Company.java new file mode 100644 index 0000000000..b11a216e52 --- /dev/null +++ b/spring-4/src/main/java/com/baeldung/jsonp/model/Company.java @@ -0,0 +1,38 @@ +package com.baeldung.jsonp.model; + +public class Company { + + private long id; + private String name; + + public Company() { + super(); + } + + public Company(final long id, final String name) { + this.id = id; + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + @Override + public String toString() { + return "Company [id=" + id + ", name=" + name + "]"; + } + +} diff --git a/spring-4/src/main/java/com/baeldung/jsonp/web/controller/CompanyController.java b/spring-4/src/main/java/com/baeldung/jsonp/web/controller/CompanyController.java new file mode 100644 index 0000000000..8710359365 --- /dev/null +++ b/spring-4/src/main/java/com/baeldung/jsonp/web/controller/CompanyController.java @@ -0,0 +1,27 @@ +package com.baeldung.jsonp.web.controller; + +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.baeldung.jsonp.model.Company; + +@Controller +public class CompanyController { + + @RequestMapping(value = "/companyResponseBody", produces = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public Company getCompanyResponseBody() { + final Company company = new Company(2, "ABC"); + return company; + } + + @RequestMapping(value = "/companyResponseEntity", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity getCompanyResponseEntity() { + final Company company = new Company(3, "123"); + return new ResponseEntity(company, HttpStatus.OK); + } +} diff --git a/spring-4/src/main/java/com/baeldung/jsonp/web/controller/IndexController.java b/spring-4/src/main/java/com/baeldung/jsonp/web/controller/IndexController.java new file mode 100644 index 0000000000..8469e19458 --- /dev/null +++ b/spring-4/src/main/java/com/baeldung/jsonp/web/controller/IndexController.java @@ -0,0 +1,13 @@ +package com.baeldung.jsonp.web.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class IndexController { + + @RequestMapping() + public String retrieveIndex() { + return "index"; + } +} diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/advice/JsonpControllerAdvice.java b/spring-4/src/main/java/com/baeldung/jsonp/web/controller/advice/JsonpControllerAdvice.java similarity index 53% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/advice/JsonpControllerAdvice.java rename to spring-4/src/main/java/com/baeldung/jsonp/web/controller/advice/JsonpControllerAdvice.java index 7b2c6870df..be7c65cb1e 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/web/controller/advice/JsonpControllerAdvice.java +++ b/spring-4/src/main/java/com/baeldung/jsonp/web/controller/advice/JsonpControllerAdvice.java @@ -1,8 +1,11 @@ -package com.baeldung.web.controller.advice; +package com.baeldung.jsonp.web.controller.advice; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.AbstractJsonpResponseBodyAdvice; +// AbstractJsonpResponseBodyAdvice was deprecated in favor of configuring CORS properly +// We still want to cover the usage of JSON-P in our articles, therefore we don't care that it was deprecated. +@SuppressWarnings("deprecation") @ControllerAdvice public class JsonpControllerAdvice extends AbstractJsonpResponseBodyAdvice { diff --git a/spring-4/src/main/resources/application.properties b/spring-4/src/main/resources/application.properties index 274896be15..e67700b7be 100644 --- a/spring-4/src/main/resources/application.properties +++ b/spring-4/src/main/resources/application.properties @@ -2,4 +2,4 @@ feature.foo.by.id=Y feature.new.foo=Y last.active.after=2018-03-14T00:00:00Z first.active.after=2999-03-15T00:00:00Z -logging.level.org.flips=info \ No newline at end of file +logging.level.org.flips=info diff --git a/spring-4/src/main/resources/jsonp-application.properties b/spring-4/src/main/resources/jsonp-application.properties new file mode 100644 index 0000000000..94e7fcc026 --- /dev/null +++ b/spring-4/src/main/resources/jsonp-application.properties @@ -0,0 +1,2 @@ +spring.mvc.view.prefix=/WEB-INF/jsp/ +spring.mvc.view.suffix=.jsp diff --git a/spring-4/src/main/webapp/WEB-INF/jsp/index.jsp b/spring-4/src/main/webapp/WEB-INF/jsp/index.jsp new file mode 100644 index 0000000000..fa5498c966 --- /dev/null +++ b/spring-4/src/main/webapp/WEB-INF/jsp/index.jsp @@ -0,0 +1,66 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1" %> + + + + + Company Data + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/spring-dispatcher-servlet/pom.xml b/spring-dispatcher-servlet/pom.xml index ea5eb8845e..7ac291740e 100644 --- a/spring-dispatcher-servlet/pom.xml +++ b/spring-dispatcher-servlet/pom.xml @@ -10,9 +10,9 @@ com.baeldung - parent-spring-5-1 + parent-spring-5 0.0.1-SNAPSHOT - ../parent-spring-5-1 + ../parent-spring-5 diff --git a/spring-mvc-forms-jsp/pom.xml b/spring-mvc-forms-jsp/pom.xml index 80818f4e88..5536314086 100644 --- a/spring-mvc-forms-jsp/pom.xml +++ b/spring-mvc-forms-jsp/pom.xml @@ -11,9 +11,9 @@ com.baeldung - parent-spring-5-1 + parent-spring-5 0.0.1-SNAPSHOT - ../parent-spring-5-1 + ../parent-spring-5 diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index c7fcbd400b..851a3689ab 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -11,7 +11,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Introduction to Advice Types in Spring](http://www.baeldung.com/spring-aop-advice-tutorial) - [A Guide to the ViewResolver in Spring MVC](http://www.baeldung.com/spring-mvc-view-resolver-tutorial) - [Integration Testing in Spring](http://www.baeldung.com/integration-testing-in-spring) -- [Spring JSON-P with Jackson](http://www.baeldung.com/spring-jackson-jsonp) - [A Quick Guide to Spring MVC Matrix Variables](http://www.baeldung.com/spring-mvc-matrix-variables) - [Intro to WebSockets with Spring](http://www.baeldung.com/websockets-spring) - [File Upload with Spring MVC](http://www.baeldung.com/spring-file-upload) diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index b0b187ee84..562df30318 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -8,10 +8,10 @@ war - parent-spring-5-1 + parent-spring-5 com.baeldung 0.0.1-SNAPSHOT - ../parent-spring-5-1 + ../parent-spring-5 @@ -60,6 +60,12 @@ commons-fileupload commons-fileupload ${commons-fileupload.version} + + + commons-io + commons-io + + net.sourceforge.htmlunit @@ -70,8 +76,17 @@ commons-logging commons-logging + + commons-io + commons-io + + + commons-io + commons-io + ${commons-io.version} + @@ -255,6 +270,7 @@ 19.0 3.5 1.3.2 + 2.5 2.2.0 diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/CompanyController.java b/spring-mvc-java/src/main/java/com/baeldung/web/controller/CompanyController.java index e92abfdc47..af1e729c13 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/web/controller/CompanyController.java +++ b/spring-mvc-java/src/main/java/com/baeldung/web/controller/CompanyController.java @@ -60,17 +60,4 @@ public class CompanyController { result.put("name", name); return new ResponseEntity<>(result, HttpStatus.OK); } - - @RequestMapping(value = "/companyResponseBody", produces = MediaType.APPLICATION_JSON_VALUE) - @ResponseBody - public Company getCompanyResponseBody() { - final Company company = new Company(2, "ABC"); - return company; - } - - @RequestMapping(value = "/companyResponseEntity", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity getCompanyResponseEntity() { - final Company company = new Company(3, "123"); - return new ResponseEntity(company, HttpStatus.OK); - } } diff --git a/spring-mvc-java/src/test/java/com/baeldung/config/HandlerMappingDefaultConfig.java b/spring-mvc-java/src/test/java/com/baeldung/config/HandlerMappingDefaultConfig.java index 9190d07d6b..d3a329a387 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/config/HandlerMappingDefaultConfig.java +++ b/spring-mvc-java/src/test/java/com/baeldung/config/HandlerMappingDefaultConfig.java @@ -1,15 +1,10 @@ package com.baeldung.config; -import com.baeldung.web.controller.handlermapping.BeanNameHandlerMappingController; -import com.baeldung.web.controller.handlermapping.SimpleUrlMappingController; -import com.baeldung.web.controller.handlermapping.WelcomeController; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping; -import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; -import java.util.HashMap; -import java.util.Map; +import com.baeldung.web.controller.handlermapping.BeanNameHandlerMappingController; +import com.baeldung.web.controller.handlermapping.WelcomeController; @Configuration diff --git a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/TestConfig.java b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/TestConfig.java index 5b86b59095..529879fada 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/TestConfig.java +++ b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/TestConfig.java @@ -9,7 +9,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.thymeleaf.spring4.SpringTemplateEngine; import org.thymeleaf.spring4.view.ThymeleafViewResolver; import org.thymeleaf.templateresolver.ServletContextTemplateResolver; diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/ClassValidationMvcIntegrationTest.java b/spring-mvc-java/src/test/java/com/baeldung/web/controller/ClassValidationMvcIntegrationTest.java index a86f71011c..2cd225a775 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/web/controller/ClassValidationMvcIntegrationTest.java +++ b/spring-mvc-java/src/test/java/com/baeldung/web/controller/ClassValidationMvcIntegrationTest.java @@ -1,6 +1,5 @@ package com.baeldung.web.controller; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java b/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java index 384bd85ec6..bce5ab0a8c 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java +++ b/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java @@ -20,7 +20,6 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; -import com.baeldung.spring.web.config.WebConfig; import com.baeldung.spring.web.config.WebConfig; @RunWith(SpringJUnit4ClassRunner.class) From 8c34b3e93ba35f8d06cbda55d9e46f048997abe4 Mon Sep 17 00:00:00 2001 From: geroza Date: Wed, 9 Jan 2019 12:43:11 -0200 Subject: [PATCH 204/271] * removed temporary parent module parent-spring-5 --- parent-spring-5-1/README.md | 1 - parent-spring-5-1/pom.xml | 39 ------------------------------------- pom.xml | 6 ------ 3 files changed, 46 deletions(-) delete mode 100644 parent-spring-5-1/README.md delete mode 100644 parent-spring-5-1/pom.xml diff --git a/parent-spring-5-1/README.md b/parent-spring-5-1/README.md deleted file mode 100644 index ff12555376..0000000000 --- a/parent-spring-5-1/README.md +++ /dev/null @@ -1 +0,0 @@ -## Relevant articles: diff --git a/parent-spring-5-1/pom.xml b/parent-spring-5-1/pom.xml deleted file mode 100644 index 983e5e63eb..0000000000 --- a/parent-spring-5-1/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - com.baeldung - parent-spring-5-1 - 0.0.1-SNAPSHOT - pom - parent-spring-5-1 - Parent for all spring 5 core modules - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - - - org.springframework - spring-core - ${spring.version} - - - org.junit.jupiter - junit-jupiter-engine - ${junit.jupiter.version} - test - - - - - 5.0.6.RELEASE - 5.0.2 - 2.9.6 - 2.9.6 - 5.0.6.RELEASE - - - diff --git a/pom.xml b/pom.xml index 13b866b968..324f6129db 100644 --- a/pom.xml +++ b/pom.xml @@ -329,7 +329,6 @@ parent-boot-2 parent-spring-4 parent-spring-5 - parent-spring-5-1 parent-java parent-kotlin @@ -601,7 +600,6 @@ parent-boot-2 parent-spring-4 parent-spring-5 - parent-spring-5-1 parent-java parent-kotlin @@ -995,7 +993,6 @@ parent-boot-2 parent-spring-4 parent-spring-5 - parent-spring-5-1 parent-java parent-kotlin @@ -1048,7 +1045,6 @@ parent-boot-2 parent-spring-4 parent-spring-5 - parent-spring-5-1 parent-java parent-kotlin @@ -1316,7 +1312,6 @@ parent-boot-2 parent-spring-4 parent-spring-5 - parent-spring-5-1 parent-java parent-kotlin @@ -1549,7 +1544,6 @@ parent-boot-2 parent-spring-4 parent-spring-5 - parent-spring-5-1 parent-java parent-kotlin From 2432527980d6adcd5fe77cf11857a45945b27a03 Mon Sep 17 00:00:00 2001 From: eelhazati Date: Thu, 10 Jan 2019 16:22:07 +0100 Subject: [PATCH 205/271] jpa 2.2 support for java 8 date and time types. --- persistence-modules/java-jpa/pom.xml | 31 ++- .../datetime/DateTimeEntityRepository.java | 68 +++++++ .../jpa/datetime/JPA22DateTimeEntity.java | 176 ++++++++++++++++++ .../com/baeldung/jpa/datetime/MainApp.java | 18 ++ .../main/resources/META-INF/persistence.xml | 22 ++- 5 files changed, 310 insertions(+), 5 deletions(-) create mode 100644 persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/datetime/DateTimeEntityRepository.java create mode 100644 persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/datetime/JPA22DateTimeEntity.java create mode 100644 persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/datetime/MainApp.java diff --git a/persistence-modules/java-jpa/pom.xml b/persistence-modules/java-jpa/pom.xml index ddab51a2e2..7e9c7b83f1 100644 --- a/persistence-modules/java-jpa/pom.xml +++ b/persistence-modules/java-jpa/pom.xml @@ -4,8 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 java-jpa - java-jpa - + java-jpa + parent-modules com.baeldung @@ -24,10 +24,35 @@ h2 ${h2.version} + + + + javax.persistence + javax.persistence-api + 2.2 + + + + + org.eclipse.persistence + eclipselink + ${eclipselink.version} + runtime + + + org.postgresql + postgresql + ${postgres.version} + runtime + bundle + - 5.3.1.Final + 5.4.0.Final 1.4.197 + 2.7.4-RC1 + 42.2.5 + \ No newline at end of file diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/datetime/DateTimeEntityRepository.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/datetime/DateTimeEntityRepository.java new file mode 100644 index 0000000000..0bd04da221 --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/datetime/DateTimeEntityRepository.java @@ -0,0 +1,68 @@ +package com.baeldung.jpa.datetime; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import java.sql.Date; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.*; +import java.util.Calendar; + +public class DateTimeEntityRepository { + private EntityManagerFactory emf = null; + + public DateTimeEntityRepository() { + emf = Persistence.createEntityManagerFactory("java8-datetime-postgresql"); + } + + public JPA22DateTimeEntity find(Long id) { + EntityManager entityManager = emf.createEntityManager(); + + JPA22DateTimeEntity dateTimeTypes = entityManager.find(JPA22DateTimeEntity.class, id); + + entityManager.close(); + return dateTimeTypes; + } + + public void save(Long id) { + JPA22DateTimeEntity dateTimeTypes = new JPA22DateTimeEntity(); + dateTimeTypes.setId(id); + + //java.sql types: date/time + dateTimeTypes.setSqlTime(Time.valueOf(LocalTime.now())); + dateTimeTypes.setSqlDate(Date.valueOf(LocalDate.now())); + dateTimeTypes.setSqlTimestamp(Timestamp.valueOf(LocalDateTime.now())); + + //java.util types: date/calendar + java.util.Date date = new java.util.Date(); + dateTimeTypes.setUtilTime(date); + dateTimeTypes.setUtilDate(date); + dateTimeTypes.setUtilTimestamp(date); + + //Calendar + Calendar calendar = Calendar.getInstance(); + dateTimeTypes.setCalendarTime(calendar); + dateTimeTypes.setCalendarDate(calendar); + dateTimeTypes.setCalendarTimestamp(calendar); + + //java.time types + dateTimeTypes.setLocalTime(LocalTime.now()); + dateTimeTypes.setLocalDate(LocalDate.now()); + dateTimeTypes.setLocalDateTime(LocalDateTime.now()); + + //java.time types with offset + dateTimeTypes.setOffsetTime(OffsetTime.now()); + dateTimeTypes.setOffsetDateTime(OffsetDateTime.now()); + + EntityManager entityManager = emf.createEntityManager(); + entityManager.getTransaction().begin(); + entityManager.persist(dateTimeTypes); + entityManager.getTransaction().commit(); + entityManager.close(); + } + + public void clean() { + emf.close(); + } +} diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/datetime/JPA22DateTimeEntity.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/datetime/JPA22DateTimeEntity.java new file mode 100644 index 0000000000..065385bd86 --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/datetime/JPA22DateTimeEntity.java @@ -0,0 +1,176 @@ +package com.baeldung.jpa.datetime; + +import javax.persistence.*; +import java.sql.Date; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.*; +import java.util.Calendar; + +@Entity +public class JPA22DateTimeEntity { + + @Id + private Long id; + + //java.sql types + private Time sqlTime; + private Date sqlDate; + private Timestamp sqlTimestamp; + + //java.util types + @Temporal(TemporalType.TIME) + private java.util.Date utilTime; + + @Temporal(TemporalType.DATE) + private java.util.Date utilDate; + + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date utilTimestamp; + + //Calendar + @Temporal(TemporalType.TIME) + private Calendar calendarTime; + + @Temporal(TemporalType.DATE) + private Calendar calendarDate; + + @Temporal(TemporalType.TIMESTAMP) + private Calendar calendarTimestamp; + + // java.time types + @Column(name = "local_time", columnDefinition = "TIME") + private LocalTime localTime; + + @Column(name = "local_date", columnDefinition = "DATE") + private LocalDate localDate; + + @Column(name = "local_date_time", columnDefinition = "TIMESTAMP") + private LocalDateTime localDateTime; + + @Column(name = "offset_time", columnDefinition = "TIME WITH TIME ZONE") + private OffsetTime offsetTime; + + @Column(name = "offset_date_time", columnDefinition = "TIMESTAMP WITH TIME ZONE") + private OffsetDateTime offsetDateTime; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Time getSqlTime() { + return sqlTime; + } + + public void setSqlTime(Time sqlTime) { + this.sqlTime = sqlTime; + } + + public Date getSqlDate() { + return sqlDate; + } + + public void setSqlDate(Date sqlDate) { + this.sqlDate = sqlDate; + } + + public Timestamp getSqlTimestamp() { + return sqlTimestamp; + } + + public void setSqlTimestamp(Timestamp sqlTimestamp) { + this.sqlTimestamp = sqlTimestamp; + } + + public java.util.Date getUtilTime() { + return utilTime; + } + + public void setUtilTime(java.util.Date utilTime) { + this.utilTime = utilTime; + } + + public java.util.Date getUtilDate() { + return utilDate; + } + + public void setUtilDate(java.util.Date utilDate) { + this.utilDate = utilDate; + } + + public java.util.Date getUtilTimestamp() { + return utilTimestamp; + } + + public void setUtilTimestamp(java.util.Date utilTimestamp) { + this.utilTimestamp = utilTimestamp; + } + + public Calendar getCalendarTime() { + return calendarTime; + } + + public void setCalendarTime(Calendar calendarTime) { + this.calendarTime = calendarTime; + } + + public Calendar getCalendarDate() { + return calendarDate; + } + + public void setCalendarDate(Calendar calendarDate) { + this.calendarDate = calendarDate; + } + + public Calendar getCalendarTimestamp() { + return calendarTimestamp; + } + + public void setCalendarTimestamp(Calendar calendarTimestamp) { + this.calendarTimestamp = calendarTimestamp; + } + + public LocalTime getLocalTime() { + return localTime; + } + + public void setLocalTime(LocalTime localTime) { + this.localTime = localTime; + } + + public LocalDate getLocalDate() { + return localDate; + } + + public void setLocalDate(LocalDate localDate) { + this.localDate = localDate; + } + + public LocalDateTime getLocalDateTime() { + return localDateTime; + } + + public void setLocalDateTime(LocalDateTime localDateTime) { + this.localDateTime = localDateTime; + } + + public OffsetTime getOffsetTime() { + return offsetTime; + } + + public void setOffsetTime(OffsetTime offsetTime) { + this.offsetTime = offsetTime; + } + + public OffsetDateTime getOffsetDateTime() { + return offsetDateTime; + } + + public void setOffsetDateTime(OffsetDateTime offsetDateTime) { + this.offsetDateTime = offsetDateTime; + } +} diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/datetime/MainApp.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/datetime/MainApp.java new file mode 100644 index 0000000000..7f23f44254 --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/datetime/MainApp.java @@ -0,0 +1,18 @@ +package com.baeldung.jpa.datetime; + +public class MainApp { + + public static void main(String... args) { + + DateTimeEntityRepository dateTimeEntityRepository = new DateTimeEntityRepository(); + + //Persist + dateTimeEntityRepository.save(100L); + + //Find + JPA22DateTimeEntity dateTimeEntity = dateTimeEntityRepository.find(100L); + + dateTimeEntityRepository.clean(); + } + +} \ No newline at end of file diff --git a/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml b/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml index 433d456cc9..9e4f4bf4c9 100644 --- a/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml +++ b/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml @@ -2,8 +2,8 @@ + http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd" + version="2.2"> org.hibernate.jpa.HibernatePersistenceProvider @@ -66,4 +66,22 @@
+ + org.eclipse.persistence.jpa.PersistenceProvider + com.baeldung.jpa.datetime.JPA22DateTimeEntity + true + + + + + + + + + + + + + + \ No newline at end of file From 3907f624b57bf9314ec8a9bf73d354685ff50a80 Mon Sep 17 00:00:00 2001 From: eelhazati Date: Thu, 10 Jan 2019 16:36:52 +0100 Subject: [PATCH 206/271] jpa 2.2 support for java 8 date and time types. --- persistence-modules/java-jpa/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/persistence-modules/java-jpa/pom.xml b/persistence-modules/java-jpa/pom.xml index 7e9c7b83f1..fa47d6bd9c 100644 --- a/persistence-modules/java-jpa/pom.xml +++ b/persistence-modules/java-jpa/pom.xml @@ -44,7 +44,6 @@ postgresql ${postgres.version} runtime - bundle
From 1c6dba97187e598e25219291408b87be6dd8e793 Mon Sep 17 00:00:00 2001 From: eelhazati Date: Thu, 10 Jan 2019 16:50:29 +0100 Subject: [PATCH 207/271] excludes jpa entities. --- .../java-jpa/src/main/resources/META-INF/persistence.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml b/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml index 9e4f4bf4c9..f7258e3109 100644 --- a/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml +++ b/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml @@ -8,6 +8,8 @@ org.hibernate.jpa.HibernatePersistenceProvider com.baeldung.sqlresultsetmapping.ScheduledDay + com.baeldung.sqlresultsetmapping.Employee + true Date: Thu, 10 Jan 2019 17:08:47 +0100 Subject: [PATCH 208/271] exludes jpa entities. --- .../java-jpa/src/main/resources/META-INF/persistence.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml b/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml index f7258e3109..8592fce533 100644 --- a/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml +++ b/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml @@ -26,6 +26,7 @@ org.hibernate.jpa.HibernatePersistenceProvider com.baeldung.jpa.stringcast.Message + true @@ -41,6 +42,7 @@ org.hibernate.jpa.HibernatePersistenceProvider com.baeldung.jpa.model.Car + true From 94c146e245c78b2ddaf941f0f6e43fb1eff3a1b4 Mon Sep 17 00:00:00 2001 From: Ger Roza Date: Thu, 10 Jan 2019 14:21:27 -0200 Subject: [PATCH 209/271] just to trigger the Travis build --- ethereum/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereum/README.md b/ethereum/README.md index 7accb4cd53..0c7ae3d4d2 100644 --- a/ethereum/README.md +++ b/ethereum/README.md @@ -4,4 +4,4 @@ - [Introduction to EthereumJ](http://www.baeldung.com/ethereumj) - [Creating and Deploying Smart Contracts with Solidity](http://www.baeldung.com/smart-contracts-ethereum-solidity) - [Lightweight Ethereum Clients Using Web3j](http://www.baeldung.com/web3j) - \ No newline at end of file + From 4fb05ab3a27bc4267db4d344a3987e875d55537d Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 10 Jan 2019 21:22:46 +0200 Subject: [PATCH 210/271] Update pom.xml --- java-numbers/pom.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/java-numbers/pom.xml b/java-numbers/pom.xml index bb63c8cfe1..0f5140ea5e 100644 --- a/java-numbers/pom.xml +++ b/java-numbers/pom.xml @@ -72,16 +72,6 @@ - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*IntegrationTest.java - - true - - org.apache.maven.plugins From dfbff7aa19384117e758e12ae1eab870d183f097 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 10 Jan 2019 21:32:08 +0200 Subject: [PATCH 211/271] Update pom.xml --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 07e90cca94..a9b4b3f119 100644 --- a/pom.xml +++ b/pom.xml @@ -232,6 +232,7 @@ ${maven-war-plugin.version} + com.vackosar.gitflowincrementalbuilder From a15045f8a7f46a72268a088e4d0c7943cd17b456 Mon Sep 17 00:00:00 2001 From: Ger Roza Date: Thu, 10 Jan 2019 18:17:59 -0200 Subject: [PATCH 212/271] edit readme to trigger travis build --- ethereum/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/ethereum/README.md b/ethereum/README.md index 0c7ae3d4d2..d06ca09636 100644 --- a/ethereum/README.md +++ b/ethereum/README.md @@ -4,4 +4,3 @@ - [Introduction to EthereumJ](http://www.baeldung.com/ethereumj) - [Creating and Deploying Smart Contracts with Solidity](http://www.baeldung.com/smart-contracts-ethereum-solidity) - [Lightweight Ethereum Clients Using Web3j](http://www.baeldung.com/web3j) - From 7f501f169f7f7d22362e7e28cdb1331ad020ef55 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 10 Jan 2019 22:32:12 +0200 Subject: [PATCH 213/271] Update Circle.java --- core-java/src/main/java/com/baeldung/keyword/Circle.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/src/main/java/com/baeldung/keyword/Circle.java b/core-java/src/main/java/com/baeldung/keyword/Circle.java index 4ec91d1b8a..231b2f5a59 100644 --- a/core-java/src/main/java/com/baeldung/keyword/Circle.java +++ b/core-java/src/main/java/com/baeldung/keyword/Circle.java @@ -1,4 +1,5 @@ package com.baeldung.keyword; public class Circle extends Round implements Shape { + } From b8dbc9d053a6f56eb2884baa7c811b713ce7a2ae Mon Sep 17 00:00:00 2001 From: Laurentiu Delcea Date: Thu, 10 Jan 2019 23:21:06 +0200 Subject: [PATCH 214/271] BAEL-2480 Java Map to String conversion (#6075) * BAEL-2480 Java Map to String conversion * BAEL-2480 Java Map to String conversion * BAEL-2480 Java Map to String conversion * BAEL-2480 Java Map to String conversion --- .../com/baeldung/convert/MapToString.java | 34 +++++++++++++ .../com/baeldung/convert/StringToMap.java | 21 ++++++++ .../baeldung/convert/MapToStringUnitTest.java | 48 +++++++++++++++++++ .../baeldung/convert/StringToMapUnitTest.java | 23 +++++++++ 4 files changed, 126 insertions(+) create mode 100644 java-collections-maps/src/main/java/com/baeldung/convert/MapToString.java create mode 100644 java-collections-maps/src/main/java/com/baeldung/convert/StringToMap.java create mode 100644 java-collections-maps/src/test/java/com/baeldung/convert/MapToStringUnitTest.java create mode 100644 java-collections-maps/src/test/java/com/baeldung/convert/StringToMapUnitTest.java diff --git a/java-collections-maps/src/main/java/com/baeldung/convert/MapToString.java b/java-collections-maps/src/main/java/com/baeldung/convert/MapToString.java new file mode 100644 index 0000000000..aca0d05ef1 --- /dev/null +++ b/java-collections-maps/src/main/java/com/baeldung/convert/MapToString.java @@ -0,0 +1,34 @@ +package com.baeldung.convert; + +import com.google.common.base.Joiner; +import org.apache.commons.lang3.StringUtils; + +import java.util.Map; +import java.util.stream.Collectors; + +public class MapToString { + + public static String convertWithIteration(Map map) { + StringBuilder mapAsString = new StringBuilder("{"); + for (Integer key : map.keySet()) { + mapAsString.append(key + "=" + map.get(key) + ", "); + } + mapAsString.delete(mapAsString.length()-2, mapAsString.length()).append("}"); + return mapAsString.toString(); + } + + public static String convertWithStream(Map map) { + String mapAsString = map.keySet().stream() + .map(key -> key + "=" + map.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + return mapAsString; + } + + public static String convertWithGuava(Map map) { + return Joiner.on(",").withKeyValueSeparator("=").join(map); + } + + public static String convertWithApache(Map map) { + return StringUtils.join(map); + } +} diff --git a/java-collections-maps/src/main/java/com/baeldung/convert/StringToMap.java b/java-collections-maps/src/main/java/com/baeldung/convert/StringToMap.java new file mode 100644 index 0000000000..caabca4a09 --- /dev/null +++ b/java-collections-maps/src/main/java/com/baeldung/convert/StringToMap.java @@ -0,0 +1,21 @@ +package com.baeldung.convert; + +import com.google.common.base.Splitter; + +import java.util.Arrays; +import java.util.Map; +import java.util.stream.Collectors; + +public class StringToMap { + + public static Map convertWithStream(String mapAsString) { + Map map = Arrays.stream(mapAsString.split(",")) + .map(entry -> entry.split("=")) + .collect(Collectors.toMap(entry -> entry[0], entry -> entry[1])); + return map; + } + + public static Map convertWithGuava(String mapAsString) { + return Splitter.on(',').withKeyValueSeparator('=').split(mapAsString); + } +} diff --git a/java-collections-maps/src/test/java/com/baeldung/convert/MapToStringUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/convert/MapToStringUnitTest.java new file mode 100644 index 0000000000..d9923e74a0 --- /dev/null +++ b/java-collections-maps/src/test/java/com/baeldung/convert/MapToStringUnitTest.java @@ -0,0 +1,48 @@ +package com.baeldung.convert; + +import org.apache.commons.collections4.MapUtils; +import org.junit.Assert; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.HashMap; +import java.util.Map; + +public class MapToStringUnitTest { + + private Map wordsByKey = new HashMap<>(); + + @BeforeEach + public void setup() { + wordsByKey.clear(); + wordsByKey.put(1, "one"); + wordsByKey.put(2, "two"); + wordsByKey.put(3, "three"); + wordsByKey.put(4, "four"); + } + + @Test + public void givenMap_WhenUsingIteration_ThenResultingMapIsCorrect() { + String mapAsString = MapToString.convertWithIteration(wordsByKey); + Assert.assertEquals("{1=one, 2=two, 3=three, 4=four}", mapAsString); + } + + @Test + public void givenMap_WhenUsingStream_ThenResultingMapIsCorrect() { + String mapAsString = MapToString.convertWithStream(wordsByKey); + Assert.assertEquals("{1=one, 2=two, 3=three, 4=four}", mapAsString); + } + + @Test + public void givenMap_WhenUsingGuava_ThenResultingMapIsCorrect() { + String mapAsString = MapToString.convertWithGuava(wordsByKey); + Assert.assertEquals("1=one,2=two,3=three,4=four", mapAsString); + } + + @Test + public void givenMap_WhenUsingApache_ThenResultingMapIsCorrect() { + String mapAsString = MapToString.convertWithApache(wordsByKey); + Assert.assertEquals("{1=one, 2=two, 3=three, 4=four}", mapAsString); + MapUtils.debugPrint(System.out, "Map as String", wordsByKey); + } +} \ No newline at end of file diff --git a/java-collections-maps/src/test/java/com/baeldung/convert/StringToMapUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/convert/StringToMapUnitTest.java new file mode 100644 index 0000000000..8fb906efd0 --- /dev/null +++ b/java-collections-maps/src/test/java/com/baeldung/convert/StringToMapUnitTest.java @@ -0,0 +1,23 @@ +package com.baeldung.convert; + +import org.junit.Assert; +import org.junit.jupiter.api.Test; + +import java.util.Map; + +public class StringToMapUnitTest { + + @Test + public void givenString_WhenUsingStream_ThenResultingStringIsCorrect() { + Map wordsByKey = StringToMap.convertWithStream("1=one,2=two,3=three,4=four"); + Assert.assertEquals(4, wordsByKey.size()); + Assert.assertEquals("one", wordsByKey.get("1")); + } + + @Test + void givenString_WhenUsingGuava_ThenResultingStringIsCorrect() { + Map wordsByKey = StringToMap.convertWithGuava("1=one,2=two,3=three,4=four"); + Assert.assertEquals(4, wordsByKey.size()); + Assert.assertEquals("one", wordsByKey.get("1")); + } +} \ No newline at end of file From c65180c74f75f2cbb0d21b787d12b9098865a703 Mon Sep 17 00:00:00 2001 From: Emily Cheyne Date: Thu, 10 Jan 2019 15:05:00 -0700 Subject: [PATCH 215/271] BAEL-2535 Remove CustomerReflectionToStringUnitTest --- .../CustomerReflectionToStringUnitTest.java | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringUnitTest.java diff --git a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringUnitTest.java b/java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringUnitTest.java deleted file mode 100644 index 77dcab52e6..0000000000 --- a/java-strings/src/test/java/com/baeldung/string/tostring/CustomerReflectionToStringUnitTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.string.tostring; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.jupiter.api.Test; - -public class CustomerReflectionToStringUnitTest { - private static final String CUSTOMER_REFLECTION_TO_STRING = "com.baeldung.string.tostring.CustomerReflectionToString"; - - @Test - public void givenWrapperCollectionStrBuffer_whenReflectionToString_thenCustomerDetails() { - CustomerReflectionToString customer = new CustomerReflectionToString(); - customer.setFirstName("Rajesh"); - customer.setLastName("Bhojwani"); - customer.setScore(8); - - List orders = new ArrayList(); - orders.add("Book"); - orders.add("Pen"); - customer.setOrders(orders); - - StringBuffer fullname = new StringBuffer(); - fullname.append(customer.getLastName()+", "+ customer.getFirstName()); - customer.setFullname(fullname); - - assertTrue(customer.toString().contains(CUSTOMER_REFLECTION_TO_STRING)); - } - -} From c5415eecac1322a79f30e6ecf9bcd946d231233d Mon Sep 17 00:00:00 2001 From: "Erick Audet M.Sc" Date: Thu, 10 Jan 2019 17:16:53 -0500 Subject: [PATCH 216/271] BAEL-2059 * New section in InputStream to byte array article and recreating branch. * Minor typo * Code reformat using intellij formatter. * Code reformat using intellij formatter. * guava implementation to be completed * guava implementation * Added assert to guava test * Fix formatting --- .../io/InputStreamToByteBufferUnitTest.java | 60 ++++++++++++++++++ .../resources/frontenac-2257154_960_720.jpg | Bin 0 -> 194684 bytes parent-java/pom.xml | 4 +- 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 core-java-io/src/test/java/org/baeldung/java/io/InputStreamToByteBufferUnitTest.java create mode 100644 core-java-io/src/test/resources/frontenac-2257154_960_720.jpg diff --git a/core-java-io/src/test/java/org/baeldung/java/io/InputStreamToByteBufferUnitTest.java b/core-java-io/src/test/java/org/baeldung/java/io/InputStreamToByteBufferUnitTest.java new file mode 100644 index 0000000000..fedadde04b --- /dev/null +++ b/core-java-io/src/test/java/org/baeldung/java/io/InputStreamToByteBufferUnitTest.java @@ -0,0 +1,60 @@ +package org.baeldung.java.io; + + +import com.google.common.io.ByteStreams; +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.channels.ReadableByteChannel; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class InputStreamToByteBufferUnitTest { + + @Test + public void givenUsingCoreClasses_whenWritingAFileIntoAByteBuffer_thenBytesLengthMustMatch() throws IOException { + File inputFile = getFile(); + ByteBuffer bufferByte = ByteBuffer.allocate((int) inputFile.length()); + FileInputStream in = new FileInputStream(inputFile); + in.getChannel().read(bufferByte); + + assertEquals(bufferByte.position(), inputFile.length()); + } + + @Test + public void givenUsingCommonsIo_whenWritingAFileIntoAByteBuffer_thenBytesLengthMustMatch() throws IOException { + File inputFile = getFile(); + ByteBuffer bufferByte = ByteBuffer.allocateDirect((int) inputFile.length()); + ReadableByteChannel readableByteChannel = new FileInputStream(inputFile).getChannel(); + IOUtils.readFully(readableByteChannel, bufferByte); + + assertEquals(bufferByte.position(), inputFile.length()); + } + + @Test + public void givenUsingGuava_whenWritingAFileIntoAByteBuffer_thenBytesLengthMustMatch() throws IOException { + File inputFile = getFile(); + FileInputStream in = new FileInputStream(inputFile); + byte[] targetArray = ByteStreams.toByteArray(in); + ByteBuffer bufferByte = ByteBuffer.wrap(targetArray); + bufferByte.rewind(); + while (bufferByte.hasRemaining()) { + bufferByte.get(); + } + + assertEquals(bufferByte.position(), inputFile.length()); + } + + private File getFile() { + ClassLoader classLoader = new InputStreamToByteBufferUnitTest().getClass().getClassLoader(); + + String fileName = "frontenac-2257154_960_720.jpg"; + + return new File(classLoader.getResource(fileName).getFile()); + } + +} diff --git a/core-java-io/src/test/resources/frontenac-2257154_960_720.jpg b/core-java-io/src/test/resources/frontenac-2257154_960_720.jpg new file mode 100644 index 0000000000000000000000000000000000000000..77c459b0e39604cbac6d0bd59e6ef3fceb22061b GIT binary patch literal 194684 zcmb4qXHZk$7i}Pc0MZc!qy!SBic}3?=q(^kdJ%!3bfinKQVoQTh2DEFigc7v6r_cw zfChem0V4>Z24DUk-pu>@PG&N9?z#8wd*+_A_g-tS^KbFrI)GJA8>tPTq5=S@C_liz z6@Uf+Nd3R|zkeX5foMVhYjm`?|3=H&i^z;mjEQ}0Sn6J>&GqEu-v#_$Vu`)2S zbFi~=P>xyu_YkW8-3bKIQEp_tLVtyF_W!f}8vwA;QQrU#0I7rk)NE8hHmZLg0eqDA z1Ofl|y8pLPYt#;Lf zPR7xf6B?7DUea<+_TeD?b(n^e-}H|^H}|>ZOk*`s{&7Q@S!MFht!=}U2l7$@s43?D zAA{6D${SEj(ouSq*(k?UKx!bEijHysqI6L%X9KYdO4F!u2$|4cr5KCJDB*;vw+vEj zJOp2p-G|-OaEkTIEd93(U<6XGX9KbUQ~(apBq~+JA^0Ca<&nq0y&6pODc4M&?L7!$ zaHOaCM-rKy?}BjjsA=N2P_LezCij@|oDwYRFR?+7_SiEpI^s|dVh(Bak2NCHD_-N8 zR2+l_7Ln!EMs5BWz{~*-#m9wxXNS>^R8ZlSrU;R%9J9?M^a2O}00>mvHIXYEtJ5( z0<@)nYj;?+F1>2rjN7ZJ7Lr_o_(UkcBF_$DR(0NAE{o#11g|e%9F_OfGyn0447lfL z6*OUya^Fv3%(FmfJxI+dD$2jqStGXO3cGXzH=lKaGF}*OF&kd%N&~4`;N(&f7TB!! z5!04k0ybgRG?OM}6wfc;9Oq<>nQerJ^RYA8S3efvn9V04g|}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CF~k|C~qb<%h5*tkO}<2{q^W0$_`+03iPTHTX>2;HX3ww z1M^0`jQ*qc)qB5u8MAK6I+-q|DoHP)xYFAncf z$o2as%3Lr3;-g4g^JCsH54NLwhrL=I6fe`)ke9%?*dGG5ACAX$+mD* z35@K%eeQjoy*B>Uxow@pB`rynB&Vl(NaHcgLh(Yf5E*iC8A%Q9Fv>7!3RDdke0&3j zAEv&Ac!_qn*{wCAlBCG00`aQ?sYuHEiGu^~ef7f|!rMb^+}AsOzL_AVhN!G@C*?&T z90Bk1#Yp zYhgyX`BdoMX%0G3kXew9!yk}6!9P0c{{X=~mdCm)Zg$$ByJJY{{lS>UnO)PRZlJFrY$B;M(M@Q^?1LITsq+;AH=|;~UY9x?9HfKj!5ml9m zEUW~MG6*~t^`q44kVLobFC_(ulM+0VDq2w`a&=`WtK zM^q}~^@G89ze6#PNXK~2tsS#dJ<``=70>1ht0J`O09BEi;ZVhhTmo{dgYGfbHD$|e zqN?0cLp&v;TBCx_13$>5;8=s;i7K)ll2-O;bm3fK3>gDj~pC9AzVtjzklKfu`>o{B%pk=ehV6 zyFn;v_MO<#Qq{+CGV_L-DI-84XvQ*xe~jY;-#UH#VBBt2>$iuGL2|68F>VT|ltobL zI2ofHNCyOCuJug#m2# - 22.0 + 23.0 - \ No newline at end of file + From c4edb95d4ef6733a1e520249861950743c0fa54c Mon Sep 17 00:00:00 2001 From: Olaniyi Anjola Date: Thu, 10 Jan 2019 18:51:30 -0500 Subject: [PATCH 217/271] BAEL-2452: Using curl from Java (#6113) * Renamed from Unit Test to Live Test * Update JavaCurlExamplesLiveTest.java --- ...est.java => JavaCurlExamplesLiveTest.java} | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) rename core-java/src/test/java/com/baeldung/curltojava/{JavaCurlExamplesUnitTest.java => JavaCurlExamplesLiveTest.java} (56%) diff --git a/core-java/src/test/java/com/baeldung/curltojava/JavaCurlExamplesUnitTest.java b/core-java/src/test/java/com/baeldung/curltojava/JavaCurlExamplesLiveTest.java similarity index 56% rename from core-java/src/test/java/com/baeldung/curltojava/JavaCurlExamplesUnitTest.java rename to core-java/src/test/java/com/baeldung/curltojava/JavaCurlExamplesLiveTest.java index 4e82059f2b..2ec62cbbf9 100644 --- a/core-java/src/test/java/com/baeldung/curltojava/JavaCurlExamplesUnitTest.java +++ b/core-java/src/test/java/com/baeldung/curltojava/JavaCurlExamplesLiveTest.java @@ -3,19 +3,16 @@ package com.baeldung.curltojava; import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URL; import org.junit.Assert; import org.junit.Test; -public class JavaCurlExamplesUnitTest { - +public class JavaCurlExamplesLiveTest { @Test public void givenCommand_whenCalled_thenProduceZeroExitCode() throws IOException { - String command = "curl --location --request GET \"https://postman-echo.com/get?foo1=bar1&foo2=bar2\""; - ProcessBuilder processBuilder = new ProcessBuilder(command.replaceAll("\"", "").split(" ")); + String command = "curl -X GET https://postman-echo.com/get?foo1=bar1&foo2=bar2"; + ProcessBuilder processBuilder = new ProcessBuilder(command.split(" ")); processBuilder.directory(new File("/home/")); Process process = processBuilder.start(); InputStream inputStream = process.getInputStream(); @@ -28,8 +25,8 @@ public class JavaCurlExamplesUnitTest { @Test public void givenNewCommands_whenCalled_thenCheckIfIsAlive() throws IOException { - String command = "curl --location --request GET \"https://postman-echo.com/get?foo1=bar1&foo2=bar2\""; - ProcessBuilder processBuilder = new ProcessBuilder(command.replaceAll("\"", "").split(" ")); + String command = "curl -X GET https://postman-echo.com/get?foo1=bar1&foo2=bar2"; + ProcessBuilder processBuilder = new ProcessBuilder(command.split(" ")); processBuilder.directory(new File("/home/")); Process process = processBuilder.start(); @@ -40,16 +37,14 @@ public class JavaCurlExamplesUnitTest { } @Test - public void whenRequestGet_thenReturnSuccessResponseCode() throws IOException { - String url = "https://postman-echo.com/get?foo1=bar1&foo2=bar2"; - URL urlObj = new URL(url); - HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection(); - connection.setDoOutput(true); - connection.setInstanceFollowRedirects(false); - connection.setRequestMethod("GET"); - connection.connect(); + public void whenRequestPost_thenCheckIfReturnContent() throws IOException { + String command = "curl -X POST https://postman-echo.com/post --data foo1=bar1&foo2=bar2"; + Process process = Runtime.getRuntime().exec(command); - Assert.assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode()); + // Get the POST result + String content = JavaCurlExamples.inputStreamToString(process.getInputStream()); + + Assert.assertTrue(null != content && !content.isEmpty()); } } From 36e48924468b9030ec382bf537084635785fc5e1 Mon Sep 17 00:00:00 2001 From: Upendra Chintala Date: Fri, 11 Jan 2019 18:13:27 +0530 Subject: [PATCH 218/271] Check if a year/date is a leap year in Java (#6086) * Hexagonal architecture implementation in Java - upendra.chintala@gmail.com * An example program to find a leap year using java 8 java.time.Year API * Changed to add assertions * Remvoed evaluation article code * Added unit test suite for leap year testing using java.time.Year and java.util.GregorianCalendar * Update LeapYearUnitTest.java * Update LeapYearUnitTest.java --- .../baeldung/leapyear/LeapYearUnitTest.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 core-java/src/test/java/com/baeldung/leapyear/LeapYearUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/leapyear/LeapYearUnitTest.java b/core-java/src/test/java/com/baeldung/leapyear/LeapYearUnitTest.java new file mode 100644 index 0000000000..9fb3d03838 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/leapyear/LeapYearUnitTest.java @@ -0,0 +1,39 @@ +package com.baeldung.leapyear; + +import java.time.Year; +import java.util.GregorianCalendar; + +import org.junit.Assert; +import org.junit.Test; + +public class LeapYearUnitTest { + + //Before Java8 + @Test + public void testLeapYearUsingGregorianCalendar () { + Assert.assertFalse(new GregorianCalendar().isLeapYear(2018)); + } + + //Java 8 and above + @Test + public void testLeapYearUsingJavaTimeYear () { + Assert.assertTrue(Year.isLeap(2012)); + } + + @Test + public void testBCYearUsingJavaTimeYear () { + Assert.assertTrue(Year.isLeap(-4)); + } + + @Test + public void testWrongLeapYearUsingJavaTimeYear () { + Assert.assertFalse(Year.isLeap(2018)); + } + + @Test + public void testLeapYearInDateUsingJavaTimeYear () { + LocalDate date = LocalDate.parse("2020-01-05", DateTimeFormatter.ISO_LOCAL_DATE); + Assert.assertTrue(Year.from(date).isLeap()); + } + +} From 583969b59d09e3a975e3da06823270a217103e41 Mon Sep 17 00:00:00 2001 From: Amy DeGregorio Date: Fri, 11 Jan 2019 13:28:10 -0500 Subject: [PATCH 219/271] BAEL-2499 Write to CSV in Java - Updated PR (#6122) * example code for Article How to Write to a CSV File in Java * Updated to use a Stream --- .../com/baeldung/csv/WriteCsvFileExample.java | 7 ++----- .../csv/WriteCsvFileExampleUnitTest.java | 20 +++++++------------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java b/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java index fd3678d2c5..e1237481b1 100644 --- a/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java +++ b/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java @@ -1,11 +1,8 @@ package com.baeldung.csv; -import java.io.BufferedWriter; -import java.io.IOException; - public class WriteCsvFileExample { - public void writeLine(BufferedWriter writer, String[] data) throws IOException { + public String convertToCSV(String[] data) { StringBuilder csvLine = new StringBuilder(); for (int i = 0; i < data.length; i++) { @@ -15,7 +12,7 @@ public class WriteCsvFileExample { csvLine.append(escapeSpecialCharacters(data[i])); } - writer.write(csvLine.toString()); + return csvLine.toString(); } public String escapeSpecialCharacters(String data) { diff --git a/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java b/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java index 4ac84f939d..e30ec0818c 100644 --- a/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java +++ b/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java @@ -3,12 +3,10 @@ package com.baeldung.csv; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; -import java.io.IOException; +import java.io.FileNotFoundException; +import java.io.PrintWriter; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.junit.Before; @@ -73,15 +71,11 @@ public class WriteCsvFileExampleUnitTest { dataLines.add(new String[] { "Jane", "Doe, Jr.", "19", "She said \"I'm being quoted\"" }); File csvOutputFile = new File(CSV_FILE_NAME); - try (BufferedWriter writer = new BufferedWriter(new FileWriter(csvOutputFile))) { - for (Iterator dataIterator = dataLines.iterator(); dataIterator.hasNext();) { - csvExample.writeLine(writer, dataIterator.next()); - if (dataIterator.hasNext()) { - writer.newLine(); - } - } - writer.flush(); - } catch (IOException e) { + try (PrintWriter pw = new PrintWriter(csvOutputFile)) { + dataLines.stream() + .map(csvExample::convertToCSV) + .forEach(pw::println); + } catch (FileNotFoundException e) { LOG.error("IOException " + e.getMessage()); } From 4b47306e913180c1c4da86f6f507a3d1724b28f5 Mon Sep 17 00:00:00 2001 From: Emily Cheyne Date: Fri, 11 Jan 2019 12:48:28 -0700 Subject: [PATCH 220/271] BAEL-2535 --- java-strings/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-strings/README.md b/java-strings/README.md index 08fbec35ab..b72a378d06 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -49,3 +49,4 @@ - [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) - [Remove Leading and Trailing Characters from a String](https://www.baeldung.com/java-remove-trailing-characters) - [Concatenating Strings In Java](https://www.baeldung.com/java-strings-concatenation) +- [Java toString() Method](https://www.baeldung.com/java-tostring) From 2cb4faddb0edf2f05edb8d2cc77560e6205396fc Mon Sep 17 00:00:00 2001 From: Loredana Date: Fri, 11 Jan 2019 23:03:38 +0200 Subject: [PATCH 221/271] fix core-java test and back to build --- core-java/pom.xml | 1 + .../src/test/java/com/baeldung/leapyear/LeapYearUnitTest.java | 2 ++ pom.xml | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core-java/pom.xml b/core-java/pom.xml index 6c58653d5a..d21c624997 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -13,6 +13,7 @@ ../parent-java + commons-io diff --git a/core-java/src/test/java/com/baeldung/leapyear/LeapYearUnitTest.java b/core-java/src/test/java/com/baeldung/leapyear/LeapYearUnitTest.java index 9fb3d03838..e710eecc66 100644 --- a/core-java/src/test/java/com/baeldung/leapyear/LeapYearUnitTest.java +++ b/core-java/src/test/java/com/baeldung/leapyear/LeapYearUnitTest.java @@ -1,6 +1,8 @@ package com.baeldung.leapyear; +import java.time.LocalDate; import java.time.Year; +import java.time.format.DateTimeFormatter; import java.util.GregorianCalendar; import org.junit.Assert; diff --git a/pom.xml b/pom.xml index a9b4b3f119..1c0738cafb 100644 --- a/pom.xml +++ b/pom.xml @@ -391,6 +391,7 @@ core-java-networking core-java-perf core-java-sun + core-java core-scala couchbase custom-pmd @@ -996,8 +997,7 @@ parent-spring-5 parent-java parent-kotlin - - core-java + core-java-concurrency-advanced core-kotlin From 469e36f07a93156664dd05dfb7efee58a7689c6b Mon Sep 17 00:00:00 2001 From: Juan Moreno Date: Sat, 12 Jan 2019 15:59:25 -0300 Subject: [PATCH 222/271] BAEL-2444 Extra examples (#6087) --- .../com/baeldung/time/InstantUnitTest.java | 42 +++++++++++++++++ .../time/InstantWithJMockUnitTest.java | 47 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 core-java-8/src/test/java/com/baeldung/time/InstantUnitTest.java create mode 100644 core-java-8/src/test/java/com/baeldung/time/InstantWithJMockUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/time/InstantUnitTest.java b/core-java-8/src/test/java/com/baeldung/time/InstantUnitTest.java new file mode 100644 index 0000000000..8400748710 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/time/InstantUnitTest.java @@ -0,0 +1,42 @@ +package com.baeldung.time; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.time.Clock; +import java.time.Instant; +import java.time.ZoneId; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; +import static org.powermock.api.mockito.PowerMockito.mockStatic; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({ Instant.class }) +public class InstantUnitTest { + + @Test + public void givenInstantMock_whenNow_thenGetFixedInstant() { + String instantExpected = "2014-12-22T10:15:30Z"; + Clock clock = Clock.fixed(Instant.parse(instantExpected), ZoneId.of("UTC")); + Instant instant = Instant.now(clock); + mockStatic(Instant.class); + when(Instant.now()).thenReturn(instant); + + Instant now = Instant.now(); + + assertThat(now.toString()).isEqualTo(instantExpected); + } + + @Test + public void givenFixedClock_whenNow_thenGetFixedInstant() { + String instantExpected = "2014-12-22T10:15:30Z"; + Clock clock = Clock.fixed(Instant.parse(instantExpected), ZoneId.of("UTC")); + + Instant instant = Instant.now(clock); + + assertThat(instant.toString()).isEqualTo(instantExpected); + } +} diff --git a/core-java-8/src/test/java/com/baeldung/time/InstantWithJMockUnitTest.java b/core-java-8/src/test/java/com/baeldung/time/InstantWithJMockUnitTest.java new file mode 100644 index 0000000000..8f83b91101 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/time/InstantWithJMockUnitTest.java @@ -0,0 +1,47 @@ +package com.baeldung.time; + +import mockit.Expectations; +import mockit.Mock; +import mockit.MockUp; +import org.junit.jupiter.api.Test; + +import java.time.Clock; +import java.time.Instant; +import java.time.ZoneId; + +import static org.assertj.core.api.Assertions.assertThat; + +public class InstantWithJMockUnitTest { + + @Test + public void givenInstantWithJMock_whenNow_thenGetFixedInstant() { + String instantExpected = "2014-12-21T10:15:30Z"; + Clock clock = Clock.fixed(Instant.parse(instantExpected), ZoneId.of("UTC")); + new MockUp() { + @Mock + public Instant now() { + return Instant.now(clock); + } + }; + + Instant now = Instant.now(); + + assertThat(now.toString()).isEqualTo(instantExpected); + } + + @Test + public void givenInstantWithExpectations_whenNow_thenGetFixedInstant() { + Clock clock = Clock.fixed(Instant.parse("2014-12-23T10:15:30.00Z"), ZoneId.of("UTC")); + Instant instantExpected = Instant.now(clock); + new Expectations(Instant.class) { + { + Instant.now(); + result = instantExpected; + } + }; + + Instant now = Instant.now(); + + assertThat(now).isEqualTo(instantExpected); + } +} From b395dc1d418f5077ffe76c17d7d59fda9328c2ac Mon Sep 17 00:00:00 2001 From: Ger Roza Date: Sat, 12 Jan 2019 18:57:19 -0200 Subject: [PATCH 223/271] Now using Auth and Resource servers from Baeldung/spring-security-oauth (#6128) --- .../OauthClientApplication.java | 4 +-- .../web/ClientRestController.java | 2 +- ....java => OauthClientLoginApplication.java} | 8 ++--- .../web/ClientRestController.java | 2 +- .../ClientCredentialsOauthApplication.java | 4 +-- .../service/WebClientChonJob.java | 6 ++-- .../ManualRequestApplication.java | 5 ++-- .../web/ManualOauthRequestController.java | 20 ++++++++----- ...nt-auth-code-client-application.properties | 8 ++--- ...ent-auth-code-login-application.properties | 12 ++++---- ...t-credentials-oauth-application.properties | 6 ++-- ...anual-request-oauth-application.properties | 3 ++ .../OAuth2ClientCredentialsLiveTest.java | 6 ++-- .../OAuth2ManualRequestLiveTest.java | 5 ++-- .../AuthorizationServerApplication.java | 17 ----------- .../configuration/WebSecurityConfig.java | 26 ----------------- .../ResourceServerApplication.java | 17 ----------- .../configuration/AuthorizationConfigs.java | 29 ------------------- .../web/ResourceRestController.java | 23 --------------- ...lient-authorization-application.properties | 13 --------- ...webclient-resources-application.properties | 6 ---- 21 files changed, 48 insertions(+), 174 deletions(-) rename spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/{OauthClientApplication.java => OauthClientLoginApplication.java} (62%) create mode 100644 spring-5-reactive-oauth/src/main/resources/webclient-manual-request-oauth-application.properties delete mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/AuthorizationServerApplication.java delete mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/configuration/WebSecurityConfig.java delete mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/ResourceServerApplication.java delete mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/configuration/AuthorizationConfigs.java delete mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/web/ResourceRestController.java delete mode 100644 spring-5-security-oauth/src/main/resources/webclient-authorization-application.properties delete mode 100644 spring-5-security-oauth/src/main/resources/webclient-resources-application.properties diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/OauthClientApplication.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/OauthClientApplication.java index 7bae78bb14..843d3f251f 100644 --- a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/OauthClientApplication.java +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/OauthClientApplication.java @@ -6,9 +6,9 @@ import org.springframework.context.annotation.PropertySource; /** * - * Note: This app is configured to use the authorization service and the resource service located in module spring-5-security-oauth + * Note: This app is configured to use the authorization service and the resource service located in Baeldung/spring-security-oauth repo * - * As we usually do with other well-known auth providers (github/facebook/...) we have to log-in using user credentials (bael-user/bael-password) and client configurations (bael-client-id/bael-secret) handled by the auth server + * As we usually do with other well-known auth providers (github/facebook/...) we have to log-in using user credentials (john/123) and client configurations handled by the auth server * * @author rozagerardo * diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/web/ClientRestController.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/web/ClientRestController.java index c36b7d1dea..9994a1255a 100644 --- a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/web/ClientRestController.java +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodeclient/web/ClientRestController.java @@ -15,7 +15,7 @@ import reactor.core.publisher.Mono; @RestController public class ClientRestController { - private static final String RESOURCE_URI = "http://localhost:8084/retrieve-resource"; + private static final String RESOURCE_URI = "http://localhost:8082/spring-security-oauth-resource/foos/1"; @Autowired WebClient webClient; diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/OauthClientApplication.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/OauthClientLoginApplication.java similarity index 62% rename from spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/OauthClientApplication.java rename to spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/OauthClientLoginApplication.java index 9dd6dd1bde..e71e549ea4 100644 --- a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/OauthClientApplication.java +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/OauthClientLoginApplication.java @@ -6,19 +6,19 @@ import org.springframework.context.annotation.PropertySource; /** * - * Note: This app is configured to use the authorization service and the resource service located in module spring-5-security-oauth + * Note: This app is configured to use the authorization service and the resource service located in Baeldung/spring-security-oauth repo * - * As we usually do with other well-known auth providers (github/facebook/...) we have to log-in using user credentials (bael-user/bael-password) and client configurations (bael-client-id/bael-secret) handled by the auth server + * As we usually do with other well-known auth providers (github/facebook/...) we have to log-in using user credentials (john/123) and client configurations handled by the auth server * * @author rozagerardo * */ @PropertySource("classpath:webclient-auth-code-login-application.properties") @SpringBootApplication -public class OauthClientApplication { +public class OauthClientLoginApplication { public static void main(String[] args) { - SpringApplication.run(OauthClientApplication.class, args); + SpringApplication.run(OauthClientLoginApplication.class, args); } } diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/web/ClientRestController.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/web/ClientRestController.java index 55e0096525..24e5377f36 100644 --- a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/web/ClientRestController.java +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/authorizationcodelogin/web/ClientRestController.java @@ -16,7 +16,7 @@ import reactor.core.publisher.Mono; @RestController public class ClientRestController { - private static final String RESOURCE_URI = "http://localhost:8084/retrieve-resource"; + private static final String RESOURCE_URI = "http://localhost:8082/spring-security-oauth-resource/foos/1"; @Autowired WebClient webClient; diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/ClientCredentialsOauthApplication.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/ClientCredentialsOauthApplication.java index d1b9f7f744..4356581819 100644 --- a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/ClientCredentialsOauthApplication.java +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/ClientCredentialsOauthApplication.java @@ -7,9 +7,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; /** * - * Note: This app is configured to use the authorization service and the resource service located in module spring-5-security-oauth - * - * As we usually do with other well-known auth providers (github/facebook/...) we have to log-in using credentials handled by the auth server (bael-user/bael-password) + * Note: This app is configured to use the authorization service and the resource service located in Baeldung/spring-security-oauth repo * * @author rozagerardo * diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/service/WebClientChonJob.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/service/WebClientChonJob.java index dc38ce3f9e..ef39222933 100644 --- a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/service/WebClientChonJob.java +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/clientcredentials/service/WebClientChonJob.java @@ -4,8 +4,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.security.oauth2.client.OAuth2AuthorizedClient; -import org.springframework.security.oauth2.client.annotation.RegisteredOAuth2AuthorizedClient; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -14,12 +12,12 @@ public class WebClientChonJob { Logger logger = LoggerFactory.getLogger(WebClientChonJob.class); - private static final String RESOURCE_URI = "http://localhost:8084/retrieve-resource"; + private static final String RESOURCE_URI = "localhost:8082/spring-security-oauth-resource/foos/1"; @Autowired private WebClient webClient; - @Scheduled(fixedRate = 1000) + @Scheduled(fixedRate = 5000) public void logResourceServiceResponse() { webClient.get() diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/ManualRequestApplication.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/ManualRequestApplication.java index c2762ad559..59a63355f7 100644 --- a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/ManualRequestApplication.java +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/ManualRequestApplication.java @@ -6,13 +6,12 @@ import org.springframework.context.annotation.PropertySource; /** * - * Note: This app is configured to use the authorization service and the resource service located in module spring-5-security-oauth - * - * As we usually do with other well-known auth providers (github/facebook/...) we have to log-in using user credentials (bael-user/bael-password) and client configurations (bael-client-id/bael-secret) handled by the auth server + * Note: This app is configured to use the authorization service and the resource service located in Baeldung/spring-security-oauth repo * * @author rozagerardo * */ +@PropertySource("classpath:webclient-manual-request-oauth-application.properties") @SpringBootApplication public class ManualRequestApplication { diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/web/ManualOauthRequestController.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/web/ManualOauthRequestController.java index 9f9d6d3167..d54d811032 100644 --- a/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/web/ManualOauthRequestController.java +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/webclient/manualrequest/web/ManualOauthRequestController.java @@ -3,8 +3,8 @@ package com.baeldung.webclient.manualrequest.web; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames; import org.springframework.util.Base64Utils; import org.springframework.web.bind.annotation.GetMapping; @@ -22,10 +22,16 @@ public class ManualOauthRequestController { private static Logger logger = LoggerFactory.getLogger(ManualOauthRequestController.class); - private static final String TOKEN_ENDPOINT = "localhost:8085/oauth/token"; - private static final String RESOURCE_ENDPOINT = "localhost:8084/retrieve-resource"; - private static final String CLIENT_ID = "bael-client-id"; - private static final String CLIENT_SECRET = "bael-secret"; + private static final String RESOURCE_ENDPOINT = "localhost:8082/spring-security-oauth-resource/foos/1"; + + @Value("${the.authorization.client-id}") + private String clientId; + + @Value("${the.authorization.client-secret}") + private String clientSecret; + + @Value("${the.authorization.token-uri}") + private String tokenUri; @Autowired WebClient client; @@ -34,8 +40,8 @@ public class ManualOauthRequestController { public Mono obtainSecuredResource() { logger.info("Creating web client..."); Mono resource = client.post() - .uri(TOKEN_ENDPOINT) - .header(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString((CLIENT_ID + ":" + CLIENT_SECRET).getBytes())) + .uri(tokenUri) + .header(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString((clientId + ":" + clientSecret).getBytes())) .body(BodyInserters.fromFormData(OAuth2ParameterNames.GRANT_TYPE, GrantType.CLIENT_CREDENTIALS.getValue())) .retrieve() .bodyToMono(JsonNode.class) diff --git a/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-client-application.properties b/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-client-application.properties index 612777a06d..ac96aae6d6 100644 --- a/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-client-application.properties +++ b/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-client-application.properties @@ -1,10 +1,10 @@ spring.security.oauth2.client.registration.bael.client-name=bael -spring.security.oauth2.client.registration.bael.client-id=bael-client-id -spring.security.oauth2.client.registration.bael.client-secret=bael-secret +spring.security.oauth2.client.registration.bael.client-id=fooClientIdPassword +spring.security.oauth2.client.registration.bael.client-secret=secret spring.security.oauth2.client.registration.bael.authorization-grant-type=authorization_code spring.security.oauth2.client.registration.bael.redirect-uri=http://localhost:8080/authorize/oauth2/code/bael -spring.security.oauth2.client.provider.bael.token-uri=http://localhost:8085/oauth/token -spring.security.oauth2.client.provider.bael.authorization-uri=http://localhost:8085/oauth/authorize +spring.security.oauth2.client.provider.bael.token-uri=http://localhost:8081/spring-security-oauth-server/oauth/token +spring.security.oauth2.client.provider.bael.authorization-uri=http://localhost:8081/spring-security-oauth-server/oauth/authorize spring.security.user.password=pass diff --git a/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-login-application.properties b/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-login-application.properties index edd5b80b13..e4dd0a532d 100644 --- a/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-login-application.properties +++ b/spring-5-reactive-oauth/src/main/resources/webclient-auth-code-login-application.properties @@ -1,10 +1,10 @@ spring.security.oauth2.client.registration.bael.client-name=bael -spring.security.oauth2.client.registration.bael.client-id=bael-client-id -spring.security.oauth2.client.registration.bael.client-secret=bael-secret +spring.security.oauth2.client.registration.bael.client-id=fooClientIdPassword +spring.security.oauth2.client.registration.bael.client-secret=secret spring.security.oauth2.client.registration.bael.authorization-grant-type=authorization_code spring.security.oauth2.client.registration.bael.redirect-uri=http://localhost:8080/login/oauth2/code/bael -spring.security.oauth2.client.provider.bael.token-uri=http://localhost:8085/oauth/token -spring.security.oauth2.client.provider.bael.authorization-uri=http://localhost:8085/oauth/authorize -spring.security.oauth2.client.provider.bael.user-info-uri=http://localhost:8084/user -spring.security.oauth2.client.provider.bael.user-name-attribute=name +spring.security.oauth2.client.provider.bael.token-uri=http://localhost:8081/spring-security-oauth-server/oauth/token +spring.security.oauth2.client.provider.bael.authorization-uri=http://localhost:8081/spring-security-oauth-server/oauth/authorize +spring.security.oauth2.client.provider.bael.user-info-uri=http://localhost:8082/spring-security-oauth-resource/users/extra +spring.security.oauth2.client.provider.bael.user-name-attribute=user_name diff --git a/spring-5-reactive-oauth/src/main/resources/webclient-client-credentials-oauth-application.properties b/spring-5-reactive-oauth/src/main/resources/webclient-client-credentials-oauth-application.properties index f82f74ec48..14c5b97605 100644 --- a/spring-5-reactive-oauth/src/main/resources/webclient-client-credentials-oauth-application.properties +++ b/spring-5-reactive-oauth/src/main/resources/webclient-client-credentials-oauth-application.properties @@ -1,4 +1,4 @@ spring.security.oauth2.client.registration.bael.authorization-grant-type=client_credentials -spring.security.oauth2.client.registration.bael.client-id=bael-client-id -spring.security.oauth2.client.registration.bael.client-secret=bael-secret -spring.security.oauth2.client.provider.bael.token-uri=http://localhost:8085/oauth/token +spring.security.oauth2.client.registration.bael.client-id=fooClientIdPassword +spring.security.oauth2.client.registration.bael.client-secret=secret +spring.security.oauth2.client.provider.bael.token-uri=http://localhost:8081/spring-security-oauth-server/oauth/token diff --git a/spring-5-reactive-oauth/src/main/resources/webclient-manual-request-oauth-application.properties b/spring-5-reactive-oauth/src/main/resources/webclient-manual-request-oauth-application.properties new file mode 100644 index 0000000000..36ec3defd1 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/resources/webclient-manual-request-oauth-application.properties @@ -0,0 +1,3 @@ +the.authorization.client-id=fooClientIdPassword +the.authorization.client-secret=secret +the.authorization.token-uri=http://localhost:8081/spring-security-oauth-server/oauth/token diff --git a/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/clientcredentials/OAuth2ClientCredentialsLiveTest.java b/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/clientcredentials/OAuth2ClientCredentialsLiveTest.java index e31815c3f8..ef913ba055 100644 --- a/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/clientcredentials/OAuth2ClientCredentialsLiveTest.java +++ b/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/clientcredentials/OAuth2ClientCredentialsLiveTest.java @@ -19,9 +19,9 @@ import ch.qos.logback.classic.spi.ILoggingEvent; /** * - * Note: this Live test requires the Authorization Service and the Resource service located in the spring-5-security-oauth module + * Note: this Live test requires the Authorization Service and the Resource service located in the Baeldung/spring-security-oauth repo * - * @author ger + * @author rozagerardo * */ @RunWith(SpringRunner.class) @@ -46,7 +46,7 @@ public class OAuth2ClientCredentialsLiveTest { .stream() .map(ILoggingEvent::getFormattedMessage) .collect(Collectors.toList()); - assertThat(allLoggedEntries).anyMatch(entry -> entry.contains("We retrieved the following resource using Client Credentials Grant Type: This is the resource!")); + assertThat(allLoggedEntries).anyMatch(entry -> entry.contains("We retrieved the following resource using Client Credentials Grant Type: {\"id\"")); } } diff --git a/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/manualrequest/OAuth2ManualRequestLiveTest.java b/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/manualrequest/OAuth2ManualRequestLiveTest.java index 94aa580f0a..2381264926 100644 --- a/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/manualrequest/OAuth2ManualRequestLiveTest.java +++ b/spring-5-reactive-oauth/src/test/java/com/baeldung/webclient/manualrequest/OAuth2ManualRequestLiveTest.java @@ -1,5 +1,6 @@ package com.baeldung.webclient.manualrequest; +import org.hamcrest.Matchers; import org.junit.Before; import org.junit.Test; import org.springframework.test.web.reactive.server.WebTestClient; @@ -8,7 +9,7 @@ import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; /** * * Note: this Live test requires not only the corresponding application running, - * but also the Authorization Service and the Resource service located in the spring-5-security-oauth module. + * but also the Authorization Service and the Resource service located in the Baeldung/spring-security-oauth repo * * * @author ger @@ -37,7 +38,7 @@ public class OAuth2ManualRequestLiveTest { response.expectStatus() .isOk() .expectBody(String.class) - .isEqualTo("Retrieved the resource using a manual approach: This is the resource!"); + .value(Matchers.containsString("Retrieved the resource using a manual approach: {\"id\"")); } } diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/AuthorizationServerApplication.java b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/AuthorizationServerApplication.java deleted file mode 100644 index d72704386c..0000000000 --- a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/AuthorizationServerApplication.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.webclient.authorizationserver; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.PropertySource; -import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; - -@EnableAuthorizationServer -@PropertySource("classpath:webclient-authorization-application.properties") -@SpringBootApplication -public class AuthorizationServerApplication { - - public static void main(String[] args) { - SpringApplication.run(AuthorizationServerApplication.class, args); - } - -} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/configuration/WebSecurityConfig.java b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/configuration/WebSecurityConfig.java deleted file mode 100644 index 5dd15f1b8c..0000000000 --- a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/authorizationserver/configuration/WebSecurityConfig.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baeldung.webclient.authorizationserver.configuration; - -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; - -@EnableWebSecurity -@Configuration -public class WebSecurityConfig extends WebSecurityConfigurerAdapter { - - @Override - protected void configure(HttpSecurity http) throws Exception { - http.authorizeRequests() - .antMatchers("/login", "/user") - .permitAll() - .and() - .authorizeRequests() - .anyRequest() - .authenticated() - .and() - .formLogin() - .and() - .httpBasic(); - } -} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/ResourceServerApplication.java b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/ResourceServerApplication.java deleted file mode 100644 index 50ad293ef8..0000000000 --- a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/ResourceServerApplication.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.webclient.resourceserver; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.PropertySource; -import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; - -@EnableResourceServer -@PropertySource("webclient-resources-application.properties") -@SpringBootApplication -public class ResourceServerApplication { - - public static void main(String[] args) { - SpringApplication.run(ResourceServerApplication.class, args); - } - -} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/configuration/AuthorizationConfigs.java b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/configuration/AuthorizationConfigs.java deleted file mode 100644 index 5aea1983db..0000000000 --- a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/configuration/AuthorizationConfigs.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.webclient.resourceserver.configuration; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.oauth2.provider.token.RemoteTokenServices; -import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; - -@Configuration -public class AuthorizationConfigs { - - @Value("${oauth.authserver.client-id}") - String clientId; - - @Value("${oauth.authserver.client-secret}") - String clientSecret; - - @Value("${oauth.authserver.check-token-endpoint}") - String checkTokenEndpoint; - - @Bean - public ResourceServerTokenServices tokenSvc() { - RemoteTokenServices remoteService = new RemoteTokenServices(); - remoteService.setCheckTokenEndpointUrl(checkTokenEndpoint); - remoteService.setClientId(clientId); - remoteService.setClientSecret(clientSecret); - return remoteService; - } -} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/web/ResourceRestController.java b/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/web/ResourceRestController.java deleted file mode 100644 index aef0fb4d7d..0000000000 --- a/spring-5-security-oauth/src/main/java/com/baeldung/webclient/resourceserver/web/ResourceRestController.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baeldung.webclient.resourceserver.web; - -import java.security.Principal; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -@RestController -public class ResourceRestController { - - @GetMapping("/retrieve-resource") - public String retrieveResource() { - return "This is the resource!"; - } - - @GetMapping("/user") - @ResponseBody - public Principal user(Principal user) { - return user; - } - -} diff --git a/spring-5-security-oauth/src/main/resources/webclient-authorization-application.properties b/spring-5-security-oauth/src/main/resources/webclient-authorization-application.properties deleted file mode 100644 index 9531045359..0000000000 --- a/spring-5-security-oauth/src/main/resources/webclient-authorization-application.properties +++ /dev/null @@ -1,13 +0,0 @@ -server.port=8085 - -security.oauth2.client.client-id=bael-client-id -security.oauth2.client.client-secret=bael-secret -security.oauth2.client.scope=read,write - -security.oauth2.authorization.check-token-access=isAuthenticated() - -spring.security.user.name=bael-user -spring.security.user.password=bael-password - -security.oauth2.client.registered-redirect-uri=http://localhost:8080/login/oauth2/code/bael, http://localhost:8080/authorize/oauth2/code/bael -security.oauth2.client.use-current-uri=false \ No newline at end of file diff --git a/spring-5-security-oauth/src/main/resources/webclient-resources-application.properties b/spring-5-security-oauth/src/main/resources/webclient-resources-application.properties deleted file mode 100644 index 1cfb9ca12d..0000000000 --- a/spring-5-security-oauth/src/main/resources/webclient-resources-application.properties +++ /dev/null @@ -1,6 +0,0 @@ -server.port=8084 - -#spring.security.oauth2.resourceserver.jwt.issuer-uri=localhost:8085 -oauth.authserver.client-id=bael-client-id -oauth.authserver.client-secret=bael-secret -oauth.authserver.check-token-endpoint=http://localhost:8085/oauth/check_token From dcc1cd3850cdb3dbbfa6df343604ac4b720cd424 Mon Sep 17 00:00:00 2001 From: chandra Date: Sat, 12 Jan 2019 16:52:52 -0500 Subject: [PATCH 224/271] BAEL-2088 Common Hibernate Exceptions Commin Hibernate Exceptions unit tests --- .../hibernate/exception/EntityWithNoId.java | 16 + .../hibernate/exception/HibernateUtil.java | 63 +++ .../baeldung/hibernate/exception/Product.java | 40 ++ .../exception/HibernateExceptionUnitTest.java | 425 ++++++++++++++++++ .../resources/hibernate-exception.properties | 16 + 5 files changed, 560 insertions(+) create mode 100644 persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/exception/EntityWithNoId.java create mode 100644 persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/exception/HibernateUtil.java create mode 100644 persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/exception/Product.java create mode 100644 persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/exception/HibernateExceptionUnitTest.java create mode 100644 persistence-modules/hibernate5/src/test/resources/hibernate-exception.properties diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/exception/EntityWithNoId.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/exception/EntityWithNoId.java new file mode 100644 index 0000000000..989fa1281a --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/exception/EntityWithNoId.java @@ -0,0 +1,16 @@ +package com.baeldung.hibernate.exception; + +import javax.persistence.Entity; + +@Entity +public class EntityWithNoId { + private int id; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/exception/HibernateUtil.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/exception/HibernateUtil.java new file mode 100644 index 0000000000..ae5174ac9c --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/exception/HibernateUtil.java @@ -0,0 +1,63 @@ +package com.baeldung.hibernate.exception; + +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.util.Properties; + +import org.apache.commons.lang3.StringUtils; +import org.hibernate.SessionFactory; +import org.hibernate.boot.Metadata; +import org.hibernate.boot.MetadataSources; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.service.ServiceRegistry; + +public class HibernateUtil { + private static SessionFactory sessionFactory; + private static String PROPERTY_FILE_NAME; + + public static SessionFactory getSessionFactory() throws IOException { + return getSessionFactory(null); + } + + public static SessionFactory getSessionFactory(String propertyFileName) + throws IOException { + PROPERTY_FILE_NAME = propertyFileName; + if (sessionFactory == null) { + ServiceRegistry serviceRegistry = configureServiceRegistry(); + sessionFactory = makeSessionFactory(serviceRegistry); + } + return sessionFactory; + } + + private static SessionFactory makeSessionFactory( + ServiceRegistry serviceRegistry) { + MetadataSources metadataSources = new MetadataSources(serviceRegistry); + metadataSources.addAnnotatedClass(Product.class); + Metadata metadata = metadataSources.getMetadataBuilder() + .build(); + return metadata.getSessionFactoryBuilder() + .build(); + + } + + private static ServiceRegistry configureServiceRegistry() + throws IOException { + Properties properties = getProperties(); + return new StandardServiceRegistryBuilder().applySettings(properties) + .build(); + } + + private static Properties getProperties() throws IOException { + Properties properties = new Properties(); + URL propertiesURL = Thread.currentThread() + .getContextClassLoader() + .getResource(StringUtils.defaultString(PROPERTY_FILE_NAME, + "hibernate-exception.properties")); + try (FileInputStream inputStream = new FileInputStream( + propertiesURL.getFile())) { + properties.load(inputStream); + } + return properties; + } +} \ No newline at end of file diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/exception/Product.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/exception/Product.java new file mode 100644 index 0000000000..031fa38de0 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/exception/Product.java @@ -0,0 +1,40 @@ +package com.baeldung.hibernate.exception; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Product { + + private int id; + + private String name; + private String description; + + @Id + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + @Column(nullable=false) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/exception/HibernateExceptionUnitTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/exception/HibernateExceptionUnitTest.java new file mode 100644 index 0000000000..3581c81daa --- /dev/null +++ b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/exception/HibernateExceptionUnitTest.java @@ -0,0 +1,425 @@ +package com.baeldung.hibernate.exception; + +import static org.hamcrest.CoreMatchers.isA; +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; +import java.util.List; + +import javax.persistence.OptimisticLockException; +import javax.persistence.PersistenceException; + +import org.hibernate.AnnotationException; +import org.hibernate.HibernateException; +import org.hibernate.MappingException; +import org.hibernate.NonUniqueObjectException; +import org.hibernate.PropertyValueException; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.StaleObjectStateException; +import org.hibernate.StaleStateException; +import org.hibernate.Transaction; +import org.hibernate.TransactionException; +import org.hibernate.cfg.AvailableSettings; +import org.hibernate.cfg.Configuration; +import org.hibernate.exception.ConstraintViolationException; +import org.hibernate.exception.DataException; +import org.hibernate.exception.SQLGrammarException; +import org.hibernate.query.NativeQuery; +import org.hibernate.tool.schema.spi.CommandAcceptanceException; +import org.hibernate.tool.schema.spi.SchemaManagementException; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class HibernateExceptionUnitTest { + + private static final Logger logger = LoggerFactory + .getLogger(HibernateExceptionUnitTest.class); + private SessionFactory sessionFactory; + + @Before + public void setUp() throws IOException { + sessionFactory = HibernateUtil.getSessionFactory(); + } + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + private Configuration getConfiguration() { + Configuration cfg = new Configuration(); + cfg.setProperty(AvailableSettings.DIALECT, + "org.hibernate.dialect.H2Dialect"); + cfg.setProperty(AvailableSettings.HBM2DDL_AUTO, "none"); + cfg.setProperty(AvailableSettings.DRIVER, "org.h2.Driver"); + cfg.setProperty(AvailableSettings.URL, + "jdbc:h2:mem:myexceptiondb2;DB_CLOSE_DELAY=-1"); + cfg.setProperty(AvailableSettings.USER, "sa"); + cfg.setProperty(AvailableSettings.PASS, ""); + return cfg; + } + + @Test + public void whenQueryExecutedWithUnmappedEntity_thenMappingException() { + thrown.expectCause(isA(MappingException.class)); + thrown.expectMessage("Unknown entity: java.lang.String"); + + Session session = sessionFactory.openSession(); + NativeQuery query = session + .createNativeQuery("select name from PRODUCT", String.class); + query.getResultList(); + } + + @Test + @SuppressWarnings("rawtypes") + public void whenQueryExecuted_thenOK() { + Session session = sessionFactory.openSession(); + NativeQuery query = session + .createNativeQuery("select name from PRODUCT"); + List results = query.getResultList(); + assertNotNull(results); + } + + @Test + public void givenEntityWithoutId_whenSessionFactoryCreated_thenAnnotationException() { + thrown.expect(AnnotationException.class); + thrown.expectMessage("No identifier specified for entity"); + + Configuration cfg = getConfiguration(); + cfg.addAnnotatedClass(EntityWithNoId.class); + cfg.buildSessionFactory(); + } + + @Test + public void givenMissingTable_whenSchemaValidated_thenSchemaManagementException() { + thrown.expect(SchemaManagementException.class); + thrown.expectMessage("Schema-validation: missing table"); + + Configuration cfg = getConfiguration(); + cfg.setProperty(AvailableSettings.HBM2DDL_AUTO, "validate"); + cfg.addAnnotatedClass(Product.class); + cfg.buildSessionFactory(); + } + + @Test + public void whenWrongDialectSpecified_thenCommandAcceptanceException() { + thrown.expect(SchemaManagementException.class); + thrown.expectCause(isA(CommandAcceptanceException.class)); + thrown.expectMessage("Halting on error : Error executing DDL"); + + Configuration cfg = getConfiguration(); + cfg.setProperty(AvailableSettings.DIALECT, + "org.hibernate.dialect.MySQLDialect"); + cfg.setProperty(AvailableSettings.HBM2DDL_AUTO, "update"); + + // This does not work due to hibernate bug + // cfg.setProperty(AvailableSettings.HBM2DDL_HALT_ON_ERROR,"true"); + cfg.getProperties() + .put(AvailableSettings.HBM2DDL_HALT_ON_ERROR, true); + + cfg.addAnnotatedClass(Product.class); + cfg.buildSessionFactory(); + } + + @Test + public void givenMissingTable_whenEntitySaved_thenSQLGrammarException() { + thrown.expect(isA(PersistenceException.class)); + thrown.expectCause(isA(SQLGrammarException.class)); + thrown + .expectMessage("SQLGrammarException: could not prepare statement"); + + Configuration cfg = getConfiguration(); + cfg.addAnnotatedClass(Product.class); + + SessionFactory sessionFactory = cfg.buildSessionFactory(); + Session session = null; + Transaction transaction = null; + try { + + session = sessionFactory.openSession(); + transaction = session.beginTransaction(); + Product product = new Product(); + product.setId(1); + product.setName("Product 1"); + session.save(product); + transaction.commit(); + } catch (Exception e) { + rollbackTransactionQuietly(transaction); + throw (e); + } finally { + closeSessionQuietly(session); + closeSessionFactoryQuietly(sessionFactory); + } + } + + @Test + public void givenMissingTable_whenQueryExecuted_thenSQLGrammarException() { + thrown.expect(isA(PersistenceException.class)); + thrown.expectCause(isA(SQLGrammarException.class)); + thrown + .expectMessage("SQLGrammarException: could not prepare statement"); + + Session session = sessionFactory.openSession(); + NativeQuery query = session.createNativeQuery( + "select * from NON_EXISTING_TABLE", Product.class); + query.getResultList(); + } + + @Test + public void whenDuplicateIdSaved_thenConstraintViolationException() { + thrown.expect(isA(PersistenceException.class)); + thrown.expectCause(isA(ConstraintViolationException.class)); + thrown.expectMessage( + "ConstraintViolationException: could not execute statement"); + + Session session = null; + Transaction transaction = null; + + for (int i = 1; i <= 2; i++) { + try { + session = sessionFactory.openSession(); + transaction = session.beginTransaction(); + Product product = new Product(); + product.setId(1); + product.setName("Product " + i); + session.save(product); + transaction.commit(); + } catch (Exception e) { + rollbackTransactionQuietly(transaction); + throw (e); + } finally { + closeSessionQuietly(session); + } + } + } + + @Test + public void givenNotNullPropertyNotSet_whenEntityIdSaved_thenPropertyValueException() { + thrown.expect(isA(PropertyValueException.class)); + thrown.expectMessage( + "not-null property references a null or transient value"); + + Session session = null; + Transaction transaction = null; + + try { + session = sessionFactory.openSession(); + transaction = session.beginTransaction(); + + Product product = new Product(); + product.setId(1); + session.save(product); + transaction.commit(); + } catch (Exception e) { + rollbackTransactionQuietly(transaction); + throw (e); + } finally { + closeSessionQuietly(session); + } + + } + + @Test + public void givenQueryWithDataTypeMismatch_WhenQueryExecuted_thenDataException() { + thrown.expectCause(isA(DataException.class)); + thrown.expectMessage( + "org.hibernate.exception.DataException: could not prepare statement"); + + Session session = sessionFactory.openSession(); + NativeQuery query = session.createNativeQuery( + "select * from PRODUCT where id='wrongTypeId'", Product.class); + query.getResultList(); + } + + @Test + public void givenSessionContainingAnId_whenIdAssociatedAgain_thenNonUniqueObjectException() { + thrown.expect(isA(NonUniqueObjectException.class)); + thrown.expectMessage( + "A different object with the same identifier value was already associated with the session"); + + Session session = null; + Transaction transaction = null; + + try { + session = sessionFactory.openSession(); + transaction = session.beginTransaction(); + + Product product1 = new Product(); + product1.setId(1); + product1.setName("Product 1"); + session.save(product1); + + Product product2 = new Product(); + product2.setId(1); + product2.setName("Product 2"); + session.save(product2); + + transaction.commit(); + } catch (Exception e) { + rollbackTransactionQuietly(transaction); + throw (e); + } finally { + closeSessionQuietly(session); + } + } + + @Test + public void whenDeletingADeletedObject_thenOptimisticLockException() { + thrown.expect(isA(OptimisticLockException.class)); + thrown.expectMessage( + "Batch update returned unexpected row count from update"); + thrown.expectCause(isA(StaleStateException.class)); + + Session session = null; + Transaction transaction = null; + + try { + session = sessionFactory.openSession(); + transaction = session.beginTransaction(); + + Product product1 = new Product(); + product1.setId(12); + product1.setName("Product 12"); + session.save(product1); + transaction.commit(); + session.close(); + + session = sessionFactory.openSession(); + transaction = session.beginTransaction(); + Product product2 = session.get(Product.class, 12); + session.createNativeQuery("delete from Product where id=12") + .executeUpdate(); + // We need to refresh to fix the error. + // session.refresh(product2); + session.delete(product2); + transaction.commit(); + } catch (Exception e) { + rollbackTransactionQuietly(transaction); + throw (e); + } finally { + closeSessionQuietly(session); + } + } + + @Test + public void whenUpdatingNonExistingObject_thenStaleStateException() { + thrown.expect(isA(OptimisticLockException.class)); + thrown + .expectMessage("Row was updated or deleted by another transaction"); + thrown.expectCause(isA(StaleObjectStateException.class)); + + Session session = null; + Transaction transaction = null; + + try { + session = sessionFactory.openSession(); + transaction = session.beginTransaction(); + + Product product1 = new Product(); + product1.setId(15); + product1.setName("Product1"); + session.update(product1); + transaction.commit(); + } catch (Exception e) { + rollbackTransactionQuietly(transaction); + throw (e); + } finally { + closeSessionQuietly(session); + } + } + + @Test + public void givenTxnMarkedRollbackOnly_whenCommitted_thenTransactionException() { + thrown.expect(isA(TransactionException.class)); + + Session session = null; + Transaction transaction = null; + try { + session = sessionFactory.openSession(); + transaction = session.beginTransaction(); + + Product product1 = new Product(); + product1.setId(15); + product1.setName("Product1"); + session.save(product1); + transaction.setRollbackOnly(); + + transaction.commit(); + } catch (Exception e) { + rollbackTransactionQuietly(transaction); + throw (e); + } finally { + closeSessionQuietly(session); + } + } + + private void rollbackTransactionQuietly(Transaction transaction) { + if (transaction != null && transaction.isActive()) { + try { + transaction.rollback(); + } catch (Exception e) { + logger.error("Exception while rolling back transaction", e); + } + } + } + + private void closeSessionQuietly(Session session) { + if (session != null) { + try { + session.close(); + } catch (Exception e) { + logger.error("Exception while closing session", e); + } + } + } + + private void closeSessionFactoryQuietly(SessionFactory sessionFactory) { + if (sessionFactory != null) { + try { + sessionFactory.close(); + } catch (Exception e) { + logger.error("Exception while closing sessionFactory", e); + } + } + } + + @Test + public void givenExistingEntity_whenIdUpdated_thenHibernateException() { + thrown.expect(isA(PersistenceException.class)); + thrown.expectCause(isA(HibernateException.class)); + thrown.expectMessage( + "identifier of an instance of com.baeldung.hibernate.exception.Product was altered"); + + Session session = null; + Transaction transaction = null; + + try { + session = sessionFactory.openSession(); + transaction = session.beginTransaction(); + + Product product1 = new Product(); + product1.setId(222); + product1.setName("Product 222"); + session.save(product1); + transaction.commit(); + closeSessionQuietly(session); + + session = sessionFactory.openSession(); + transaction = session.beginTransaction(); + + Product product2 = session.get(Product.class, 222); + product2.setId(333); + session.save(product2); + + transaction.commit(); + } catch (Exception e) { + rollbackTransactionQuietly(transaction); + throw (e); + } finally { + closeSessionQuietly(session); + } + } +} diff --git a/persistence-modules/hibernate5/src/test/resources/hibernate-exception.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-exception.properties new file mode 100644 index 0000000000..e08a23166d --- /dev/null +++ b/persistence-modules/hibernate5/src/test/resources/hibernate-exception.properties @@ -0,0 +1,16 @@ +hibernate.connection.driver_class=org.h2.Driver +hibernate.connection.url=jdbc:h2:mem:myexceptiondb1;DB_CLOSE_DELAY=-1 +hibernate.connection.username=sa +hibernate.connection.autocommit=true +jdbc.password= + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop + +hibernate.c3p0.min_size=5 +hibernate.c3p0.max_size=20 +hibernate.c3p0.acquire_increment=5 +hibernate.c3p0.timeout=1800 + +hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory From 4f103eeb278324ad943e8b5ad17542fc04902ea5 Mon Sep 17 00:00:00 2001 From: Loredana Date: Sun, 13 Jan 2019 10:32:02 +0200 Subject: [PATCH 225/271] move instanceof code --- .../src/main/java/com/baeldung/keyword/Circle.java | 0 .../src/main/java/com/baeldung/keyword/Ring.java | 0 .../src/main/java/com/baeldung/keyword/Round.java | 0 .../src/main/java/com/baeldung/keyword/Shape.java | 0 .../src/main/java/com/baeldung/keyword/Triangle.java | 0 .../test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename {core-java => core-java-lang-syntax}/src/main/java/com/baeldung/keyword/Circle.java (100%) rename {core-java => core-java-lang-syntax}/src/main/java/com/baeldung/keyword/Ring.java (100%) rename {core-java => core-java-lang-syntax}/src/main/java/com/baeldung/keyword/Round.java (100%) rename {core-java => core-java-lang-syntax}/src/main/java/com/baeldung/keyword/Shape.java (100%) rename {core-java => core-java-lang-syntax}/src/main/java/com/baeldung/keyword/Triangle.java (100%) rename {core-java => core-java-lang-syntax}/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java (100%) diff --git a/core-java/src/main/java/com/baeldung/keyword/Circle.java b/core-java-lang-syntax/src/main/java/com/baeldung/keyword/Circle.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keyword/Circle.java rename to core-java-lang-syntax/src/main/java/com/baeldung/keyword/Circle.java diff --git a/core-java/src/main/java/com/baeldung/keyword/Ring.java b/core-java-lang-syntax/src/main/java/com/baeldung/keyword/Ring.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keyword/Ring.java rename to core-java-lang-syntax/src/main/java/com/baeldung/keyword/Ring.java diff --git a/core-java/src/main/java/com/baeldung/keyword/Round.java b/core-java-lang-syntax/src/main/java/com/baeldung/keyword/Round.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keyword/Round.java rename to core-java-lang-syntax/src/main/java/com/baeldung/keyword/Round.java diff --git a/core-java/src/main/java/com/baeldung/keyword/Shape.java b/core-java-lang-syntax/src/main/java/com/baeldung/keyword/Shape.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keyword/Shape.java rename to core-java-lang-syntax/src/main/java/com/baeldung/keyword/Shape.java diff --git a/core-java/src/main/java/com/baeldung/keyword/Triangle.java b/core-java-lang-syntax/src/main/java/com/baeldung/keyword/Triangle.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keyword/Triangle.java rename to core-java-lang-syntax/src/main/java/com/baeldung/keyword/Triangle.java diff --git a/core-java/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java b/core-java-lang-syntax/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java rename to core-java-lang-syntax/src/test/java/com/baeldung/keyword/test/InstanceOfUnitTest.java From d16167ea63a6cbef5e665248e94f20decbea4027 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Mon, 14 Jan 2019 00:37:51 +0530 Subject: [PATCH 226/271] [BAEL-10781] - Added code for spring data rest pagination --- .../java/com/baeldung/config/DbConfig.java | 8 ++-- .../java/com/baeldung/models/Subject.java | 37 +++++++++++++++++++ .../repositories/SubjectRepository.java | 15 ++++++++ 3 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 spring-data-rest/src/main/java/com/baeldung/models/Subject.java create mode 100644 spring-data-rest/src/main/java/com/baeldung/repositories/SubjectRepository.java diff --git a/spring-data-rest/src/main/java/com/baeldung/config/DbConfig.java b/spring-data-rest/src/main/java/com/baeldung/config/DbConfig.java index 26d882d6a0..05fa27bbff 100644 --- a/spring-data-rest/src/main/java/com/baeldung/config/DbConfig.java +++ b/spring-data-rest/src/main/java/com/baeldung/config/DbConfig.java @@ -64,22 +64,22 @@ public class DbConfig { @Configuration @Profile("h2") -@PropertySource("persistence-h2.properties") +@PropertySource("classpath:persistence-h2.properties") class H2Config {} @Configuration @Profile("hsqldb") -@PropertySource("persistence-hsqldb.properties") +@PropertySource("classpath:persistence-hsqldb.properties") class HsqldbConfig {} @Configuration @Profile("derby") -@PropertySource("persistence-derby.properties") +@PropertySource("classpath:persistence-derby.properties") class DerbyConfig {} @Configuration @Profile("sqlite") -@PropertySource("persistence-sqlite.properties") +@PropertySource("classpath:persistence-sqlite.properties") class SqliteConfig {} diff --git a/spring-data-rest/src/main/java/com/baeldung/models/Subject.java b/spring-data-rest/src/main/java/com/baeldung/models/Subject.java new file mode 100644 index 0000000000..b3b9a5b0a0 --- /dev/null +++ b/spring-data-rest/src/main/java/com/baeldung/models/Subject.java @@ -0,0 +1,37 @@ +package com.baeldung.models; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class Subject { + + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + private long id; + + @Column(nullable = false) + private String name; + + public Subject() { + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} \ No newline at end of file diff --git a/spring-data-rest/src/main/java/com/baeldung/repositories/SubjectRepository.java b/spring-data-rest/src/main/java/com/baeldung/repositories/SubjectRepository.java new file mode 100644 index 0000000000..a91ae2d505 --- /dev/null +++ b/spring-data-rest/src/main/java/com/baeldung/repositories/SubjectRepository.java @@ -0,0 +1,15 @@ +package com.baeldung.repositories; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RestResource; +import com.baeldung.models.Subject; + +public interface SubjectRepository extends PagingAndSortingRepository { + + @RestResource(path = "nameContains") + public Page findByNameContaining(@Param("name") String name, Pageable p); + +} \ No newline at end of file From e7412182a9e7f8d5e5ab13760b23580aad940d24 Mon Sep 17 00:00:00 2001 From: fanatixan Date: Sun, 13 Jan 2019 22:27:07 +0100 Subject: [PATCH 227/271] bael-2508 - Stream.peek() examples (#6132) * bael-2508 - Stream.peek() examples * beal-2508 additional example * bael-2508 moving examples --- .../com/baeldung/stream/PeekUnitTest.java | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 java-streams/src/test/java/com/baeldung/stream/PeekUnitTest.java diff --git a/java-streams/src/test/java/com/baeldung/stream/PeekUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/PeekUnitTest.java new file mode 100644 index 0000000000..a3a2816e9c --- /dev/null +++ b/java-streams/src/test/java/com/baeldung/stream/PeekUnitTest.java @@ -0,0 +1,118 @@ +package com.baeldung.stream; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.StringWriter; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class PeekUnitTest { + + private StringWriter out; + + @BeforeEach + void setup() { + out = new StringWriter(); + } + + @Test + void givenStringStream_whenCallingPeekOnly_thenNoElementProcessed() { + // given + Stream nameStream = Stream.of("Alice", "Bob", "Chuck"); + + // when + nameStream.peek(out::append); + + // then + assertThat(out.toString()).isEmpty(); + } + + @Test + void givenStringStream_whenCallingForEachOnly_thenElementsProcessed() { + // given + Stream nameStream = Stream.of("Alice", "Bob", "Chuck"); + + // when + nameStream.forEach(out::append); + + // then + assertThat(out.toString()).isEqualTo("AliceBobChuck"); + } + + @Test + void givenStringStream_whenCallingPeekAndNoopForEach_thenElementsProcessed() { + // given + Stream nameStream = Stream.of("Alice", "Bob", "Chuck"); + + // when + nameStream.peek(out::append) + .forEach(this::noop); + + // then + assertThat(out.toString()).isEqualTo("AliceBobChuck"); + } + + @Test + void givenStringStream_whenCallingPeekAndCollect_thenElementsProcessed() { + // given + Stream nameStream = Stream.of("Alice", "Bob", "Chuck"); + + // when + nameStream.peek(out::append) + .collect(Collectors.toList()); + + // then + assertThat(out.toString()).isEqualTo("AliceBobChuck"); + } + + @Test + void givenStringStream_whenCallingPeekAndForEach_thenElementsProcessedTwice() { + // given + Stream nameStream = Stream.of("Alice", "Bob", "Chuck"); + + // when + nameStream.peek(out::append) + .forEach(out::append); + + // then + assertThat(out.toString()).isEqualTo("AliceAliceBobBobChuckChuck"); + } + + @Test + void givenStringStream_whenCallingPeek_thenElementsProcessedTwice() { + // given + Stream userStream = Stream.of(new User("Alice"), new User("Bob"), new User("Chuck")); + + // when + userStream.peek(u -> u.setName(u.getName().toLowerCase())) + .map(User::getName) + .forEach(out::append); + + // then + assertThat(out.toString()).isEqualTo("alicebobchuck"); + } + + private static class User { + private String name; + + public User(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + } + + private void noop(String s) { + } + +} From a480f7b8d326b794e8003d54b0543380da2c4a64 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Mon, 14 Jan 2019 20:48:58 +0100 Subject: [PATCH 228/271] added link --- core-java-concurrency-basic/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-concurrency-basic/README.md b/core-java-concurrency-basic/README.md index 1c43149d03..ad3de4a758 100644 --- a/core-java-concurrency-basic/README.md +++ b/core-java-concurrency-basic/README.md @@ -14,4 +14,5 @@ - [ExecutorService - Waiting for Threads to Finish](http://www.baeldung.com/java-executor-wait-for-threads) - [wait and notify() Methods in Java](http://www.baeldung.com/java-wait-notify) - [Life Cycle of a Thread in Java](http://www.baeldung.com/java-thread-lifecycle) -- [Runnable vs. Callable in Java](http://www.baeldung.com/java-runnable-callable) \ No newline at end of file +- [Runnable vs. Callable in Java](http://www.baeldung.com/java-runnable-callable) +- [What is Thread-Safety and How to Achieve it](https://www.baeldung.com/java-thread-safety) From d7bfa764629815684c6588ade9dc32eca58280f3 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Mon, 14 Jan 2019 22:21:27 +0200 Subject: [PATCH 229/271] Update README.md --- libraries-data/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-data/README.md b/libraries-data/README.md index 69856af66b..077961f887 100644 --- a/libraries-data/README.md +++ b/libraries-data/README.md @@ -15,3 +15,4 @@ - [Intro to Apache Storm](https://www.baeldung.com/apache-storm) - [Guide to Ebean ORM](https://www.baeldung.com/ebean-orm) - [Introduction to Kafka Connectors](https://www.baeldung.com/kafka-connectors-guide) +- [Kafka Connect Example with MQTT and MongoDB](https://www.baeldung.com/kafka-connect-mqtt-mongodb) From 18e1a3067d660556d3c6e1b78debc64f525266d8 Mon Sep 17 00:00:00 2001 From: freddyaott Date: Tue, 15 Jan 2019 04:04:54 +0100 Subject: [PATCH 230/271] [BAEL-2270] Guide to XMPP Smack Client (#5959) Smack Library - Simple chat client --- libraries/log4j.properties | 4 + libraries/pom.xml | 25 ++++++ .../java/com/baeldung/smack/StanzaThread.java | 40 +++++++++ .../baeldung/smack/SmackIntegrationTest.java | 85 +++++++++++++++++++ 4 files changed, 154 insertions(+) create mode 100644 libraries/src/main/java/com/baeldung/smack/StanzaThread.java create mode 100644 libraries/src/test/java/com/baeldung/smack/SmackIntegrationTest.java diff --git a/libraries/log4j.properties b/libraries/log4j.properties index 2173c5d96f..ed367509d1 100644 --- a/libraries/log4j.properties +++ b/libraries/log4j.properties @@ -1 +1,5 @@ log4j.rootLogger=INFO, stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n \ No newline at end of file diff --git a/libraries/pom.xml b/libraries/pom.xml index c7ef64bc59..301fa86c8d 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -675,6 +675,30 @@ ${mockftpserver.version} test + + + org.igniterealtime.smack + smack-tcp + ${smack.version} + + + + org.igniterealtime.smack + smack-im + ${smack.version} + + + + org.igniterealtime.smack + smack-extensions + ${smack.version} + + + + org.igniterealtime.smack + smack-java7 + ${smack.version} + @@ -896,6 +920,7 @@ 1.1.0 2.7.1 3.6 + 4.3.1 diff --git a/libraries/src/main/java/com/baeldung/smack/StanzaThread.java b/libraries/src/main/java/com/baeldung/smack/StanzaThread.java new file mode 100644 index 0000000000..72db258164 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/smack/StanzaThread.java @@ -0,0 +1,40 @@ +package com.baeldung.smack; + +import org.jivesoftware.smack.AbstractXMPPConnection; +import org.jivesoftware.smack.chat2.Chat; +import org.jivesoftware.smack.chat2.ChatManager; +import org.jivesoftware.smack.tcp.XMPPTCPConnection; +import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration; +import org.jxmpp.jid.impl.JidCreate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class StanzaThread implements Runnable { + + private Logger logger = LoggerFactory.getLogger(StanzaThread.class); + + @Override + public void run() { + XMPPTCPConnectionConfiguration config = null; + try { + config = XMPPTCPConnectionConfiguration.builder() + .setUsernameAndPassword("baeldung2","baeldung2") + .setXmppDomain("jabb3r.org") + .setHost("jabb3r.org") + .build(); + + AbstractXMPPConnection connection = new XMPPTCPConnection(config); + connection.connect(); + connection.login(); + + ChatManager chatManager = ChatManager.getInstanceFor(connection); + + Chat chat = chatManager.chatWith(JidCreate.from("baeldung@jabb3r.org").asEntityBareJidOrThrow()); + + chat.send("Hello!"); + + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + } +} diff --git a/libraries/src/test/java/com/baeldung/smack/SmackIntegrationTest.java b/libraries/src/test/java/com/baeldung/smack/SmackIntegrationTest.java new file mode 100644 index 0000000000..1e5e36ce24 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/smack/SmackIntegrationTest.java @@ -0,0 +1,85 @@ +package com.baeldung.smack; + +import org.jivesoftware.smack.AbstractXMPPConnection; +import org.jivesoftware.smack.SmackException; +import org.jivesoftware.smack.XMPPException; +import org.jivesoftware.smack.chat2.ChatManager; +import org.jivesoftware.smack.filter.StanzaTypeFilter; +import org.jivesoftware.smack.packet.Message; +import org.jivesoftware.smack.tcp.XMPPTCPConnection; +import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.jxmpp.stringprep.XmppStringprepException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.concurrent.CountDownLatch; + +public class SmackIntegrationTest { + + private static AbstractXMPPConnection connection; + private Logger logger = LoggerFactory.getLogger(SmackIntegrationTest.class); + + @BeforeClass + public static void setup() throws IOException, InterruptedException, XMPPException, SmackException { + + XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder() + .setUsernameAndPassword("baeldung","baeldung") + .setXmppDomain("jabb3r.org") + .setHost("jabb3r.org") + .build(); + + XMPPTCPConnectionConfiguration config2 = XMPPTCPConnectionConfiguration.builder() + .setUsernameAndPassword("baeldung2","baeldung2") + .setXmppDomain("jabb3r.org") + .setHost("jabb3r.org") + .build(); + + connection = new XMPPTCPConnection(config); + connection.connect(); + connection.login(); + + } + + @Test + public void whenSendMessageWithChat_thenReceiveMessage() throws XmppStringprepException, InterruptedException { + + CountDownLatch latch = new CountDownLatch(1); + ChatManager chatManager = ChatManager.getInstanceFor(connection); + final String[] expected = {null}; + + new StanzaThread().run(); + + chatManager.addIncomingListener((entityBareJid, message, chat) -> { + logger.info("Message arrived: " + message.getBody()); + expected[0] = message.getBody(); + latch.countDown(); + }); + + latch.await(); + Assert.assertEquals("Hello!", expected[0]); + } + + @Test + public void whenSendMessage_thenReceiveMessageWithFilter() throws XmppStringprepException, InterruptedException { + + CountDownLatch latch = new CountDownLatch(1); + final String[] expected = {null}; + + new StanzaThread().run(); + + connection.addAsyncStanzaListener(stanza -> { + if (stanza instanceof Message) { + Message message = (Message) stanza; + expected[0] = message.getBody(); + latch.countDown(); + } + }, StanzaTypeFilter.MESSAGE); + + latch.await(); + Assert.assertEquals("Hello!", expected[0]); + } +} From e7301029c346147df75c1b256a7ee8b50fc273b3 Mon Sep 17 00:00:00 2001 From: soufiane-cheouati <46105138+soufiane-cheouati@users.noreply.github.com> Date: Tue, 15 Jan 2019 16:37:38 +0000 Subject: [PATCH 231/271] Adding new methods for calculating the sum (#6088) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Creating new module Creating new module for Hexagonal Architecture * Adding Java classes Adding Java classes used in the example * Adding the pom.xml file Adding the pom.xml file. * Update the pom.xml file Update the pom.xml file * BAEL-2498: Creating new folder Creating new folder for Java 8 sum with Streams examples * BAEL-2498: Uploading java Classes Adding the Java classes containing examples of different methods to calculate the sum using Java 8 Streams * BAEL-2498: Creating new folder Creating new folder for sum unit tests * BAEL-2498: Adding the unit tests Adding the unit tests for the methods that calculate the sum using the Java Streams * Add files via Upload - Adding a method for calculating the sum of a map´s values - Adding a method for calculating the sum of numbers within a String object * Add files via upload - Adding a method for calculating the sum of a map´s values - Adding a method for calculating the sum of numbers within a String object * Delete . ... * Delete pom.xml * Delete User.java * Delete UserControler.java * Delete UserDataBaseAdapter.java * Delete UserInterfaceAdapter.java * Delete UserDataBasePort.java * Delete UserInterfacePort.java * Delete UserService.java --- .../main/java/com/baeldung/stream/sum/. .. | 1 + .../baeldung/stream/sum/ArithmeticUtils.java | 8 ++ .../java/com/baeldung/stream/sum/Item.java | 31 ++++ .../stream/sum/StreamSumCalculator.java | 59 ++++++++ .../sum/StreamSumCalculatorWithObject.java | 38 +++++ .../test/java/com/baeldung/stream/sum/. .. | 1 + .../stream/sum/StreamSumUnitTest.java | 136 ++++++++++++++++++ 7 files changed, 274 insertions(+) create mode 100644 java-streams/src/main/java/com/baeldung/stream/sum/. .. create mode 100644 java-streams/src/main/java/com/baeldung/stream/sum/ArithmeticUtils.java create mode 100644 java-streams/src/main/java/com/baeldung/stream/sum/Item.java create mode 100644 java-streams/src/main/java/com/baeldung/stream/sum/StreamSumCalculator.java create mode 100644 java-streams/src/main/java/com/baeldung/stream/sum/StreamSumCalculatorWithObject.java create mode 100644 java-streams/src/test/java/com/baeldung/stream/sum/. .. create mode 100644 java-streams/src/test/java/com/baeldung/stream/sum/StreamSumUnitTest.java diff --git a/java-streams/src/main/java/com/baeldung/stream/sum/. .. b/java-streams/src/main/java/com/baeldung/stream/sum/. .. new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/java-streams/src/main/java/com/baeldung/stream/sum/. .. @@ -0,0 +1 @@ + diff --git a/java-streams/src/main/java/com/baeldung/stream/sum/ArithmeticUtils.java b/java-streams/src/main/java/com/baeldung/stream/sum/ArithmeticUtils.java new file mode 100644 index 0000000000..3170b1fb31 --- /dev/null +++ b/java-streams/src/main/java/com/baeldung/stream/sum/ArithmeticUtils.java @@ -0,0 +1,8 @@ +package com.baeldung.stream.sum; + +public class ArithmeticUtils { + + public static int add(int a, int b) { + return a + b; + } +} diff --git a/java-streams/src/main/java/com/baeldung/stream/sum/Item.java b/java-streams/src/main/java/com/baeldung/stream/sum/Item.java new file mode 100644 index 0000000000..2f162d6eda --- /dev/null +++ b/java-streams/src/main/java/com/baeldung/stream/sum/Item.java @@ -0,0 +1,31 @@ +package com.baeldung.stream.sum; + +public class Item { + + private int id; + private Integer price; + + public Item(int id, Integer price) { + super(); + this.id = id; + this.price = price; + } + + // Standard getters and setters + public long getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public Integer getPrice() { + return price; + } + + public void setPrice(Integer price) { + this.price = price; + } + +} diff --git a/java-streams/src/main/java/com/baeldung/stream/sum/StreamSumCalculator.java b/java-streams/src/main/java/com/baeldung/stream/sum/StreamSumCalculator.java new file mode 100644 index 0000000000..2f63cf8629 --- /dev/null +++ b/java-streams/src/main/java/com/baeldung/stream/sum/StreamSumCalculator.java @@ -0,0 +1,59 @@ +package com.baeldung.stream.sum; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class StreamSumCalculator { + + public static Integer getSumUsingCustomizedAccumulator(List integers) { + return integers.stream() + .reduce(0, ArithmeticUtils::add); + + } + + public static Integer getSumUsingJavaAccumulator(List integers) { + return integers.stream() + .reduce(0, Integer::sum); + + } + + public static Integer getSumUsingReduce(List integers) { + return integers.stream() + .reduce(0, (a, b) -> a + b); + + } + + public static Integer getSumUsingCollect(List integers) { + + return integers.stream() + .collect(Collectors.summingInt(Integer::intValue)); + + } + + public static Integer getSumUsingSum(List integers) { + + return integers.stream() + .mapToInt(Integer::intValue) + .sum(); + } + + public static Integer getSumOfMapValues(Map map) { + + return map.values() + .stream() + .mapToInt(Integer::valueOf) + .sum(); + } + + public static Integer getSumIntegersFromString(String str) { + + Integer sum = Arrays.stream(str.split(" ")) + .filter((s) -> s.matches("\\d+")) + .mapToInt(Integer::valueOf) + .sum(); + + return sum; + } +} diff --git a/java-streams/src/main/java/com/baeldung/stream/sum/StreamSumCalculatorWithObject.java b/java-streams/src/main/java/com/baeldung/stream/sum/StreamSumCalculatorWithObject.java new file mode 100644 index 0000000000..b83616928e --- /dev/null +++ b/java-streams/src/main/java/com/baeldung/stream/sum/StreamSumCalculatorWithObject.java @@ -0,0 +1,38 @@ +package com.baeldung.stream.sum; + +import java.util.List; +import java.util.stream.Collectors; + +public class StreamSumCalculatorWithObject { + + public static Integer getSumUsingCustomizedAccumulator(List items) { + return items.stream() + .map(x -> x.getPrice()) + .reduce(0, ArithmeticUtils::add); + } + + public static Integer getSumUsingJavaAccumulator(List items) { + return items.stream() + .map(x -> x.getPrice()) + .reduce(0, Integer::sum); + } + + public static Integer getSumUsingReduce(List items) { + return items.stream() + .map(item -> item.getPrice()) + .reduce(0, (a, b) -> a + b); + } + + public static Integer getSumUsingCollect(List items) { + return items.stream() + .map(x -> x.getPrice()) + .collect(Collectors.summingInt(Integer::intValue)); + } + + public static Integer getSumUsingSum(List items) { + return items.stream() + .mapToInt(x -> x.getPrice()) + .sum(); + } + +} diff --git a/java-streams/src/test/java/com/baeldung/stream/sum/. .. b/java-streams/src/test/java/com/baeldung/stream/sum/. .. new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/java-streams/src/test/java/com/baeldung/stream/sum/. .. @@ -0,0 +1 @@ + diff --git a/java-streams/src/test/java/com/baeldung/stream/sum/StreamSumUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/sum/StreamSumUnitTest.java new file mode 100644 index 0000000000..46e1af9a4a --- /dev/null +++ b/java-streams/src/test/java/com/baeldung/stream/sum/StreamSumUnitTest.java @@ -0,0 +1,136 @@ +package com.baeldung.stream.sum; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.jupiter.api.Test; + +public class StreamSumUnitTest { + + @Test + public void givenListOfIntegersWhenSummingUsingCustomizedAccumulatorThenCorrectValueReturned() { + List integers = Arrays.asList(1, 2, 3, 4, 5); + Integer sum = StreamSumCalculator.getSumUsingCustomizedAccumulator(integers); + assertEquals(15, sum.intValue()); + + } + + @Test + public void givenListOfIntegersWhenSummingUsingJavaAccumulatorThenCorrectValueReturned() { + List integers = Arrays.asList(1, 2, 3, 4, 5); + Integer sum = StreamSumCalculator.getSumUsingJavaAccumulator(integers); + assertEquals(15, sum.intValue()); + } + + @Test + public void givenListOfIntegersWhenSummingUsingReduceThenCorrectValueReturned() { + List integers = Arrays.asList(1, 2, 3, 4, 5); + Integer sum = StreamSumCalculator.getSumUsingReduce(integers); + assertEquals(15, sum.intValue()); + } + + @Test + public void givenListOfIntegersWhenSummingUsingCollectThenCorrectValueReturned() { + List integers = Arrays.asList(1, 2, 3, 4, 5); + Integer sum = StreamSumCalculator.getSumUsingCollect(integers); + assertEquals(15, sum.intValue()); + } + + @Test + public void givenListOfIntegersWhenSummingUsingSumThenCorrectValueReturned() { + List integers = Arrays.asList(1, 2, 3, 4, 5); + Integer sum = StreamSumCalculator.getSumUsingSum(integers); + assertEquals(15, sum.intValue()); + } + + @Test + public void givenListOfItemsWhenSummingUsingCustomizedAccumulatorThenCorrectValueReturned() { + Item item1 = new Item(1, 10); + Item item2 = new Item(2, 15); + Item item3 = new Item(3, 25); + Item item4 = new Item(4, 40); + + List items = Arrays.asList(item1, item2, item3, item4); + + Integer sum = StreamSumCalculatorWithObject.getSumUsingCustomizedAccumulator(items); + assertEquals(90, sum.intValue()); + + } + + @Test + public void givenListOfItemsWhenSummingUsingJavaAccumulatorThenCorrectValueReturned() { + Item item1 = new Item(1, 10); + Item item2 = new Item(2, 15); + Item item3 = new Item(3, 25); + Item item4 = new Item(4, 40); + + List items = Arrays.asList(item1, item2, item3, item4); + + Integer sum = StreamSumCalculatorWithObject.getSumUsingJavaAccumulator(items); + assertEquals(90, sum.intValue()); + } + + @Test + public void givenListOfItemsWhenSummingUsingReduceThenCorrectValueReturned() { + Item item1 = new Item(1, 10); + Item item2 = new Item(2, 15); + Item item3 = new Item(3, 25); + Item item4 = new Item(4, 40); + + List items = Arrays.asList(item1, item2, item3, item4); + + Integer sum = StreamSumCalculatorWithObject.getSumUsingReduce(items); + assertEquals(90, sum.intValue()); + } + + @Test + public void givenListOfItemsWhenSummingUsingCollectThenCorrectValueReturned() { + Item item1 = new Item(1, 10); + Item item2 = new Item(2, 15); + Item item3 = new Item(3, 25); + Item item4 = new Item(4, 40); + + List items = Arrays.asList(item1, item2, item3, item4); + + Integer sum = StreamSumCalculatorWithObject.getSumUsingCollect(items); + assertEquals(90, sum.intValue()); + } + + @Test + public void givenListOfItemsWhenSummingUsingSumThenCorrectValueReturned() { + Item item1 = new Item(1, 10); + Item item2 = new Item(2, 15); + Item item3 = new Item(3, 25); + Item item4 = new Item(4, 40); + + List items = Arrays.asList(item1, item2, item3, item4); + + Integer sum = StreamSumCalculatorWithObject.getSumUsingSum(items); + assertEquals(90, sum.intValue()); + } + + @Test + public void givenMapWhenSummingThenCorrectValueReturned() { + Map map = new HashMap(); + map.put(1, 10); + map.put(2, 15); + map.put(3, 25); + map.put(4, 40); + + Integer sum = StreamSumCalculator.getSumOfMapValues(map); + assertEquals(90, sum.intValue()); + } + + @Test + public void givenStringWhenSummingThenCorrectValueReturned() { + String string = "Item1 10 Item2 25 Item3 30 Item4 45"; + + Integer sum = StreamSumCalculator.getSumIntegersFromString(string); + assertEquals(110, sum.intValue()); + } + +} From 0bfa50825bad3bd4bdb98712c7ff6e419f95d9dd Mon Sep 17 00:00:00 2001 From: Amy DeGregorio Date: Tue, 15 Jan 2019 15:31:37 -0500 Subject: [PATCH 232/271] BAEL-2499 Write to CSV in Java - updated (#6135) * example code for Article How to Write to a CSV File in Java * Updated to use a Stream * Updated to use Streams in convertToCSV for BAEL-2499 --- .../com/baeldung/csv/WriteCsvFileExample.java | 16 ++++++---------- .../csv/WriteCsvFileExampleUnitTest.java | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java b/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java index e1237481b1..f409d05b06 100644 --- a/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java +++ b/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java @@ -1,18 +1,14 @@ package com.baeldung.csv; +import java.util.stream.Collectors; +import java.util.stream.Stream; + public class WriteCsvFileExample { public String convertToCSV(String[] data) { - StringBuilder csvLine = new StringBuilder(); - - for (int i = 0; i < data.length; i++) { - if (i > 0) { - csvLine.append(","); - } - csvLine.append(escapeSpecialCharacters(data[i])); - } - - return csvLine.toString(); + return Stream.of(data) + .map(this::escapeSpecialCharacters) + .collect(Collectors.joining(",")); } public String escapeSpecialCharacters(String data) { diff --git a/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java b/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java index e30ec0818c..0658ec6101 100644 --- a/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java +++ b/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java @@ -65,7 +65,7 @@ public class WriteCsvFileExampleUnitTest { } @Test - public void givenBufferedWriter_whenWriteLine_thenOutputCreated() { + public void givenDataArray_whenConvertToCSV_thenOutputCreated() { List dataLines = new ArrayList(); dataLines.add(new String[] { "John", "Doe", "38", "Comment Data\nAnother line of comment data" }); dataLines.add(new String[] { "Jane", "Doe, Jr.", "19", "She said \"I'm being quoted\"" }); From 4c9ea991cc5edacd714fc566ce572a417181ce0c Mon Sep 17 00:00:00 2001 From: PRIFTI Date: Tue, 15 Jan 2019 21:38:40 +0100 Subject: [PATCH 233/271] BAEL-2441: Providing example for Implementing simple State Machine with Java Enums. --- .../enumstatemachine/LeaveRequestState.java | 46 +++++++++++++++++++ .../LeaveRequestStateTest.java | 41 +++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestState.java create mode 100644 algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateTest.java diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestState.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestState.java new file mode 100644 index 0000000000..5153c2e18e --- /dev/null +++ b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestState.java @@ -0,0 +1,46 @@ +package com.baeldung.algorithms.enumstatemachine; + +public enum LeaveRequestState { + + Submitted { + @Override + public LeaveRequestState nextState() { + System.out.println("Starting the Leave Request and sending to Team Leader for approval."); + return Escalated; + } + + @Override + public String responsiblePerson() { + return "Employee"; + } + }, + Escalated { + @Override + public LeaveRequestState nextState() { + System.out.println("Reviewing the Leave Request and escalating to Department Manager."); + return Approved; + } + + @Override + public String responsiblePerson() { + return "Team Leader"; + } + }, + Approved { + @Override + public LeaveRequestState nextState() { + System.out.println("Approving the Leave Request."); + return this; + } + + @Override + public String responsiblePerson() { + return "Department Manager"; + } + }; + + public abstract String responsiblePerson(); + + public abstract LeaveRequestState nextState(); + +} diff --git a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateTest.java new file mode 100644 index 0000000000..b209dcb2fb --- /dev/null +++ b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateTest.java @@ -0,0 +1,41 @@ +package com.baeldung.algorithms.enumstatemachine; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class LeaveRequestStateTest { + + @Test + public void givenLeaveRequest_whenStateEscalated_thenResponsibleIsTeamLeader() { + LeaveRequestState state = LeaveRequestState.Escalated; + + String responsible = state.responsiblePerson(); + + assertEquals(responsible, "Team Leader"); + } + + + @Test + public void givenLeaveRequest_whenStateApproved_thenResponsibleIsDepartmentManager() { + LeaveRequestState state = LeaveRequestState.Approved; + + String responsible = state.responsiblePerson(); + + assertEquals(responsible, "Department Manager"); + } + + @Test + public void givenLeaveRequest_whenNextStateIsCalled_thenStateIsChanged() { + LeaveRequestState state = LeaveRequestState.Submitted; + + state = state.nextState(); + assertEquals(state, LeaveRequestState.Escalated); + + state = state.nextState(); + assertEquals(state, LeaveRequestState.Approved); + + state = state.nextState(); + assertEquals(state, LeaveRequestState.Approved); + } +} From 22e98e06eafae25dbbf7a9eaaf7e858d4b11d519 Mon Sep 17 00:00:00 2001 From: Ger Roza Date: Tue, 15 Jan 2019 18:45:36 -0200 Subject: [PATCH 234/271] Removed most exception handlers from spring-rest-full (except the ones used in other articles) and moved them to spring-boot-rest --- .../RestResponseEntityExceptionHandler.java | 86 +++++++++++++++++++ .../web/exception/MyDataAccessException.java | 21 +++++ .../MyDataIntegrityViolationException.java | 21 +++++ .../MyResourceNotFoundException.java | 21 +++++ spring-rest-full/.attach_pid28499 | 0 spring-rest-full/pom.xml | 43 ---------- .../RestResponseEntityExceptionHandler.java | 61 +------------ ...{TestSuite.java => TestSuiteLiveTest.java} | 6 +- ...tSuite.java => LiveTestSuiteLiveTest.java} | 2 +- 9 files changed, 154 insertions(+), 107 deletions(-) create mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataAccessException.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataIntegrityViolationException.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java create mode 100644 spring-rest-full/.attach_pid28499 rename spring-rest-full/src/test/java/org/baeldung/{TestSuite.java => TestSuiteLiveTest.java} (68%) rename spring-rest-full/src/test/java/org/baeldung/web/{LiveTestSuite.java => LiveTestSuiteLiveTest.java} (87%) diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java b/spring-boot-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java new file mode 100644 index 0000000000..fe0465156d --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java @@ -0,0 +1,86 @@ +package com.baeldung.web.error; + +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.http.converter.HttpMessageNotReadableException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.context.request.WebRequest; +import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; + +import com.baeldung.web.exception.MyDataAccessException; +import com.baeldung.web.exception.MyDataIntegrityViolationException; +import com.baeldung.web.exception.MyResourceNotFoundException; + +@ControllerAdvice +public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionHandler { + + public RestResponseEntityExceptionHandler() { + super(); + } + + // API + + // 400 + /* + * Some examples of exceptions that we could retrieve as 400 (BAD_REQUEST) responses: + * Hibernate's ConstraintViolationException + * Spring's DataIntegrityViolationException + */ + @ExceptionHandler({ MyDataIntegrityViolationException.class }) + public ResponseEntity handleBadRequest(final MyDataIntegrityViolationException ex, final WebRequest request) { + final String bodyOfResponse = "This should be application specific"; + return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.BAD_REQUEST, request); + } + + @Override + protected ResponseEntity handleHttpMessageNotReadable(final HttpMessageNotReadableException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) { + final String bodyOfResponse = "This should be application specific"; + // ex.getCause() instanceof JsonMappingException, JsonParseException // for additional information later on + return handleExceptionInternal(ex, bodyOfResponse, headers, HttpStatus.BAD_REQUEST, request); + } + + @Override + protected ResponseEntity handleMethodArgumentNotValid(final MethodArgumentNotValidException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) { + final String bodyOfResponse = "This should be application specific"; + return handleExceptionInternal(ex, bodyOfResponse, headers, HttpStatus.BAD_REQUEST, request); + } + + + // 404 + /* + * Some examples of exceptions that we could retrieve as 404 (NOT_FOUND) responses: + * Java Persistence's EntityNotFoundException + */ + @ExceptionHandler(value = { MyResourceNotFoundException.class }) + protected ResponseEntity handleNotFound(final RuntimeException ex, final WebRequest request) { + final String bodyOfResponse = "This should be application specific"; + return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.NOT_FOUND, request); + } + + // 409 + /* + * Some examples of exceptions that we could retrieve as 409 (CONFLICT) responses: + * Spring's InvalidDataAccessApiUsageException + * Spring's DataAccessException + */ + @ExceptionHandler({ MyDataAccessException.class}) + protected ResponseEntity handleConflict(final RuntimeException ex, final WebRequest request) { + final String bodyOfResponse = "This should be application specific"; + return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.CONFLICT, request); + } + + // 412 + + // 500 + + @ExceptionHandler({ NullPointerException.class, IllegalArgumentException.class, IllegalStateException.class }) + /*500*/public ResponseEntity handleInternal(final RuntimeException ex, final WebRequest request) { + logger.error("500 Status Code", ex); + final String bodyOfResponse = "This should be application specific"; + return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request); + } + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataAccessException.java b/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataAccessException.java new file mode 100644 index 0000000000..8fc9a3a0ea --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataAccessException.java @@ -0,0 +1,21 @@ +package com.baeldung.web.exception; + +public final class MyDataAccessException extends RuntimeException { + + public MyDataAccessException() { + super(); + } + + public MyDataAccessException(final String message, final Throwable cause) { + super(message, cause); + } + + public MyDataAccessException(final String message) { + super(message); + } + + public MyDataAccessException(final Throwable cause) { + super(cause); + } + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataIntegrityViolationException.java b/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataIntegrityViolationException.java new file mode 100644 index 0000000000..50adb09c09 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataIntegrityViolationException.java @@ -0,0 +1,21 @@ +package com.baeldung.web.exception; + +public final class MyDataIntegrityViolationException extends RuntimeException { + + public MyDataIntegrityViolationException() { + super(); + } + + public MyDataIntegrityViolationException(final String message, final Throwable cause) { + super(message, cause); + } + + public MyDataIntegrityViolationException(final String message) { + super(message); + } + + public MyDataIntegrityViolationException(final Throwable cause) { + super(cause); + } + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java b/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java new file mode 100644 index 0000000000..fd002efc28 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java @@ -0,0 +1,21 @@ +package com.baeldung.web.exception; + +public final class MyResourceNotFoundException extends RuntimeException { + + public MyResourceNotFoundException() { + super(); + } + + public MyResourceNotFoundException(final String message, final Throwable cause) { + super(message, cause); + } + + public MyResourceNotFoundException(final String message) { + super(message); + } + + public MyResourceNotFoundException(final Throwable cause) { + super(cause); + } + +} diff --git a/spring-rest-full/.attach_pid28499 b/spring-rest-full/.attach_pid28499 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-rest-full/pom.xml b/spring-rest-full/pom.xml index 81c938a289..ddc7e042b5 100644 --- a/spring-rest-full/pom.xml +++ b/spring-rest-full/pom.xml @@ -212,23 +212,6 @@ org.apache.maven.plugins maven-war-plugin - - - org.apache.maven.plugins - maven-surefire-plugin - - 3 - true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LongRunningUnitTest.java - **/*ManualTest.java - **/*LiveTest.java - **/*TestSuite.java - - - org.codehaus.cargo cargo-maven2-plugin @@ -274,32 +257,6 @@ live - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*IntegrationTest.java - **/*IntTest.java - - - **/*LiveTest.java - - - - - - - json - - - org.codehaus.cargo cargo-maven2-plugin diff --git a/spring-rest-full/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java b/spring-rest-full/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java index b593116c4a..c0639acef4 100644 --- a/spring-rest-full/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java +++ b/spring-rest-full/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java @@ -1,17 +1,9 @@ package org.baeldung.web.error; -import javax.persistence.EntityNotFoundException; - import org.baeldung.web.exception.MyResourceNotFoundException; -import org.hibernate.exception.ConstraintViolationException; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.http.converter.HttpMessageNotReadableException; -import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.context.request.WebRequest; @@ -24,61 +16,10 @@ public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionH super(); } - // API - - // 400 - - @ExceptionHandler({ ConstraintViolationException.class }) - public ResponseEntity handleBadRequest(final ConstraintViolationException ex, final WebRequest request) { - final String bodyOfResponse = "This should be application specific"; - return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.BAD_REQUEST, request); - } - - @ExceptionHandler({ DataIntegrityViolationException.class }) - public ResponseEntity handleBadRequest(final DataIntegrityViolationException ex, final WebRequest request) { - final String bodyOfResponse = "This should be application specific"; - return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.BAD_REQUEST, request); - } - - @Override - protected ResponseEntity handleHttpMessageNotReadable(final HttpMessageNotReadableException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) { - final String bodyOfResponse = "This should be application specific"; - // ex.getCause() instanceof JsonMappingException, JsonParseException // for additional information later on - return handleExceptionInternal(ex, bodyOfResponse, headers, HttpStatus.BAD_REQUEST, request); - } - - @Override - protected ResponseEntity handleMethodArgumentNotValid(final MethodArgumentNotValidException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) { - final String bodyOfResponse = "This should be application specific"; - return handleExceptionInternal(ex, bodyOfResponse, headers, HttpStatus.BAD_REQUEST, request); - } - - - // 404 - - @ExceptionHandler(value = { EntityNotFoundException.class, MyResourceNotFoundException.class }) + @ExceptionHandler(value = { MyResourceNotFoundException.class }) protected ResponseEntity handleNotFound(final RuntimeException ex, final WebRequest request) { final String bodyOfResponse = "This should be application specific"; return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.NOT_FOUND, request); } - // 409 - - @ExceptionHandler({ InvalidDataAccessApiUsageException.class, DataAccessException.class }) - protected ResponseEntity handleConflict(final RuntimeException ex, final WebRequest request) { - final String bodyOfResponse = "This should be application specific"; - return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.CONFLICT, request); - } - - // 412 - - // 500 - - @ExceptionHandler({ NullPointerException.class, IllegalArgumentException.class, IllegalStateException.class }) - /*500*/public ResponseEntity handleInternal(final RuntimeException ex, final WebRequest request) { - logger.error("500 Status Code", ex); - final String bodyOfResponse = "This should be application specific"; - return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request); - } - } diff --git a/spring-rest-full/src/test/java/org/baeldung/TestSuite.java b/spring-rest-full/src/test/java/org/baeldung/TestSuiteLiveTest.java similarity index 68% rename from spring-rest-full/src/test/java/org/baeldung/TestSuite.java rename to spring-rest-full/src/test/java/org/baeldung/TestSuiteLiveTest.java index cd5fa4661f..76215bb6e3 100644 --- a/spring-rest-full/src/test/java/org/baeldung/TestSuite.java +++ b/spring-rest-full/src/test/java/org/baeldung/TestSuiteLiveTest.java @@ -1,7 +1,7 @@ package org.baeldung; import org.baeldung.persistence.PersistenceTestSuite; -import org.baeldung.web.LiveTestSuite; +import org.baeldung.web.LiveTestSuiteLiveTest; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -9,8 +9,8 @@ import org.junit.runners.Suite; @Suite.SuiteClasses({ // @formatter:off PersistenceTestSuite.class - ,LiveTestSuite.class + ,LiveTestSuiteLiveTest.class }) // -public class TestSuite { +public class TestSuiteLiveTest { } diff --git a/spring-rest-full/src/test/java/org/baeldung/web/LiveTestSuite.java b/spring-rest-full/src/test/java/org/baeldung/web/LiveTestSuiteLiveTest.java similarity index 87% rename from spring-rest-full/src/test/java/org/baeldung/web/LiveTestSuite.java rename to spring-rest-full/src/test/java/org/baeldung/web/LiveTestSuiteLiveTest.java index 6d5b94a686..71a61ed338 100644 --- a/spring-rest-full/src/test/java/org/baeldung/web/LiveTestSuite.java +++ b/spring-rest-full/src/test/java/org/baeldung/web/LiveTestSuiteLiveTest.java @@ -10,6 +10,6 @@ import org.junit.runners.Suite; ,FooLiveTest.class ,FooPageableLiveTest.class }) // -public class LiveTestSuite { +public class LiveTestSuiteLiveTest { } From 438ff48c275d1d1dd92bbf3e210b300b422c19d7 Mon Sep 17 00:00:00 2001 From: cror Date: Wed, 16 Jan 2019 17:09:44 +0100 Subject: [PATCH 235/271] BAEL-2546: added Stream.count examples --- .../stream/filter/StreamCountUnitTest.java | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 java-streams/src/test/java/com/baeldung/stream/filter/StreamCountUnitTest.java diff --git a/java-streams/src/test/java/com/baeldung/stream/filter/StreamCountUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/filter/StreamCountUnitTest.java new file mode 100644 index 0000000000..1cad710e14 --- /dev/null +++ b/java-streams/src/test/java/com/baeldung/stream/filter/StreamCountUnitTest.java @@ -0,0 +1,72 @@ +package com.baeldung.stream.filter; + +import org.junit.Test; +import org.junit.Before; + +import java.util.Arrays; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +public class StreamCountUnitTest { + + private List customers; + + @Before + public void setUp() { + Customer john = new Customer("John P.", 15, "https://images.unsplash.com/photo-1543320485-d0d5a49c2b2e"); + Customer sarah = new Customer("Sarah M.", 200); + Customer charles = new Customer("Charles B.", 150); + Customer mary = new Customer("Mary T.", 1, "https://images.unsplash.com/photo-1543297057-25167dfc180e"); + customers = Arrays.asList(john, sarah, charles, mary); + } + + @Test + public void givenListOfCustomers_whenCount_thenGetListSize() { + long count = customers + .stream() + .count(); + + assertThat(count).isEqualTo(4L); + } + + @Test + public void givenListOfCustomers_whenFilterByPointsOver100AndCount_thenGetTwo() { + long countBigCustomers = customers + .stream() + .filter(c -> c.getPoints() > 100) + .count(); + + assertThat(countBigCustomers).isEqualTo(2L); + } + + @Test + public void givenListOfCustomers_whenFilterByPointsAndNameAndCount_thenGetOne() { + long count = customers + .stream() + .filter(c -> c.getPoints() > 10 && c.getName().startsWith("Charles")) + .count(); + + assertThat(count).isEqualTo(1L); + } + + @Test + public void givenListOfCustomers_whenNoneMatchesFilterAndCount_thenGetZero() { + long count = customers + .stream() + .filter(c -> c.getPoints() > 500) + .count(); + + assertThat(count).isEqualTo(0L); + } + + @Test + public void givenListOfCustomers_whenUsingMethodOverHundredPointsAndCount_thenGetTwo() { + long count = customers + .stream() + .filter(Customer::hasOverThousandPoints) + .count(); + + assertThat(count).isEqualTo(2L); + } +} From 2b7e66a3989bebd92e76d4d116f74b72db2edcc4 Mon Sep 17 00:00:00 2001 From: cror Date: Wed, 16 Jan 2019 17:14:35 +0100 Subject: [PATCH 236/271] renaming method according to content: thousand -> hundred --- .../src/main/java/com/baeldung/stream/filter/Customer.java | 2 +- .../java/com/baeldung/stream/filter/StreamCountUnitTest.java | 2 +- .../java/com/baeldung/stream/filter/StreamFilterUnitTest.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/java-streams/src/main/java/com/baeldung/stream/filter/Customer.java b/java-streams/src/main/java/com/baeldung/stream/filter/Customer.java index 49da6e7175..fd4f6021ff 100644 --- a/java-streams/src/main/java/com/baeldung/stream/filter/Customer.java +++ b/java-streams/src/main/java/com/baeldung/stream/filter/Customer.java @@ -32,7 +32,7 @@ public class Customer { return this.points > points; } - public boolean hasOverThousandPoints() { + public boolean hasOverHundredPoints() { return this.points > 100; } diff --git a/java-streams/src/test/java/com/baeldung/stream/filter/StreamCountUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/filter/StreamCountUnitTest.java index 1cad710e14..742e5aedc9 100644 --- a/java-streams/src/test/java/com/baeldung/stream/filter/StreamCountUnitTest.java +++ b/java-streams/src/test/java/com/baeldung/stream/filter/StreamCountUnitTest.java @@ -64,7 +64,7 @@ public class StreamCountUnitTest { public void givenListOfCustomers_whenUsingMethodOverHundredPointsAndCount_thenGetTwo() { long count = customers .stream() - .filter(Customer::hasOverThousandPoints) + .filter(Customer::hasOverHundredPoints) .count(); assertThat(count).isEqualTo(2L); diff --git a/java-streams/src/test/java/com/baeldung/stream/filter/StreamFilterUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/filter/StreamFilterUnitTest.java index cf82802940..29190f7298 100644 --- a/java-streams/src/test/java/com/baeldung/stream/filter/StreamFilterUnitTest.java +++ b/java-streams/src/test/java/com/baeldung/stream/filter/StreamFilterUnitTest.java @@ -62,7 +62,7 @@ public class StreamFilterUnitTest { List customersWithMoreThan100Points = customers .stream() - .filter(Customer::hasOverThousandPoints) + .filter(Customer::hasOverHundredPoints) .collect(Collectors.toList()); assertThat(customersWithMoreThan100Points).hasSize(2); @@ -81,7 +81,7 @@ public class StreamFilterUnitTest { .flatMap(c -> c .map(Stream::of) .orElseGet(Stream::empty)) - .filter(Customer::hasOverThousandPoints) + .filter(Customer::hasOverHundredPoints) .collect(Collectors.toList()); assertThat(customersWithMoreThan100Points).hasSize(2); From 212ea5d83b68a5b053a3cda462bed2d3b9b1086b Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 17 Jan 2019 00:30:52 +0530 Subject: [PATCH 237/271] BAEL-2129 Added Unit test for Void Type in Kotlin article (#5944) --- .../baeldung/voidtypes/VoidTypesUnitTest.kt | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/voidtypes/VoidTypesUnitTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/voidtypes/VoidTypesUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/voidtypes/VoidTypesUnitTest.kt new file mode 100644 index 0000000000..5c285c3135 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/voidtypes/VoidTypesUnitTest.kt @@ -0,0 +1,51 @@ +package com.baeldung.voidtypes + +import org.junit.jupiter.api.Test +import kotlin.test.assertNull +import kotlin.test.assertTrue + +class VoidTypesUnitTest { + + fun returnTypeAsVoid(): Void? { + println("Function can have Void as return type") + return null + } + + fun unitReturnTypeForNonMeaningfulReturns(): Unit { + println("No meaningful return") + } + + fun unitReturnTypeIsImplicit() { + println("Unit Return type is implicit") + } + + fun alwaysThrowException(): Nothing { + throw IllegalArgumentException() + } + + fun invokeANothingOnlyFunction() { + alwaysThrowException() + + var name = "Tom" + } + + @Test + fun givenJavaVoidFunction_thenMappedToKotlinUnit() { + assertTrue(System.out.println() is Unit) + } + + @Test + fun givenVoidReturnType_thenReturnsNullOnly() { + assertNull(returnTypeAsVoid()) + } + + @Test + fun givenUnitReturnTypeDeclared_thenReturnsOfTypeUnit() { + assertTrue(unitReturnTypeForNonMeaningfulReturns() is Unit) + } + + @Test + fun givenUnitReturnTypeNotDeclared_thenReturnsOfTypeUnit() { + assertTrue(unitReturnTypeIsImplicit() is Unit) + } +} \ No newline at end of file From e6e0c065d509357f6a04bef853ad0f52c4c9e420 Mon Sep 17 00:00:00 2001 From: Rajesh Bhojwani Date: Thu, 17 Jan 2019 15:17:09 +0530 Subject: [PATCH 238/271] Added test file to demo the deletion of file content --- .../file/FilesClearDataManualTest.java | 98 +++++++++++++++++++ .../src/test/resources/fileexample.txt | 1 + 2 files changed, 99 insertions(+) create mode 100644 core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java create mode 100644 core-java-io/src/test/resources/fileexample.txt diff --git a/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java b/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java new file mode 100644 index 0000000000..8a4b3a7380 --- /dev/null +++ b/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java @@ -0,0 +1,98 @@ +package com.baeldung.file; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.nio.channels.FileChannel; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; + +import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.baeldung.util.StreamUtils; + +public class FilesClearDataManualTest { + + public static final String FILE_PATH = "src/test/resources/fileexample.txt"; + + @Before + @After + public void setup() throws IOException { + PrintWriter writer = new PrintWriter(FILE_PATH); + writer.print("This example shows how we can delete the file contents without deleting the file"); + writer.close(); + } + + @Test + public void givenExistingFile_whenDeleteContentUsingPrintWritter_thenEmptyFile() throws IOException { + PrintWriter writer = new PrintWriter(FILE_PATH); + writer.print(""); + writer.close(); + assertEquals(0, StreamUtils.getStringFromInputStream(new FileInputStream(FILE_PATH)).length()); + } + + @Test + public void givenExistingFile_whenDeleteContentUsingPrintWritterWithougObject_thenEmptyFile() throws IOException { + new PrintWriter(FILE_PATH).close(); + assertEquals(0, StreamUtils.getStringFromInputStream(new FileInputStream(FILE_PATH)).length()); + } + + + @Test + public void givenExistingFile_whenDeleteContentUsingFileWriter_thenEmptyFile() throws IOException { + new FileWriter(FILE_PATH, false).close(); + + assertEquals(0, StreamUtils.getStringFromInputStream(new FileInputStream(FILE_PATH)).length()); + } + + @Test + public void givenExistingFile_whenDeleteContentUsingFileOutputStream_thenEmptyFile() throws IOException { + new FileOutputStream(FILE_PATH).close(); + + assertEquals(0, StreamUtils.getStringFromInputStream(new FileInputStream(FILE_PATH)).length()); + } + + @Test + public void givenExistingFile_whenDeleteContentUsingFileUtils_thenEmptyFile() throws IOException { + FileUtils.write(new File(FILE_PATH), "", Charset.defaultCharset()); + + assertEquals(0, StreamUtils.getStringFromInputStream(new FileInputStream(FILE_PATH)).length()); + } + + @Test + public void givenExistingFile_whenDeleteContentUsingNIOFiles_thenEmptyFile() throws IOException { + BufferedWriter writer = Files.newBufferedWriter(Paths.get(FILE_PATH)); + writer.write(""); + writer.flush(); + + assertEquals(0, StreamUtils.getStringFromInputStream(new FileInputStream(FILE_PATH)).length()); + } + + @Test + public void givenExistingFile_whenDeleteContentUsingNIOFileChannel_thenEmptyFile() throws IOException { + FileChannel.open(Paths.get(FILE_PATH), StandardOpenOption.WRITE).truncate(0).close(); + + assertEquals(0, StreamUtils.getStringFromInputStream(new FileInputStream(FILE_PATH)).length()); + } + + @Test + public void givenExistingFile_whenDeleteContentUsingGuava_thenEmptyFile() throws IOException { + File file = new File(FILE_PATH); + byte[] empty = new byte[0]; + com.google.common.io.Files.write(empty, file); + + assertEquals(0, StreamUtils.getStringFromInputStream(new FileInputStream(FILE_PATH)).length()); + } + +} diff --git a/core-java-io/src/test/resources/fileexample.txt b/core-java-io/src/test/resources/fileexample.txt new file mode 100644 index 0000000000..ee48fdfb84 --- /dev/null +++ b/core-java-io/src/test/resources/fileexample.txt @@ -0,0 +1 @@ +This example shows how we can delete the file contents without deleting the file \ No newline at end of file From 273c569b88de74d048a1b7989021c686c9764dbf Mon Sep 17 00:00:00 2001 From: Rajesh Bhojwani Date: Thu, 17 Jan 2019 15:20:25 +0530 Subject: [PATCH 239/271] remove space --- .../test/java/com/baeldung/file/FilesClearDataManualTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java b/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java index 8a4b3a7380..c00290168c 100644 --- a/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java +++ b/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java @@ -47,7 +47,6 @@ public class FilesClearDataManualTest { new PrintWriter(FILE_PATH).close(); assertEquals(0, StreamUtils.getStringFromInputStream(new FileInputStream(FILE_PATH)).length()); } - @Test public void givenExistingFile_whenDeleteContentUsingFileWriter_thenEmptyFile() throws IOException { From b47140fdd2607b6565df0c49bda7933ab2300252 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Thu, 17 Jan 2019 15:44:27 +0100 Subject: [PATCH 240/271] Delete . .. --- java-streams/src/main/java/com/baeldung/stream/sum/. .. | 1 - 1 file changed, 1 deletion(-) delete mode 100644 java-streams/src/main/java/com/baeldung/stream/sum/. .. diff --git a/java-streams/src/main/java/com/baeldung/stream/sum/. .. b/java-streams/src/main/java/com/baeldung/stream/sum/. .. deleted file mode 100644 index 8b13789179..0000000000 --- a/java-streams/src/main/java/com/baeldung/stream/sum/. .. +++ /dev/null @@ -1 +0,0 @@ - From af1636fe23675e77fbb914d11c4f745978ed1a4e Mon Sep 17 00:00:00 2001 From: "Erick Audet M.Sc" Date: Thu, 17 Jan 2019 12:21:30 -0500 Subject: [PATCH 241/271] BAEL-2509 * New section in InputStream to byte array article and recreating branch. * Minor typo * Code reformat using intellij formatter. * Code reformat using intellij formatter. * guava implementation to be completed * guava implementation * Added assert to guava test * Fix formatting * Formatting using Baeldung format * Based on Josh comments, I removed some code BAEL-2509 * Removed all references to File * Update fork from upstream * Update fork from upstream * Merhe Upstream * Remove all references to FileInputStream (Josh Comments) * Delete CustomBaeldungQueueUnitTest.java --- .../io/InputStreamToByteBufferUnitTest.java | 64 +++++++++---------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/core-java-io/src/test/java/org/baeldung/java/io/InputStreamToByteBufferUnitTest.java b/core-java-io/src/test/java/org/baeldung/java/io/InputStreamToByteBufferUnitTest.java index fedadde04b..37f52fefea 100644 --- a/core-java-io/src/test/java/org/baeldung/java/io/InputStreamToByteBufferUnitTest.java +++ b/core-java-io/src/test/java/org/baeldung/java/io/InputStreamToByteBufferUnitTest.java @@ -1,60 +1,56 @@ package org.baeldung.java.io; - +import com.google.common.io.ByteSource; import com.google.common.io.ByteStreams; import org.apache.commons.io.IOUtils; -import org.junit.jupiter.api.Test; +import org.junit.Test; -import java.io.File; -import java.io.FileInputStream; +import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.channels.ReadableByteChannel; -import static org.junit.jupiter.api.Assertions.assertEquals; +import static java.nio.channels.Channels.newChannel; +import static org.junit.Assert.assertEquals; -class InputStreamToByteBufferUnitTest { +public class InputStreamToByteBufferUnitTest { @Test - public void givenUsingCoreClasses_whenWritingAFileIntoAByteBuffer_thenBytesLengthMustMatch() throws IOException { - File inputFile = getFile(); - ByteBuffer bufferByte = ByteBuffer.allocate((int) inputFile.length()); - FileInputStream in = new FileInputStream(inputFile); - in.getChannel().read(bufferByte); + public void givenUsingCoreClasses_whenByteArrayInputStreamToAByteBuffer_thenLengthMustMatch() throws IOException { + byte[] input = new byte[] { 0, 1, 2 }; + InputStream initialStream = new ByteArrayInputStream(input); + ByteBuffer byteBuffer = ByteBuffer.allocate(3); + while (initialStream.available() > 0) { + byteBuffer.put((byte) initialStream.read()); + } - assertEquals(bufferByte.position(), inputFile.length()); + assertEquals(byteBuffer.position(), input.length); } @Test - public void givenUsingCommonsIo_whenWritingAFileIntoAByteBuffer_thenBytesLengthMustMatch() throws IOException { - File inputFile = getFile(); - ByteBuffer bufferByte = ByteBuffer.allocateDirect((int) inputFile.length()); - ReadableByteChannel readableByteChannel = new FileInputStream(inputFile).getChannel(); - IOUtils.readFully(readableByteChannel, bufferByte); - - assertEquals(bufferByte.position(), inputFile.length()); - } - - @Test - public void givenUsingGuava_whenWritingAFileIntoAByteBuffer_thenBytesLengthMustMatch() throws IOException { - File inputFile = getFile(); - FileInputStream in = new FileInputStream(inputFile); - byte[] targetArray = ByteStreams.toByteArray(in); + public void givenUsingGuava__whenByteArrayInputStreamToAByteBuffer_thenLengthMustMatch() throws IOException { + InputStream initialStream = ByteSource + .wrap(new byte[] { 0, 1, 2 }) + .openStream(); + byte[] targetArray = ByteStreams.toByteArray(initialStream); ByteBuffer bufferByte = ByteBuffer.wrap(targetArray); - bufferByte.rewind(); while (bufferByte.hasRemaining()) { bufferByte.get(); } - - assertEquals(bufferByte.position(), inputFile.length()); + + assertEquals(bufferByte.position(), targetArray.length); } - private File getFile() { - ClassLoader classLoader = new InputStreamToByteBufferUnitTest().getClass().getClassLoader(); + @Test + public void givenUsingCommonsIo_whenByteArrayInputStreamToAByteBuffer_thenLengthMustMatch() throws IOException { + byte[] input = new byte[] { 0, 1, 2 }; + InputStream initialStream = new ByteArrayInputStream(input); + ByteBuffer byteBuffer = ByteBuffer.allocate(3); + ReadableByteChannel channel = newChannel(initialStream); + IOUtils.readFully(channel, byteBuffer); - String fileName = "frontenac-2257154_960_720.jpg"; - - return new File(classLoader.getResource(fileName).getFile()); + assertEquals(byteBuffer.position(), input.length); } } From 684ee6040e4fad45a30da1d7d46b86ce49913b34 Mon Sep 17 00:00:00 2001 From: Ger Roza Date: Thu, 17 Jan 2019 17:44:49 -0200 Subject: [PATCH 242/271] Added example for spring boot exception handling --- spring-boot-rest/README.md | 1 + spring-boot-rest/pom.xml | 11 ++++ .../boot/ErrorHandlingBootApplication.java | 15 +++++ .../MyCustomErrorAttributes.java | 23 +++++++ .../configurations/MyErrorController.java | 31 +++++++++ .../boot/web/FaultyRestController.java | 15 +++++ .../web/SpringBootRestApplication.java | 2 +- .../errorhandling-application.properties | 3 + .../boot/ErrorHandlingLiveTest.java | 65 +++++++++++++++++++ .../web/SpringContextIntegrationTest.java | 2 +- spring-rest-full/README.md | 1 - 11 files changed, 166 insertions(+), 3 deletions(-) create mode 100644 spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/ErrorHandlingBootApplication.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyCustomErrorAttributes.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyErrorController.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/web/FaultyRestController.java create mode 100644 spring-boot-rest/src/main/resources/errorhandling-application.properties create mode 100644 spring-boot-rest/src/test/java/com/baeldung/errorhandling/boot/ErrorHandlingLiveTest.java diff --git a/spring-boot-rest/README.md b/spring-boot-rest/README.md index 0a8d13cf76..2b955ddc5b 100644 --- a/spring-boot-rest/README.md +++ b/spring-boot-rest/README.md @@ -1,3 +1,4 @@ Module for the articles that are part of the Spring REST E-book: 1. [Bootstrap a Web Application with Spring 5](https://www.baeldung.com/bootstraping-a-web-application-with-spring-and-java-based-configuration) +2. [Error Handling for REST with Spring](http://www.baeldung.com/exception-handling-for-rest-with-spring) diff --git a/spring-boot-rest/pom.xml b/spring-boot-rest/pom.xml index baf9d35a09..3b8cf7e39e 100644 --- a/spring-boot-rest/pom.xml +++ b/spring-boot-rest/pom.xml @@ -20,12 +20,22 @@ org.springframework.boot spring-boot-starter-web + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + org.springframework.boot spring-boot-starter-test test + + net.sourceforge.htmlunit + htmlunit + ${htmlunit.version} + test + @@ -39,5 +49,6 @@ com.baeldung.SpringBootRestApplication + 2.32 diff --git a/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/ErrorHandlingBootApplication.java b/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/ErrorHandlingBootApplication.java new file mode 100644 index 0000000000..0885ecbbf7 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/ErrorHandlingBootApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.errorhandling.boot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; + +@SpringBootApplication +@PropertySource("errorhandling-application.properties") +public class ErrorHandlingBootApplication { + + public static void main(String[] args) { + SpringApplication.run(ErrorHandlingBootApplication.class, args); + } + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyCustomErrorAttributes.java b/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyCustomErrorAttributes.java new file mode 100644 index 0000000000..e2c62cb907 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyCustomErrorAttributes.java @@ -0,0 +1,23 @@ +package com.baeldung.errorhandling.boot.configurations; + +import java.util.Map; + +import org.springframework.boot.web.servlet.error.DefaultErrorAttributes; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.WebRequest; + +@Component +public class MyCustomErrorAttributes extends DefaultErrorAttributes { + + @Override + public Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { + Map errorAttributes = super.getErrorAttributes(webRequest, includeStackTrace); + errorAttributes.put("locale", webRequest.getLocale() + .toString()); + errorAttributes.remove("error"); + errorAttributes.put("cause", errorAttributes.get("message")); + errorAttributes.remove("message"); + errorAttributes.put("status", String.valueOf(errorAttributes.get("status"))); + return errorAttributes; + } +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyErrorController.java b/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyErrorController.java new file mode 100644 index 0000000000..427a0b43d7 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyErrorController.java @@ -0,0 +1,31 @@ +package com.baeldung.errorhandling.boot.configurations; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.boot.autoconfigure.web.ErrorProperties; +import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController; +import org.springframework.boot.web.servlet.error.ErrorAttributes; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestMapping; + +@Component +public class MyErrorController extends BasicErrorController { + + public MyErrorController(ErrorAttributes errorAttributes) { + super(errorAttributes, new ErrorProperties()); + } + + @RequestMapping(produces = MediaType.APPLICATION_XML_VALUE) + public ResponseEntity> xmlError(HttpServletRequest request) { + Map body = getErrorAttributes(request, isIncludeStackTrace(request, MediaType.APPLICATION_XML)); + body.put("xmlkey", "the XML response is different!"); + HttpStatus status = getStatus(request); + return new ResponseEntity<>(body, status); + } + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/web/FaultyRestController.java b/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/web/FaultyRestController.java new file mode 100644 index 0000000000..e56e395754 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/web/FaultyRestController.java @@ -0,0 +1,15 @@ +package com.baeldung.errorhandling.boot.web; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class FaultyRestController { + + @GetMapping("/exception") + public ResponseEntity requestWithException() { + throw new NullPointerException("Error in the faulty controller!"); + } + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/SpringBootRestApplication.java b/spring-boot-rest/src/main/java/com/baeldung/web/SpringBootRestApplication.java index 62aae7619d..c945b20aa1 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/web/SpringBootRestApplication.java +++ b/spring-boot-rest/src/main/java/com/baeldung/web/SpringBootRestApplication.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.web; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-boot-rest/src/main/resources/errorhandling-application.properties b/spring-boot-rest/src/main/resources/errorhandling-application.properties new file mode 100644 index 0000000000..994c517163 --- /dev/null +++ b/spring-boot-rest/src/main/resources/errorhandling-application.properties @@ -0,0 +1,3 @@ + +#server.error.whitelabel.enabled=false +#server.error.include-stacktrace=always \ No newline at end of file diff --git a/spring-boot-rest/src/test/java/com/baeldung/errorhandling/boot/ErrorHandlingLiveTest.java b/spring-boot-rest/src/test/java/com/baeldung/errorhandling/boot/ErrorHandlingLiveTest.java new file mode 100644 index 0000000000..e587b67fcf --- /dev/null +++ b/spring-boot-rest/src/test/java/com/baeldung/errorhandling/boot/ErrorHandlingLiveTest.java @@ -0,0 +1,65 @@ +package com.baeldung.errorhandling.boot; + +import static io.restassured.RestAssured.given; +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasKey; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.isA; +import static org.hamcrest.Matchers.not; + +import org.junit.jupiter.api.Test; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; + +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.html.HtmlPage; + +public class ErrorHandlingLiveTest { + + private static final String BASE_URL = "http://localhost:8080"; + private static final String EXCEPTION_ENDPOINT = "/exception"; + + private static final String ERROR_RESPONSE_KEY_PATH = "error"; + private static final String XML_RESPONSE_KEY_PATH = "xmlkey"; + private static final String LOCALE_RESPONSE_KEY_PATH = "locale"; + private static final String CAUSE_RESPONSE_KEY_PATH = "cause"; + private static final String RESPONSE_XML_ROOT = "Map"; + private static final String XML_RESPONSE_KEY_XML_PATH = RESPONSE_XML_ROOT + "." + XML_RESPONSE_KEY_PATH; + private static final String LOCALE_RESPONSE_KEY_XML_PATH = RESPONSE_XML_ROOT + "." + LOCALE_RESPONSE_KEY_PATH; + private static final String CAUSE_RESPONSE_KEY_XML_PATH = RESPONSE_XML_ROOT + "." + CAUSE_RESPONSE_KEY_PATH; + private static final String CAUSE_RESPONSE_VALUE = "Error in the faulty controller!"; + private static final String XML_RESPONSE_VALUE = "the XML response is different!"; + + @Test + public void whenRequestingFaultyEndpointAsJson_thenReceiveDefaultResponseWithConfiguredAttrs() { + given().header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) + .get(EXCEPTION_ENDPOINT) + .then() + .body("$", hasKey(LOCALE_RESPONSE_KEY_PATH)) + .body(CAUSE_RESPONSE_KEY_PATH, is(CAUSE_RESPONSE_VALUE)) + .body("$", not(hasKey(ERROR_RESPONSE_KEY_PATH))) + .body("$", not(hasKey(XML_RESPONSE_KEY_PATH))); + } + + @Test + public void whenRequestingFaultyEndpointAsXml_thenReceiveXmlResponseWithConfiguredAttrs() { + given().header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML_VALUE) + .get(EXCEPTION_ENDPOINT) + .then() + .body(LOCALE_RESPONSE_KEY_XML_PATH, isA(String.class)) + .body(CAUSE_RESPONSE_KEY_XML_PATH, is(CAUSE_RESPONSE_VALUE)) + .body(RESPONSE_XML_ROOT, not(hasKey(ERROR_RESPONSE_KEY_PATH))) + .body(XML_RESPONSE_KEY_XML_PATH, is(XML_RESPONSE_VALUE)); + } + + @Test + public void whenRequestingFaultyEndpointAsHtml_thenReceiveWhitelabelPageResponse() throws Exception { + try (WebClient webClient = new WebClient()) { + webClient.getOptions() + .setThrowExceptionOnFailingStatusCode(false); + HtmlPage page = webClient.getPage(BASE_URL + EXCEPTION_ENDPOINT); + assertThat(page.getBody() + .asText()).contains("Whitelabel Error Page"); + } + } +} diff --git a/spring-boot-rest/src/test/java/com/baeldung/web/SpringContextIntegrationTest.java b/spring-boot-rest/src/test/java/com/baeldung/web/SpringContextIntegrationTest.java index 0c1fdf372b..1e49df2909 100644 --- a/spring-boot-rest/src/test/java/com/baeldung/web/SpringContextIntegrationTest.java +++ b/spring-boot-rest/src/test/java/com/baeldung/web/SpringContextIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.boot.rest; +package com.baeldung.web; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-rest-full/README.md b/spring-rest-full/README.md index d429e17671..3a8d0a727a 100644 --- a/spring-rest-full/README.md +++ b/spring-rest-full/README.md @@ -18,7 +18,6 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com - [Metrics for your Spring REST API](http://www.baeldung.com/spring-rest-api-metrics) - [Bootstrap a Web Application with Spring 4](http://www.baeldung.com/bootstraping-a-web-application-with-spring-and-java-based-configuration) - [Build a REST API with Spring and Java Config](http://www.baeldung.com/building-a-restful-web-service-with-spring-and-java-based-configuration) -- [Error Handling for REST with Spring](http://www.baeldung.com/exception-handling-for-rest-with-spring) - [Spring Security Expressions - hasRole Example](https://www.baeldung.com/spring-security-expressions-basic) From 85eab12c0356015c763a97ba9f3deb5bf1b53d42 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 17 Jan 2019 23:22:05 +0200 Subject: [PATCH 243/271] Update and rename LeaveRequestStateTest.java to LeaveRequestStateUnitTest.java --- ...eaveRequestStateTest.java => LeaveRequestStateUnitTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/{LeaveRequestStateTest.java => LeaveRequestStateUnitTest.java} (96%) diff --git a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateUnitTest.java similarity index 96% rename from algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateTest.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateUnitTest.java index b209dcb2fb..796998907d 100644 --- a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateTest.java +++ b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateUnitTest.java @@ -4,7 +4,7 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; -public class LeaveRequestStateTest { +public class LeaveRequestStateUnitTest { @Test public void givenLeaveRequest_whenStateEscalated_thenResponsibleIsTeamLeader() { From 735b0a10b28a9868baeab71807e6ff5ab7e57119 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 17 Jan 2019 23:25:26 +0200 Subject: [PATCH 244/271] Update StreamFilterUnitTest.java --- .../java/com/baeldung/stream/filter/StreamFilterUnitTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/java-streams/src/test/java/com/baeldung/stream/filter/StreamFilterUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/filter/StreamFilterUnitTest.java index 29190f7298..5ad875f61e 100644 --- a/java-streams/src/test/java/com/baeldung/stream/filter/StreamFilterUnitTest.java +++ b/java-streams/src/test/java/com/baeldung/stream/filter/StreamFilterUnitTest.java @@ -156,4 +156,5 @@ public class StreamFilterUnitTest { }) .collect(Collectors.toList())).isInstanceOf(RuntimeException.class); } + } From 8510b07a5642e261eceb76711c3739e4379d359b Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 17 Jan 2019 23:27:50 +0200 Subject: [PATCH 245/271] Update FilesClearDataManualTest.java --- .../test/java/com/baeldung/file/FilesClearDataManualTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java b/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java index c00290168c..6abe677acf 100644 --- a/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java +++ b/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java @@ -93,5 +93,4 @@ public class FilesClearDataManualTest { assertEquals(0, StreamUtils.getStringFromInputStream(new FileInputStream(FILE_PATH)).length()); } - } From 98c9d22151efa5f098ee46d09511d436ec1e661f Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Thu, 17 Jan 2019 20:06:22 -0600 Subject: [PATCH 246/271] BAEL-2335 and BAEL-2413 README updates (#6152) * BAEL-2246: add link back to article * BAEL-2174: rename core-java-net module to core-java-networking * BAEL-2174: add link back to article * BAEL-2363 BAEL-2337 BAEL-1996 BAEL-2277 add links back to articles * BAEL-2367: add link back to article * BAEL-2335: add link back to article * BAEL-2413: add link back to article * Update README.MD --- core-java-collections-list/README.md | 1 + persistence-modules/spring-boot-persistence/README.MD | 2 ++ 2 files changed, 3 insertions(+) diff --git a/core-java-collections-list/README.md b/core-java-collections-list/README.md index a35e714006..d1112047ba 100644 --- a/core-java-collections-list/README.md +++ b/core-java-collections-list/README.md @@ -26,3 +26,4 @@ - [ClassCastException: Arrays$ArrayList cannot be cast to ArrayList](https://www.baeldung.com/java-classcastexception-arrays-arraylist) - [Flattening Nested Collections in Java](http://www.baeldung.com/java-flatten-nested-collections) - [Intersection of Two Lists in Java](https://www.baeldung.com/java-lists-intersection) +- [Multi Dimensional ArrayList in Java](https://www.baeldung.com/java-multi-dimensional-arraylist) diff --git a/persistence-modules/spring-boot-persistence/README.MD b/persistence-modules/spring-boot-persistence/README.MD index 8988fb4ebd..cab6be1ec8 100644 --- a/persistence-modules/spring-boot-persistence/README.MD +++ b/persistence-modules/spring-boot-persistence/README.MD @@ -5,3 +5,5 @@ - [Quick Guide on data.sql and schema.sql Files in Spring Boot](http://www.baeldung.com/spring-boot-data-sql-and-schema-sql) - [Configuring a Tomcat Connection Pool in Spring Boot](https://www.baeldung.com/spring-boot-tomcat-connection-pool) - [Hibernate Field Naming with Spring Boot](https://www.baeldung.com/hibernate-field-naming-spring-boot) +- [Integrating Spring Boot with HSQLDB](https://www.baeldung.com/spring-boot-hsqldb) + From af9a60bddfa284ceecc9a9396f5350be084186d3 Mon Sep 17 00:00:00 2001 From: Maiklins Date: Fri, 18 Jan 2019 04:31:13 +0100 Subject: [PATCH 247/271] BAEL-2217 forEach within forEach (#6166) --- .../kotlin/com/baeldung/forEach/forEach.kt | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/forEach/forEach.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/forEach/forEach.kt b/core-kotlin/src/main/kotlin/com/baeldung/forEach/forEach.kt new file mode 100644 index 0000000000..ef56009c71 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/forEach/forEach.kt @@ -0,0 +1,61 @@ +package com.baeldung.forEach + + +class Country(val name : String, val cities : List) + +class City(val name : String, val streets : List) + +class World { + + private val streetsOfAmsterdam = listOf("Herengracht", "Prinsengracht") + private val streetsOfBerlin = listOf("Unter den Linden","Tiergarten") + private val streetsOfMaastricht = listOf("Grote Gracht", "Vrijthof") + private val countries = listOf( + Country("Netherlands", listOf(City("Maastricht", streetsOfMaastricht), + City("Amsterdam", streetsOfAmsterdam))), + Country("Germany", listOf(City("Berlin", streetsOfBerlin)))) + + fun allCountriesIt() { + countries.forEach { println(it.name) } + } + + fun allCountriesItExplicit() { + countries.forEach { it -> println(it.name) } + } + + //here we cannot refer to 'it' anymore inside the forEach + fun allCountriesExplicit() { + countries.forEach { c -> println(c.name) } + } + + fun allNested() { + countries.forEach { + println(it.name) + it.cities.forEach { + println(" ${it.name}") + it.streets.forEach { println(" $it") } + } + } + } + + fun allTable() { + countries.forEach { c -> + c.cities.forEach { p -> + p.streets.forEach { println("${c.name} ${p.name} $it") } + } + } + } +} + +fun main(args : Array) { + + val world = World() + + world.allCountriesExplicit() + + world.allNested() + + world.allTable() +} + + From 97273bab7e5d1d615b5c9d3aae044ca2e7043510 Mon Sep 17 00:00:00 2001 From: PRIFTI Date: Fri, 18 Jan 2019 13:17:52 +0100 Subject: [PATCH 248/271] BAEL-2441: Removed the responsible variable. --- .../enumstatemachine/LeaveRequestStateTest.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateTest.java index b209dcb2fb..c246c16912 100644 --- a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateTest.java +++ b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/enumstatemachine/LeaveRequestStateTest.java @@ -10,9 +10,7 @@ public class LeaveRequestStateTest { public void givenLeaveRequest_whenStateEscalated_thenResponsibleIsTeamLeader() { LeaveRequestState state = LeaveRequestState.Escalated; - String responsible = state.responsiblePerson(); - - assertEquals(responsible, "Team Leader"); + assertEquals(state.responsiblePerson(), "Team Leader"); } @@ -20,9 +18,7 @@ public class LeaveRequestStateTest { public void givenLeaveRequest_whenStateApproved_thenResponsibleIsDepartmentManager() { LeaveRequestState state = LeaveRequestState.Approved; - String responsible = state.responsiblePerson(); - - assertEquals(responsible, "Department Manager"); + assertEquals(state.responsiblePerson(), "Department Manager"); } @Test From eb7cde988bceac9c5eb6f160d6dd186cdd254705 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Sat, 19 Jan 2019 05:38:13 +0330 Subject: [PATCH 249/271] JUnit 5 parameterized tests Issue: BAEL-1665 --- testing-modules/junit-5/pom.xml | 5 + .../BlankStringsArgumentsProvider.java | 19 +++ .../baeldung/parameterized/EnumsUnitTest.java | 50 ++++++++ .../parameterized/LocalDateUnitTest.java | 18 +++ .../com/baeldung/parameterized/Numbers.java | 8 ++ .../parameterized/NumbersUnitTest.java | 15 +++ .../com/baeldung/parameterized/Person.java | 20 ++++ .../parameterized/PersonAggregator.java | 15 +++ .../parameterized/PersonUnitTest.java | 31 +++++ .../parameterized/SlashyDateConverter.java | 27 +++++ .../baeldung/parameterized/StringParams.java | 10 ++ .../com/baeldung/parameterized/Strings.java | 8 ++ .../parameterized/StringsUnitTest.java | 108 ++++++++++++++++++ .../VariableArgumentsProvider.java | 45 ++++++++ .../parameterized/VariableSource.java | 19 +++ .../junit-5/src/test/resources/data.csv | 4 + 16 files changed, 402 insertions(+) create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/BlankStringsArgumentsProvider.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/EnumsUnitTest.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/LocalDateUnitTest.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/Numbers.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/NumbersUnitTest.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/Person.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/PersonAggregator.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/PersonUnitTest.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/SlashyDateConverter.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/StringParams.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/Strings.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/StringsUnitTest.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/VariableArgumentsProvider.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/parameterized/VariableSource.java create mode 100644 testing-modules/junit-5/src/test/resources/data.csv diff --git a/testing-modules/junit-5/pom.xml b/testing-modules/junit-5/pom.xml index b7600267d9..a5a1ddaf0b 100644 --- a/testing-modules/junit-5/pom.xml +++ b/testing-modules/junit-5/pom.xml @@ -21,6 +21,11 @@ junit-platform-engine ${junit.platform.version} + + org.junit.jupiter + junit-jupiter-params + ${junit.jupiter.version} + org.junit.platform junit-platform-runner diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/BlankStringsArgumentsProvider.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/BlankStringsArgumentsProvider.java new file mode 100644 index 0000000000..1d2c76d37b --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/BlankStringsArgumentsProvider.java @@ -0,0 +1,19 @@ +package com.baeldung.parameterized; + +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.ArgumentsProvider; + +import java.util.stream.Stream; + +class BlankStringsArgumentsProvider implements ArgumentsProvider { + + @Override + public Stream provideArguments(ExtensionContext context) { + return Stream.of( + Arguments.of((String) null), + Arguments.of(""), + Arguments.of(" ") + ); + } +} diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/EnumsUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/EnumsUnitTest.java new file mode 100644 index 0000000000..0b2068dbf1 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/EnumsUnitTest.java @@ -0,0 +1,50 @@ +package com.baeldung.parameterized; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; +import org.junit.jupiter.params.provider.EnumSource; + +import java.time.Month; +import java.util.EnumSet; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class EnumsUnitTest { + + @ParameterizedTest + @EnumSource(Month.class) + void getValueForAMonth_IsAlwaysBetweenOneAndTwelve(Month month) { + int monthNumber = month.getValue(); + assertTrue(monthNumber >= 1 && monthNumber <= 12); + } + + @ParameterizedTest(name = "{index} {0} is 30 days long") + @EnumSource(value = Month.class, names = {"APRIL", "JUNE", "SEPTEMBER", "NOVEMBER"}) + void someMonths_Are30DaysLong(Month month) { + final boolean isALeapYear = false; + assertEquals(30, month.length(isALeapYear)); + } + + @ParameterizedTest + @EnumSource(value = Month.class, names = {"APRIL", "JUNE", "SEPTEMBER", "NOVEMBER", "FEBRUARY"}, mode = EnumSource.Mode.EXCLUDE) + void exceptFourMonths_OthersAre31DaysLong(Month month) { + final boolean isALeapYear = false; + assertEquals(31, month.length(isALeapYear)); + } + + @ParameterizedTest + @EnumSource(value = Month.class, names = ".+BER", mode = EnumSource.Mode.MATCH_ANY) + void fourMonths_AreEndingWithBer(Month month) { + EnumSet months = EnumSet.of(Month.SEPTEMBER, Month.OCTOBER, Month.NOVEMBER, Month.DECEMBER); + assertTrue(months.contains(month)); + } + + @ParameterizedTest + @CsvSource({"APRIL", "JUNE", "SEPTEMBER", "NOVEMBER"}) + void someMonths_Are30DaysLongCsv(Month month) { + final boolean isALeapYear = false; + assertEquals(30, month.length(isALeapYear)); + } + +} diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/LocalDateUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/LocalDateUnitTest.java new file mode 100644 index 0000000000..95487705f5 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/LocalDateUnitTest.java @@ -0,0 +1,18 @@ +package com.baeldung.parameterized; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.converter.ConvertWith; +import org.junit.jupiter.params.provider.CsvSource; + +import java.time.LocalDate; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class LocalDateUnitTest { + + @ParameterizedTest + @CsvSource({"2018/12/25,2018", "2019/02/11,2019"}) + void getYear_ShouldWorkAsExpected(@ConvertWith(SlashyDateConverter.class) LocalDate date, int expected) { + assertEquals(expected, date.getYear()); + } +} diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/Numbers.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/Numbers.java new file mode 100644 index 0000000000..8a9b229aac --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/Numbers.java @@ -0,0 +1,8 @@ +package com.baeldung.parameterized; + +public class Numbers { + + public static boolean isOdd(int number) { + return number % 2 != 0; + } +} diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/NumbersUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/NumbersUnitTest.java new file mode 100644 index 0000000000..b3a3371bb2 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/NumbersUnitTest.java @@ -0,0 +1,15 @@ +package com.baeldung.parameterized; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +class NumbersUnitTest { + + @ParameterizedTest + @ValueSource(ints = {1, 3, 5, -3, 15, Integer.MAX_VALUE}) + void isOdd_ShouldReturnTrueForOddNumbers(int number) { + assertTrue(Numbers.isOdd(number)); + } +} \ No newline at end of file diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/Person.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/Person.java new file mode 100644 index 0000000000..225f11ba29 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/Person.java @@ -0,0 +1,20 @@ +package com.baeldung.parameterized; + +class Person { + + private final String firstName; + private final String middleName; + private final String lastName; + + public Person(String firstName, String middleName, String lastName) { + this.firstName = firstName; + this.middleName = middleName; + this.lastName = lastName; + } + + public String fullName() { + if (middleName == null || middleName.trim().isEmpty()) return String.format("%s %s", firstName, lastName); + + return String.format("%s %s %s", firstName, middleName, lastName); + } +} diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/PersonAggregator.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/PersonAggregator.java new file mode 100644 index 0000000000..df2ddc9e66 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/PersonAggregator.java @@ -0,0 +1,15 @@ +package com.baeldung.parameterized; + +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.params.aggregator.ArgumentsAccessor; +import org.junit.jupiter.params.aggregator.ArgumentsAggregationException; +import org.junit.jupiter.params.aggregator.ArgumentsAggregator; + +class PersonAggregator implements ArgumentsAggregator { + + @Override + public Object aggregateArguments(ArgumentsAccessor accessor, ParameterContext context) + throws ArgumentsAggregationException { + return new Person(accessor.getString(1), accessor.getString(2), accessor.getString(3)); + } +} diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/PersonUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/PersonUnitTest.java new file mode 100644 index 0000000000..b30ecc748e --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/PersonUnitTest.java @@ -0,0 +1,31 @@ +package com.baeldung.parameterized; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.aggregator.AggregateWith; +import org.junit.jupiter.params.aggregator.ArgumentsAccessor; +import org.junit.jupiter.params.provider.CsvSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class PersonUnitTest { + + @ParameterizedTest + @CsvSource({"Isaac,,Newton, Isaac Newton", "Charles,Robert,Darwin,Charles Robert Darwin"}) + void fullName_ShouldGenerateTheExpectedFullName(ArgumentsAccessor argumentsAccessor) { + String firstName = argumentsAccessor.getString(0); + String middleName = (String) argumentsAccessor.get(1); + String lastName = argumentsAccessor.get(2, String.class); + String expectedFullName = argumentsAccessor.getString(3); + + Person person = new Person(firstName, middleName, lastName); + assertEquals(expectedFullName, person.fullName()); + } + + @ParameterizedTest + @CsvSource({"Isaac Newton,Isaac,,Newton", "Charles Robert Darwin,Charles,Robert,Darwin"}) + void fullName_ShouldGenerateTheExpectedFullName(String expectedFullName, + @AggregateWith(PersonAggregator.class) Person person) { + + assertEquals(expectedFullName, person.fullName()); + } +} diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/SlashyDateConverter.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/SlashyDateConverter.java new file mode 100644 index 0000000000..40773d29a9 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/SlashyDateConverter.java @@ -0,0 +1,27 @@ +package com.baeldung.parameterized; + +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.params.converter.ArgumentConversionException; +import org.junit.jupiter.params.converter.ArgumentConverter; + +import java.time.LocalDate; + +class SlashyDateConverter implements ArgumentConverter { + + @Override + public Object convert(Object source, ParameterContext context) throws ArgumentConversionException { + if (!(source instanceof String)) + throw new IllegalArgumentException("The argument should be a string: " + source); + + try { + String[] parts = ((String) source).split("/"); + int year = Integer.parseInt(parts[0]); + int month = Integer.parseInt(parts[1]); + int day = Integer.parseInt(parts[2]); + + return LocalDate.of(year, month, day); + } catch (Exception e) { + throw new IllegalArgumentException("Failed to convert", e); + } + } +} diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/StringParams.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/StringParams.java new file mode 100644 index 0000000000..bc9f881bd4 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/StringParams.java @@ -0,0 +1,10 @@ +package com.baeldung.parameterized; + +import java.util.stream.Stream; + +public class StringParams { + + static Stream blankStrings() { + return Stream.of(null, "", " "); + } +} diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/Strings.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/Strings.java new file mode 100644 index 0000000000..f8e29f6b7f --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/Strings.java @@ -0,0 +1,8 @@ +package com.baeldung.parameterized; + +class Strings { + + static boolean isBlank(String input) { + return input == null || input.trim().isEmpty(); + } +} diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/StringsUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/StringsUnitTest.java new file mode 100644 index 0000000000..7d02a5a74b --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/StringsUnitTest.java @@ -0,0 +1,108 @@ +package com.baeldung.parameterized; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.*; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class StringsUnitTest { + + static Stream arguments = Stream.of( + Arguments.of(null, true), // null strings should be considered blank + Arguments.of("", true), + Arguments.of(" ", true), + Arguments.of("not blank", false) + ); + + @ParameterizedTest + @VariableSource("arguments") + void isBlank_ShouldReturnTrueForNullOrBlankStringsVariableSource(String input, boolean expected) { + assertEquals(expected, Strings.isBlank(input)); + } + + @ParameterizedTest + @ValueSource(strings = {"", " "}) + void isBlank_ShouldReturnTrueForNullOrBlankStrings(String input) { + assertTrue(Strings.isBlank(input)); + } + + @ParameterizedTest + @MethodSource("provideStringsForIsBlank") + void isBlank_ShouldReturnTrueForNullOrBlankStrings(String input, boolean expected) { + assertEquals(expected, Strings.isBlank(input)); + } + + @ParameterizedTest + @MethodSource // Please note method name is not provided + void isBlank_ShouldReturnTrueForNullOrBlankStringsOneArgument(String input) { + assertTrue(Strings.isBlank(input)); + } + + @ParameterizedTest + @MethodSource("com.baeldung.parameterized.StringParams#blankStrings") + void isBlank_ShouldReturnTrueForNullOrBlankStringsExternalSource(String input) { + assertTrue(Strings.isBlank(input)); + } + + @ParameterizedTest + @ArgumentsSource(BlankStringsArgumentsProvider.class) + void isBlank_ShouldReturnTrueForNullOrBlankStringsArgProvider(String input) { + assertTrue(Strings.isBlank(input)); + } + + private static Stream isBlank_ShouldReturnTrueForNullOrBlankStringsOneArgument() { + return Stream.of(null, "", " "); + } + + @ParameterizedTest + @MethodSource("provideStringsForIsBlankList") + void isBlank_ShouldReturnTrueForNullOrBlankStringsList(String input, boolean expected) { + assertEquals(expected, Strings.isBlank(input)); + } + + @ParameterizedTest + @CsvSource({"test,TEST", "tEst,TEST", "Java,JAVA"}) // Passing a CSV pair per test execution + void toUpperCase_ShouldGenerateTheExpectedUppercaseValue(String input, String expected) { + String actualValue = input.toUpperCase(); + assertEquals(expected, actualValue); + } + + @ParameterizedTest + @CsvSource(value = {"test:test", "tEst:test", "Java:java"}, delimiter =':') // Using : as the column separator. + void toLowerCase_ShouldGenerateTheExpectedLowercaseValue(String input, String expected) { + String actualValue = input.toLowerCase(); + assertEquals(expected, actualValue); + } + + @ParameterizedTest + @CsvFileSource(resources = "/data.csv", numLinesToSkip = 1) + void toUpperCase_ShouldGenerateTheExpectedUppercaseValueCSVFile(String input, String expected) { + String actualValue = input.toUpperCase(); + assertEquals(expected, actualValue); + } + + + + private static Stream provideStringsForIsBlank() { + return Stream.of( + Arguments.of(null, true), // null strings should be considered blank + Arguments.of("", true), + Arguments.of(" ", true), + Arguments.of("not blank", false) + ); + } + + private static List provideStringsForIsBlankList() { + return Arrays.asList( + Arguments.of(null, true), // null strings should be considered blank + Arguments.of("", true), + Arguments.of(" ", true), + Arguments.of("not blank", false) + ); + } +} \ No newline at end of file diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/VariableArgumentsProvider.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/VariableArgumentsProvider.java new file mode 100644 index 0000000000..a96d01e854 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/VariableArgumentsProvider.java @@ -0,0 +1,45 @@ +package com.baeldung.parameterized; + +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.ArgumentsProvider; +import org.junit.jupiter.params.support.AnnotationConsumer; + +import java.lang.reflect.Field; +import java.util.stream.Stream; + +class VariableArgumentsProvider implements ArgumentsProvider, AnnotationConsumer { + + private String variableName; + + @Override + public Stream provideArguments(ExtensionContext context) { + return context.getTestClass() + .map(this::getField) + .map(this::getValue) + .orElseThrow(() -> new IllegalArgumentException("Failed to load test arguments")); + } + + @Override + public void accept(VariableSource variableSource) { + variableName = variableSource.value(); + } + + private Field getField(Class clazz) { + try { + return clazz.getDeclaredField(variableName); + } catch (Exception e) { + return null; + } + } + + @SuppressWarnings("unchecked") + private Stream getValue(Field field) { + Object value = null; + try { + value = field.get(null); + } catch (Exception ignored) {} + + return value == null ? null : (Stream) value; + } +} diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/VariableSource.java b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/VariableSource.java new file mode 100644 index 0000000000..9c1d07c1be --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/parameterized/VariableSource.java @@ -0,0 +1,19 @@ +package com.baeldung.parameterized; + +import org.junit.jupiter.params.provider.ArgumentsSource; + +import java.lang.annotation.*; + +@Documented +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@ArgumentsSource(VariableArgumentsProvider.class) +public @interface VariableSource { + + /** + * Represents the name of the static variable to load the test arguments from. + * + * @return Static variable name. + */ + String value(); +} diff --git a/testing-modules/junit-5/src/test/resources/data.csv b/testing-modules/junit-5/src/test/resources/data.csv new file mode 100644 index 0000000000..321554cc23 --- /dev/null +++ b/testing-modules/junit-5/src/test/resources/data.csv @@ -0,0 +1,4 @@ +input,expected +test,TEST +tEst,TEST +Java,JAVA \ No newline at end of file From 8a307c1aba5b8d186f893e68273733ce67cbd882 Mon Sep 17 00:00:00 2001 From: Ger Roza Date: Sat, 19 Jan 2019 09:32:54 -0200 Subject: [PATCH 250/271] moved new package to existing one --- .../boot/ErrorHandlingBootApplication.java | 15 --------------- .../config}/MyCustomErrorAttributes.java | 2 +- .../config}/MyErrorController.java | 2 +- .../controller}/FaultyRestController.java | 4 ++-- .../src/main/resources/application.properties | 3 +++ .../errorhandling-application.properties | 3 --- .../boot => web/error}/ErrorHandlingLiveTest.java | 2 +- 7 files changed, 8 insertions(+), 23 deletions(-) delete mode 100644 spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/ErrorHandlingBootApplication.java rename spring-boot-rest/src/main/java/com/baeldung/{errorhandling/boot/configurations => web/config}/MyCustomErrorAttributes.java (93%) rename spring-boot-rest/src/main/java/com/baeldung/{errorhandling/boot/configurations => web/config}/MyErrorController.java (95%) rename spring-boot-rest/src/main/java/com/baeldung/{errorhandling/boot/web => web/controller}/FaultyRestController.java (73%) delete mode 100644 spring-boot-rest/src/main/resources/errorhandling-application.properties rename spring-boot-rest/src/test/java/com/baeldung/{errorhandling/boot => web/error}/ErrorHandlingLiveTest.java (98%) diff --git a/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/ErrorHandlingBootApplication.java b/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/ErrorHandlingBootApplication.java deleted file mode 100644 index 0885ecbbf7..0000000000 --- a/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/ErrorHandlingBootApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.errorhandling.boot; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.PropertySource; - -@SpringBootApplication -@PropertySource("errorhandling-application.properties") -public class ErrorHandlingBootApplication { - - public static void main(String[] args) { - SpringApplication.run(ErrorHandlingBootApplication.class, args); - } - -} diff --git a/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyCustomErrorAttributes.java b/spring-boot-rest/src/main/java/com/baeldung/web/config/MyCustomErrorAttributes.java similarity index 93% rename from spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyCustomErrorAttributes.java rename to spring-boot-rest/src/main/java/com/baeldung/web/config/MyCustomErrorAttributes.java index e2c62cb907..1948d5552f 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyCustomErrorAttributes.java +++ b/spring-boot-rest/src/main/java/com/baeldung/web/config/MyCustomErrorAttributes.java @@ -1,4 +1,4 @@ -package com.baeldung.errorhandling.boot.configurations; +package com.baeldung.web.config; import java.util.Map; diff --git a/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyErrorController.java b/spring-boot-rest/src/main/java/com/baeldung/web/config/MyErrorController.java similarity index 95% rename from spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyErrorController.java rename to spring-boot-rest/src/main/java/com/baeldung/web/config/MyErrorController.java index 427a0b43d7..e3716ec113 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/configurations/MyErrorController.java +++ b/spring-boot-rest/src/main/java/com/baeldung/web/config/MyErrorController.java @@ -1,4 +1,4 @@ -package com.baeldung.errorhandling.boot.configurations; +package com.baeldung.web.config; import java.util.Map; diff --git a/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/web/FaultyRestController.java b/spring-boot-rest/src/main/java/com/baeldung/web/controller/FaultyRestController.java similarity index 73% rename from spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/web/FaultyRestController.java rename to spring-boot-rest/src/main/java/com/baeldung/web/controller/FaultyRestController.java index e56e395754..bf7b7a5f99 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/errorhandling/boot/web/FaultyRestController.java +++ b/spring-boot-rest/src/main/java/com/baeldung/web/controller/FaultyRestController.java @@ -1,4 +1,4 @@ -package com.baeldung.errorhandling.boot.web; +package com.baeldung.web.controller; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -9,7 +9,7 @@ public class FaultyRestController { @GetMapping("/exception") public ResponseEntity requestWithException() { - throw new NullPointerException("Error in the faulty controller!"); + throw new RuntimeException("Error in the faulty controller!"); } } diff --git a/spring-boot-rest/src/main/resources/application.properties b/spring-boot-rest/src/main/resources/application.properties index e69de29bb2..e65440e2b9 100644 --- a/spring-boot-rest/src/main/resources/application.properties +++ b/spring-boot-rest/src/main/resources/application.properties @@ -0,0 +1,3 @@ +### Spring Boot default error handling configurations +#server.error.whitelabel.enabled=false +#server.error.include-stacktrace=always \ No newline at end of file diff --git a/spring-boot-rest/src/main/resources/errorhandling-application.properties b/spring-boot-rest/src/main/resources/errorhandling-application.properties deleted file mode 100644 index 994c517163..0000000000 --- a/spring-boot-rest/src/main/resources/errorhandling-application.properties +++ /dev/null @@ -1,3 +0,0 @@ - -#server.error.whitelabel.enabled=false -#server.error.include-stacktrace=always \ No newline at end of file diff --git a/spring-boot-rest/src/test/java/com/baeldung/errorhandling/boot/ErrorHandlingLiveTest.java b/spring-boot-rest/src/test/java/com/baeldung/web/error/ErrorHandlingLiveTest.java similarity index 98% rename from spring-boot-rest/src/test/java/com/baeldung/errorhandling/boot/ErrorHandlingLiveTest.java rename to spring-boot-rest/src/test/java/com/baeldung/web/error/ErrorHandlingLiveTest.java index e587b67fcf..ea1b6ab227 100644 --- a/spring-boot-rest/src/test/java/com/baeldung/errorhandling/boot/ErrorHandlingLiveTest.java +++ b/spring-boot-rest/src/test/java/com/baeldung/web/error/ErrorHandlingLiveTest.java @@ -1,4 +1,4 @@ -package com.baeldung.errorhandling.boot; +package com.baeldung.web.error; import static io.restassured.RestAssured.given; import static org.assertj.core.api.Assertions.assertThat; From dea88da77728edb77c12475ca551045ac2960503 Mon Sep 17 00:00:00 2001 From: Ger Roza Date: Sat, 19 Jan 2019 17:00:30 -0200 Subject: [PATCH 251/271] Adding dao dependencies and exception handling of original classes --- spring-boot-rest/pom.xml | 8 ++++ .../RestResponseEntityExceptionHandler.java | 41 +++++++++---------- .../web/exception/MyDataAccessException.java | 21 ---------- .../MyDataIntegrityViolationException.java | 21 ---------- 4 files changed, 28 insertions(+), 63 deletions(-) delete mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataAccessException.java delete mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataIntegrityViolationException.java diff --git a/spring-boot-rest/pom.xml b/spring-boot-rest/pom.xml index 3b8cf7e39e..f05d242072 100644 --- a/spring-boot-rest/pom.xml +++ b/spring-boot-rest/pom.xml @@ -24,6 +24,14 @@ com.fasterxml.jackson.dataformat jackson-dataformat-xml + + org.hibernate + hibernate-entitymanager + + + org.springframework + spring-jdbc + org.springframework.boot diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java b/spring-boot-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java index fe0465156d..2e2672f510 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java +++ b/spring-boot-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java @@ -1,5 +1,11 @@ package com.baeldung.web.error; +import javax.persistence.EntityNotFoundException; + +import org.hibernate.exception.ConstraintViolationException; +import org.springframework.dao.DataAccessException; +import org.springframework.dao.DataIntegrityViolationException; +import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -10,8 +16,6 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; -import com.baeldung.web.exception.MyDataAccessException; -import com.baeldung.web.exception.MyDataIntegrityViolationException; import com.baeldung.web.exception.MyResourceNotFoundException; @ControllerAdvice @@ -24,13 +28,15 @@ public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionH // API // 400 - /* - * Some examples of exceptions that we could retrieve as 400 (BAD_REQUEST) responses: - * Hibernate's ConstraintViolationException - * Spring's DataIntegrityViolationException - */ - @ExceptionHandler({ MyDataIntegrityViolationException.class }) - public ResponseEntity handleBadRequest(final MyDataIntegrityViolationException ex, final WebRequest request) { + + @ExceptionHandler({ ConstraintViolationException.class }) + public ResponseEntity handleBadRequest(final ConstraintViolationException ex, final WebRequest request) { + final String bodyOfResponse = "This should be application specific"; + return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.BAD_REQUEST, request); + } + + @ExceptionHandler({ DataIntegrityViolationException.class }) + public ResponseEntity handleBadRequest(final DataIntegrityViolationException ex, final WebRequest request) { final String bodyOfResponse = "This should be application specific"; return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.BAD_REQUEST, request); } @@ -50,23 +56,16 @@ public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionH // 404 - /* - * Some examples of exceptions that we could retrieve as 404 (NOT_FOUND) responses: - * Java Persistence's EntityNotFoundException - */ - @ExceptionHandler(value = { MyResourceNotFoundException.class }) + + @ExceptionHandler(value = { EntityNotFoundException.class, MyResourceNotFoundException.class }) protected ResponseEntity handleNotFound(final RuntimeException ex, final WebRequest request) { final String bodyOfResponse = "This should be application specific"; return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.NOT_FOUND, request); } // 409 - /* - * Some examples of exceptions that we could retrieve as 409 (CONFLICT) responses: - * Spring's InvalidDataAccessApiUsageException - * Spring's DataAccessException - */ - @ExceptionHandler({ MyDataAccessException.class}) + + @ExceptionHandler({ InvalidDataAccessApiUsageException.class, DataAccessException.class }) protected ResponseEntity handleConflict(final RuntimeException ex, final WebRequest request) { final String bodyOfResponse = "This should be application specific"; return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.CONFLICT, request); @@ -83,4 +82,4 @@ public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionH return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request); } -} +} \ No newline at end of file diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataAccessException.java b/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataAccessException.java deleted file mode 100644 index 8fc9a3a0ea..0000000000 --- a/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataAccessException.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.web.exception; - -public final class MyDataAccessException extends RuntimeException { - - public MyDataAccessException() { - super(); - } - - public MyDataAccessException(final String message, final Throwable cause) { - super(message, cause); - } - - public MyDataAccessException(final String message) { - super(message); - } - - public MyDataAccessException(final Throwable cause) { - super(cause); - } - -} diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataIntegrityViolationException.java b/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataIntegrityViolationException.java deleted file mode 100644 index 50adb09c09..0000000000 --- a/spring-boot-rest/src/main/java/com/baeldung/web/exception/MyDataIntegrityViolationException.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.web.exception; - -public final class MyDataIntegrityViolationException extends RuntimeException { - - public MyDataIntegrityViolationException() { - super(); - } - - public MyDataIntegrityViolationException(final String message, final Throwable cause) { - super(message, cause); - } - - public MyDataIntegrityViolationException(final String message) { - super(message); - } - - public MyDataIntegrityViolationException(final Throwable cause) { - super(cause); - } - -} From e03c0871ae561caf0a9b25695cf971c2bab0a921 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sat, 19 Jan 2019 23:14:25 +0100 Subject: [PATCH 252/271] [REORG-2531] Updated a test to illustrate use of File.separator --- .../java/com/baeldung/directories/NewDirectoryUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-io/src/test/java/com/baeldung/directories/NewDirectoryUnitTest.java b/core-java-io/src/test/java/com/baeldung/directories/NewDirectoryUnitTest.java index e0111c2702..d645782955 100644 --- a/core-java-io/src/test/java/com/baeldung/directories/NewDirectoryUnitTest.java +++ b/core-java-io/src/test/java/com/baeldung/directories/NewDirectoryUnitTest.java @@ -62,7 +62,7 @@ public class NewDirectoryUnitTest { @Test public void givenUnexistingNestedDirectories_whenMkdirs_thenTrue() { - File newDirectory = new File(TEMP_DIRECTORY, "new_directory"); + File newDirectory = new File(System.getProperty("java.io.tmpdir") + File.separator + "new_directory"); File nestedDirectory = new File(newDirectory, "nested_directory"); assertFalse(newDirectory.exists()); assertFalse(nestedDirectory.exists()); From 5408ed78fe23ace31fbb09317721ba5fa04746d2 Mon Sep 17 00:00:00 2001 From: Eric Martin Date: Sat, 19 Jan 2019 18:15:26 -0600 Subject: [PATCH 253/271] Delete . .. --- java-streams/src/test/java/com/baeldung/stream/sum/. .. | 1 - 1 file changed, 1 deletion(-) delete mode 100644 java-streams/src/test/java/com/baeldung/stream/sum/. .. diff --git a/java-streams/src/test/java/com/baeldung/stream/sum/. .. b/java-streams/src/test/java/com/baeldung/stream/sum/. .. deleted file mode 100644 index 8b13789179..0000000000 --- a/java-streams/src/test/java/com/baeldung/stream/sum/. .. +++ /dev/null @@ -1 +0,0 @@ - From c19558f42077593bf03445b8b4294603f1dc335b Mon Sep 17 00:00:00 2001 From: eric-martin Date: Sat, 19 Jan 2019 18:38:13 -0600 Subject: [PATCH 254/271] BAEL-2521: Moving LocalDateConverter to java-jpa --- .../src/main/java/com/baeldung/util/LocalDateConverter.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename persistence-modules/{spring-boot-persistence => java-jpa}/src/main/java/com/baeldung/util/LocalDateConverter.java (100%) diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/util/LocalDateConverter.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/util/LocalDateConverter.java similarity index 100% rename from persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/util/LocalDateConverter.java rename to persistence-modules/java-jpa/src/main/java/com/baeldung/util/LocalDateConverter.java From e2d10d45dbd5000879eb3598cd2a3ddd261480b7 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 20 Jan 2019 17:21:45 +0200 Subject: [PATCH 255/271] Update pom.xml --- lombok/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lombok/pom.xml b/lombok/pom.xml index 7ad2e3dc83..72bff8828a 100644 --- a/lombok/pom.xml +++ b/lombok/pom.xml @@ -80,7 +80,7 @@ 1.0.0.Final - 1.16.10.0 + 1.18.4.0 3.8.0 From c22af13c21fd2ce158e0177e82c7fd0dacc5ae1c Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 20 Jan 2019 17:26:27 +0200 Subject: [PATCH 256/271] Update pom.xml --- lombok/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lombok/pom.xml b/lombok/pom.xml index 72bff8828a..2acf9e240d 100644 --- a/lombok/pom.xml +++ b/lombok/pom.xml @@ -76,7 +76,7 @@ - 1.16.18 + 1.18.4 1.0.0.Final From c7a8627f1005c462b1bc213ed141612323ec9ca3 Mon Sep 17 00:00:00 2001 From: Alejandro Gervasio Date: Sun, 20 Jan 2019 13:52:39 -0300 Subject: [PATCH 257/271] BAEL-2545 - Configuring a DataSource Programatically in Spring Boot (#6139) * Initial Commit * Update UserRepositoryIntegrationTest.java * Update UserRepositoryIntegrationTest --- .../application/Application.java | 27 +++++++++++ .../datasources/DataSourceBean.java | 20 ++++++++ .../application/entities/User.java | 46 +++++++++++++++++++ .../repositories/UserRepository.java | 8 ++++ .../tests/UserRepositoryIntegrationTest.java | 28 +++++++++++ 5 files changed, 129 insertions(+) create mode 100644 persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/Application.java create mode 100644 persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/datasources/DataSourceBean.java create mode 100644 persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/entities/User.java create mode 100644 persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/repositories/UserRepository.java create mode 100644 persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootdatasourceconfig/tests/UserRepositoryIntegrationTest.java diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/Application.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/Application.java new file mode 100644 index 0000000000..e1f67c0185 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/Application.java @@ -0,0 +1,27 @@ +package com.baeldung.springbootdatasourceconfig.application; + +import com.baeldung.springbootdatasourceconfig.application.entities.User; +import com.baeldung.springbootdatasourceconfig.application.repositories.UserRepository; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + + @Bean + public CommandLineRunner run(UserRepository userRepository) throws Exception { + return (String[] args) -> { + User user1 = new User("John", "john@domain.com"); + User user2 = new User("Julie", "julie@domain.com"); + userRepository.save(user1); + userRepository.save(user2); + userRepository.findAll().forEach(user -> System.out.println(user.getName())); + }; + } +} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/datasources/DataSourceBean.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/datasources/DataSourceBean.java new file mode 100644 index 0000000000..9ef9b77aed --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/datasources/DataSourceBean.java @@ -0,0 +1,20 @@ +package com.baeldung.springbootdatasourceconfig.application.datasources; + +import javax.sql.DataSource; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class DataSourceBean { + + @Bean + public DataSource getDataSource() { + DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create(); + dataSourceBuilder.driverClassName("org.h2.Driver"); + dataSourceBuilder.url("jdbc:h2:mem:test"); + dataSourceBuilder.username("SA"); + dataSourceBuilder.password(""); + return dataSourceBuilder.build(); + } +} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/entities/User.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/entities/User.java new file mode 100644 index 0000000000..518a11701f --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/entities/User.java @@ -0,0 +1,46 @@ +package com.baeldung.springbootdatasourceconfig.application.entities; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "users") +public class User { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + private String name; + private String email; + + public User(){} + + public User(String name, String email) { + this.name = name; + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public String toString() { + return "User{" + "id=" + id + ", name=" + name + ", email=" + email + '}'; + } +} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/repositories/UserRepository.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/repositories/UserRepository.java new file mode 100644 index 0000000000..27929ead44 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootdatasourceconfig/application/repositories/UserRepository.java @@ -0,0 +1,8 @@ +package com.baeldung.springbootdatasourceconfig.application.repositories; + +import com.baeldung.springbootdatasourceconfig.application.entities.User; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface UserRepository extends CrudRepository {} diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootdatasourceconfig/tests/UserRepositoryIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootdatasourceconfig/tests/UserRepositoryIntegrationTest.java new file mode 100644 index 0000000000..f27681021e --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootdatasourceconfig/tests/UserRepositoryIntegrationTest.java @@ -0,0 +1,28 @@ +package com.baeldung.springbootdatasourceconfig.tests; + +import com.baeldung.springbootdatasourceconfig.application.entities.User; +import com.baeldung.springbootdatasourceconfig.application.repositories.UserRepository; +import java.util.List; +import java.util.Optional; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.runner.RunWith; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@DataJpaTest +public class UserRepositoryIntegrationTest { + + @Autowired + private UserRepository userRepository; + + @Test + public void whenCalledSave_thenCorrectNumberOfUsers() { + userRepository.save(new User("Bob", "bob@domain.com")); + List users = (List) userRepository.findAll(); + + assertThat(users.size()).isEqualTo(1); + } +} From 0fb2adfe99fdbbb5d313c41c3d04e5cb9478425c Mon Sep 17 00:00:00 2001 From: Philippe M Date: Sun, 20 Jan 2019 19:38:14 +0100 Subject: [PATCH 258/271] Fix performance issues of JMeter Test Plan (#5979) --- .../resources/scripts/JMeter/Test Plan.jmx | 289 +++++++++--------- 1 file changed, 142 insertions(+), 147 deletions(-) diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx b/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx index da32a13a22..97640dfac7 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx @@ -1,5 +1,5 @@ - + @@ -25,80 +25,116 @@ - - true - 1 - - - - - - Content-Type - application/json + + + + Content-Type + application/json + + + + + + true + + + + false + {"customerRewardsId":null,"customerId":${random},"transactionDate":null} + = - + + localhost + 8080 + http + + /transactions/add + POST + true + false + true + false + + + + + + + txnId + $.id + 1 + all + foo + - + + txnDate + $.transactionDate + 1 + Never + + + + custId + $.customerId + 1 + all + bob + + + + + + + + localhost + 8080 + + + /rewards/find/${custId} + GET + true + false + true + false + + + + + + + rwdId + $.id + 1 + 0 + all + + + + + ${__jexl3(${rwdId} == 0,)} + true + true + + + true false - {"customerRewardsId":null,"customerId":${random},"transactionDate":null} + {"customerId":${custId}} = localhost 8080 - http - - /transactions/add - POST - true - false - true - false - - - - - - - txnId - $.id - 1 - all - foo - - - - txnDate - $.transactionDate - 1 - Never - - - - custId - $.customerId - 1 - all - bob - - - - - - - - localhost - 8080 - /rewards/find/${custId} - GET + /rewards/add + POST true false true @@ -112,98 +148,57 @@ rwdId $.id 1 - 0 + bar all - - ${rwdId} == 0 - true - - - - true - - - - false - {"customerId":${custId}} - = - - - - localhost - 8080 - - - /rewards/add - POST - true - false - true - false - - - - - - - rwdId - $.id - 1 - bar - all - - - - - - true - - - - false - {"id":${txnId},"customerRewardsId":${rwdId},"customerId":${custId},"transactionDate":"${txnDate}"} - = - - - - localhost - 8080 - - - /transactions/add - POST - true - false - true - false - - - - - - - - - - localhost - 8080 - - - /transactions/findAll/${rwdId} - GET - true - false - true - false - - - - - + + true + + + + false + {"id":${txnId},"customerRewardsId":${rwdId},"customerId":${custId},"transactionDate":"${txnDate}"} + = + + + + localhost + 8080 + + + /transactions/add + POST + true + false + true + false + + + + + + + + + + localhost + 8080 + + + /transactions/findAll/${rwdId} + GET + true + false + true + false + + + + + 10000 1 @@ -213,7 +208,7 @@ random - + false saveConfig From 08b8c427bd1784f0dc0de4f43f7638a0aabcdfc3 Mon Sep 17 00:00:00 2001 From: Rajesh Bhojwani Date: Mon, 21 Jan 2019 08:15:38 +0530 Subject: [PATCH 259/271] rename file --- ...ilesClearDataManualTest.java => FilesClearDataUnitTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename core-java-io/src/test/java/com/baeldung/file/{FilesClearDataManualTest.java => FilesClearDataUnitTest.java} (98%) diff --git a/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java b/core-java-io/src/test/java/com/baeldung/file/FilesClearDataUnitTest.java similarity index 98% rename from core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java rename to core-java-io/src/test/java/com/baeldung/file/FilesClearDataUnitTest.java index c00290168c..653c4320c0 100644 --- a/core-java-io/src/test/java/com/baeldung/file/FilesClearDataManualTest.java +++ b/core-java-io/src/test/java/com/baeldung/file/FilesClearDataUnitTest.java @@ -22,7 +22,7 @@ import org.junit.Test; import com.baeldung.util.StreamUtils; -public class FilesClearDataManualTest { +public class FilesClearDataUnitTest { public static final String FILE_PATH = "src/test/resources/fileexample.txt"; From 3aff027b7a7e47a4700604b0b44ae45f48fa3c9b Mon Sep 17 00:00:00 2001 From: Urvy Agrawal Date: Mon, 21 Jan 2019 11:23:24 +0530 Subject: [PATCH 260/271] Adding file for BAEL-2558 --- .../BitwiseOperatorExample.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/bitwiseoperator/BitwiseOperatorExample.java diff --git a/core-java/src/main/java/com/baeldung/bitwiseoperator/BitwiseOperatorExample.java b/core-java/src/main/java/com/baeldung/bitwiseoperator/BitwiseOperatorExample.java new file mode 100644 index 0000000000..4fef92102a --- /dev/null +++ b/core-java/src/main/java/com/baeldung/bitwiseoperator/BitwiseOperatorExample.java @@ -0,0 +1,56 @@ +package com.baeldung.bitwiseoperator; + +public class BitwiseOperatorExample { + + public static void main(String[] args) { + + int value1 = 6; + int value2 = 5; + + // Bitwise AND Operator + int result = value1 & value2; + System.out.println("result : " + result); + + // Bitwise OR Operator + result = value1 | value2; + System.out.println("result : " + result); + + // Bitwise Exclusive OR Operator + result = value1 ^ value2; + System.out.println("result : " + result); + + // Bitwise NOT operator + result = ~value1; + System.out.println("result : " + result); + + // Right Shift Operator with positive number + int value = 12; + int rightShift = value >> 2; + System.out.println("rightShift result with positive number : " + rightShift); + + // Right Shift Operator with negative number + value = -12; + rightShift = value >> 2; + System.out.println("rightShift result with negative number : " + rightShift); + + // Left Shift Operator with positive number + value = 1; + int leftShift = value << 1; + System.out.println("leftShift result with positive number : " + leftShift); + + // Left Shift Operator with negative number + value = -12; + leftShift = value << 2; + System.out.println("leftShift result with negative number : " + leftShift); + + // Unsigned Right Shift Operator with positive number + value = 12; + int unsignedRightShift = value >>> 2; + System.out.println("unsignedRightShift result with positive number : " + unsignedRightShift); + + // Unsigned Right Shift Operator with negative number + value = -12; + unsignedRightShift = value >>> 2; + System.out.println("unsignedRightShift result with negative number : " + unsignedRightShift); + } +} From 369655aa02adf178b3d813edbc97ee603a963ffc Mon Sep 17 00:00:00 2001 From: pcoates33 Date: Mon, 21 Jan 2019 08:14:06 +0000 Subject: [PATCH 261/271] spring-boot ehcache example added (#6136) --- .../cachetest/config/CacheConfig.java | 49 +------------------ .../cachetest/config/CacheEventLogger.java | 11 ++--- .../cachetest/rest/NumberController.java | 16 +++--- .../cachetest/service/NumberService.java | 15 +++--- .../src/main/resources/application.properties | 1 + spring-ehcache/src/main/resources/ehcache.xml | 31 ++++++++++++ 6 files changed, 54 insertions(+), 69 deletions(-) create mode 100644 spring-ehcache/src/main/resources/application.properties create mode 100644 spring-ehcache/src/main/resources/ehcache.xml diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheConfig.java b/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheConfig.java index 3cf2309cb9..5e72b5dcfc 100644 --- a/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheConfig.java +++ b/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheConfig.java @@ -1,57 +1,10 @@ package com.baeldung.cachetest.config; -import java.math.BigDecimal; -import java.time.Duration; - -import javax.cache.CacheManager; - -import org.ehcache.config.CacheConfiguration; -import org.ehcache.config.ResourcePools; -import org.ehcache.config.builders.CacheConfigurationBuilder; -import org.ehcache.config.builders.CacheEventListenerConfigurationBuilder; -import org.ehcache.config.builders.ExpiryPolicyBuilder; -import org.ehcache.config.builders.ResourcePoolsBuilder; -import org.ehcache.config.units.EntryUnit; -import org.ehcache.config.units.MemoryUnit; -import org.ehcache.event.EventType; -import org.ehcache.jsr107.Eh107Configuration; -import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer; import org.springframework.cache.annotation.EnableCaching; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration @EnableCaching public class CacheConfig { - - private static final int ON_HEAP_CACHE_SIZE_ENTRIES = 2; - private static final int OFF_HEAP_CACHE_SIZE_MB = 10; - private static final int CACHE_EXPIRY_SECONDS = 30; - - @Bean - public JCacheManagerCustomizer jcacheManagerCustomizer() { - return new JCacheManagerCustomizer() { - - @Override - public void customize(CacheManager cacheManager) { - ResourcePools resourcePools = ResourcePoolsBuilder.newResourcePoolsBuilder() - .heap(ON_HEAP_CACHE_SIZE_ENTRIES, EntryUnit.ENTRIES) - .offheap(OFF_HEAP_CACHE_SIZE_MB, MemoryUnit.MB).build(); - - CacheEventListenerConfigurationBuilder eventLoggerConfig = CacheEventListenerConfigurationBuilder - .newEventListenerConfiguration(new CacheEventLogger(), EventType.CREATED, EventType.EXPIRED) - .unordered().asynchronous(); - - CacheConfiguration cacheConfiguration = CacheConfigurationBuilder - .newCacheConfigurationBuilder(Long.class, BigDecimal.class, resourcePools) - .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(CACHE_EXPIRY_SECONDS))) - .add(eventLoggerConfig).build(); - - cacheManager.createCache("squareCache", - Eh107Configuration.fromEhcacheCacheConfiguration(cacheConfiguration)); - - } - }; - } - + } diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java b/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java index c8ead85f1e..dcaec57010 100644 --- a/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java +++ b/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java @@ -7,12 +7,11 @@ import org.slf4j.LoggerFactory; public class CacheEventLogger implements CacheEventListener { - private static final Logger log = LoggerFactory.getLogger(CacheEventLogger.class); + private static final Logger log = LoggerFactory.getLogger(CacheEventLogger.class); - @Override - public void onEvent(CacheEvent cacheEvent) { - log.info("Cache event {} for item with key {}. Old value = {}, New value = {}", cacheEvent.getType(), - cacheEvent.getKey(), cacheEvent.getOldValue(), cacheEvent.getNewValue()); - } + @Override + public void onEvent(CacheEvent cacheEvent) { + log.info("Cache event {} for item with key {}. Old value = {}, New value = {}", cacheEvent.getType(), cacheEvent.getKey(), cacheEvent.getOldValue(), cacheEvent.getNewValue()); + } } diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/rest/NumberController.java b/spring-ehcache/src/main/java/com/baeldung/cachetest/rest/NumberController.java index 4115c34cc4..15b5c93dfe 100644 --- a/spring-ehcache/src/main/java/com/baeldung/cachetest/rest/NumberController.java +++ b/spring-ehcache/src/main/java/com/baeldung/cachetest/rest/NumberController.java @@ -15,15 +15,15 @@ import com.baeldung.cachetest.service.NumberService; @RequestMapping(path = "/number", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public class NumberController { - private final static Logger log = LoggerFactory.getLogger(NumberController.class); + private final static Logger log = LoggerFactory.getLogger(NumberController.class); - @Autowired - private NumberService numberService; + @Autowired + private NumberService numberService; - @GetMapping(path = "/square/{number}") - public String getThing(@PathVariable Long number) { - log.info("call numberService to square {}", number); - return String.format("{\"square\": %s}", numberService.square(number)); - } + @GetMapping(path = "/square/{number}") + public String getThing(@PathVariable Long number) { + log.info("call numberService to square {}", number); + return String.format("{\"square\": %s}", numberService.square(number)); + } } diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/service/NumberService.java b/spring-ehcache/src/main/java/com/baeldung/cachetest/service/NumberService.java index bcd930f5e1..45fb841867 100644 --- a/spring-ehcache/src/main/java/com/baeldung/cachetest/service/NumberService.java +++ b/spring-ehcache/src/main/java/com/baeldung/cachetest/service/NumberService.java @@ -10,13 +10,14 @@ import org.springframework.stereotype.Service; @Service public class NumberService { - private final static Logger log = LoggerFactory.getLogger(NumberService.class); + private final static Logger log = LoggerFactory.getLogger(NumberService.class); - @Cacheable(value = "squareCache", key = "#number", condition = "#number>10") - public BigDecimal square(Long number) { - BigDecimal square = BigDecimal.valueOf(number).multiply(BigDecimal.valueOf(number)); - log.info("square of {} is {}", number, square); - return square; - } + @Cacheable(value = "squareCache", key = "#number", condition = "#number>10") + public BigDecimal square(Long number) { + BigDecimal square = BigDecimal.valueOf(number) + .multiply(BigDecimal.valueOf(number)); + log.info("square of {} is {}", number, square); + return square; + } } diff --git a/spring-ehcache/src/main/resources/application.properties b/spring-ehcache/src/main/resources/application.properties new file mode 100644 index 0000000000..a5c2964d32 --- /dev/null +++ b/spring-ehcache/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.cache.jcache.config=classpath:ehcache.xml \ No newline at end of file diff --git a/spring-ehcache/src/main/resources/ehcache.xml b/spring-ehcache/src/main/resources/ehcache.xml new file mode 100644 index 0000000000..caba0f2cc4 --- /dev/null +++ b/spring-ehcache/src/main/resources/ehcache.xml @@ -0,0 +1,31 @@ + + + + java.lang.Long + java.math.BigDecimal + + 30 + + + + + com.baeldung.cachetest.config.CacheEventLogger + ASYNCHRONOUS + UNORDERED + CREATED + EXPIRED + + + + + 2 + 10 + + + + \ No newline at end of file From 14b65b327f571594f1572df4c145a0097cd272e8 Mon Sep 17 00:00:00 2001 From: Ger Roza Date: Sun, 20 Jan 2019 18:19:52 -0200 Subject: [PATCH 262/271] moved Rest Pagination article code from spring-rest-full to spring-boot-rest --- spring-boot-rest/README.md | 1 + spring-boot-rest/pom.xml | 30 ++++- .../{web => }/SpringBootRestApplication.java | 2 +- .../com/baeldung/persistence/IOperations.java | 16 +++ .../com/baeldung/persistence/dao/IFooDao.java | 9 ++ .../com/baeldung/persistence/model/Foo.java | 83 ++++++++++++++ .../persistence/service/IFooService.java | 13 +++ .../service/common/AbstractService.java | 31 ++++++ .../persistence/service/impl/FooService.java | 40 +++++++ .../baeldung/spring/PersistenceConfig.java | 85 +++++++++++++++ .../java/com/baeldung/spring/WebConfig.java | 43 ++++++++ .../web/config/MyErrorController.java | 1 - .../com/baeldung/web/config/WebConfig.java | 8 -- .../web/controller/FooController.java | 89 +++++++++++++++ .../web/controller/RootController.java | 40 +++++++ .../event/PaginatedResultsRetrievedEvent.java | 2 +- .../hateoas/event/ResourceCreatedEvent.java | 28 +++++ ...sultsRetrievedDiscoverabilityListener.java | 6 +- ...esourceCreatedDiscoverabilityListener.java | 36 ++++++ .../java/com/baeldung/web/util/LinkUtil.java | 36 ++++++ .../baeldung/web/util/RestPreconditions.java | 48 ++++++++ .../src/main/resources/application.properties | 3 + .../main/resources/persistence-h2.properties | 22 ++++ .../resources/persistence-mysql.properties | 10 ++ .../resources/springDataPersistenceConfig.xml | 12 ++ .../src/test/java/com/baeldung/Consts.java | 5 + .../SpringContextIntegrationTest.java | 2 +- .../common/web/AbstractBasicLiveTest.java | 103 ++++++++++++++++++ .../baeldung/common/web/AbstractLiveTest.java | 65 +++++++++++ .../spring/ConfigIntegrationTest.java | 17 +++ .../java/com/baeldung/test/IMarshaller.java | 15 +++ .../com/baeldung/test/JacksonMarshaller.java | 81 ++++++++++++++ .../baeldung/test/TestMarshallerFactory.java | 49 +++++++++ .../java/com/baeldung/web/FooLiveTest.java | 36 ++++++ .../baeldung/web/FooPageableLiveTest.java | 22 ++-- .../baeldung/web/LiveTestSuiteLiveTest.java | 14 +++ .../web/error/ErrorHandlingLiveTest.java | 7 +- .../baeldung/web/util/HTTPLinkHeaderUtil.java | 36 ++++++ spring-rest-full/README.md | 1 - .../org/baeldung/persistence/IOperations.java | 4 - .../persistence/service/IFooService.java | 4 - .../service/common/AbstractService.java | 7 -- .../persistence/service/impl/FooService.java | 7 -- .../web/controller/FooController.java | 31 ------ .../baeldung/web/util/RestPreconditions.java | 3 +- .../common/web/AbstractBasicLiveTest.java | 80 +------------- .../web/AbstractDiscoverabilityLiveTest.java | 5 +- .../baeldung/web/LiveTestSuiteLiveTest.java | 1 - 48 files changed, 1125 insertions(+), 164 deletions(-) rename spring-boot-rest/src/main/java/com/baeldung/{web => }/SpringBootRestApplication.java (92%) create mode 100644 spring-boot-rest/src/main/java/com/baeldung/persistence/IOperations.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/persistence/dao/IFooDao.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/persistence/model/Foo.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/persistence/service/IFooService.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/persistence/service/common/AbstractService.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/persistence/service/impl/FooService.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/spring/PersistenceConfig.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/spring/WebConfig.java delete mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/config/WebConfig.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/controller/FooController.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/controller/RootController.java rename {spring-rest-full/src/main/java/org => spring-boot-rest/src/main/java/com}/baeldung/web/hateoas/event/PaginatedResultsRetrievedEvent.java (97%) create mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/hateoas/event/ResourceCreatedEvent.java rename {spring-rest-full/src/main/java/org => spring-boot-rest/src/main/java/com}/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java (96%) create mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/hateoas/listener/ResourceCreatedDiscoverabilityListener.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/util/LinkUtil.java create mode 100644 spring-boot-rest/src/main/java/com/baeldung/web/util/RestPreconditions.java create mode 100644 spring-boot-rest/src/main/resources/persistence-h2.properties create mode 100644 spring-boot-rest/src/main/resources/persistence-mysql.properties create mode 100644 spring-boot-rest/src/main/resources/springDataPersistenceConfig.xml create mode 100644 spring-boot-rest/src/test/java/com/baeldung/Consts.java rename spring-boot-rest/src/test/java/com/baeldung/{web => }/SpringContextIntegrationTest.java (92%) create mode 100644 spring-boot-rest/src/test/java/com/baeldung/common/web/AbstractBasicLiveTest.java create mode 100644 spring-boot-rest/src/test/java/com/baeldung/common/web/AbstractLiveTest.java create mode 100644 spring-boot-rest/src/test/java/com/baeldung/spring/ConfigIntegrationTest.java create mode 100644 spring-boot-rest/src/test/java/com/baeldung/test/IMarshaller.java create mode 100644 spring-boot-rest/src/test/java/com/baeldung/test/JacksonMarshaller.java create mode 100644 spring-boot-rest/src/test/java/com/baeldung/test/TestMarshallerFactory.java create mode 100644 spring-boot-rest/src/test/java/com/baeldung/web/FooLiveTest.java rename {spring-rest-full/src/test/java/org => spring-boot-rest/src/test/java/com}/baeldung/web/FooPageableLiveTest.java (86%) create mode 100644 spring-boot-rest/src/test/java/com/baeldung/web/LiveTestSuiteLiveTest.java create mode 100644 spring-boot-rest/src/test/java/com/baeldung/web/util/HTTPLinkHeaderUtil.java diff --git a/spring-boot-rest/README.md b/spring-boot-rest/README.md index 2b955ddc5b..2c89a64a00 100644 --- a/spring-boot-rest/README.md +++ b/spring-boot-rest/README.md @@ -2,3 +2,4 @@ Module for the articles that are part of the Spring REST E-book: 1. [Bootstrap a Web Application with Spring 5](https://www.baeldung.com/bootstraping-a-web-application-with-spring-and-java-based-configuration) 2. [Error Handling for REST with Spring](http://www.baeldung.com/exception-handling-for-rest-with-spring) +3. [REST Pagination in Spring](http://www.baeldung.com/rest-api-pagination-in-spring) \ No newline at end of file diff --git a/spring-boot-rest/pom.xml b/spring-boot-rest/pom.xml index f05d242072..bcd0381603 100644 --- a/spring-boot-rest/pom.xml +++ b/spring-boot-rest/pom.xml @@ -1,5 +1,6 @@ - 4.0.0 com.baeldung.web @@ -24,7 +25,7 @@ com.fasterxml.jackson.dataformat jackson-dataformat-xml - + org.hibernate hibernate-entitymanager @@ -32,6 +33,30 @@ org.springframework spring-jdbc + + org.springframework.data + spring-data-jpa + + + com.h2database + h2 + + + org.springframework + spring-tx + + + org.springframework.data + spring-data-commons + + + + + + com.google.guava + guava + ${guava.version} + org.springframework.boot @@ -58,5 +83,6 @@ com.baeldung.SpringBootRestApplication 2.32 + 27.0.1-jre diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/SpringBootRestApplication.java b/spring-boot-rest/src/main/java/com/baeldung/SpringBootRestApplication.java similarity index 92% rename from spring-boot-rest/src/main/java/com/baeldung/web/SpringBootRestApplication.java rename to spring-boot-rest/src/main/java/com/baeldung/SpringBootRestApplication.java index c945b20aa1..62aae7619d 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/web/SpringBootRestApplication.java +++ b/spring-boot-rest/src/main/java/com/baeldung/SpringBootRestApplication.java @@ -1,4 +1,4 @@ -package com.baeldung.web; +package com.baeldung; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-boot-rest/src/main/java/com/baeldung/persistence/IOperations.java b/spring-boot-rest/src/main/java/com/baeldung/persistence/IOperations.java new file mode 100644 index 0000000000..d8996ca50d --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/persistence/IOperations.java @@ -0,0 +1,16 @@ +package com.baeldung.persistence; + +import java.io.Serializable; + +import org.springframework.data.domain.Page; + +public interface IOperations { + + // read - all + + Page findPaginated(int page, int size); + + // write + + T create(final T entity); +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/persistence/dao/IFooDao.java b/spring-boot-rest/src/main/java/com/baeldung/persistence/dao/IFooDao.java new file mode 100644 index 0000000000..59394d0d28 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/persistence/dao/IFooDao.java @@ -0,0 +1,9 @@ +package com.baeldung.persistence.dao; + +import org.springframework.data.jpa.repository.JpaRepository; + +import com.baeldung.persistence.model.Foo; + +public interface IFooDao extends JpaRepository { + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/persistence/model/Foo.java b/spring-boot-rest/src/main/java/com/baeldung/persistence/model/Foo.java new file mode 100644 index 0000000000..9af3d07bed --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/persistence/model/Foo.java @@ -0,0 +1,83 @@ +package com.baeldung.persistence.model; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class Foo implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + + @Column(nullable = false) + private String name; + + public Foo() { + super(); + } + + public Foo(final String name) { + super(); + + this.name = name; + } + + // API + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + // + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Foo other = (Foo) obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Foo [name=").append(name).append("]"); + return builder.toString(); + } + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/persistence/service/IFooService.java b/spring-boot-rest/src/main/java/com/baeldung/persistence/service/IFooService.java new file mode 100644 index 0000000000..0f165238eb --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/persistence/service/IFooService.java @@ -0,0 +1,13 @@ +package com.baeldung.persistence.service; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import com.baeldung.persistence.IOperations; +import com.baeldung.persistence.model.Foo; + +public interface IFooService extends IOperations { + + Page findPaginated(Pageable pageable); + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/persistence/service/common/AbstractService.java b/spring-boot-rest/src/main/java/com/baeldung/persistence/service/common/AbstractService.java new file mode 100644 index 0000000000..871f768895 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/persistence/service/common/AbstractService.java @@ -0,0 +1,31 @@ +package com.baeldung.persistence.service.common; + +import java.io.Serializable; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.persistence.IOperations; + +@Transactional +public abstract class AbstractService implements IOperations { + + // read - all + + @Override + public Page findPaginated(final int page, final int size) { + return getDao().findAll(PageRequest.of(page, size)); + } + + // write + + @Override + public T create(final T entity) { + return getDao().save(entity); + } + + protected abstract PagingAndSortingRepository getDao(); + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/persistence/service/impl/FooService.java b/spring-boot-rest/src/main/java/com/baeldung/persistence/service/impl/FooService.java new file mode 100644 index 0000000000..9d705f51d3 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/persistence/service/impl/FooService.java @@ -0,0 +1,40 @@ +package com.baeldung.persistence.service.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.persistence.dao.IFooDao; +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.service.IFooService; +import com.baeldung.persistence.service.common.AbstractService; + +@Service +@Transactional +public class FooService extends AbstractService implements IFooService { + + @Autowired + private IFooDao dao; + + public FooService() { + super(); + } + + // API + + @Override + protected PagingAndSortingRepository getDao() { + return dao; + } + + // custom methods + + @Override + public Page findPaginated(Pageable pageable) { + return dao.findAll(pageable); + } + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/spring/PersistenceConfig.java b/spring-boot-rest/src/main/java/com/baeldung/spring/PersistenceConfig.java new file mode 100644 index 0000000000..4a4b9eee3f --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/spring/PersistenceConfig.java @@ -0,0 +1,85 @@ +package com.baeldung.spring; + +import java.util.Properties; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.google.common.base.Preconditions; + +@Configuration +@EnableTransactionManagement +@PropertySource({ "classpath:persistence-${envTarget:h2}.properties" }) +@ComponentScan({ "com.baeldung.persistence" }) +// @ImportResource("classpath*:springDataPersistenceConfig.xml") +@EnableJpaRepositories(basePackages = "com.baeldung.persistence.dao") +public class PersistenceConfig { + + @Autowired + private Environment env; + + public PersistenceConfig() { + super(); + } + + @Bean + public LocalContainerEntityManagerFactoryBean entityManagerFactory() { + final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(dataSource()); + em.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); + + final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); + // vendorAdapter.set + em.setJpaVendorAdapter(vendorAdapter); + em.setJpaProperties(additionalProperties()); + + return em; + } + + @Bean + public DataSource dataSource() { + final DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); + dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); + dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); + dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); + + return dataSource; + } + + @Bean + public PlatformTransactionManager transactionManager() { + final JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(entityManagerFactory().getObject()); + + return transactionManager; + } + + @Bean + public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { + return new PersistenceExceptionTranslationPostProcessor(); + } + + final Properties additionalProperties() { + final Properties hibernateProperties = new Properties(); + hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); + // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); + return hibernateProperties; + } + +} \ No newline at end of file diff --git a/spring-boot-rest/src/main/java/com/baeldung/spring/WebConfig.java b/spring-boot-rest/src/main/java/com/baeldung/spring/WebConfig.java new file mode 100644 index 0000000000..39aade174b --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/spring/WebConfig.java @@ -0,0 +1,43 @@ +package com.baeldung.spring; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.view.InternalResourceViewResolver; + +@Configuration +@ComponentScan("com.baeldung.web") +@EnableWebMvc +public class WebConfig implements WebMvcConfigurer { + + public WebConfig() { + super(); + } + + @Bean + public ViewResolver viewResolver() { + final InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); + viewResolver.setPrefix("/WEB-INF/view/"); + viewResolver.setSuffix(".jsp"); + return viewResolver; + } + + // API + @Override + public void addViewControllers(final ViewControllerRegistry registry) { + registry.addViewController("/graph.html"); + registry.addViewController("/homepage.html"); + } + + @Override + public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { + configurer.defaultContentType(MediaType.APPLICATION_JSON); + } + +} \ No newline at end of file diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/config/MyErrorController.java b/spring-boot-rest/src/main/java/com/baeldung/web/config/MyErrorController.java index e3716ec113..cf3f9c4dbd 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/web/config/MyErrorController.java +++ b/spring-boot-rest/src/main/java/com/baeldung/web/config/MyErrorController.java @@ -27,5 +27,4 @@ public class MyErrorController extends BasicErrorController { HttpStatus status = getStatus(request); return new ResponseEntity<>(body, status); } - } diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/config/WebConfig.java b/spring-boot-rest/src/main/java/com/baeldung/web/config/WebConfig.java deleted file mode 100644 index 808e946218..0000000000 --- a/spring-boot-rest/src/main/java/com/baeldung/web/config/WebConfig.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.web.config; - -import org.springframework.context.annotation.Configuration; - -@Configuration -public class WebConfig { - -} \ No newline at end of file diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/controller/FooController.java b/spring-boot-rest/src/main/java/com/baeldung/web/controller/FooController.java new file mode 100644 index 0000000000..b35295cf99 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/web/controller/FooController.java @@ -0,0 +1,89 @@ +package com.baeldung.web.controller; + +import java.util.List; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.util.UriComponentsBuilder; + +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.service.IFooService; +import com.baeldung.web.exception.MyResourceNotFoundException; +import com.baeldung.web.hateoas.event.PaginatedResultsRetrievedEvent; +import com.baeldung.web.hateoas.event.ResourceCreatedEvent; +import com.google.common.base.Preconditions; + +@Controller +@RequestMapping(value = "/auth/foos") +public class FooController { + + @Autowired + private ApplicationEventPublisher eventPublisher; + + @Autowired + private IFooService service; + + public FooController() { + super(); + } + + // API + + // read - all + + @RequestMapping(params = { "page", "size" }, method = RequestMethod.GET) + @ResponseBody + public List findPaginated(@RequestParam("page") final int page, @RequestParam("size") final int size, + final UriComponentsBuilder uriBuilder, final HttpServletResponse response) { + final Page resultPage = service.findPaginated(page, size); + if (page > resultPage.getTotalPages()) { + throw new MyResourceNotFoundException(); + } + eventPublisher.publishEvent(new PaginatedResultsRetrievedEvent(Foo.class, uriBuilder, response, page, + resultPage.getTotalPages(), size)); + + return resultPage.getContent(); + } + + @GetMapping("/pageable") + @ResponseBody + public List findPaginatedWithPageable(Pageable pageable, final UriComponentsBuilder uriBuilder, + final HttpServletResponse response) { + final Page resultPage = service.findPaginated(pageable); + if (pageable.getPageNumber() > resultPage.getTotalPages()) { + throw new MyResourceNotFoundException(); + } + eventPublisher.publishEvent(new PaginatedResultsRetrievedEvent(Foo.class, uriBuilder, response, + pageable.getPageNumber(), resultPage.getTotalPages(), pageable.getPageSize())); + + return resultPage.getContent(); + } + + // write + + @RequestMapping(method = RequestMethod.POST) + @ResponseStatus(HttpStatus.CREATED) + @ResponseBody + public Foo create(@RequestBody final Foo resource, final HttpServletResponse response) { + Preconditions.checkNotNull(resource); + final Foo foo = service.create(resource); + final Long idOfCreatedResource = foo.getId(); + + eventPublisher.publishEvent(new ResourceCreatedEvent(this, response, idOfCreatedResource)); + + return foo; + } +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/controller/RootController.java b/spring-boot-rest/src/main/java/com/baeldung/web/controller/RootController.java new file mode 100644 index 0000000000..436e41e8eb --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/web/controller/RootController.java @@ -0,0 +1,40 @@ +package com.baeldung.web.controller; + +import java.net.URI; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.util.UriTemplate; + +import com.baeldung.web.util.LinkUtil; + +@Controller +@RequestMapping(value = "/auth/") +public class RootController { + + public RootController() { + super(); + } + + // API + + // discover + + @RequestMapping(value = "admin", method = RequestMethod.GET) + @ResponseStatus(value = HttpStatus.NO_CONTENT) + public void adminRoot(final HttpServletRequest request, final HttpServletResponse response) { + final String rootUri = request.getRequestURL() + .toString(); + + final URI fooUri = new UriTemplate("{rootUri}/{resource}").expand(rootUri, "foo"); + final String linkToFoo = LinkUtil.createLinkHeader(fooUri.toASCIIString(), "collection"); + response.addHeader("Link", linkToFoo); + } + +} diff --git a/spring-rest-full/src/main/java/org/baeldung/web/hateoas/event/PaginatedResultsRetrievedEvent.java b/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/event/PaginatedResultsRetrievedEvent.java similarity index 97% rename from spring-rest-full/src/main/java/org/baeldung/web/hateoas/event/PaginatedResultsRetrievedEvent.java rename to spring-boot-rest/src/main/java/com/baeldung/web/hateoas/event/PaginatedResultsRetrievedEvent.java index 01f7e658f1..f62fbf6247 100644 --- a/spring-rest-full/src/main/java/org/baeldung/web/hateoas/event/PaginatedResultsRetrievedEvent.java +++ b/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/event/PaginatedResultsRetrievedEvent.java @@ -1,4 +1,4 @@ -package org.baeldung.web.hateoas.event; +package com.baeldung.web.hateoas.event; import java.io.Serializable; diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/event/ResourceCreatedEvent.java b/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/event/ResourceCreatedEvent.java new file mode 100644 index 0000000000..b602f7ec4b --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/event/ResourceCreatedEvent.java @@ -0,0 +1,28 @@ +package com.baeldung.web.hateoas.event; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.context.ApplicationEvent; + +public class ResourceCreatedEvent extends ApplicationEvent { + private final HttpServletResponse response; + private final long idOfNewResource; + + public ResourceCreatedEvent(final Object source, final HttpServletResponse response, final long idOfNewResource) { + super(source); + + this.response = response; + this.idOfNewResource = idOfNewResource; + } + + // API + + public HttpServletResponse getResponse() { + return response; + } + + public long getIdOfNewResource() { + return idOfNewResource; + } + +} diff --git a/spring-rest-full/src/main/java/org/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java b/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java similarity index 96% rename from spring-rest-full/src/main/java/org/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java rename to spring-boot-rest/src/main/java/com/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java index 603c91007d..bb60bab171 100644 --- a/spring-rest-full/src/main/java/org/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java +++ b/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java @@ -1,13 +1,13 @@ -package org.baeldung.web.hateoas.listener; +package com.baeldung.web.hateoas.listener; import javax.servlet.http.HttpServletResponse; -import org.baeldung.web.hateoas.event.PaginatedResultsRetrievedEvent; -import org.baeldung.web.util.LinkUtil; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; import org.springframework.web.util.UriComponentsBuilder; +import com.baeldung.web.hateoas.event.PaginatedResultsRetrievedEvent; +import com.baeldung.web.util.LinkUtil; import com.google.common.base.Preconditions; import com.google.common.net.HttpHeaders; diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/listener/ResourceCreatedDiscoverabilityListener.java b/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/listener/ResourceCreatedDiscoverabilityListener.java new file mode 100644 index 0000000000..37afcdace4 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/listener/ResourceCreatedDiscoverabilityListener.java @@ -0,0 +1,36 @@ +package com.baeldung.web.hateoas.listener; + +import java.net.URI; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.http.HttpHeaders; +import com.baeldung.web.hateoas.event.ResourceCreatedEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; + +import com.google.common.base.Preconditions; + +@Component +class ResourceCreatedDiscoverabilityListener implements ApplicationListener { + + @Override + public void onApplicationEvent(final ResourceCreatedEvent resourceCreatedEvent) { + Preconditions.checkNotNull(resourceCreatedEvent); + + final HttpServletResponse response = resourceCreatedEvent.getResponse(); + final long idOfNewResource = resourceCreatedEvent.getIdOfNewResource(); + + addLinkHeaderOnResourceCreation(response, idOfNewResource); + } + + void addLinkHeaderOnResourceCreation(final HttpServletResponse response, final long idOfNewResource) { + // final String requestUrl = request.getRequestURL().toString(); + // final URI uri = new UriTemplate("{requestUrl}/{idOfNewResource}").expand(requestUrl, idOfNewResource); + + final URI uri = ServletUriComponentsBuilder.fromCurrentRequestUri().path("/{idOfNewResource}").buildAndExpand(idOfNewResource).toUri(); + response.setHeader(HttpHeaders.LOCATION, uri.toASCIIString()); + } + +} \ No newline at end of file diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/util/LinkUtil.java b/spring-boot-rest/src/main/java/com/baeldung/web/util/LinkUtil.java new file mode 100644 index 0000000000..3ebba8ae1c --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/web/util/LinkUtil.java @@ -0,0 +1,36 @@ +package com.baeldung.web.util; + +import javax.servlet.http.HttpServletResponse; + +/** + * Provides some constants and utility methods to build a Link Header to be stored in the {@link HttpServletResponse} object + */ +public final class LinkUtil { + + public static final String REL_COLLECTION = "collection"; + public static final String REL_NEXT = "next"; + public static final String REL_PREV = "prev"; + public static final String REL_FIRST = "first"; + public static final String REL_LAST = "last"; + + private LinkUtil() { + throw new AssertionError(); + } + + // + + /** + * Creates a Link Header to be stored in the {@link HttpServletResponse} to provide Discoverability features to the user + * + * @param uri + * the base uri + * @param rel + * the relative path + * + * @return the complete url + */ + public static String createLinkHeader(final String uri, final String rel) { + return "<" + uri + ">; rel=\"" + rel + "\""; + } + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/util/RestPreconditions.java b/spring-boot-rest/src/main/java/com/baeldung/web/util/RestPreconditions.java new file mode 100644 index 0000000000..d86aeeebd1 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/web/util/RestPreconditions.java @@ -0,0 +1,48 @@ +package com.baeldung.web.util; + +import org.springframework.http.HttpStatus; + +import com.baeldung.web.exception.MyResourceNotFoundException; + +/** + * Simple static methods to be called at the start of your own methods to verify correct arguments and state. If the Precondition fails, an {@link HttpStatus} code is thrown + */ +public final class RestPreconditions { + + private RestPreconditions() { + throw new AssertionError(); + } + + // API + + /** + * Check if some value was found, otherwise throw exception. + * + * @param expression + * has value true if found, otherwise false + * @throws MyResourceNotFoundException + * if expression is false, means value not found. + */ + public static void checkFound(final boolean expression) { + if (!expression) { + throw new MyResourceNotFoundException(); + } + } + + /** + * Check if some value was found, otherwise throw exception. + * + * @param expression + * has value true if found, otherwise false + * @throws MyResourceNotFoundException + * if expression is false, means value not found. + */ + public static T checkFound(final T resource) { + if (resource == null) { + throw new MyResourceNotFoundException(); + } + + return resource; + } + +} diff --git a/spring-boot-rest/src/main/resources/application.properties b/spring-boot-rest/src/main/resources/application.properties index e65440e2b9..a0179f1e4b 100644 --- a/spring-boot-rest/src/main/resources/application.properties +++ b/spring-boot-rest/src/main/resources/application.properties @@ -1,3 +1,6 @@ +server.port=8082 +server.servlet.context-path=/spring-boot-rest + ### Spring Boot default error handling configurations #server.error.whitelabel.enabled=false #server.error.include-stacktrace=always \ No newline at end of file diff --git a/spring-boot-rest/src/main/resources/persistence-h2.properties b/spring-boot-rest/src/main/resources/persistence-h2.properties new file mode 100644 index 0000000000..839a466533 --- /dev/null +++ b/spring-boot-rest/src/main/resources/persistence-h2.properties @@ -0,0 +1,22 @@ +## jdbc.X +#jdbc.driverClassName=com.mysql.jdbc.Driver +#jdbc.url=jdbc:mysql://localhost:3306/spring_hibernate4_01?createDatabaseIfNotExist=true +#jdbc.user=tutorialuser +#jdbc.pass=tutorialmy5ql +# +## hibernate.X +#hibernate.dialect=org.hibernate.dialect.MySQL5Dialect +#hibernate.show_sql=false +#hibernate.hbm2ddl.auto=create-drop + + +# jdbc.X +jdbc.driverClassName=org.h2.Driver +jdbc.url=jdbc:h2:mem:security_permission;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +jdbc.user=sa +jdbc.pass= + +# hibernate.X +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=false +hibernate.hbm2ddl.auto=create-drop diff --git a/spring-boot-rest/src/main/resources/persistence-mysql.properties b/spring-boot-rest/src/main/resources/persistence-mysql.properties new file mode 100644 index 0000000000..8263b0d9ac --- /dev/null +++ b/spring-boot-rest/src/main/resources/persistence-mysql.properties @@ -0,0 +1,10 @@ +# jdbc.X +jdbc.driverClassName=com.mysql.jdbc.Driver +jdbc.url=jdbc:mysql://localhost:3306/spring_hibernate4_01?createDatabaseIfNotExist=true +jdbc.user=tutorialuser +jdbc.pass=tutorialmy5ql + +# hibernate.X +hibernate.dialect=org.hibernate.dialect.MySQL5Dialect +hibernate.show_sql=false +hibernate.hbm2ddl.auto=create-drop diff --git a/spring-boot-rest/src/main/resources/springDataPersistenceConfig.xml b/spring-boot-rest/src/main/resources/springDataPersistenceConfig.xml new file mode 100644 index 0000000000..5ea2d9c05b --- /dev/null +++ b/spring-boot-rest/src/main/resources/springDataPersistenceConfig.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/spring-boot-rest/src/test/java/com/baeldung/Consts.java b/spring-boot-rest/src/test/java/com/baeldung/Consts.java new file mode 100644 index 0000000000..e33efd589e --- /dev/null +++ b/spring-boot-rest/src/test/java/com/baeldung/Consts.java @@ -0,0 +1,5 @@ +package com.baeldung; + +public interface Consts { + int APPLICATION_PORT = 8082; +} diff --git a/spring-boot-rest/src/test/java/com/baeldung/web/SpringContextIntegrationTest.java b/spring-boot-rest/src/test/java/com/baeldung/SpringContextIntegrationTest.java similarity index 92% rename from spring-boot-rest/src/test/java/com/baeldung/web/SpringContextIntegrationTest.java rename to spring-boot-rest/src/test/java/com/baeldung/SpringContextIntegrationTest.java index 1e49df2909..25fbc4cc02 100644 --- a/spring-boot-rest/src/test/java/com/baeldung/web/SpringContextIntegrationTest.java +++ b/spring-boot-rest/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.web; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-boot-rest/src/test/java/com/baeldung/common/web/AbstractBasicLiveTest.java b/spring-boot-rest/src/test/java/com/baeldung/common/web/AbstractBasicLiveTest.java new file mode 100644 index 0000000000..61eb9400cc --- /dev/null +++ b/spring-boot-rest/src/test/java/com/baeldung/common/web/AbstractBasicLiveTest.java @@ -0,0 +1,103 @@ +package com.baeldung.common.web; + +import static com.baeldung.web.util.HTTPLinkHeaderUtil.extractURIByRel; +import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; + +import java.io.Serializable; +import java.util.List; + +import org.junit.Test; + +import com.google.common.net.HttpHeaders; + +import io.restassured.RestAssured; +import io.restassured.response.Response; + +public abstract class AbstractBasicLiveTest extends AbstractLiveTest { + + public AbstractBasicLiveTest(final Class clazzToSet) { + super(clazzToSet); + } + + // find - all - paginated + + @Test + public void whenResourcesAreRetrievedPaged_then200IsReceived() { + create(); + + final Response response = RestAssured.get(getURL() + "?page=0&size=10"); + + assertThat(response.getStatusCode(), is(200)); + } + + @Test + public void whenPageOfResourcesAreRetrievedOutOfBounds_then404IsReceived() { + final String url = getURL() + "?page=" + randomNumeric(5) + "&size=10"; + final Response response = RestAssured.get(url); + + assertThat(response.getStatusCode(), is(404)); + } + + @Test + public void givenResourcesExist_whenFirstPageIsRetrieved_thenPageContainsResources() { + create(); + + final Response response = RestAssured.get(getURL() + "?page=0&size=10"); + + assertFalse(response.body().as(List.class).isEmpty()); + } + + @Test + public void whenFirstPageOfResourcesAreRetrieved_thenSecondPageIsNext() { + create(); + create(); + create(); + + final Response response = RestAssured.get(getURL() + "?page=0&size=2"); + + final String uriToNextPage = extractURIByRel(response.getHeader(HttpHeaders.LINK), "next"); + assertEquals(getURL() + "?page=1&size=2", uriToNextPage); + } + + @Test + public void whenFirstPageOfResourcesAreRetrieved_thenNoPreviousPage() { + final Response response = RestAssured.get(getURL() + "?page=0&size=2"); + + final String uriToPrevPage = extractURIByRel(response.getHeader(HttpHeaders.LINK), "prev"); + assertNull(uriToPrevPage); + } + + @Test + public void whenSecondPageOfResourcesAreRetrieved_thenFirstPageIsPrevious() { + create(); + create(); + + final Response response = RestAssured.get(getURL() + "?page=1&size=2"); + + final String uriToPrevPage = extractURIByRel(response.getHeader(HttpHeaders.LINK), "prev"); + assertEquals(getURL() + "?page=0&size=2", uriToPrevPage); + } + + @Test + public void whenLastPageOfResourcesIsRetrieved_thenNoNextPageIsDiscoverable() { + create(); + create(); + create(); + + final Response first = RestAssured.get(getURL() + "?page=0&size=2"); + final String uriToLastPage = extractURIByRel(first.getHeader(HttpHeaders.LINK), "last"); + + final Response response = RestAssured.get(uriToLastPage); + + final String uriToNextPage = extractURIByRel(response.getHeader(HttpHeaders.LINK), "next"); + assertNull(uriToNextPage); + } + + // count + +} diff --git a/spring-boot-rest/src/test/java/com/baeldung/common/web/AbstractLiveTest.java b/spring-boot-rest/src/test/java/com/baeldung/common/web/AbstractLiveTest.java new file mode 100644 index 0000000000..d26632bc38 --- /dev/null +++ b/spring-boot-rest/src/test/java/com/baeldung/common/web/AbstractLiveTest.java @@ -0,0 +1,65 @@ +package com.baeldung.common.web; + +import io.restassured.RestAssured; +import io.restassured.response.Response; + +import static com.baeldung.Consts.APPLICATION_PORT; + +import java.io.Serializable; + +import org.springframework.beans.factory.annotation.Autowired; + +import com.baeldung.test.IMarshaller; +import com.google.common.base.Preconditions; +import com.google.common.net.HttpHeaders; + +public abstract class AbstractLiveTest { + + protected final Class clazz; + + @Autowired + protected IMarshaller marshaller; + + public AbstractLiveTest(final Class clazzToSet) { + super(); + + Preconditions.checkNotNull(clazzToSet); + clazz = clazzToSet; + } + + // template method + + public abstract void create(); + + public abstract String createAsUri(); + + protected final void create(final T resource) { + createAsUri(resource); + } + + protected final String createAsUri(final T resource) { + final Response response = createAsResponse(resource); + Preconditions.checkState(response.getStatusCode() == 201, "create operation: " + response.getStatusCode()); + + final String locationOfCreatedResource = response.getHeader(HttpHeaders.LOCATION); + Preconditions.checkNotNull(locationOfCreatedResource); + return locationOfCreatedResource; + } + + final Response createAsResponse(final T resource) { + Preconditions.checkNotNull(resource); + + final String resourceAsString = marshaller.encode(resource); + return RestAssured.given() + .contentType(marshaller.getMime()) + .body(resourceAsString) + .post(getURL()); + } + + // + + protected String getURL() { + return "http://localhost:" + APPLICATION_PORT + "/spring-boot-rest/auth/foos"; + } + +} diff --git a/spring-boot-rest/src/test/java/com/baeldung/spring/ConfigIntegrationTest.java b/spring-boot-rest/src/test/java/com/baeldung/spring/ConfigIntegrationTest.java new file mode 100644 index 0000000000..da8421ea6c --- /dev/null +++ b/spring-boot-rest/src/test/java/com/baeldung/spring/ConfigIntegrationTest.java @@ -0,0 +1,17 @@ +package com.baeldung.spring; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +@ComponentScan("com.baeldung.test") +public class ConfigIntegrationTest implements WebMvcConfigurer { + + public ConfigIntegrationTest() { + super(); + } + + // API + +} \ No newline at end of file diff --git a/spring-boot-rest/src/test/java/com/baeldung/test/IMarshaller.java b/spring-boot-rest/src/test/java/com/baeldung/test/IMarshaller.java new file mode 100644 index 0000000000..e2198ecb59 --- /dev/null +++ b/spring-boot-rest/src/test/java/com/baeldung/test/IMarshaller.java @@ -0,0 +1,15 @@ +package com.baeldung.test; + +import java.util.List; + +public interface IMarshaller { + + String encode(final T entity); + + T decode(final String entityAsString, final Class clazz); + + List decodeList(final String entitiesAsString, final Class clazz); + + String getMime(); + +} diff --git a/spring-boot-rest/src/test/java/com/baeldung/test/JacksonMarshaller.java b/spring-boot-rest/src/test/java/com/baeldung/test/JacksonMarshaller.java new file mode 100644 index 0000000000..23b5d60b6b --- /dev/null +++ b/spring-boot-rest/src/test/java/com/baeldung/test/JacksonMarshaller.java @@ -0,0 +1,81 @@ +package com.baeldung.test; + +import java.io.IOException; +import java.util.List; + +import com.baeldung.persistence.model.Foo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.MediaType; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.base.Preconditions; + +public final class JacksonMarshaller implements IMarshaller { + private final Logger logger = LoggerFactory.getLogger(JacksonMarshaller.class); + + private final ObjectMapper objectMapper; + + public JacksonMarshaller() { + super(); + + objectMapper = new ObjectMapper(); + } + + // API + + @Override + public final String encode(final T resource) { + Preconditions.checkNotNull(resource); + String entityAsJSON = null; + try { + entityAsJSON = objectMapper.writeValueAsString(resource); + } catch (final IOException ioEx) { + logger.error("", ioEx); + } + + return entityAsJSON; + } + + @Override + public final T decode(final String resourceAsString, final Class clazz) { + Preconditions.checkNotNull(resourceAsString); + + T entity = null; + try { + entity = objectMapper.readValue(resourceAsString, clazz); + } catch (final IOException ioEx) { + logger.error("", ioEx); + } + + return entity; + } + + @SuppressWarnings("unchecked") + @Override + public final List decodeList(final String resourcesAsString, final Class clazz) { + Preconditions.checkNotNull(resourcesAsString); + + List entities = null; + try { + if (clazz.equals(Foo.class)) { + entities = objectMapper.readValue(resourcesAsString, new TypeReference>() { + // ... + }); + } else { + entities = objectMapper.readValue(resourcesAsString, List.class); + } + } catch (final IOException ioEx) { + logger.error("", ioEx); + } + + return entities; + } + + @Override + public final String getMime() { + return MediaType.APPLICATION_JSON.toString(); + } + +} diff --git a/spring-boot-rest/src/test/java/com/baeldung/test/TestMarshallerFactory.java b/spring-boot-rest/src/test/java/com/baeldung/test/TestMarshallerFactory.java new file mode 100644 index 0000000000..740ee07839 --- /dev/null +++ b/spring-boot-rest/src/test/java/com/baeldung/test/TestMarshallerFactory.java @@ -0,0 +1,49 @@ +package com.baeldung.test; + +import org.springframework.beans.factory.FactoryBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Profile; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +@Profile("test") +public class TestMarshallerFactory implements FactoryBean { + + @Autowired + private Environment env; + + public TestMarshallerFactory() { + super(); + } + + // API + + @Override + public IMarshaller getObject() { + final String testMime = env.getProperty("test.mime"); + if (testMime != null) { + switch (testMime) { + case "json": + return new JacksonMarshaller(); + case "xml": + // If we need to implement xml marshaller we can include spring-rest-full XStreamMarshaller + throw new IllegalStateException(); + default: + throw new IllegalStateException(); + } + } + + return new JacksonMarshaller(); + } + + @Override + public Class getObjectType() { + return IMarshaller.class; + } + + @Override + public boolean isSingleton() { + return true; + } +} \ No newline at end of file diff --git a/spring-boot-rest/src/test/java/com/baeldung/web/FooLiveTest.java b/spring-boot-rest/src/test/java/com/baeldung/web/FooLiveTest.java new file mode 100644 index 0000000000..f721489eff --- /dev/null +++ b/spring-boot-rest/src/test/java/com/baeldung/web/FooLiveTest.java @@ -0,0 +1,36 @@ +package com.baeldung.web; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; + +import org.junit.runner.RunWith; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.common.web.AbstractBasicLiveTest; +import com.baeldung.persistence.model.Foo; +import com.baeldung.spring.ConfigIntegrationTest; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { ConfigIntegrationTest.class }, loader = AnnotationConfigContextLoader.class) +@ActiveProfiles("test") +public class FooLiveTest extends AbstractBasicLiveTest { + + public FooLiveTest() { + super(Foo.class); + } + + // API + + @Override + public final void create() { + create(new Foo(randomAlphabetic(6))); + } + + @Override + public final String createAsUri() { + return createAsUri(new Foo(randomAlphabetic(6))); + } + +} diff --git a/spring-rest-full/src/test/java/org/baeldung/web/FooPageableLiveTest.java b/spring-boot-rest/src/test/java/com/baeldung/web/FooPageableLiveTest.java similarity index 86% rename from spring-rest-full/src/test/java/org/baeldung/web/FooPageableLiveTest.java rename to spring-boot-rest/src/test/java/com/baeldung/web/FooPageableLiveTest.java index 3f637c5213..359a62a4d8 100644 --- a/spring-rest-full/src/test/java/org/baeldung/web/FooPageableLiveTest.java +++ b/spring-boot-rest/src/test/java/com/baeldung/web/FooPageableLiveTest.java @@ -1,19 +1,14 @@ -package org.baeldung.web; +package com.baeldung.web; +import static com.baeldung.Consts.APPLICATION_PORT; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; -import static org.baeldung.Consts.APPLICATION_PORT; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; -import io.restassured.RestAssured; -import io.restassured.response.Response; import java.util.List; -import org.baeldung.common.web.AbstractBasicLiveTest; -import org.baeldung.persistence.model.Foo; -import org.baeldung.spring.ConfigIntegrationTest; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ActiveProfiles; @@ -21,6 +16,13 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; +import com.baeldung.common.web.AbstractBasicLiveTest; +import com.baeldung.persistence.model.Foo; +import com.baeldung.spring.ConfigIntegrationTest; + +import io.restassured.RestAssured; +import io.restassured.response.Response; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { ConfigIntegrationTest.class }, loader = AnnotationConfigContextLoader.class) @ActiveProfiles("test") @@ -34,7 +36,7 @@ public class FooPageableLiveTest extends AbstractBasicLiveTest { @Override public final void create() { - create(new Foo(randomAlphabetic(6))); + super.create(new Foo(randomAlphabetic(6))); } @Override @@ -45,6 +47,8 @@ public class FooPageableLiveTest extends AbstractBasicLiveTest { @Override @Test public void whenResourcesAreRetrievedPaged_then200IsReceived() { + this.create(); + final Response response = RestAssured.get(getPageableURL() + "?page=0&size=10"); assertThat(response.getStatusCode(), is(200)); @@ -70,7 +74,7 @@ public class FooPageableLiveTest extends AbstractBasicLiveTest { } protected String getPageableURL() { - return "http://localhost:" + APPLICATION_PORT + "/spring-rest-full/auth/foos/pageable"; + return "http://localhost:" + APPLICATION_PORT + "/spring-boot-rest/auth/foos/pageable"; } } diff --git a/spring-boot-rest/src/test/java/com/baeldung/web/LiveTestSuiteLiveTest.java b/spring-boot-rest/src/test/java/com/baeldung/web/LiveTestSuiteLiveTest.java new file mode 100644 index 0000000000..1e2ddd5ec5 --- /dev/null +++ b/spring-boot-rest/src/test/java/com/baeldung/web/LiveTestSuiteLiveTest.java @@ -0,0 +1,14 @@ +package com.baeldung.web; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ +// @formatter:off + FooLiveTest.class + ,FooPageableLiveTest.class +}) // +public class LiveTestSuiteLiveTest { + +} diff --git a/spring-boot-rest/src/test/java/com/baeldung/web/error/ErrorHandlingLiveTest.java b/spring-boot-rest/src/test/java/com/baeldung/web/error/ErrorHandlingLiveTest.java index ea1b6ab227..3e21af524f 100644 --- a/spring-boot-rest/src/test/java/com/baeldung/web/error/ErrorHandlingLiveTest.java +++ b/spring-boot-rest/src/test/java/com/baeldung/web/error/ErrorHandlingLiveTest.java @@ -6,6 +6,7 @@ import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.isA; import static org.hamcrest.Matchers.not; +import static com.baeldung.Consts.APPLICATION_PORT; import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; @@ -16,8 +17,8 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage; public class ErrorHandlingLiveTest { - private static final String BASE_URL = "http://localhost:8080"; - private static final String EXCEPTION_ENDPOINT = "/exception"; + private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-boot-rest"; + private static final String EXCEPTION_ENDPOINT = BASE_URL + "/exception"; private static final String ERROR_RESPONSE_KEY_PATH = "error"; private static final String XML_RESPONSE_KEY_PATH = "xmlkey"; @@ -57,7 +58,7 @@ public class ErrorHandlingLiveTest { try (WebClient webClient = new WebClient()) { webClient.getOptions() .setThrowExceptionOnFailingStatusCode(false); - HtmlPage page = webClient.getPage(BASE_URL + EXCEPTION_ENDPOINT); + HtmlPage page = webClient.getPage(EXCEPTION_ENDPOINT); assertThat(page.getBody() .asText()).contains("Whitelabel Error Page"); } diff --git a/spring-boot-rest/src/test/java/com/baeldung/web/util/HTTPLinkHeaderUtil.java b/spring-boot-rest/src/test/java/com/baeldung/web/util/HTTPLinkHeaderUtil.java new file mode 100644 index 0000000000..54d62b64e8 --- /dev/null +++ b/spring-boot-rest/src/test/java/com/baeldung/web/util/HTTPLinkHeaderUtil.java @@ -0,0 +1,36 @@ +package com.baeldung.web.util; + +public final class HTTPLinkHeaderUtil { + + private HTTPLinkHeaderUtil() { + throw new AssertionError(); + } + + // + + public static String extractURIByRel(final String linkHeader, final String rel) { + if (linkHeader == null) { + return null; + } + + String uriWithSpecifiedRel = null; + final String[] links = linkHeader.split(", "); + String linkRelation; + for (final String link : links) { + final int positionOfSeparator = link.indexOf(';'); + linkRelation = link.substring(positionOfSeparator + 1, link.length()).trim(); + if (extractTypeOfRelation(linkRelation).equals(rel)) { + uriWithSpecifiedRel = link.substring(1, positionOfSeparator - 1); + break; + } + } + + return uriWithSpecifiedRel; + } + + private static Object extractTypeOfRelation(final String linkRelation) { + final int positionOfEquals = linkRelation.indexOf('='); + return linkRelation.substring(positionOfEquals + 2, linkRelation.length() - 1).trim(); + } + +} diff --git a/spring-rest-full/README.md b/spring-rest-full/README.md index 3a8d0a727a..2ef3a09e37 100644 --- a/spring-rest-full/README.md +++ b/spring-rest-full/README.md @@ -8,7 +8,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring The "Learn Spring Security" Classes: http://github.learnspringsecurity.com ### Relevant Articles: -- [REST Pagination in Spring](http://www.baeldung.com/rest-api-pagination-in-spring) - [HATEOAS for a Spring REST Service](http://www.baeldung.com/rest-api-discoverability-with-spring) - [REST API Discoverability and HATEOAS](http://www.baeldung.com/restful-web-service-discoverability) - [ETags for REST with Spring](http://www.baeldung.com/etags-for-rest-with-spring) diff --git a/spring-rest-full/src/main/java/org/baeldung/persistence/IOperations.java b/spring-rest-full/src/main/java/org/baeldung/persistence/IOperations.java index d4f3f0982c..8c5593c3e8 100644 --- a/spring-rest-full/src/main/java/org/baeldung/persistence/IOperations.java +++ b/spring-rest-full/src/main/java/org/baeldung/persistence/IOperations.java @@ -3,8 +3,6 @@ package org.baeldung.persistence; import java.io.Serializable; import java.util.List; -import org.springframework.data.domain.Page; - public interface IOperations { // read - one @@ -15,8 +13,6 @@ public interface IOperations { List findAll(); - Page findPaginated(int page, int size); - // write T create(final T entity); diff --git a/spring-rest-full/src/main/java/org/baeldung/persistence/service/IFooService.java b/spring-rest-full/src/main/java/org/baeldung/persistence/service/IFooService.java index a3d16d9c15..60d607b9ef 100644 --- a/spring-rest-full/src/main/java/org/baeldung/persistence/service/IFooService.java +++ b/spring-rest-full/src/main/java/org/baeldung/persistence/service/IFooService.java @@ -2,13 +2,9 @@ package org.baeldung.persistence.service; import org.baeldung.persistence.IOperations; import org.baeldung.persistence.model.Foo; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; public interface IFooService extends IOperations { Foo retrieveByName(String name); - - Page findPaginated(Pageable pageable); } diff --git a/spring-rest-full/src/main/java/org/baeldung/persistence/service/common/AbstractService.java b/spring-rest-full/src/main/java/org/baeldung/persistence/service/common/AbstractService.java index 5987bbae5f..59ccea8b12 100644 --- a/spring-rest-full/src/main/java/org/baeldung/persistence/service/common/AbstractService.java +++ b/spring-rest-full/src/main/java/org/baeldung/persistence/service/common/AbstractService.java @@ -4,8 +4,6 @@ import java.io.Serializable; import java.util.List; import org.baeldung.persistence.IOperations; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.transaction.annotation.Transactional; @@ -30,11 +28,6 @@ public abstract class AbstractService implements IOperat return Lists.newArrayList(getDao().findAll()); } - @Override - public Page findPaginated(final int page, final int size) { - return getDao().findAll(new PageRequest(page, size)); - } - // write @Override diff --git a/spring-rest-full/src/main/java/org/baeldung/persistence/service/impl/FooService.java b/spring-rest-full/src/main/java/org/baeldung/persistence/service/impl/FooService.java index 376082b2d5..d46f1bfe90 100644 --- a/spring-rest-full/src/main/java/org/baeldung/persistence/service/impl/FooService.java +++ b/spring-rest-full/src/main/java/org/baeldung/persistence/service/impl/FooService.java @@ -7,8 +7,6 @@ import org.baeldung.persistence.model.Foo; import org.baeldung.persistence.service.IFooService; import org.baeldung.persistence.service.common.AbstractService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -48,9 +46,4 @@ public class FooService extends AbstractService implements IFooService { return Lists.newArrayList(getDao().findAll()); } - @Override - public Page findPaginated(Pageable pageable) { - return dao.findAll(pageable); - } - } diff --git a/spring-rest-full/src/main/java/org/baeldung/web/controller/FooController.java b/spring-rest-full/src/main/java/org/baeldung/web/controller/FooController.java index 484a59f8ef..443d0908ee 100644 --- a/spring-rest-full/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-rest-full/src/main/java/org/baeldung/web/controller/FooController.java @@ -6,27 +6,20 @@ import javax.servlet.http.HttpServletResponse; import org.baeldung.persistence.model.Foo; import org.baeldung.persistence.service.IFooService; -import org.baeldung.web.exception.MyResourceNotFoundException; -import org.baeldung.web.hateoas.event.PaginatedResultsRetrievedEvent; import org.baeldung.web.hateoas.event.ResourceCreatedEvent; import org.baeldung.web.hateoas.event.SingleResourceRetrievedEvent; import org.baeldung.web.util.RestPreconditions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.util.UriComponentsBuilder; import com.google.common.base.Preconditions; @@ -72,30 +65,6 @@ public class FooController { return service.findAll(); } - @RequestMapping(params = { "page", "size" }, method = RequestMethod.GET) - @ResponseBody - public List findPaginated(@RequestParam("page") final int page, @RequestParam("size") final int size, final UriComponentsBuilder uriBuilder, final HttpServletResponse response) { - final Page resultPage = service.findPaginated(page, size); - if (page > resultPage.getTotalPages()) { - throw new MyResourceNotFoundException(); - } - eventPublisher.publishEvent(new PaginatedResultsRetrievedEvent(Foo.class, uriBuilder, response, page, resultPage.getTotalPages(), size)); - - return resultPage.getContent(); - } - - @GetMapping("/pageable") - @ResponseBody - public List findPaginatedWithPageable(Pageable pageable, final UriComponentsBuilder uriBuilder, final HttpServletResponse response) { - final Page resultPage = service.findPaginated(pageable); - if (pageable.getPageNumber() > resultPage.getTotalPages()) { - throw new MyResourceNotFoundException(); - } - eventPublisher.publishEvent(new PaginatedResultsRetrievedEvent(Foo.class, uriBuilder, response, pageable.getPageNumber(), resultPage.getTotalPages(), pageable.getPageSize())); - - return resultPage.getContent(); - } - // write @RequestMapping(method = RequestMethod.POST) diff --git a/spring-rest-full/src/main/java/org/baeldung/web/util/RestPreconditions.java b/spring-rest-full/src/main/java/org/baeldung/web/util/RestPreconditions.java index 18cb8219ec..4e211ccb10 100644 --- a/spring-rest-full/src/main/java/org/baeldung/web/util/RestPreconditions.java +++ b/spring-rest-full/src/main/java/org/baeldung/web/util/RestPreconditions.java @@ -1,8 +1,9 @@ package org.baeldung.web.util; -import org.baeldung.web.exception.MyResourceNotFoundException; import org.springframework.http.HttpStatus; +import org.baeldung.web.exception.MyResourceNotFoundException; + /** * Simple static methods to be called at the start of your own methods to verify correct arguments and state. If the Precondition fails, an {@link HttpStatus} code is thrown */ diff --git a/spring-rest-full/src/test/java/org/baeldung/common/web/AbstractBasicLiveTest.java b/spring-rest-full/src/test/java/org/baeldung/common/web/AbstractBasicLiveTest.java index 4e0007d036..d64807d97f 100644 --- a/spring-rest-full/src/test/java/org/baeldung/common/web/AbstractBasicLiveTest.java +++ b/spring-rest-full/src/test/java/org/baeldung/common/web/AbstractBasicLiveTest.java @@ -1,26 +1,19 @@ package org.baeldung.common.web; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; -import static org.baeldung.web.util.HTTPLinkHeaderUtil.extractURIByRel; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import io.restassured.RestAssured; -import io.restassured.response.Response; import java.io.Serializable; -import java.util.List; import org.junit.Ignore; import org.junit.Test; import com.google.common.net.HttpHeaders; +import io.restassured.RestAssured; +import io.restassured.response.Response; + public abstract class AbstractBasicLiveTest extends AbstractLiveTest { public AbstractBasicLiveTest(final Class clazzToSet) { @@ -104,71 +97,4 @@ public abstract class AbstractBasicLiveTest extends Abst // find - one // find - all - - // find - all - paginated - - @Test - public void whenResourcesAreRetrievedPaged_then200IsReceived() { - final Response response = RestAssured.get(getURL() + "?page=0&size=10"); - - assertThat(response.getStatusCode(), is(200)); - } - - @Test - public void whenPageOfResourcesAreRetrievedOutOfBounds_then404IsReceived() { - final String url = getURL() + "?page=" + randomNumeric(5) + "&size=10"; - final Response response = RestAssured.get(url); - - assertThat(response.getStatusCode(), is(404)); - } - - @Test - public void givenResourcesExist_whenFirstPageIsRetrieved_thenPageContainsResources() { - create(); - - final Response response = RestAssured.get(getURL() + "?page=0&size=10"); - - assertFalse(response.body().as(List.class).isEmpty()); - } - - @Test - public void whenFirstPageOfResourcesAreRetrieved_thenSecondPageIsNext() { - final Response response = RestAssured.get(getURL() + "?page=0&size=2"); - - final String uriToNextPage = extractURIByRel(response.getHeader(HttpHeaders.LINK), "next"); - assertEquals(getURL() + "?page=1&size=2", uriToNextPage); - } - - @Test - public void whenFirstPageOfResourcesAreRetrieved_thenNoPreviousPage() { - final Response response = RestAssured.get(getURL() + "?page=0&size=2"); - - final String uriToPrevPage = extractURIByRel(response.getHeader(HttpHeaders.LINK), "prev"); - assertNull(uriToPrevPage); - } - - @Test - public void whenSecondPageOfResourcesAreRetrieved_thenFirstPageIsPrevious() { - create(); - create(); - - final Response response = RestAssured.get(getURL() + "?page=1&size=2"); - - final String uriToPrevPage = extractURIByRel(response.getHeader(HttpHeaders.LINK), "prev"); - assertEquals(getURL() + "?page=0&size=2", uriToPrevPage); - } - - @Test - public void whenLastPageOfResourcesIsRetrieved_thenNoNextPageIsDiscoverable() { - final Response first = RestAssured.get(getURL() + "?page=0&size=2"); - final String uriToLastPage = extractURIByRel(first.getHeader(HttpHeaders.LINK), "last"); - - final Response response = RestAssured.get(uriToLastPage); - - final String uriToNextPage = extractURIByRel(response.getHeader(HttpHeaders.LINK), "next"); - assertNull(uriToNextPage); - } - - // count - } diff --git a/spring-rest-full/src/test/java/org/baeldung/common/web/AbstractDiscoverabilityLiveTest.java b/spring-rest-full/src/test/java/org/baeldung/common/web/AbstractDiscoverabilityLiveTest.java index c2dd3d84c7..96d796349a 100644 --- a/spring-rest-full/src/test/java/org/baeldung/common/web/AbstractDiscoverabilityLiveTest.java +++ b/spring-rest-full/src/test/java/org/baeldung/common/web/AbstractDiscoverabilityLiveTest.java @@ -5,8 +5,6 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; -import io.restassured.RestAssured; -import io.restassured.response.Response; import java.io.Serializable; @@ -18,6 +16,9 @@ import org.springframework.http.MediaType; import com.google.common.net.HttpHeaders; +import io.restassured.RestAssured; +import io.restassured.response.Response; + public abstract class AbstractDiscoverabilityLiveTest extends AbstractLiveTest { public AbstractDiscoverabilityLiveTest(final Class clazzToSet) { diff --git a/spring-rest-full/src/test/java/org/baeldung/web/LiveTestSuiteLiveTest.java b/spring-rest-full/src/test/java/org/baeldung/web/LiveTestSuiteLiveTest.java index 71a61ed338..da736392c4 100644 --- a/spring-rest-full/src/test/java/org/baeldung/web/LiveTestSuiteLiveTest.java +++ b/spring-rest-full/src/test/java/org/baeldung/web/LiveTestSuiteLiveTest.java @@ -8,7 +8,6 @@ import org.junit.runners.Suite; // @formatter:off FooDiscoverabilityLiveTest.class ,FooLiveTest.class - ,FooPageableLiveTest.class }) // public class LiveTestSuiteLiveTest { From b50ef0b4002f61131de4d6496f869940eb584d16 Mon Sep 17 00:00:00 2001 From: Ger Roza Date: Mon, 21 Jan 2019 23:14:03 -0200 Subject: [PATCH 263/271] improved slightly link generation code --- ...sultsRetrievedDiscoverabilityListener.java | 55 ++++++++++++------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java b/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java index bb60bab171..31555ef353 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java +++ b/spring-boot-rest/src/main/java/com/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java @@ -1,5 +1,7 @@ package com.baeldung.web.hateoas.listener; +import java.util.StringJoiner; + import javax.servlet.http.HttpServletResponse; import org.springframework.context.ApplicationListener; @@ -27,32 +29,32 @@ class PaginatedResultsRetrievedDiscoverabilityListener implements ApplicationLis public final void onApplicationEvent(final PaginatedResultsRetrievedEvent ev) { Preconditions.checkNotNull(ev); - addLinkHeaderOnPagedResourceRetrieval(ev.getUriBuilder(), ev.getResponse(), ev.getClazz(), ev.getPage(), ev.getTotalPages(), ev.getPageSize()); + addLinkHeaderOnPagedResourceRetrieval(ev.getUriBuilder(), ev.getResponse(), ev.getClazz(), ev.getPage(), + ev.getTotalPages(), ev.getPageSize()); } // - note: at this point, the URI is transformed into plural (added `s`) in a hardcoded way - this will change in the future - final void addLinkHeaderOnPagedResourceRetrieval(final UriComponentsBuilder uriBuilder, final HttpServletResponse response, final Class clazz, final int page, final int totalPages, final int pageSize) { + final void addLinkHeaderOnPagedResourceRetrieval(final UriComponentsBuilder uriBuilder, + final HttpServletResponse response, final Class clazz, final int page, final int totalPages, + final int pageSize) { plural(uriBuilder, clazz); - final StringBuilder linkHeader = new StringBuilder(); + final StringJoiner linkHeader = new StringJoiner(", "); if (hasNextPage(page, totalPages)) { final String uriForNextPage = constructNextPageUri(uriBuilder, page, pageSize); - linkHeader.append(LinkUtil.createLinkHeader(uriForNextPage, LinkUtil.REL_NEXT)); + linkHeader.add(LinkUtil.createLinkHeader(uriForNextPage, LinkUtil.REL_NEXT)); } if (hasPreviousPage(page)) { final String uriForPrevPage = constructPrevPageUri(uriBuilder, page, pageSize); - appendCommaIfNecessary(linkHeader); - linkHeader.append(LinkUtil.createLinkHeader(uriForPrevPage, LinkUtil.REL_PREV)); + linkHeader.add(LinkUtil.createLinkHeader(uriForPrevPage, LinkUtil.REL_PREV)); } if (hasFirstPage(page)) { final String uriForFirstPage = constructFirstPageUri(uriBuilder, pageSize); - appendCommaIfNecessary(linkHeader); - linkHeader.append(LinkUtil.createLinkHeader(uriForFirstPage, LinkUtil.REL_FIRST)); + linkHeader.add(LinkUtil.createLinkHeader(uriForFirstPage, LinkUtil.REL_FIRST)); } if (hasLastPage(page, totalPages)) { final String uriForLastPage = constructLastPageUri(uriBuilder, totalPages, pageSize); - appendCommaIfNecessary(linkHeader); - linkHeader.append(LinkUtil.createLinkHeader(uriForLastPage, LinkUtil.REL_LAST)); + linkHeader.add(LinkUtil.createLinkHeader(uriForLastPage, LinkUtil.REL_LAST)); } if (linkHeader.length() > 0) { @@ -61,19 +63,35 @@ class PaginatedResultsRetrievedDiscoverabilityListener implements ApplicationLis } final String constructNextPageUri(final UriComponentsBuilder uriBuilder, final int page, final int size) { - return uriBuilder.replaceQueryParam(PAGE, page + 1).replaceQueryParam("size", size).build().encode().toUriString(); + return uriBuilder.replaceQueryParam(PAGE, page + 1) + .replaceQueryParam("size", size) + .build() + .encode() + .toUriString(); } final String constructPrevPageUri(final UriComponentsBuilder uriBuilder, final int page, final int size) { - return uriBuilder.replaceQueryParam(PAGE, page - 1).replaceQueryParam("size", size).build().encode().toUriString(); + return uriBuilder.replaceQueryParam(PAGE, page - 1) + .replaceQueryParam("size", size) + .build() + .encode() + .toUriString(); } final String constructFirstPageUri(final UriComponentsBuilder uriBuilder, final int size) { - return uriBuilder.replaceQueryParam(PAGE, 0).replaceQueryParam("size", size).build().encode().toUriString(); + return uriBuilder.replaceQueryParam(PAGE, 0) + .replaceQueryParam("size", size) + .build() + .encode() + .toUriString(); } final String constructLastPageUri(final UriComponentsBuilder uriBuilder, final int totalPages, final int size) { - return uriBuilder.replaceQueryParam(PAGE, totalPages).replaceQueryParam("size", size).build().encode().toUriString(); + return uriBuilder.replaceQueryParam(PAGE, totalPages) + .replaceQueryParam("size", size) + .build() + .encode() + .toUriString(); } final boolean hasNextPage(final int page, final int totalPages) { @@ -92,16 +110,11 @@ class PaginatedResultsRetrievedDiscoverabilityListener implements ApplicationLis return (totalPages > 1) && hasNextPage(page, totalPages); } - final void appendCommaIfNecessary(final StringBuilder linkHeader) { - if (linkHeader.length() > 0) { - linkHeader.append(", "); - } - } - // template protected void plural(final UriComponentsBuilder uriBuilder, final Class clazz) { - final String resourceName = clazz.getSimpleName().toLowerCase() + "s"; + final String resourceName = clazz.getSimpleName() + .toLowerCase() + "s"; uriBuilder.path("/auth/" + resourceName); } From 34907bfb0bb6b237c39cec3ac3a4ae00f09b17ee Mon Sep 17 00:00:00 2001 From: aietcn Date: Tue, 22 Jan 2019 14:24:38 +0800 Subject: [PATCH 264/271] BAEL-2551 add parallelprefix section in Arrays (#6184) --- .../arrays/ParallelPrefixBenchmark.java | 44 ++++++++++++++++ .../com/baeldung/arrays/ArraysUnitTest.java | 51 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 core-java-arrays/src/main/java/com/baeldung/arrays/ParallelPrefixBenchmark.java diff --git a/core-java-arrays/src/main/java/com/baeldung/arrays/ParallelPrefixBenchmark.java b/core-java-arrays/src/main/java/com/baeldung/arrays/ParallelPrefixBenchmark.java new file mode 100644 index 0000000000..ac54aea402 --- /dev/null +++ b/core-java-arrays/src/main/java/com/baeldung/arrays/ParallelPrefixBenchmark.java @@ -0,0 +1,44 @@ +package com.baeldung.arrays; + +import org.openjdk.jmh.annotations.*; +import org.openjdk.jmh.infra.Blackhole; + +import java.util.Arrays; + +public class ParallelPrefixBenchmark { + private static final int ARRAY_SIZE = 200_000_000; + + @State(Scope.Benchmark) + public static class BigArray { + + int[] data; + + @Setup(Level.Iteration) + public void prepare() { + data = new int[ARRAY_SIZE]; + for(int j = 0; j< ARRAY_SIZE; j++) { + data[j] = 1; + } + } + + @TearDown(Level.Iteration) + public void destroy() { + data = null; + } + + } + + @Benchmark + public void largeArrayLoopSum(BigArray bigArray, Blackhole blackhole) { + for (int i = 0; i < ARRAY_SIZE - 1; i++) { + bigArray.data[i + 1] += bigArray.data[i]; + } + blackhole.consume(bigArray.data); + } + + @Benchmark + public void largeArrayParallelPrefixSum(BigArray bigArray, Blackhole blackhole) { + Arrays.parallelPrefix(bigArray.data, (left, right) -> left + right); + blackhole.consume(bigArray.data); + } +} diff --git a/core-java-arrays/src/test/java/com/baeldung/arrays/ArraysUnitTest.java b/core-java-arrays/src/test/java/com/baeldung/arrays/ArraysUnitTest.java index 9e6d3d6131..b6801612b9 100644 --- a/core-java-arrays/src/test/java/com/baeldung/arrays/ArraysUnitTest.java +++ b/core-java-arrays/src/test/java/com/baeldung/arrays/ArraysUnitTest.java @@ -1,5 +1,7 @@ package com.baeldung.arrays; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; import static org.junit.Assert.*; import org.junit.Before; @@ -9,6 +11,7 @@ import org.junit.rules.ExpectedException; import java.util.Arrays; import java.util.List; +import java.util.Random; import java.util.stream.Stream; public class ArraysUnitTest { @@ -150,4 +153,52 @@ public class ArraysUnitTest { exception.expect(UnsupportedOperationException.class); rets.add("the"); } + + @Test + public void givenIntArray_whenPrefixAdd_thenAllAccumulated() { + int[] arri = new int[] { 1, 2, 3, 4}; + Arrays.parallelPrefix(arri, (left, right) -> left + right); + assertThat(arri, is(new int[] { 1, 3, 6, 10})); + } + + @Test + public void givenStringArray_whenPrefixConcat_thenAllMerged() { + String[] arrs = new String[] { "1", "2", "3" }; + Arrays.parallelPrefix(arrs, (left, right) -> left + right); + assertThat(arrs, is(new String[] { "1", "12", "123" })); + } + + @Test + public void whenPrefixAddWithRange_thenRangeAdded() { + int[] arri = new int[] { 1, 2, 3, 4, 5 }; + Arrays.parallelPrefix(arri, 1, 4, (left, right) -> left + right); + assertThat(arri, is(new int[] { 1, 2, 5, 9, 5 })); + } + + @Test + public void whenPrefixNonAssociative_thenError() { + boolean consistent = true; + Random r = new Random(); + for (int k = 0; k < 100_000; k++) { + int[] arrA = r.ints(100, 1, 5).toArray(); + int[] arrB = Arrays.copyOf(arrA, arrA.length); + + Arrays.parallelPrefix(arrA, this::nonassociativeFunc); + + for (int i = 1; i < arrB.length; i++) { + arrB[i] = nonassociativeFunc(arrB[i - 1], arrB[i]); + } + consistent = Arrays.equals(arrA, arrB); + if(!consistent) break; + } + assertFalse(consistent); + } + + /** + * non-associative int binary operator + */ + private int nonassociativeFunc(int left, int right) { + return left + right*left; + } + } From 2fb3e867d75aa291a53cf69d0d2f75230404c324 Mon Sep 17 00:00:00 2001 From: Urvy Agrawal Date: Tue, 22 Jan 2019 14:28:12 +0530 Subject: [PATCH 265/271] Adding test file for bitwise operators --- .../BitwiseOperatorExample.java | 56 ------------- .../test/BitwiseOperatorUnitTest.java | 81 +++++++++++++++++++ 2 files changed, 81 insertions(+), 56 deletions(-) delete mode 100644 core-java/src/main/java/com/baeldung/bitwiseoperator/BitwiseOperatorExample.java create mode 100644 core-java/src/test/java/com/baeldung/bitwiseoperator/test/BitwiseOperatorUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/bitwiseoperator/BitwiseOperatorExample.java b/core-java/src/main/java/com/baeldung/bitwiseoperator/BitwiseOperatorExample.java deleted file mode 100644 index 4fef92102a..0000000000 --- a/core-java/src/main/java/com/baeldung/bitwiseoperator/BitwiseOperatorExample.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.baeldung.bitwiseoperator; - -public class BitwiseOperatorExample { - - public static void main(String[] args) { - - int value1 = 6; - int value2 = 5; - - // Bitwise AND Operator - int result = value1 & value2; - System.out.println("result : " + result); - - // Bitwise OR Operator - result = value1 | value2; - System.out.println("result : " + result); - - // Bitwise Exclusive OR Operator - result = value1 ^ value2; - System.out.println("result : " + result); - - // Bitwise NOT operator - result = ~value1; - System.out.println("result : " + result); - - // Right Shift Operator with positive number - int value = 12; - int rightShift = value >> 2; - System.out.println("rightShift result with positive number : " + rightShift); - - // Right Shift Operator with negative number - value = -12; - rightShift = value >> 2; - System.out.println("rightShift result with negative number : " + rightShift); - - // Left Shift Operator with positive number - value = 1; - int leftShift = value << 1; - System.out.println("leftShift result with positive number : " + leftShift); - - // Left Shift Operator with negative number - value = -12; - leftShift = value << 2; - System.out.println("leftShift result with negative number : " + leftShift); - - // Unsigned Right Shift Operator with positive number - value = 12; - int unsignedRightShift = value >>> 2; - System.out.println("unsignedRightShift result with positive number : " + unsignedRightShift); - - // Unsigned Right Shift Operator with negative number - value = -12; - unsignedRightShift = value >>> 2; - System.out.println("unsignedRightShift result with negative number : " + unsignedRightShift); - } -} diff --git a/core-java/src/test/java/com/baeldung/bitwiseoperator/test/BitwiseOperatorUnitTest.java b/core-java/src/test/java/com/baeldung/bitwiseoperator/test/BitwiseOperatorUnitTest.java new file mode 100644 index 0000000000..139d3a2512 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/bitwiseoperator/test/BitwiseOperatorUnitTest.java @@ -0,0 +1,81 @@ +package com.baeldung.bitwiseoperator.test; + +import org.junit.Assert; +import org.junit.jupiter.api.Test; + +public class BitwiseOperatorUnitTest { + + @Test + public void givenTwoIntegers_whenAndOperator_thenNewDecimalNumber() { + int value1 = 6; + int value2 = 5; + int result = value1 & value2; + Assert.assertEquals(result, 4); + } + + @Test + public void givenTwoIntegers_whenOrOperator_thenNewDecimalNumber() { + int value1 = 6; + int value2 = 5; + int result = value1 | value2; + Assert.assertEquals(result, 7); + } + + @Test + public void givenTwoIntegers_whenXorOperator_thenNewDecimalNumber() { + int value1 = 6; + int value2 = 5; + int result = value1 ^ value2; + Assert.assertEquals(result, 3); + } + + @Test + public void givenOneInteger_whenNotOperator_thenNewDecimalNumber() { + int value1 = 6; + int result = ~value1; + Assert.assertEquals(result, -7); + } + + @Test + public void givenOnePositiveInteger_whenSignedRightShiftOperator_thenNewDecimalNumber() { + int value = 12; + int rightShift = value >> 2; + Assert.assertEquals(rightShift, 3); + } + + @Test + public void givenOneNegativeInteger_whenSignedRightShiftOperator_thenNewDecimalNumber() { + int value = -12; + int rightShift = value >> 2; + Assert.assertEquals(rightShift, -3); + } + + @Test + public void givenOnePositiveInteger_whenLeftShiftOperator_thenNewDecimalNumber() { + int value = 12; + int leftShift = value << 2; + Assert.assertEquals(leftShift, 48); + } + + @Test + public void givenOneNegativeInteger_whenLeftShiftOperator_thenNewDecimalNumber() { + int value = -12; + int leftShift = value << 2; + Assert.assertEquals(leftShift, -48); + } + + @Test + public void givenOnePositiveInteger_whenUnsignedRightShiftOperator_thenNewDecimalNumber() { + int value = 12; + int unsignedRightShift = value >>> 2; + Assert.assertEquals(unsignedRightShift, 3); + } + + @Test + public void givenOneNegativeInteger_whenUnsignedRightShiftOperator_thenNewDecimalNumber() { + int value = -12; + int unsignedRightShift = value >>> 2; + Assert.assertEquals(unsignedRightShift, 1073741821); + } + +} From 5bbc85c6c1cedb411019e62f506fae42f618bc6d Mon Sep 17 00:00:00 2001 From: enpy Date: Tue, 22 Jan 2019 17:18:11 +0100 Subject: [PATCH 266/271] classes and objects code added (#6173) * classes and objects code added * Car class and test added * fixes and enhancements * code moved to core-java-lang --- .../main/java/com/baeldung/objects/Car.java | 51 +++++++++++++++++++ .../com/baeldung/objects/CarUnitTest.java | 38 ++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 core-java-lang/src/main/java/com/baeldung/objects/Car.java create mode 100644 core-java-lang/src/test/java/com/baeldung/objects/CarUnitTest.java diff --git a/core-java-lang/src/main/java/com/baeldung/objects/Car.java b/core-java-lang/src/main/java/com/baeldung/objects/Car.java new file mode 100644 index 0000000000..35ef8585b2 --- /dev/null +++ b/core-java-lang/src/main/java/com/baeldung/objects/Car.java @@ -0,0 +1,51 @@ +package com.baeldung.objects; + +public class Car { + + private String type; + private String model; + private String color; + private int speed; + + public Car(String type, String model, String color) { + this.type = type; + this.model = model; + this.color = color; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public int getSpeed() { + return speed; + } + + public int increaseSpeed(int increment) { + if (increment > 0) { + this.speed += increment; + } else { + System.out.println("Increment can't be negative."); + } + return this.speed; + } + + public int decreaseSpeed(int decrement) { + if (decrement > 0 && decrement <= this.speed) { + this.speed -= decrement; + } else { + System.out.println("Decrement can't be negative or greater than current speed."); + } + return this.speed; + } + + @Override + public String toString() { + return "Car [type=" + type + ", model=" + model + ", color=" + color + ", speed=" + speed + "]"; + } + +} diff --git a/core-java-lang/src/test/java/com/baeldung/objects/CarUnitTest.java b/core-java-lang/src/test/java/com/baeldung/objects/CarUnitTest.java new file mode 100644 index 0000000000..a1ef20523e --- /dev/null +++ b/core-java-lang/src/test/java/com/baeldung/objects/CarUnitTest.java @@ -0,0 +1,38 @@ +package com.baeldung.objects; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; + +public class CarUnitTest { + + private Car car; + + @Before + public void setUp() throws Exception { + car = new Car("Ford", "Focus", "red"); + } + + @Test + public final void when_speedIncreased_then_verifySpeed() { + car.increaseSpeed(30); + assertEquals(30, car.getSpeed()); + + car.increaseSpeed(20); + assertEquals(50, car.getSpeed()); + } + + @Test + public final void when_speedDecreased_then_verifySpeed() { + car.increaseSpeed(50); + assertEquals(50, car.getSpeed()); + + car.decreaseSpeed(30); + assertEquals(20, car.getSpeed()); + + car.decreaseSpeed(20); + assertEquals(0, car.getSpeed()); + } + +} From 39ea408549fbce7be95e1b7160525c3b45f64e09 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Tue, 22 Jan 2019 19:58:57 +0200 Subject: [PATCH 267/271] Update BitwiseOperatorUnitTest.java --- .../test/BitwiseOperatorUnitTest.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/core-java/src/test/java/com/baeldung/bitwiseoperator/test/BitwiseOperatorUnitTest.java b/core-java/src/test/java/com/baeldung/bitwiseoperator/test/BitwiseOperatorUnitTest.java index 139d3a2512..d8af4b0833 100644 --- a/core-java/src/test/java/com/baeldung/bitwiseoperator/test/BitwiseOperatorUnitTest.java +++ b/core-java/src/test/java/com/baeldung/bitwiseoperator/test/BitwiseOperatorUnitTest.java @@ -1,6 +1,6 @@ package com.baeldung.bitwiseoperator.test; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; import org.junit.jupiter.api.Test; public class BitwiseOperatorUnitTest { @@ -10,7 +10,7 @@ public class BitwiseOperatorUnitTest { int value1 = 6; int value2 = 5; int result = value1 & value2; - Assert.assertEquals(result, 4); + assertEquals(result, 4); } @Test @@ -18,7 +18,7 @@ public class BitwiseOperatorUnitTest { int value1 = 6; int value2 = 5; int result = value1 | value2; - Assert.assertEquals(result, 7); + assertEquals(result, 7); } @Test @@ -26,56 +26,56 @@ public class BitwiseOperatorUnitTest { int value1 = 6; int value2 = 5; int result = value1 ^ value2; - Assert.assertEquals(result, 3); + assertEquals(result, 3); } @Test public void givenOneInteger_whenNotOperator_thenNewDecimalNumber() { int value1 = 6; int result = ~value1; - Assert.assertEquals(result, -7); + assertEquals(result, -7); } @Test public void givenOnePositiveInteger_whenSignedRightShiftOperator_thenNewDecimalNumber() { int value = 12; int rightShift = value >> 2; - Assert.assertEquals(rightShift, 3); + assertEquals(rightShift, 3); } @Test public void givenOneNegativeInteger_whenSignedRightShiftOperator_thenNewDecimalNumber() { int value = -12; int rightShift = value >> 2; - Assert.assertEquals(rightShift, -3); + assertEquals(rightShift, -3); } @Test public void givenOnePositiveInteger_whenLeftShiftOperator_thenNewDecimalNumber() { int value = 12; int leftShift = value << 2; - Assert.assertEquals(leftShift, 48); + assertEquals(leftShift, 48); } @Test public void givenOneNegativeInteger_whenLeftShiftOperator_thenNewDecimalNumber() { int value = -12; int leftShift = value << 2; - Assert.assertEquals(leftShift, -48); + assertEquals(leftShift, -48); } @Test public void givenOnePositiveInteger_whenUnsignedRightShiftOperator_thenNewDecimalNumber() { int value = 12; int unsignedRightShift = value >>> 2; - Assert.assertEquals(unsignedRightShift, 3); + assertEquals(unsignedRightShift, 3); } @Test public void givenOneNegativeInteger_whenUnsignedRightShiftOperator_thenNewDecimalNumber() { int value = -12; int unsignedRightShift = value >>> 2; - Assert.assertEquals(unsignedRightShift, 1073741821); + assertEquals(unsignedRightShift, 1073741821); } } From 7fa2aba180074969b59b4599a20f9792e76c1dc5 Mon Sep 17 00:00:00 2001 From: Fabian Rivera Date: Tue, 22 Jan 2019 23:54:24 -0600 Subject: [PATCH 268/271] BAEL-2414 Guide to problem-spring-web (#6147) * Fix issue with package name and folder name mismatch * Add problem-spring-web code samples * Use the latest version of the problem-spring-web library. Add spring security exceptions handling samples * Fix issue with security configuration. Fix sample for forbidden operation * Update ProblemDemoConfiguration.java * Add integration tests to validate problems are correctly handled and responses are generated using the problem library --- spring-boot-libraries/pom.xml | 270 +++++++++--------- .../com/baeldung/{ => boot}/Application.java | 2 +- .../problem/SpringProblemApplication.java | 19 ++ .../boot/problem/advice/ExceptionHandler.java | 9 + .../advice/SecurityExceptionHandler.java | 9 + .../ProblemDemoConfiguration.java | 17 ++ .../configuration/SecurityConfiguration.java | 31 ++ .../controller/ProblemDemoController.java | 56 ++++ .../com/baeldung/boot/problem/dto/Task.java | 32 +++ .../problem/problems/TaskNotFoundProblem.java | 16 ++ .../resources/application-problem.properties | 3 + .../ProblemDemoControllerIntegrationTest.java | 75 +++++ 12 files changed, 409 insertions(+), 130 deletions(-) rename spring-boot-libraries/src/main/java/com/baeldung/{ => boot}/Application.java (93%) create mode 100644 spring-boot-libraries/src/main/java/com/baeldung/boot/problem/SpringProblemApplication.java create mode 100644 spring-boot-libraries/src/main/java/com/baeldung/boot/problem/advice/ExceptionHandler.java create mode 100644 spring-boot-libraries/src/main/java/com/baeldung/boot/problem/advice/SecurityExceptionHandler.java create mode 100644 spring-boot-libraries/src/main/java/com/baeldung/boot/problem/configuration/ProblemDemoConfiguration.java create mode 100644 spring-boot-libraries/src/main/java/com/baeldung/boot/problem/configuration/SecurityConfiguration.java create mode 100644 spring-boot-libraries/src/main/java/com/baeldung/boot/problem/controller/ProblemDemoController.java create mode 100644 spring-boot-libraries/src/main/java/com/baeldung/boot/problem/dto/Task.java create mode 100644 spring-boot-libraries/src/main/java/com/baeldung/boot/problem/problems/TaskNotFoundProblem.java create mode 100644 spring-boot-libraries/src/main/resources/application-problem.properties create mode 100644 spring-boot-libraries/src/test/java/com/baeldung/boot/problem/controller/ProblemDemoControllerIntegrationTest.java diff --git a/spring-boot-libraries/pom.xml b/spring-boot-libraries/pom.xml index c28128c5f0..66aa66bdfd 100644 --- a/spring-boot-libraries/pom.xml +++ b/spring-boot-libraries/pom.xml @@ -1,144 +1,156 @@ - 4.0.0 - spring-boot-libraries - war - spring-boot-libraries - This is simple boot application for Spring boot actuator test + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + spring-boot-libraries + war + spring-boot-libraries + This is simple boot application for Spring boot actuator test - - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-2 - + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-tomcat - - - org.springframework.boot - spring-boot-starter-test - test - + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-tomcat + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.zalando + problem-spring-web + ${problem-spring-web.version} + - - - net.javacrumbs.shedlock - shedlock-spring - 2.1.0 - - - net.javacrumbs.shedlock - shedlock-provider-jdbc-template - 2.1.0 - + + + net.javacrumbs.shedlock + shedlock-spring + 2.1.0 + + + net.javacrumbs.shedlock + shedlock-provider-jdbc-template + 2.1.0 + - + - - spring-boot - - - src/main/resources - true - - + + spring-boot + + + src/main/resources + true + + - + - - org.apache.maven.plugins - maven-war-plugin - + + org.apache.maven.plugins + maven-war-plugin + - - pl.project13.maven - git-commit-id-plugin - ${git-commit-id-plugin.version} - - - get-the-git-infos - - revision - - initialize - - - validate-the-git-infos - - validateRevision - - package - - - - true - ${project.build.outputDirectory}/git.properties - - + + pl.project13.maven + git-commit-id-plugin + ${git-commit-id-plugin.version} + + + get-the-git-infos + + revision + + initialize + + + validate-the-git-infos + + validateRevision + + package + + + + true + ${project.build.outputDirectory}/git.properties + + - + - + - - - autoconfiguration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*LiveTest.java - **/*IntegrationTest.java - **/*IntTest.java - - - **/AutoconfigurationTest.java - - - - - - - json - - - - - - - + + + autoconfiguration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + **/*IntegrationTest.java + **/*IntTest.java + + + **/AutoconfigurationTest.java + + + + + + + json + + + + + + + - - - com.baeldung.intro.App - 8.5.11 - 2.4.1.Final - 1.9.0 - 2.0.0 - 5.0.2 - 5.0.2 - 5.2.4 - 18.0 - 2.2.4 - 2.3.2 - + + + com.baeldung.intro.App + 8.5.11 + 2.4.1.Final + 1.9.0 + 2.0.0 + 5.0.2 + 5.0.2 + 5.2.4 + 18.0 + 2.2.4 + 2.3.2 + 0.23.0 + diff --git a/spring-boot-libraries/src/main/java/com/baeldung/Application.java b/spring-boot-libraries/src/main/java/com/baeldung/boot/Application.java similarity index 93% rename from spring-boot-libraries/src/main/java/com/baeldung/Application.java rename to spring-boot-libraries/src/main/java/com/baeldung/boot/Application.java index c1b6558b26..cb0d0c1532 100644 --- a/spring-boot-libraries/src/main/java/com/baeldung/Application.java +++ b/spring-boot-libraries/src/main/java/com/baeldung/boot/Application.java @@ -1,4 +1,4 @@ -package org.baeldung.boot; +package com.baeldung.boot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/SpringProblemApplication.java b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/SpringProblemApplication.java new file mode 100644 index 0000000000..7ca9881fb9 --- /dev/null +++ b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/SpringProblemApplication.java @@ -0,0 +1,19 @@ +package com.baeldung.boot.problem; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication +@EnableAutoConfiguration(exclude = ErrorMvcAutoConfiguration.class) +@ComponentScan("com.baeldung.boot.problem") +public class SpringProblemApplication { + + public static void main(String[] args) { + System.setProperty("spring.profiles.active", "problem"); + SpringApplication.run(SpringProblemApplication.class, args); + } + +} diff --git a/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/advice/ExceptionHandler.java b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/advice/ExceptionHandler.java new file mode 100644 index 0000000000..7b4cbac7f7 --- /dev/null +++ b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/advice/ExceptionHandler.java @@ -0,0 +1,9 @@ +package com.baeldung.boot.problem.advice; + +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.zalando.problem.spring.web.advice.ProblemHandling; + +@ControllerAdvice +public class ExceptionHandler implements ProblemHandling { + +} diff --git a/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/advice/SecurityExceptionHandler.java b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/advice/SecurityExceptionHandler.java new file mode 100644 index 0000000000..8013cbf5c3 --- /dev/null +++ b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/advice/SecurityExceptionHandler.java @@ -0,0 +1,9 @@ +package com.baeldung.boot.problem.advice; + +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.zalando.problem.spring.web.advice.security.SecurityAdviceTrait; + +@ControllerAdvice +public class SecurityExceptionHandler implements SecurityAdviceTrait { + +} \ No newline at end of file diff --git a/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/configuration/ProblemDemoConfiguration.java b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/configuration/ProblemDemoConfiguration.java new file mode 100644 index 0000000000..209ff553c7 --- /dev/null +++ b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/configuration/ProblemDemoConfiguration.java @@ -0,0 +1,17 @@ +package com.baeldung.boot.problem.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.zalando.problem.ProblemModule; +import org.zalando.problem.validation.ConstraintViolationProblemModule; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@Configuration +public class ProblemDemoConfiguration { + + @Bean + public ObjectMapper objectMapper() { + return new ObjectMapper().registerModules(new ProblemModule(), new ConstraintViolationProblemModule()); + } +} diff --git a/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/configuration/SecurityConfiguration.java b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/configuration/SecurityConfiguration.java new file mode 100644 index 0000000000..0cb8048981 --- /dev/null +++ b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/configuration/SecurityConfiguration.java @@ -0,0 +1,31 @@ +package com.baeldung.boot.problem.configuration; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.zalando.problem.spring.web.advice.security.SecurityProblemSupport; + +@Configuration +@EnableWebSecurity +@Import(SecurityProblemSupport.class) +public class SecurityConfiguration extends WebSecurityConfigurerAdapter { + + @Autowired + private SecurityProblemSupport problemSupport; + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.csrf().disable(); + + http.authorizeRequests() + .antMatchers("/") + .permitAll(); + + http.exceptionHandling() + .authenticationEntryPoint(problemSupport) + .accessDeniedHandler(problemSupport); + } +} diff --git a/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/controller/ProblemDemoController.java b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/controller/ProblemDemoController.java new file mode 100644 index 0000000000..50f1ad5137 --- /dev/null +++ b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/controller/ProblemDemoController.java @@ -0,0 +1,56 @@ +package com.baeldung.boot.problem.controller; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.http.MediaType; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.boot.problem.dto.Task; +import com.baeldung.boot.problem.problems.TaskNotFoundProblem; + +@RestController +@RequestMapping("/tasks") +public class ProblemDemoController { + + private static final Map MY_TASKS; + + static { + MY_TASKS = new HashMap<>(); + MY_TASKS.put(1L, new Task(1L, "My first task")); + MY_TASKS.put(2L, new Task(2L, "My second task")); + } + + @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) + public List getTasks() { + return new ArrayList<>(MY_TASKS.values()); + } + + @GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) + public Task getTasks(@PathVariable("id") Long taskId) { + if (MY_TASKS.containsKey(taskId)) { + return MY_TASKS.get(taskId); + } else { + throw new TaskNotFoundProblem(taskId); + } + } + + @PutMapping("/{id}") + public void updateTask(@PathVariable("id") Long id) { + throw new UnsupportedOperationException(); + } + + @DeleteMapping("/{id}") + public void deleteTask(@PathVariable("id") Long id) { + throw new AccessDeniedException("You can't delete this task"); + } + +} diff --git a/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/dto/Task.java b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/dto/Task.java new file mode 100644 index 0000000000..a5f39474e7 --- /dev/null +++ b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/dto/Task.java @@ -0,0 +1,32 @@ +package com.baeldung.boot.problem.dto; + +public class Task { + + private Long id; + private String description; + + public Task() { + } + + public Task(Long id, String description) { + this.id = id; + this.description = description; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/problems/TaskNotFoundProblem.java b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/problems/TaskNotFoundProblem.java new file mode 100644 index 0000000000..cc3f21d4a5 --- /dev/null +++ b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/problems/TaskNotFoundProblem.java @@ -0,0 +1,16 @@ +package com.baeldung.boot.problem.problems; + +import java.net.URI; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +public class TaskNotFoundProblem extends AbstractThrowableProblem { + + private static final URI TYPE = URI.create("https://example.org/not-found"); + + public TaskNotFoundProblem(Long taskId) { + super(TYPE, "Not found", Status.NOT_FOUND, String.format("Task '%s' not found", taskId)); + } + +} diff --git a/spring-boot-libraries/src/main/resources/application-problem.properties b/spring-boot-libraries/src/main/resources/application-problem.properties new file mode 100644 index 0000000000..7d0b0a2720 --- /dev/null +++ b/spring-boot-libraries/src/main/resources/application-problem.properties @@ -0,0 +1,3 @@ +spring.resources.add-mappings=false +spring.mvc.throw-exception-if-no-handler-found=true +spring.http.encoding.force=true diff --git a/spring-boot-libraries/src/test/java/com/baeldung/boot/problem/controller/ProblemDemoControllerIntegrationTest.java b/spring-boot-libraries/src/test/java/com/baeldung/boot/problem/controller/ProblemDemoControllerIntegrationTest.java new file mode 100644 index 0000000000..3b7e43a565 --- /dev/null +++ b/spring-boot-libraries/src/test/java/com/baeldung/boot/problem/controller/ProblemDemoControllerIntegrationTest.java @@ -0,0 +1,75 @@ +package com.baeldung.boot.problem.controller; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; + +import com.baeldung.boot.problem.SpringProblemApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes = SpringProblemApplication.class) +@AutoConfigureMockMvc +public class ProblemDemoControllerIntegrationTest { + + @Autowired + private MockMvc mockMvc; + + @Test + public void whenRequestingAllTasks_thenReturnSuccessfulResponseWithArrayWithTwoTasks() throws Exception { + mockMvc.perform(get("/tasks").contentType(MediaType.APPLICATION_JSON_VALUE)) + .andDo(print()) + .andExpect(jsonPath("$.length()", equalTo(2))) + .andExpect(status().isOk()); + } + + @Test + public void whenRequestingExistingTask_thenReturnSuccessfulResponse() throws Exception { + mockMvc.perform(get("/tasks/1").contentType(MediaType.APPLICATION_JSON_VALUE)) + .andDo(print()) + .andExpect(jsonPath("$.id", equalTo(1))) + .andExpect(status().isOk()); + } + + @Test + public void whenRequestingMissingTask_thenReturnNotFoundProblemResponse() throws Exception { + mockMvc.perform(get("/tasks/5").contentType(MediaType.APPLICATION_PROBLEM_JSON_VALUE)) + .andDo(print()) + .andExpect(jsonPath("$.title", equalTo("Not found"))) + .andExpect(jsonPath("$.status", equalTo(404))) + .andExpect(jsonPath("$.detail", equalTo("Task '5' not found"))) + .andExpect(status().isNotFound()); + } + + @Test + public void whenMakePutCall_thenReturnNotImplementedProblemResponse() throws Exception { + mockMvc.perform(put("/tasks/1").contentType(MediaType.APPLICATION_PROBLEM_JSON_VALUE)) + .andDo(print()) + .andExpect(jsonPath("$.title", equalTo("Not Implemented"))) + .andExpect(jsonPath("$.status", equalTo(501))) + .andExpect(status().isNotImplemented()); + } + + @Test + public void whenMakeDeleteCall_thenReturnForbiddenProblemResponse() throws Exception { + mockMvc.perform(delete("/tasks/2").contentType(MediaType.APPLICATION_PROBLEM_JSON_VALUE)) + .andDo(print()) + .andExpect(jsonPath("$.title", equalTo("Forbidden"))) + .andExpect(jsonPath("$.status", equalTo(403))) + .andExpect(jsonPath("$.detail", equalTo("You can't delete this task"))) + .andExpect(status().isForbidden()); + } + +} From effde80333489fa4b74cb173261c812456de8134 Mon Sep 17 00:00:00 2001 From: Anshul Bansal Date: Wed, 23 Jan 2019 14:19:48 +0200 Subject: [PATCH 269/271] BAEL - 2420 Converting Float to Byte Array and vice-versa in Java (#6194) * Hexagonal Architecture in Java - Spring boot app * create README.md * Update README.md * Update README.md * BAEL-2420 Converting Float to Byte Array and vice-versa in Java * BAEL-2420 Converting Float to Byte Array and vice-versa in Java - conversions package added * Hexagonal architecture code removed --- .../array/conversions/FloatToByteArray.java | 44 ++++++++++++++++++ .../conversions/FloatToByteArrayUnitTest.java | 46 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 core-java-arrays/src/main/java/com/baeldung/array/conversions/FloatToByteArray.java create mode 100644 core-java-arrays/src/test/java/com/baeldung/array/conversions/FloatToByteArrayUnitTest.java diff --git a/core-java-arrays/src/main/java/com/baeldung/array/conversions/FloatToByteArray.java b/core-java-arrays/src/main/java/com/baeldung/array/conversions/FloatToByteArray.java new file mode 100644 index 0000000000..b831e436a5 --- /dev/null +++ b/core-java-arrays/src/main/java/com/baeldung/array/conversions/FloatToByteArray.java @@ -0,0 +1,44 @@ +package com.baeldung.array.conversions; + +import java.nio.ByteBuffer; + +public class FloatToByteArray { + + /** + * convert float into byte array using Float API floatToIntBits + * @param value + * @return byte[] + */ + public static byte[] floatToByteArray(float value) { + int intBits = Float.floatToIntBits(value); + return new byte[] {(byte) (intBits >> 24), (byte) (intBits >> 16), (byte) (intBits >> 8), (byte) (intBits) }; + } + + /** + * convert byte array into float using Float API intBitsToFloat + * @param bytes + * @return float + */ + public static float byteArrayToFloat(byte[] bytes) { + int intBits = bytes[0] << 24 | (bytes[1] & 0xFF) << 16 | (bytes[2] & 0xFF) << 8 | (bytes[3] & 0xFF); + return Float.intBitsToFloat(intBits); + } + + /** + * convert float into byte array using ByteBuffer + * @param value + * @return byte[] + */ + public static byte[] floatToByteArrayWithByteBuffer(float value) { + return ByteBuffer.allocate(4).putFloat(value).array(); + } + + /** + * convert byte array into float using ByteBuffer + * @param bytes + * @return float + */ + public static float byteArrayToFloatWithByteBuffer(byte[] bytes) { + return ByteBuffer.wrap(bytes).getFloat(); + } +} diff --git a/core-java-arrays/src/test/java/com/baeldung/array/conversions/FloatToByteArrayUnitTest.java b/core-java-arrays/src/test/java/com/baeldung/array/conversions/FloatToByteArrayUnitTest.java new file mode 100644 index 0000000000..a2cd273f21 --- /dev/null +++ b/core-java-arrays/src/test/java/com/baeldung/array/conversions/FloatToByteArrayUnitTest.java @@ -0,0 +1,46 @@ +package com.baeldung.array.conversions; + +import static com.baeldung.array.conversions.FloatToByteArray.byteArrayToFloat; +import static com.baeldung.array.conversions.FloatToByteArray.byteArrayToFloatWithByteBuffer; +import static com.baeldung.array.conversions.FloatToByteArray.floatToByteArray; +import static com.baeldung.array.conversions.FloatToByteArray.floatToByteArrayWithByteBuffer; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class FloatToByteArrayUnitTest { + + @Test + public void givenAFloat_thenConvertToByteArray() { + assertArrayEquals(new byte[] { 63, -116, -52, -51}, floatToByteArray(1.1f)); + } + + @Test + public void givenAByteArray_thenConvertToFloat() { + assertEquals(1.1f, byteArrayToFloat(new byte[] { 63, -116, -52, -51}), 0); + } + + @Test + public void givenAFloat_thenConvertToByteArrayUsingByteBuffer() { + assertArrayEquals(new byte[] { 63, -116, -52, -51}, floatToByteArrayWithByteBuffer(1.1f)); + } + + @Test + public void givenAByteArray_thenConvertToFloatUsingByteBuffer() { + assertEquals(1.1f, byteArrayToFloatWithByteBuffer(new byte[] { 63, -116, -52, -51}), 0); + } + + @Test + public void givenAFloat_thenConvertToByteArray_thenConvertToFloat() { + float floatToConvert = 200.12f; + byte[] byteArray = floatToByteArray(floatToConvert); + assertEquals(200.12f, byteArrayToFloat(byteArray), 0); + } + + @Test + public void givenAFloat_thenConvertToByteArrayWithByteBuffer_thenConvertToFloatWithByteBuffer() { + float floatToConvert = 30100.42f; + byte[] byteArray = floatToByteArrayWithByteBuffer(floatToConvert); + assertEquals(30100.42f, byteArrayToFloatWithByteBuffer(byteArray), 0); + } +} From 4c7ef02bf3781299a09db3430c2989648f6d5841 Mon Sep 17 00:00:00 2001 From: Andrea Ligios Date: Wed, 23 Jan 2019 18:12:06 +0100 Subject: [PATCH 270/271] BAEL-2294 (#6191) * BAEL-2294 * BAEL-2294 * live tests... * formatting * Live Tests! But not parent pom. Yet. --- blade/README.md | 5 + blade/pom.xml | 189 ++++++++++++++++++ .../java/com/baeldung/blade/sample/App.java | 38 ++++ .../sample/AttributesExampleController.java | 37 ++++ .../blade/sample/LogExampleController.java | 22 ++ .../ParameterInjectionExampleController.java | 71 +++++++ .../blade/sample/RouteExampleController.java | 78 ++++++++ .../configuration/BaeldungException.java | 9 + .../configuration/GlobalExceptionHandler.java | 25 +++ .../sample/configuration/LoadConfig.java | 23 +++ .../sample/configuration/ScheduleExample.java | 15 ++ .../sample/interceptors/BaeldungHook.java | 17 ++ .../interceptors/BaeldungMiddleware.java | 15 ++ .../com/baeldung/blade/sample/vo/User.java | 16 ++ .../src/main/resources/application.properties | 5 + .../src/main/resources/custom-static/icon.png | Bin 0 -> 28893 bytes blade/src/main/resources/favicon.ico | Bin 0 -> 650 bytes blade/src/main/resources/static/app.css | 1 + blade/src/main/resources/static/app.js | 0 .../main/resources/static/file-upload.html | 43 ++++ .../src/main/resources/static/user-post.html | 25 +++ .../main/resources/templates/allmatch.html | 1 + .../src/main/resources/templates/delete.html | 1 + blade/src/main/resources/templates/get.html | 1 + blade/src/main/resources/templates/index.html | 30 +++ .../src/main/resources/templates/my-404.html | 10 + .../src/main/resources/templates/my-500.html | 12 ++ blade/src/main/resources/templates/post.html | 1 + blade/src/main/resources/templates/put.html | 1 + .../templates/template-output-test.html | 1 + .../baeldung/blade/sample/AppLiveTest.java | 56 ++++++ .../AttributesExampleControllerLiveTest.java | 55 +++++ ...terInjectionExampleControllerLiveTest.java | 82 ++++++++ .../RouteExampleControllerLiveTest.java | 117 +++++++++++ pom.xml | 2 + 35 files changed, 1004 insertions(+) create mode 100644 blade/README.md create mode 100644 blade/pom.xml create mode 100644 blade/src/main/java/com/baeldung/blade/sample/App.java create mode 100644 blade/src/main/java/com/baeldung/blade/sample/AttributesExampleController.java create mode 100644 blade/src/main/java/com/baeldung/blade/sample/LogExampleController.java create mode 100644 blade/src/main/java/com/baeldung/blade/sample/ParameterInjectionExampleController.java create mode 100644 blade/src/main/java/com/baeldung/blade/sample/RouteExampleController.java create mode 100644 blade/src/main/java/com/baeldung/blade/sample/configuration/BaeldungException.java create mode 100644 blade/src/main/java/com/baeldung/blade/sample/configuration/GlobalExceptionHandler.java create mode 100644 blade/src/main/java/com/baeldung/blade/sample/configuration/LoadConfig.java create mode 100644 blade/src/main/java/com/baeldung/blade/sample/configuration/ScheduleExample.java create mode 100644 blade/src/main/java/com/baeldung/blade/sample/interceptors/BaeldungHook.java create mode 100644 blade/src/main/java/com/baeldung/blade/sample/interceptors/BaeldungMiddleware.java create mode 100644 blade/src/main/java/com/baeldung/blade/sample/vo/User.java create mode 100644 blade/src/main/resources/application.properties create mode 100644 blade/src/main/resources/custom-static/icon.png create mode 100644 blade/src/main/resources/favicon.ico create mode 100644 blade/src/main/resources/static/app.css create mode 100644 blade/src/main/resources/static/app.js create mode 100644 blade/src/main/resources/static/file-upload.html create mode 100644 blade/src/main/resources/static/user-post.html create mode 100644 blade/src/main/resources/templates/allmatch.html create mode 100644 blade/src/main/resources/templates/delete.html create mode 100644 blade/src/main/resources/templates/get.html create mode 100644 blade/src/main/resources/templates/index.html create mode 100644 blade/src/main/resources/templates/my-404.html create mode 100644 blade/src/main/resources/templates/my-500.html create mode 100644 blade/src/main/resources/templates/post.html create mode 100644 blade/src/main/resources/templates/put.html create mode 100644 blade/src/main/resources/templates/template-output-test.html create mode 100644 blade/src/test/java/com/baeldung/blade/sample/AppLiveTest.java create mode 100644 blade/src/test/java/com/baeldung/blade/sample/AttributesExampleControllerLiveTest.java create mode 100644 blade/src/test/java/com/baeldung/blade/sample/ParameterInjectionExampleControllerLiveTest.java create mode 100644 blade/src/test/java/com/baeldung/blade/sample/RouteExampleControllerLiveTest.java diff --git a/blade/README.md b/blade/README.md new file mode 100644 index 0000000000..d823de775f --- /dev/null +++ b/blade/README.md @@ -0,0 +1,5 @@ +### Relevant Articles: + +- [Blade - A Complete GuideBook](http://www.baeldung.com/blade) + +Run Integration Tests with `mvn integration-test` \ No newline at end of file diff --git a/blade/pom.xml b/blade/pom.xml new file mode 100644 index 0000000000..6bad505f4a --- /dev/null +++ b/blade/pom.xml @@ -0,0 +1,189 @@ + + + 4.0.0 + blade + blade + + + com.baeldung + 1.0.0-SNAPSHOT + + + + + + + + + + 1.8 + 1.8 + + + + + com.bladejava + blade-mvc + 2.0.14.RELEASE + + + + org.webjars + bootstrap + 4.2.1 + + + + org.apache.commons + commons-lang3 + 3.8.1 + + + + + org.projectlombok + lombok + 1.18.4 + provided + + + + + junit + junit + 4.12 + test + + + org.assertj + assertj-core + 3.11.1 + test + + + org.apache.httpcomponents + httpclient + 4.5.6 + test + + + org.apache.httpcomponents + httpmime + 4.5.6 + test + + + org.apache.httpcomponents + httpcore + 4.4.10 + test + + + + sample-blade-app + + + + org.apache.maven.plugins + maven-surefire-plugin + + 3 + true + + **/*LiveTest.java + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.0.0-M3 + + + **/*LiveTest.java + + + + + + integration-test + verify + + + + + + + com.bazaarvoice.maven.plugins + process-exec-maven-plugin + 0.7 + + + + blade-process + pre-integration-test + + start + + + Blade + false + + java + -jar + sample-blade-app.jar + + + + + + + stop-all + post-integration-test + + stop-all + + + + + + + + maven-assembly-plugin + 3.1.0 + + ${project.build.finalName} + false + + + com.baeldung.blade.sample.App + + + + jar-with-dependencies + + + + + make-assembly + package + + single + + + + + + maven-compiler-plugin + + 1.8 + 1.8 + UTF-8 + + + + + diff --git a/blade/src/main/java/com/baeldung/blade/sample/App.java b/blade/src/main/java/com/baeldung/blade/sample/App.java new file mode 100644 index 0000000000..f3f3d4aebd --- /dev/null +++ b/blade/src/main/java/com/baeldung/blade/sample/App.java @@ -0,0 +1,38 @@ +package com.baeldung.blade.sample; + +import com.baeldung.blade.sample.interceptors.BaeldungMiddleware; +import com.blade.Blade; +import com.blade.event.EventType; +import com.blade.mvc.WebContext; +import com.blade.mvc.http.Session; + +public class App { + + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(App.class); + + public static void main(String[] args) { + + Blade.of() + .get("/", ctx -> ctx.render("index.html")) + .get("/basic-route-example", ctx -> ctx.text("GET called")) + .post("/basic-route-example", ctx -> ctx.text("POST called")) + .put("/basic-route-example", ctx -> ctx.text("PUT called")) + .delete("/basic-route-example", ctx -> ctx.text("DELETE called")) + .addStatics("/custom-static") + // .showFileList(true) + .enableCors(true) + .before("/user/*", ctx -> log.info("[NarrowedHook] Before '/user/*', URL called: " + ctx.uri())) + .on(EventType.SERVER_STARTED, e -> { + String version = WebContext.blade() + .env("app.version") + .orElse("N/D"); + log.info("[Event::serverStarted] Loading 'app.version' from configuration, value: " + version); + }) + .on(EventType.SESSION_CREATED, e -> { + Session session = (Session) e.attribute("session"); + session.attribute("mySessionValue", "Baeldung"); + }) + .use(new BaeldungMiddleware()) + .start(App.class, args); + } +} diff --git a/blade/src/main/java/com/baeldung/blade/sample/AttributesExampleController.java b/blade/src/main/java/com/baeldung/blade/sample/AttributesExampleController.java new file mode 100644 index 0000000000..339ba701f7 --- /dev/null +++ b/blade/src/main/java/com/baeldung/blade/sample/AttributesExampleController.java @@ -0,0 +1,37 @@ +package com.baeldung.blade.sample; + +import com.blade.mvc.annotation.GetRoute; +import com.blade.mvc.annotation.Path; +import com.blade.mvc.http.Request; +import com.blade.mvc.http.Response; +import com.blade.mvc.http.Session; + +@Path +public class AttributesExampleController { + + public final static String REQUEST_VALUE = "Some Request value"; + public final static String SESSION_VALUE = "1337"; + public final static String HEADER = "Some Header"; + + @GetRoute("/request-attribute-example") + public void getRequestAttribute(Request request, Response response) { + request.attribute("request-val", REQUEST_VALUE); + String requestVal = request.attribute("request-val"); + response.text(requestVal); + } + + @GetRoute("/session-attribute-example") + public void getSessionAttribute(Request request, Response response) { + Session session = request.session(); + session.attribute("session-val", SESSION_VALUE); + String sessionVal = session.attribute("session-val"); + response.text(sessionVal); + } + + @GetRoute("/header-example") + public void getHeader(Request request, Response response) { + String headerVal = request.header("a-header", HEADER); + response.header("a-header", headerVal); + } + +} diff --git a/blade/src/main/java/com/baeldung/blade/sample/LogExampleController.java b/blade/src/main/java/com/baeldung/blade/sample/LogExampleController.java new file mode 100644 index 0000000000..f0c22c70dd --- /dev/null +++ b/blade/src/main/java/com/baeldung/blade/sample/LogExampleController.java @@ -0,0 +1,22 @@ +package com.baeldung.blade.sample; + +import com.blade.mvc.annotation.Path; +import com.blade.mvc.annotation.Route; +import com.blade.mvc.http.Response; + +@Path +public class LogExampleController { + + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LogExampleController.class); + + @Route(value = "/test-logs") + public void testLogs(Response response) { + log.trace("This is a TRACE Message"); + log.debug("This is a DEBUG Message"); + log.info("This is an INFO Message"); + log.warn("This is a WARN Message"); + log.error("This is an ERROR Message"); + response.text("Check in ./logs"); + } + +} diff --git a/blade/src/main/java/com/baeldung/blade/sample/ParameterInjectionExampleController.java b/blade/src/main/java/com/baeldung/blade/sample/ParameterInjectionExampleController.java new file mode 100644 index 0000000000..bc28244022 --- /dev/null +++ b/blade/src/main/java/com/baeldung/blade/sample/ParameterInjectionExampleController.java @@ -0,0 +1,71 @@ +package com.baeldung.blade.sample; + +import java.nio.file.Files; +import java.nio.file.StandardOpenOption; + +import com.baeldung.blade.sample.vo.User; +import com.blade.mvc.annotation.CookieParam; +import com.blade.mvc.annotation.GetRoute; +import com.blade.mvc.annotation.HeaderParam; +import com.blade.mvc.annotation.JSON; +import com.blade.mvc.annotation.MultipartParam; +import com.blade.mvc.annotation.Param; +import com.blade.mvc.annotation.Path; +import com.blade.mvc.annotation.PathParam; +import com.blade.mvc.annotation.PostRoute; +import com.blade.mvc.http.Response; +import com.blade.mvc.multipart.FileItem; +import com.blade.mvc.ui.RestResponse; + +@Path +public class ParameterInjectionExampleController { + + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(ParameterInjectionExampleController.class); + + @GetRoute("/params/form") + public void formParam(@Param String name, Response response) { + log.info("name: " + name); + response.text(name); + } + + @GetRoute("/params/path/:uid") + public void restfulParam(@PathParam Integer uid, Response response) { + log.info("uid: " + uid); + response.text(String.valueOf(uid)); + } + + @PostRoute("/params-file") // DO NOT USE A SLASH WITHIN THE ROUTE OR IT WILL BREAK (?) + @JSON + public RestResponse fileParam(@MultipartParam FileItem fileItem) throws Exception { + try { + byte[] fileContent = fileItem.getData(); + + log.debug("Saving the uploaded file"); + java.nio.file.Path tempFile = Files.createTempFile("baeldung_tempfiles", ".tmp"); + Files.write(tempFile, fileContent, StandardOpenOption.WRITE); + + return RestResponse.ok(); + } catch (Exception e) { + log.error(e.getMessage(), e); + return RestResponse.fail(e.getMessage()); + } + } + + @GetRoute("/params/header") + public void headerParam(@HeaderParam String customheader, Response response) { + log.info("Custom header: " + customheader); + response.text(customheader); + } + + @GetRoute("/params/cookie") + public void cookieParam(@CookieParam(defaultValue = "default value") String myCookie, Response response) { + log.info("myCookie: " + myCookie); + response.text(myCookie); + } + + @PostRoute("/params/vo") + public void voParam(@Param User user, Response response) { + log.info("user as voParam: " + user.toString()); + response.html(user.toString() + "

Back"); + } +} \ No newline at end of file diff --git a/blade/src/main/java/com/baeldung/blade/sample/RouteExampleController.java b/blade/src/main/java/com/baeldung/blade/sample/RouteExampleController.java new file mode 100644 index 0000000000..7ba2a270a9 --- /dev/null +++ b/blade/src/main/java/com/baeldung/blade/sample/RouteExampleController.java @@ -0,0 +1,78 @@ +package com.baeldung.blade.sample; + +import com.baeldung.blade.sample.configuration.BaeldungException; +import com.blade.mvc.WebContext; +import com.blade.mvc.annotation.DeleteRoute; +import com.blade.mvc.annotation.GetRoute; +import com.blade.mvc.annotation.Path; +import com.blade.mvc.annotation.PostRoute; +import com.blade.mvc.annotation.PutRoute; +import com.blade.mvc.annotation.Route; +import com.blade.mvc.http.HttpMethod; +import com.blade.mvc.http.Request; +import com.blade.mvc.http.Response; + +@Path +public class RouteExampleController { + + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(RouteExampleController.class); + + @GetRoute("/route-example") + public String get() { + return "get.html"; + } + + @PostRoute("/route-example") + public String post() { + return "post.html"; + } + + @PutRoute("/route-example") + public String put() { + return "put.html"; + } + + @DeleteRoute("/route-example") + public String delete() { + return "delete.html"; + } + + @Route(value = "/another-route-example", method = HttpMethod.GET) + public String anotherGet() { + return "get.html"; + } + + @Route(value = "/allmatch-route-example") + public String allmatch() { + return "allmatch.html"; + } + + @Route(value = "/triggerInternalServerError") + public void triggerInternalServerError() { + int x = 1 / 0; + } + + @Route(value = "/triggerBaeldungException") + public void triggerBaeldungException() throws BaeldungException { + throw new BaeldungException("Foobar Exception to threat differently"); + } + + @Route(value = "/user/foo") + public void urlCoveredByNarrowedWebhook(Response response) { + response.text("Check out for the WebHook covering '/user/*' in the logs"); + } + + @GetRoute("/load-configuration-in-a-route") + public void loadConfigurationInARoute(Response response) { + String authors = WebContext.blade() + .env("app.authors", "Unknown authors"); + log.info("[/load-configuration-in-a-route] Loading 'app.authors' from configuration, value: " + authors); + response.render("index.html"); + } + + @GetRoute("/template-output-test") + public void templateOutputTest(Request request, Response response) { + request.attribute("name", "Blade"); + response.render("template-output-test.html"); + } +} diff --git a/blade/src/main/java/com/baeldung/blade/sample/configuration/BaeldungException.java b/blade/src/main/java/com/baeldung/blade/sample/configuration/BaeldungException.java new file mode 100644 index 0000000000..01a030b7e7 --- /dev/null +++ b/blade/src/main/java/com/baeldung/blade/sample/configuration/BaeldungException.java @@ -0,0 +1,9 @@ +package com.baeldung.blade.sample.configuration; + +public class BaeldungException extends RuntimeException { + + public BaeldungException(String message) { + super(message); + } + +} \ No newline at end of file diff --git a/blade/src/main/java/com/baeldung/blade/sample/configuration/GlobalExceptionHandler.java b/blade/src/main/java/com/baeldung/blade/sample/configuration/GlobalExceptionHandler.java new file mode 100644 index 0000000000..ab7b81c0dc --- /dev/null +++ b/blade/src/main/java/com/baeldung/blade/sample/configuration/GlobalExceptionHandler.java @@ -0,0 +1,25 @@ +package com.baeldung.blade.sample.configuration; + +import com.blade.ioc.annotation.Bean; +import com.blade.mvc.WebContext; +import com.blade.mvc.handler.DefaultExceptionHandler; + +@Bean +public class GlobalExceptionHandler extends DefaultExceptionHandler { + + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(GlobalExceptionHandler.class); + + @Override + public void handle(Exception e) { + if (e instanceof BaeldungException) { + Exception baeldungException = (BaeldungException) e; + String msg = baeldungException.getMessage(); + log.error("[GlobalExceptionHandler] Intercepted an exception to threat with additional logic. Error message: " + msg); + WebContext.response() + .render("index.html"); + + } else { + super.handle(e); + } + } +} \ No newline at end of file diff --git a/blade/src/main/java/com/baeldung/blade/sample/configuration/LoadConfig.java b/blade/src/main/java/com/baeldung/blade/sample/configuration/LoadConfig.java new file mode 100644 index 0000000000..0f1aab1b52 --- /dev/null +++ b/blade/src/main/java/com/baeldung/blade/sample/configuration/LoadConfig.java @@ -0,0 +1,23 @@ +package com.baeldung.blade.sample.configuration; + +import com.blade.Blade; +import com.blade.ioc.annotation.Bean; +import com.blade.loader.BladeLoader; +import com.blade.mvc.WebContext; + +@Bean +public class LoadConfig implements BladeLoader { + + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoadConfig.class); + + @Override + public void load(Blade blade) { + String version = WebContext.blade() + .env("app.version") + .orElse("N/D"); + String authors = WebContext.blade() + .env("app.authors", "Unknown authors"); + + log.info("[LoadConfig] loaded 'app.version' (" + version + ") and 'app.authors' (" + authors + ") in a configuration bean"); + } +} \ No newline at end of file diff --git a/blade/src/main/java/com/baeldung/blade/sample/configuration/ScheduleExample.java b/blade/src/main/java/com/baeldung/blade/sample/configuration/ScheduleExample.java new file mode 100644 index 0000000000..c170975818 --- /dev/null +++ b/blade/src/main/java/com/baeldung/blade/sample/configuration/ScheduleExample.java @@ -0,0 +1,15 @@ +package com.baeldung.blade.sample.configuration; + +import com.blade.ioc.annotation.Bean; +import com.blade.task.annotation.Schedule; + +@Bean +public class ScheduleExample { + + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(ScheduleExample.class); + + @Schedule(name = "baeldungTask", cron = "0 */1 * * * ?") + public void runScheduledTask() { + log.info("[ScheduleExample] This is a scheduled Task running once per minute."); + } +} diff --git a/blade/src/main/java/com/baeldung/blade/sample/interceptors/BaeldungHook.java b/blade/src/main/java/com/baeldung/blade/sample/interceptors/BaeldungHook.java new file mode 100644 index 0000000000..4d0d178b0d --- /dev/null +++ b/blade/src/main/java/com/baeldung/blade/sample/interceptors/BaeldungHook.java @@ -0,0 +1,17 @@ +package com.baeldung.blade.sample.interceptors; + +import com.blade.ioc.annotation.Bean; +import com.blade.mvc.RouteContext; +import com.blade.mvc.hook.WebHook; + +@Bean +public class BaeldungHook implements WebHook { + + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(BaeldungHook.class); + + @Override + public boolean before(RouteContext ctx) { + log.info("[BaeldungHook] called before Route method"); + return true; + } +} \ No newline at end of file diff --git a/blade/src/main/java/com/baeldung/blade/sample/interceptors/BaeldungMiddleware.java b/blade/src/main/java/com/baeldung/blade/sample/interceptors/BaeldungMiddleware.java new file mode 100644 index 0000000000..3342cd8b01 --- /dev/null +++ b/blade/src/main/java/com/baeldung/blade/sample/interceptors/BaeldungMiddleware.java @@ -0,0 +1,15 @@ +package com.baeldung.blade.sample.interceptors; + +import com.blade.mvc.RouteContext; +import com.blade.mvc.hook.WebHook; + +public class BaeldungMiddleware implements WebHook { + + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(BaeldungMiddleware.class); + + @Override + public boolean before(RouteContext context) { + log.info("[BaeldungMiddleware] called before Route method and other WebHooks"); + return true; + } +} \ No newline at end of file diff --git a/blade/src/main/java/com/baeldung/blade/sample/vo/User.java b/blade/src/main/java/com/baeldung/blade/sample/vo/User.java new file mode 100644 index 0000000000..b493dc3663 --- /dev/null +++ b/blade/src/main/java/com/baeldung/blade/sample/vo/User.java @@ -0,0 +1,16 @@ +package com.baeldung.blade.sample.vo; + +import org.apache.commons.lang3.builder.ReflectionToStringBuilder; + +import lombok.Getter; +import lombok.Setter; + +public class User { + @Getter @Setter private String name; + @Getter @Setter private String site; + + @Override + public String toString() { + return ReflectionToStringBuilder.toString(this); + } +} \ No newline at end of file diff --git a/blade/src/main/resources/application.properties b/blade/src/main/resources/application.properties new file mode 100644 index 0000000000..ebf365406a --- /dev/null +++ b/blade/src/main/resources/application.properties @@ -0,0 +1,5 @@ +mvc.statics.show-list=true +mvc.view.404=my-404.html +mvc.view.500=my-500.html +app.version=0.0.1 +app.authors=Andrea Ligios diff --git a/blade/src/main/resources/custom-static/icon.png b/blade/src/main/resources/custom-static/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..59af395afc55f38e5a727a119b4627088753c28e GIT binary patch literal 28893 zcmV)5K*_&}P)Pyg07*naRCodGy$86iXIba_t-f|k4=IEsq!J=Tz)*sYFgC15l%sQWJZDq}buLFa zqnF1viiTKFQ4uN9^f-<~l+ig@r--8>f)pL3qyV8LArN-zPIg)4{D1%deZTL!*4jyS z3Nzq@7(-suVk0z=jLYmQMsyDN4#@2riVDr zEilZPAu>OYZe*LL*&t_}k`2FXwv1Ini(Z7wym6w(5truVrT%TOHjHVSYp}sVZNofK zGgXfU^APAl!(xq#mbuA;o^c1A@Y;subr>*h0(?4~0}Ha@g* zc=MV&Z$13BKYrQG?|koHee956*7c(Jrp0JP(H?e7v=0x)Yb1#77c^e@vKO3l{O3LQ z(a+s;+~V_=mgk;6H$S(F1*ExvH0h;M0Tw+VAi<>=8Pn*d`sT5OBC6ipg4?nbP#8Yy z&~R-ZC3qHt&p!)8i+-l{CfLSfg?lB&g&m6yCVUr`Wvc*6i6WZnS8YTd=O+4HT!YMj zi(uQBj5EZ=vLAwNmeKZ$$nnIov$=b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*zm0*x zkgnIa!QjZ=@8a+F@b&uk_WJkt`}p|#`TG3&{Qdl3v2$j#cxJPCXta81wR>x}eQdXW zZMT1Jw|{Q9fN;2ha=C+Zx`TDPg?GD$dAx{uyoq|fiGRP2f5480!m3{>-FyJ_3rQY@$mQY@c8ob`1AAm^z`}l^!oPs z{QCU<{r&#^{r>*`{{H^||Amb{2><{9_(?=TR5;7!kwtdHKoCUd&q$VJcFYiFW@ct) zW`_GOv(Qc>`v6IAe|6QXZXy2iD5El$@wlpljiKwsKsj$I!@Zl2tVlm<$lB=evibA_ zNk4&Vnm)QK0>HdagmTV40C>*vHK_|!$ECZR-+d)Ns7I)z%h}$5`%b-P!-dPu#1)*@ z=?1Y30O_u|Pgv6vWK|I0rZ0L6*@1F`v}31$lX|^mb@v0`W{+GbLSf8nU<5+3)k1Eo z*_wR=QeiJ|o!QTn&PPOKDGQkG-i~to{l%PWw4B2d1b5oB8yGF4iHJ1piM`{4^?qCV kz0ndv2qkJlQi^{#zhk}{OSDILr~m)}07*qoM6N<$f)M?L^Z)<= literal 0 HcmV?d00001 diff --git a/blade/src/main/resources/static/app.css b/blade/src/main/resources/static/app.css new file mode 100644 index 0000000000..9fff13d9b6 --- /dev/null +++ b/blade/src/main/resources/static/app.css @@ -0,0 +1 @@ +/* App CSS */ \ No newline at end of file diff --git a/blade/src/main/resources/static/app.js b/blade/src/main/resources/static/app.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/blade/src/main/resources/static/file-upload.html b/blade/src/main/resources/static/file-upload.html new file mode 100644 index 0000000000..b805be81b1 --- /dev/null +++ b/blade/src/main/resources/static/file-upload.html @@ -0,0 +1,43 @@ + + + + +Title + + + + + +

File Upload and download test

+
+ + +
+ +
+ Back + + + + \ No newline at end of file diff --git a/blade/src/main/resources/static/user-post.html b/blade/src/main/resources/static/user-post.html new file mode 100644 index 0000000000..ccfc4e8d0b --- /dev/null +++ b/blade/src/main/resources/static/user-post.html @@ -0,0 +1,25 @@ + + + + +Title + + + + + +

User POJO post test

+ + +
+ Person POJO: + + + +
+ +
+ Back + + + \ No newline at end of file diff --git a/blade/src/main/resources/templates/allmatch.html b/blade/src/main/resources/templates/allmatch.html new file mode 100644 index 0000000000..7a4bfa070f --- /dev/null +++ b/blade/src/main/resources/templates/allmatch.html @@ -0,0 +1 @@ +ALLMATCH called \ No newline at end of file diff --git a/blade/src/main/resources/templates/delete.html b/blade/src/main/resources/templates/delete.html new file mode 100644 index 0000000000..1acb4b0b62 --- /dev/null +++ b/blade/src/main/resources/templates/delete.html @@ -0,0 +1 @@ +DELETE called \ No newline at end of file diff --git a/blade/src/main/resources/templates/get.html b/blade/src/main/resources/templates/get.html new file mode 100644 index 0000000000..2c37aa1058 --- /dev/null +++ b/blade/src/main/resources/templates/get.html @@ -0,0 +1 @@ +GET called \ No newline at end of file diff --git a/blade/src/main/resources/templates/index.html b/blade/src/main/resources/templates/index.html new file mode 100644 index 0000000000..6b7c2e77ad --- /dev/null +++ b/blade/src/main/resources/templates/index.html @@ -0,0 +1,30 @@ + + + + +Baeldung Blade App • Written by Andrea Ligios + + + +

Baeldung Blade App - Showcase

+ +

Manual tests

+

The following are tests which are not covered by integration tests, but that can be run manually in order to check the functionality, either in the browser or in the logs, depending on the case.

+ + + + +

Session value created in App.java

+

mySessionValue = ${mySessionValue}

+ + + + + \ No newline at end of file diff --git a/blade/src/main/resources/templates/my-404.html b/blade/src/main/resources/templates/my-404.html new file mode 100644 index 0000000000..0fa694f241 --- /dev/null +++ b/blade/src/main/resources/templates/my-404.html @@ -0,0 +1,10 @@ + + + + + 404 Not found + + + Custom Error 404 Page + + \ No newline at end of file diff --git a/blade/src/main/resources/templates/my-500.html b/blade/src/main/resources/templates/my-500.html new file mode 100644 index 0000000000..cc8438bfd6 --- /dev/null +++ b/blade/src/main/resources/templates/my-500.html @@ -0,0 +1,12 @@ + + + + + 500 Internal Server Error + + +

Custom Error 500 Page

+

The following error occurred: "${message}"

+
 ${stackTrace} 
+ + \ No newline at end of file diff --git a/blade/src/main/resources/templates/post.html b/blade/src/main/resources/templates/post.html new file mode 100644 index 0000000000..b7a8a931cd --- /dev/null +++ b/blade/src/main/resources/templates/post.html @@ -0,0 +1 @@ +POST called \ No newline at end of file diff --git a/blade/src/main/resources/templates/put.html b/blade/src/main/resources/templates/put.html new file mode 100644 index 0000000000..bdbe6d3285 --- /dev/null +++ b/blade/src/main/resources/templates/put.html @@ -0,0 +1 @@ +PUT called \ No newline at end of file diff --git a/blade/src/main/resources/templates/template-output-test.html b/blade/src/main/resources/templates/template-output-test.html new file mode 100644 index 0000000000..233b12fb88 --- /dev/null +++ b/blade/src/main/resources/templates/template-output-test.html @@ -0,0 +1 @@ +

Hello, ${name}!

\ No newline at end of file diff --git a/blade/src/test/java/com/baeldung/blade/sample/AppLiveTest.java b/blade/src/test/java/com/baeldung/blade/sample/AppLiveTest.java new file mode 100644 index 0000000000..1172e6755f --- /dev/null +++ b/blade/src/test/java/com/baeldung/blade/sample/AppLiveTest.java @@ -0,0 +1,56 @@ +package com.baeldung.blade.sample; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.junit.Test; + +public class AppLiveTest { + + @Test + public void givenBasicRoute_whenGet_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpGet("http://localhost:9000/basic-route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("GET called"); + } + } + + @Test + public void givenBasicRoute_whenPost_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpPost("http://localhost:9000/basic-route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("POST called"); + } + } + + @Test + public void givenBasicRoute_whenPut_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpPut("http://localhost:9000/basic-route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("PUT called"); + } + } + + @Test + public void givenBasicRoute_whenDelete_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpDelete("http://localhost:9000/basic-route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("DELETE called"); + } + } +} diff --git a/blade/src/test/java/com/baeldung/blade/sample/AttributesExampleControllerLiveTest.java b/blade/src/test/java/com/baeldung/blade/sample/AttributesExampleControllerLiveTest.java new file mode 100644 index 0000000000..7cf00c2d4b --- /dev/null +++ b/blade/src/test/java/com/baeldung/blade/sample/AttributesExampleControllerLiveTest.java @@ -0,0 +1,55 @@ +package com.baeldung.blade.sample; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.junit.Test; + +public class AttributesExampleControllerLiveTest { + + @Test + public void givenRequestAttribute_whenSet_thenRetrieveWithGet() throws Exception { + final HttpUriRequest request = new HttpGet("http://localhost:9000/request-attribute-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo(AttributesExampleController.REQUEST_VALUE); + } + } + + @Test + public void givenSessionAttribute_whenSet_thenRetrieveWithGet() throws Exception { + final HttpUriRequest request = new HttpGet("http://localhost:9000/session-attribute-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo(AttributesExampleController.SESSION_VALUE); + } + } + + @Test + public void givenHeader_whenSet_thenRetrieveWithGet() throws Exception { + final HttpUriRequest request = new HttpGet("http://localhost:9000/header-example"); + request.addHeader("a-header","foobar"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(httpResponse.getHeaders("a-header")[0].getValue()).isEqualTo("foobar"); + } + } + + @Test + public void givenNoHeader_whenSet_thenRetrieveDefaultValueWithGet() throws Exception { + final HttpUriRequest request = new HttpGet("http://localhost:9000/header-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(httpResponse.getHeaders("a-header")[0].getValue()).isEqualTo(AttributesExampleController.HEADER); + } + } + +} diff --git a/blade/src/test/java/com/baeldung/blade/sample/ParameterInjectionExampleControllerLiveTest.java b/blade/src/test/java/com/baeldung/blade/sample/ParameterInjectionExampleControllerLiveTest.java new file mode 100644 index 0000000000..fbd5280116 --- /dev/null +++ b/blade/src/test/java/com/baeldung/blade/sample/ParameterInjectionExampleControllerLiveTest.java @@ -0,0 +1,82 @@ +package com.baeldung.blade.sample; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.junit.Test; + +public class ParameterInjectionExampleControllerLiveTest { + + @Test + public void givenFormParam_whenSet_thenRetrieveWithGet() throws Exception { + URIBuilder builder = new URIBuilder("http://localhost:9000/params/form"); + builder.setParameter("name", "Andrea Ligios"); + + final HttpUriRequest request = new HttpGet(builder.build()); + + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("Andrea Ligios"); + } + } + + @Test + public void givenPathParam_whenSet_thenRetrieveWithGet() throws Exception { + final HttpUriRequest request = new HttpGet("http://localhost:9000/params/path/1337"); + + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("1337"); + } + } + + // @Test + // public void givenFileParam_whenSet_thenRetrieveWithGet() throws Exception { + // + // byte[] data = "this is some temp file content".getBytes("UTF-8"); + // java.nio.file.Path tempFile = Files.createTempFile("baeldung_test_tempfiles", ".tmp"); + // Files.write(tempFile, data, StandardOpenOption.WRITE); + // + // //HttpEntity entity = MultipartEntityBuilder.create().addPart("file", new FileBody(tempFile.toFile())).build(); + // HttpEntity entity = MultipartEntityBuilder.create().addTextBody("field1", "value1") + // .addBinaryBody("fileItem", tempFile.toFile(), ContentType.create("application/octet-stream"), "file1.txt").build(); + // + // final HttpPost post = new HttpPost("http://localhost:9000/params-file"); + // post.setEntity(entity); + // + // try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create().build().execute(post);) { + // assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("file1.txt"); + // } + // } + + @Test + public void givenHeader_whenSet_thenRetrieveWithGet() throws Exception { + final HttpUriRequest request = new HttpGet("http://localhost:9000/params/header"); + request.addHeader("customheader", "foobar"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("foobar"); + } + } + + @Test + public void givenNoCookie_whenCalled_thenReadDefaultValue() throws Exception { + + final HttpUriRequest request = new HttpGet("http://localhost:9000/params/cookie"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("default value"); + } + + } + +} diff --git a/blade/src/test/java/com/baeldung/blade/sample/RouteExampleControllerLiveTest.java b/blade/src/test/java/com/baeldung/blade/sample/RouteExampleControllerLiveTest.java new file mode 100644 index 0000000000..df8e70c461 --- /dev/null +++ b/blade/src/test/java/com/baeldung/blade/sample/RouteExampleControllerLiveTest.java @@ -0,0 +1,117 @@ +package com.baeldung.blade.sample; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.junit.Test; + +public class RouteExampleControllerLiveTest { + + @Test + public void givenRoute_whenGet_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpGet("http://localhost:9000/route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("GET called"); + } + } + + @Test + public void givenRoute_whenPost_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpPost("http://localhost:9000/route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("POST called"); + } + } + + @Test + public void givenRoute_whenPut_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpPut("http://localhost:9000/route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("PUT called"); + } + } + + @Test + public void givenRoute_whenDelete_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpDelete("http://localhost:9000/route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("DELETE called"); + } + } + + @Test + public void givenAnotherRoute_whenGet_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpGet("http://localhost:9000/another-route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("GET called"); + } + } + + @Test + public void givenAllMatchRoute_whenGet_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpGet("http://localhost:9000/allmatch-route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("ALLMATCH called"); + } + } + + @Test + public void givenAllMatchRoute_whenPost_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpPost("http://localhost:9000/allmatch-route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("ALLMATCH called"); + } + } + + @Test + public void givenAllMatchRoute_whenPut_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpPut("http://localhost:9000/allmatch-route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("ALLMATCH called"); + } + } + + @Test + public void givenAllMatchRoute_whenDelete_thenCorrectOutput() throws Exception { + final HttpUriRequest request = new HttpDelete("http://localhost:9000/allmatch-route-example"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("ALLMATCH called"); + } + } + + @Test + public void givenRequestAttribute_whenRenderedWithTemplate_thenCorrectlyEvaluateIt() throws Exception { + final HttpUriRequest request = new HttpGet("http://localhost:9000/template-output-test"); + try (final CloseableHttpResponse httpResponse = HttpClientBuilder.create() + .build() + .execute(request);) { + assertThat(EntityUtils.toString(httpResponse.getEntity())).isEqualTo("

Hello, Blade!

"); + } + } + +} diff --git a/pom.xml b/pom.xml index 1c0738cafb..d084d0f7af 100644 --- a/pom.xml +++ b/pom.xml @@ -367,6 +367,8 @@ axon azure + blade + bootique cas/cas-secured-app From 24cf6b473d903256b1d906305b47e2f9c88ca066 Mon Sep 17 00:00:00 2001 From: Diego Moreira Date: Thu, 24 Jan 2019 21:32:29 -0300 Subject: [PATCH 271/271] BAEL-2270 Refactor - Moved classes from libraries to libraries-server (#6210) --- libraries-server/pom.xml | 25 +++++++++++++++++++ .../java/com/baeldung/smack/StanzaThread.java | 0 .../baeldung/smack/SmackIntegrationTest.java | 0 libraries/pom.xml | 24 ------------------ 4 files changed, 25 insertions(+), 24 deletions(-) rename {libraries => libraries-server}/src/main/java/com/baeldung/smack/StanzaThread.java (100%) rename {libraries => libraries-server}/src/test/java/com/baeldung/smack/SmackIntegrationTest.java (100%) diff --git a/libraries-server/pom.xml b/libraries-server/pom.xml index 661f5f01d5..f60e664fa7 100644 --- a/libraries-server/pom.xml +++ b/libraries-server/pom.xml @@ -71,6 +71,30 @@ tomcat-catalina ${tomcat.version} + + + org.igniterealtime.smack + smack-tcp + ${smack.version} + + + + org.igniterealtime.smack + smack-im + ${smack.version} + + + + org.igniterealtime.smack + smack-extensions + ${smack.version} + + + + org.igniterealtime.smack + smack-java7 + ${smack.version} + @@ -82,6 +106,7 @@ 4.1 4.12 8.5.24 + 4.3.1 \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/smack/StanzaThread.java b/libraries-server/src/main/java/com/baeldung/smack/StanzaThread.java similarity index 100% rename from libraries/src/main/java/com/baeldung/smack/StanzaThread.java rename to libraries-server/src/main/java/com/baeldung/smack/StanzaThread.java diff --git a/libraries/src/test/java/com/baeldung/smack/SmackIntegrationTest.java b/libraries-server/src/test/java/com/baeldung/smack/SmackIntegrationTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/smack/SmackIntegrationTest.java rename to libraries-server/src/test/java/com/baeldung/smack/SmackIntegrationTest.java diff --git a/libraries/pom.xml b/libraries/pom.xml index 301fa86c8d..d067525315 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -676,29 +676,6 @@ test - - org.igniterealtime.smack - smack-tcp - ${smack.version} - - - - org.igniterealtime.smack - smack-im - ${smack.version} - - - - org.igniterealtime.smack - smack-extensions - ${smack.version} - - - - org.igniterealtime.smack - smack-java7 - ${smack.version} - @@ -920,7 +897,6 @@ 1.1.0 2.7.1 3.6 - 4.3.1