+ *
+ * @param descriptor remote node descriptor
+ *
+ * @param module the name of the Erlang module containing the function to be called.
+ *
+ * @param function the name of the function to call.
+ *
+ * @param args a list of Erlang terms, to be used as arguments to the function.
+ *
+ * @return response holder, instance of {@link RpcResponse}.
+ */
+ public RpcResponse call (@NonNull NodeDescriptor descriptor, @NonNull String module, @NonNull String function, ErlangTerm ...args) {
+ return call(descriptor, atom(module), atom(function), args);
+ }
+
+ /**
+ * Send an RPC request to the remote Erlang node. This convenience function
+ * creates the following message and sends it to 'rex' on the remote node:
+ *
+ *
+ * Note that this method has unpredicatble results if the remote node is not
+ * an Erlang node.
+ *
+ *
+ *
+ * The response will be send back to this node in format:
+ *
+ * { :rex, response_body }
+ *
+ *
+ *
+ * @param remote remote node descriptor
+ *
+ * @param module the name of the Erlang module containing the function to be called.
+ *
+ * @param function the name of the function to call.
+ *
+ * @param args a list of Erlang terms, to be used as arguments to the function.
+ *
+ * @return response holder, instance of {@link RpcResponse}.
+ */
+ public RpcResponse call (@NonNull RemoteNode remote, @NonNull String module, @NonNull String function, ErlangTerm ...args) {
+ return call(remote, atom(module), atom(function), args);
+ }
+
+ /**
+ * Send an RPC request to the remote Erlang node. This convenience function
+ * creates the following message and sends it to 'rex' on the remote node:
+ *
+ *
+ * Note that this method has unpredicatble results if the remote node is not
+ * an Erlang node.
+ *
+ *
+ *
+ * The response will be send back to this node in format:
+ *
+ * { :rex, response_body }
+ *
+ *
+ *
+ * @param remoteNodeName remote node name
+ *
+ * @param module the atom of the Erlang module containing the function to be called.
+ *
+ * @param function the atom of the function to call.
+ *
+ * @param args a list of Erlang terms, to be used as arguments to the function.
+ *
+ * @return response holder, instance of {@link RpcResponse}.
+ */
+ public RpcResponse call (@NonNull String remoteNodeName, @NonNull ErlangAtom module, @NonNull ErlangAtom function, ErlangTerm ...args) {
+ val descriptor = NodeDescriptor.from(remoteNodeName);
+ return call(descriptor, module, function, args);
+ }
+
+ /**
+ * Send an RPC request to the remote Erlang node. This convenience function
+ * creates the following message and sends it to 'rex' on the remote node:
+ *
+ *
+ * Note that this method has unpredicatble results if the remote node is not
+ * an Erlang node.
+ *
+ *
+ *
+ * The response will be send back to this node in format:
+ *
+ * { :rex, response_body }
+ *
+ *
+ *
+ * @param descriptor remote node descriptor
+ *
+ * @param module the atom of the Erlang module containing the function to be called.
+ *
+ * @param function the atom of the function to call.
+ *
+ * @param args a list of Erlang terms, to be used as arguments to the function.
+ *
+ * @return response holder, instance of {@link RpcResponse}.
+ */
+ public RpcResponse call (@NonNull NodeDescriptor descriptor,
+ @NonNull ErlangAtom module,
+ @NonNull ErlangAtom function,
+ ErlangTerm ...args
+ ) {
+ RemoteNode remote = node.lookup(descriptor);
+ if (remote == null) {
+ throw new NoSuchRemoteNodeException(descriptor);
+ }
+ return call(remote, module, function, args);
+ }
+
+ /**
+ * Send an RPC request to the remote Erlang node. This convenience function
+ * creates the following message and sends it to 'rex' on the remote node:
+ *
+ *
+ * Note that this method has unpredicatble results if the remote node is not
+ * an Erlang node.
+ *
+ *
+ *
+ * The response will be send back to this node in format:
+ *
+ * { :rex, response_body }
+ *
+ *
+ *
+ * @param remote remote node descriptor
+ *
+ * @param module the atom of the Erlang module containing the function to be called.
+ *
+ * @param function the atom of the function to call.
+ *
+ * @param args a list of Erlang terms, to be used as arguments to the function.
+ *
+ * @return response holder, instance of {@link RpcResponse}.
+ */
+ @SuppressWarnings("PMD.AccessorClassGeneration")
+ public RpcResponse call (@NonNull RemoteNode remote, @NonNull ErlangAtom module, @NonNull ErlangAtom function, ErlangTerm ...args) {
+ ErlangTerm argumentsList;
+ if (args == null || args.length == 0) {
+ argumentsList = NIL;
+ } else if (args.length == 1 && args[0].isList()) {
+ argumentsList = args[0];
+ } else {
+ argumentsList = list(args);
+ }
+
+ Mailbox mailbox = node.mailbox().build();
+ mailbox.send(remote, "rex", tuple(
+ mailbox.getPid(),
+ tuple(
+ atom("call"),
+ module,
+ function,
+ argumentsList,
+ atom("user")
+ )
+ ));
+ return new RpcResponse(mailbox);
+ }
+
+ /**
+ * Remote procedure call response holder.
+ */
+ @FieldDefaults(level = PRIVATE)
+ public static final class RpcResponse {
+
+ Mailbox mailbox;
+
+ final AtomicReference response = new AtomicReference<>(null);
+
+ private RpcResponse (Mailbox mailbox) {
+ this.mailbox = mailbox;
+ }
+
+ /**
+ * Checks if a response was coming or not.
+ *
+ * @return {@code true} if this holder has a response, {@code false} otherwise.
+ */
+ public boolean hasResponse () {
+ return response.get() != null || (mailbox != null && mailbox.size() == 0);
+ }
+
+ /**
+ * Receive an RPC reply from the remote Erlang node in asynchronous manner.
+ * This convenience function receives a message from the remote node, and expects it to have
+ * the following format:
+ *
+ *
+ * { :rex, ErlangTerm }
+ *
+ *
+ * @return the second element of the tuple if the received message is a
+ * two-tuple, otherwise empty. No further error checking is
+ * performed.
+ */
+ public Optional getAsync () {
+ ErlangTerm result = response.get();
+ if (result == null) {
+ result = getSync(1, NANOSECONDS);
+ }
+ return ofNullable(result);
+ }
+
+ /**
+ * Receive an RPC reply from the remote Erlang node in synchronous manner.
+ * This convenience function receives a message from the remote node, and expects it to have
+ * the following format:
+ *
+ *
+ * { :rex, ErlangTerm }
+ *
+ *
+ * @return the second element of the tuple if the received message is a
+ * two-tuple, otherwise null. No further error checking is
+ * performed.
+ */
+ public ErlangTerm getSync () {
+ ErlangTerm result = response.get();
+ if (result != null) {
+ return result;
+ }
+ return mailbox.receive()
+ .getBody()
+ .get(1)
+ .map(this::process)
+ .orElse(null);
+ }
+
+ /**
+ * Receive an RPC reply from the remote Erlang node in synchronous manner.
+ * This convenience function receives a message from the remote node, and expects it to have
+ * the following format:
+ *
+ *
+ * { :rex, ErlangTerm }
+ *
+ *
+ * @param timeout how long to wait before giving up, in units of
+ * {@code unit}
+ * @param unit a {@code TimeUnit} determining how to interpret the
+ * {@code timeout} parameter
+ *
+ * @return the second element of the tuple if the received message is a
+ * two-tuple, otherwise null. No further error checking is
+ * performed. It also could return {@ null} if the specified
+ * waiting time elapses before an element is available
+ */
+ public ErlangTerm getSync (long timeout, TimeUnit unit) {
+ ErlangTerm result = response.get();
+ if (result != null) {
+ return result;
+ }
+ Message message = mailbox.receive(timeout, unit);
+ if (message == null) {
+ return null;
+ }
+ return message.getBody()
+ .get(1)
+ .map(this::process)
+ .orElse(null);
+ }
+
+ @SuppressWarnings("PMD.NullAssignment")
+ private ErlangTerm process (ErlangTerm term) {
+ if (!response.compareAndSet(null, term)) {
+ return null;
+ }
+ mailbox.close();
+ mailbox = null;
+ return term;
+ }
+ }
+}
diff --git a/encon/src/main/java/io/appulse/encon/Node.java b/encon/src/main/java/io/appulse/encon/Node.java
index 5f702f3..59e4997 100644
--- a/encon/src/main/java/io/appulse/encon/Node.java
+++ b/encon/src/main/java/io/appulse/encon/Node.java
@@ -133,6 +133,8 @@ static Node newInstance (@NonNull String name, @NonNull NodeConfig nodeConfig) {
ModuleClient moduleClient;
+ ModuleRemoteProcedureCall moduleRemoteProcedureCall;
+
@Builder
private Node (@NonNull NodeDescriptor descriptor,
@NonNull Meta meta,
@@ -163,6 +165,18 @@ private Node (@NonNull NodeDescriptor descriptor,
moduleServer = new ModuleServer(this, moduleConnection, port);
moduleClient = new ModuleClient(this, moduleConnection, configCopy.getShortName());
moduleMailbox = new ModuleMailbox(this, () -> generatorPid.generate());
+
+ moduleRemoteProcedureCall = new ModuleRemoteProcedureCall(this);
+ }
+
+ /**
+ * Returns reference on {@link ModuleRemoteProcedureCall} instance
+ * for calling remote node's functions.
+ *
+ * @return {@link ModuleRemoteProcedureCall} instance.
+ */
+ public ModuleRemoteProcedureCall rpc () {
+ return moduleRemoteProcedureCall;
}
/**
diff --git a/encon/src/main/java/io/appulse/encon/mailbox/Mailbox.java b/encon/src/main/java/io/appulse/encon/mailbox/Mailbox.java
index d8739c9..12b14da 100644
--- a/encon/src/main/java/io/appulse/encon/mailbox/Mailbox.java
+++ b/encon/src/main/java/io/appulse/encon/mailbox/Mailbox.java
@@ -16,10 +16,7 @@
package io.appulse.encon.mailbox;
-import static io.appulse.encon.terms.Erlang.NIL;
import static io.appulse.encon.terms.Erlang.atom;
-import static io.appulse.encon.terms.Erlang.list;
-import static io.appulse.encon.terms.Erlang.tuple;
import static lombok.AccessLevel.PACKAGE;
import static lombok.AccessLevel.PRIVATE;
@@ -45,7 +42,6 @@
import io.appulse.encon.mailbox.exception.MailboxWithSuchPidDoesntExistException;
import io.appulse.encon.mailbox.exception.ReceivedExitException;
import io.appulse.encon.terms.ErlangTerm;
-import io.appulse.encon.terms.type.ErlangAtom;
import io.appulse.encon.terms.type.ErlangPid;
import lombok.AllArgsConstructor;
@@ -224,280 +220,6 @@ public void send (@NonNull RemoteNode remote, @NonNull String mailbox, @NonNull
}
}
- /**
- * Send an RPC request to the remote Erlang node. This convenience function
- * creates the following message and sends it to 'rex' on the remote node:
- *
- *
- * Note that this method has unpredicatble results if the remote node is not
- * an Erlang node.
- *
- *
- *
- * The response will be send back to this node in format:
- *
- * { :rex, response_body }
- *
- *
- *
- * @param remoteNodeName remote node name
- *
- * @param module the name of the Erlang module containing the function to be called.
- *
- * @param function the name of the function to call.
- *
- * @param args a list of Erlang terms, to be used as arguments to the function.
- *
- * @since 1.6.4
- */
- public void call (@NonNull String remoteNodeName, @NonNull String module, @NonNull String function, ErlangTerm ...args) {
- call(remoteNodeName, atom(module), atom(function), args);
- }
-
- /**
- * Send an RPC request to the remote Erlang node. This convenience function
- * creates the following message and sends it to 'rex' on the remote node:
- *
- *
- * Note that this method has unpredicatble results if the remote node is not
- * an Erlang node.
- *
- *
- *
- * The response will be send back to this node in format:
- *
- * { :rex, response_body }
- *
- *
- *
- * @param descriptor remote node descriptor
- *
- * @param module the name of the Erlang module containing the function to be called.
- *
- * @param function the name of the function to call.
- *
- * @param args a list of Erlang terms, to be used as arguments to the function.
- *
- * @since 1.6.4
- */
- public void call (@NonNull NodeDescriptor descriptor, @NonNull String module, @NonNull String function, ErlangTerm ...args) {
- call(descriptor, atom(module), atom(function), args);
- }
-
- /**
- * Send an RPC request to the remote Erlang node. This convenience function
- * creates the following message and sends it to 'rex' on the remote node:
- *
- *
- * Note that this method has unpredicatble results if the remote node is not
- * an Erlang node.
- *
- *
- *
- * The response will be send back to this node in format:
- *
- * { :rex, response_body }
- *
- *
- *
- * @param remote remote node descriptor
- *
- * @param module the name of the Erlang module containing the function to be called.
- *
- * @param function the name of the function to call.
- *
- * @param args a list of Erlang terms, to be used as arguments to the function.
- *
- * @since 1.6.4
- */
- public void call (@NonNull RemoteNode remote, @NonNull String module, @NonNull String function, ErlangTerm ...args) {
- call(remote, atom(module), atom(function), args);
- }
-
- /**
- * Send an RPC request to the remote Erlang node. This convenience function
- * creates the following message and sends it to 'rex' on the remote node:
- *
- *
- * Note that this method has unpredicatble results if the remote node is not
- * an Erlang node.
- *
- *
- *
- * The response will be send back to this node in format:
- *
- * { :rex, response_body }
- *
- *
- *
- * @param remoteNodeName remote node name
- *
- * @param module the atom of the Erlang module containing the function to be called.
- *
- * @param function the atom of the function to call.
- *
- * @param args a list of Erlang terms, to be used as arguments to the function.
- *
- * @since 1.6.4
- */
- public void call (@NonNull String remoteNodeName, @NonNull ErlangAtom module, @NonNull ErlangAtom function, ErlangTerm ...args) {
- val descriptor = NodeDescriptor.from(remoteNodeName);
- call(descriptor, module, function, args);
- }
-
- /**
- * Send an RPC request to the remote Erlang node. This convenience function
- * creates the following message and sends it to 'rex' on the remote node:
- *
- *
- * Note that this method has unpredicatble results if the remote node is not
- * an Erlang node.
- *
- *
- *
- * The response will be send back to this node in format:
- *
- * { :rex, response_body }
- *
- *
- *
- * @param descriptor remote node descriptor
- *
- * @param module the atom of the Erlang module containing the function to be called.
- *
- * @param function the atom of the function to call.
- *
- * @param args a list of Erlang terms, to be used as arguments to the function.
- *
- * @since 1.6.4
- */
- public void call (@NonNull NodeDescriptor descriptor, @NonNull ErlangAtom module, @NonNull ErlangAtom function, ErlangTerm ...args) {
- RemoteNode remote = node.lookup(descriptor);
- if (remote == null) {
- throw new NoSuchRemoteNodeException(descriptor);
- }
- call(remote, module, function, args);
- }
-
- /**
- * Send an RPC request to the remote Erlang node. This convenience function
- * creates the following message and sends it to 'rex' on the remote node:
- *
- *
- * Note that this method has unpredicatble results if the remote node is not
- * an Erlang node.
- *
- *
- *
- * The response will be send back to this node in format:
- *
- * { :rex, response_body }
- *
- *
- *
- * @param remote remote node descriptor
- *
- * @param module the atom of the Erlang module containing the function to be called.
- *
- * @param function the atom of the function to call.
- *
- * @param args a list of Erlang terms, to be used as arguments to the function.
- *
- * @since 1.6.4
- */
- public void call (@NonNull RemoteNode remote, @NonNull ErlangAtom module, @NonNull ErlangAtom function, ErlangTerm ...args) {
- ErlangTerm argumentsList;
- if (args == null || args.length == 0) {
- argumentsList = NIL;
- } else if (args.length == 1 && args[0].isList()) {
- argumentsList = args[0];
- } else {
- argumentsList = list(args);
- }
-
- send(remote, "rex", tuple(
- pid,
- tuple(
- atom("call"),
- module,
- function,
- argumentsList,
- atom("user")
- )
- ));
- }
-
- /**
- * Receive an RPC reply from the remote Erlang node. This convenience
- * function receives a message from the remote node, and expects it to have
- * the following format:
- *
- *
- * { :rex, ErlangTerm }
- *
- *
- * @return the second element of the tuple if the received message is a
- * two-tuple, otherwise null. No further error checking is
- * performed.
- */
- public ErlangTerm receiveRemoteProcedureResult () {
- return receive().getBody()
- .get(1)
- .orElse(null);
- }
-
- /**
- * Receive an RPC reply from the remote Erlang node. This convenience
- * function receives a message from the remote node, and expects it to have
- * the following format:
- *
- *
- * { :rex, ErlangTerm }
- *
- *
- * @param timeout how long to wait before giving up, in units of
- * {@code unit}
- * @param unit a {@code TimeUnit} determining how to interpret the
- * {@code timeout} parameter
- *
- * @return the second element of the tuple if the received message is a
- * two-tuple, otherwise null. No further error checking is
- * performed. It also could return {@ null} if the specified
- * waiting time elapses before an element is available
- */
- public ErlangTerm receiveRemoteProcedureResult (long timeout, TimeUnit unit) {
- Message message = receive(timeout, unit);
- if (message == null) {
- return null;
- }
- return message.getBody()
- .get(1)
- .orElse(null);
- }
/**
* Links the mailbox.
diff --git a/encon/src/test/java/io/appulse/encon/NodeTest.java b/encon/src/test/java/io/appulse/encon/NodeTest.java
index cc4fec4..2c31a9c 100644
--- a/encon/src/test/java/io/appulse/encon/NodeTest.java
+++ b/encon/src/test/java/io/appulse/encon/NodeTest.java
@@ -28,13 +28,12 @@
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.Assertions.assertThat;
import static java.util.Optional.ofNullable;
-import static io.appulse.encon.connection.control.ControlMessageTag.SEND;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import io.appulse.encon.connection.control.ControlMessage;
import io.appulse.encon.connection.regular.Message;
+import io.appulse.encon.ModuleRemoteProcedureCall.RpcResponse;
import io.appulse.encon.NodesConfig.NodeConfig;
import io.appulse.encon.NodesConfig.NodeConfig.ServerConfig;
import io.appulse.encon.mailbox.Mailbox;
@@ -379,33 +378,19 @@ public void remoteProcedureCall () throws Exception {
.cookie("secret")
.build());
- Mailbox mailbox = node.mailbox().build();
- mailbox.call(ELIXIR_ECHO_SERVER, "erlang", "date");
+ RpcResponse response = node.rpc()
+ .call(ELIXIR_ECHO_SERVER, "erlang", "date");
- Message message = mailbox.receive(5, SECONDS);
- assertThat(message.getHeader())
- .extracting(ControlMessage::getTag)
- .isEqualTo(SEND);
-
- assertThat(message.getBody())
- .isNotNull();
-
- ErlangTerm term = message.getBody();
- assertThat(term.isTuple()).isTrue();
- assertThat(term.size()).isEqualTo(2);
-
- assertThat(term.getUnsafe(0).asText()).isEqualTo("rex");
- assertThat(term.getUnsafe(1).isTuple()).isTrue();
-
- ErlangTerm response1 = term.getUnsafe(1);
- assertThat(response1.getUnsafe(0).isNumber()).isTrue();
- assertThat(response1.getUnsafe(1).isNumber()).isTrue();
- assertThat(response1.getUnsafe(2).isNumber()).isTrue();
+ ErlangTerm payload = response.getSync(5, SECONDS);
+ assertThat(payload.getUnsafe(0).isNumber()).isTrue();
+ assertThat(payload.getUnsafe(1).isNumber()).isTrue();
+ assertThat(payload.getUnsafe(2).isNumber()).isTrue();
- mailbox.call(ELIXIR_ECHO_SERVER, "erlang", "date");
- ErlangTerm response2 = mailbox.receiveRemoteProcedureResult(5, SECONDS);
- assertThat(response2).isEqualTo(response1);
+ assertThat(response.hasResponse()).isTrue();
+ assertThat(response.getAsync().get())
+ .isEqualTo(payload)
+ .isSameAs(payload);
}
private String createName () {
From 8ea43260fb54253b1fdfc1d16693e86ff3165c2b Mon Sep 17 00:00:00 2001
From: Artem Labazin
Date: Mon, 10 Dec 2018 01:23:19 +0300
Subject: [PATCH 06/20] Update POM files
---
benchmark/pom.xml | 26 +---
encon-common/pom.xml | 33 +----
encon-config/pom.xml | 33 +----
encon-databind/pom.xml | 33 +----
encon-handler/pom.xml | 35 +----
encon-spring/pom.xml | 35 +----
encon-terms/pom.xml | 33 +----
encon/pom.xml | 39 +----
examples/custom-queue/pom.xml | 17 ---
examples/databind/pom.xml | 24 +---
examples/echo-server-spring/pom.xml | 25 +---
examples/echo-server/pom.xml | 18 ---
examples/handler-advanced/pom.xml | 24 ----
examples/handler-basic/pom.xml | 24 ----
examples/load-config-spring/pom.xml | 23 +--
examples/load-config/pom.xml | 25 ----
examples/simple/pom.xml | 19 +--
pom.xml | 214 +++++++++++++++++++---------
18 files changed, 170 insertions(+), 510 deletions(-)
diff --git a/benchmark/pom.xml b/benchmark/pom.xml
index c907d95..350ba29 100644
--- a/benchmark/pom.xml
+++ b/benchmark/pom.xml
@@ -31,14 +31,6 @@ limitations under the License.
benchmarkjar
-
- UTF-8
- UTF-8
-
- 1.8
- 1.8
-
-
io.appulse.epmd.java
@@ -55,12 +47,6 @@ limitations under the License.
jinterface
-
- org.projectlombok
- lombok
- provided
-
-
org.openjdk.jmhjmh-core
@@ -75,20 +61,10 @@ limitations under the License.
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.1
-
- ${maven.compiler.target}
- ${maven.compiler.source}
- ${maven.compiler.target}
-
- org.apache.maven.pluginsmaven-shade-plugin
- 2.2
+ 3.2.1package
diff --git a/encon-common/pom.xml b/encon-common/pom.xml
index 6d3c51c..5b7888c 100644
--- a/encon-common/pom.xml
+++ b/encon-common/pom.xml
@@ -32,38 +32,10 @@ limitations under the License.
jar
-
- org.projectlombok
- lombok
- provided
-
-
io.appulse.epmd.javacore
-
-
- com.google.code.findbugs
- annotations
- provided
-
-
- com.google.code.findbugs
- jsr305
- provided
-
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
@@ -78,14 +50,13 @@ limitations under the License.
- org.codehaus.mojo
- findbugs-maven-plugin
+ com.github.spotbugs
+ spotbugs-maven-pluginorg.apache.maven.pluginsmaven-pmd-plugin
-
org.apache.maven.pluginsmaven-checkstyle-plugin
diff --git a/encon-config/pom.xml b/encon-config/pom.xml
index 9817561..89331e6 100644
--- a/encon-config/pom.xml
+++ b/encon-config/pom.xml
@@ -32,45 +32,17 @@ limitations under the License.
jar
-
- org.projectlombok
- lombok
- provided
-
-
org.yamlsnakeyaml1.23
-
- com.google.code.findbugs
- annotations
- provided
-
-
- com.google.code.findbugs
- jsr305
- provided
-
-
io.appulseutils-javatest
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
@@ -85,14 +57,13 @@ limitations under the License.
- org.codehaus.mojo
- findbugs-maven-plugin
+ com.github.spotbugs
+ spotbugs-maven-pluginorg.apache.maven.pluginsmaven-pmd-plugin
-
org.apache.maven.pluginsmaven-checkstyle-plugin
diff --git a/encon-databind/pom.xml b/encon-databind/pom.xml
index 308f588..51ae06f 100644
--- a/encon-databind/pom.xml
+++ b/encon-databind/pom.xml
@@ -32,12 +32,6 @@ limitations under the License.
jar
-
- org.projectlombok
- lombok
- provided
-
-
${project.groupId}encon-terms
@@ -52,28 +46,6 @@ limitations under the License.
io.appulseutils-java
-
-
- com.google.code.findbugs
- annotations
- provided
-
-
- com.google.code.findbugs
- jsr305
- provided
-
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
@@ -88,14 +60,13 @@ limitations under the License.
- org.codehaus.mojo
- findbugs-maven-plugin
+ com.github.spotbugs
+ spotbugs-maven-pluginorg.apache.maven.pluginsmaven-pmd-plugin
-
org.apache.maven.pluginsmaven-checkstyle-plugin
diff --git a/encon-handler/pom.xml b/encon-handler/pom.xml
index e7d3f77..2c837d5 100644
--- a/encon-handler/pom.xml
+++ b/encon-handler/pom.xml
@@ -32,12 +32,6 @@ limitations under the License.
jar
-
- org.projectlombok
- lombok
- provided
-
-
${project.groupId}encon
@@ -52,29 +46,7 @@ limitations under the License.
cglibcglib
- 3.2.7
-
-
-
- com.google.code.findbugs
- annotations
- provided
-
-
- com.google.code.findbugs
- jsr305
- provided
-
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
+ 3.2.9
@@ -90,14 +62,13 @@ limitations under the License.
- org.codehaus.mojo
- findbugs-maven-plugin
+ com.github.spotbugs
+ spotbugs-maven-pluginorg.apache.maven.pluginsmaven-pmd-plugin
-
org.apache.maven.pluginsmaven-checkstyle-plugin
diff --git a/encon-spring/pom.xml b/encon-spring/pom.xml
index 953f11b..1ec3654 100644
--- a/encon-spring/pom.xml
+++ b/encon-spring/pom.xml
@@ -32,12 +32,6 @@ limitations under the License.
jar
-
- org.projectlombok
- lombok
- provided
-
-
${project.groupId}encon
@@ -57,29 +51,7 @@ limitations under the License.
org.springframework.bootspring-boot-starter
- 2.0.4.RELEASE
-
-
-
- com.google.code.findbugs
- annotations
- provided
-
-
- com.google.code.findbugs
- jsr305
- provided
-
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
+ 2.1.1.RELEASE
@@ -95,14 +67,13 @@ limitations under the License.
- org.codehaus.mojo
- findbugs-maven-plugin
+ com.github.spotbugs
+ spotbugs-maven-pluginorg.apache.maven.pluginsmaven-pmd-plugin
-
org.apache.maven.pluginsmaven-checkstyle-plugin
diff --git a/encon-terms/pom.xml b/encon-terms/pom.xml
index 4f77c05..bca0826 100644
--- a/encon-terms/pom.xml
+++ b/encon-terms/pom.xml
@@ -32,45 +32,17 @@ limitations under the License.
jar
-
- org.projectlombok
- lombok
- provided
-
-
${project.groupId}encon-common${project.version}
-
- com.google.code.findbugs
- annotations
- provided
-
-
- com.google.code.findbugs
- jsr305
- provided
-
-
io.nettynetty-buffer
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
@@ -85,14 +57,13 @@ limitations under the License.
- org.codehaus.mojo
- findbugs-maven-plugin
+ com.github.spotbugs
+ spotbugs-maven-pluginorg.apache.maven.pluginsmaven-pmd-plugin
-
org.apache.maven.pluginsmaven-checkstyle-plugin
diff --git a/encon/pom.xml b/encon/pom.xml
index 331126a..8fe814d 100644
--- a/encon/pom.xml
+++ b/encon/pom.xml
@@ -32,12 +32,6 @@ limitations under the License.
jar
-
- org.projectlombok
- lombok
- provided
-
-
${project.groupId}encon-common
@@ -67,21 +61,10 @@ limitations under the License.
client
-
- com.google.code.findbugs
- annotations
- provided
-
-
- com.google.code.findbugs
- jsr305
- provided
-
-
org.yamlsnakeyaml
- 1.21
+ 1.23
@@ -99,21 +82,6 @@ limitations under the License.
servertest
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
-
- org.mockito
- mockito-core
- test
-
@@ -128,14 +96,13 @@ limitations under the License.
- org.codehaus.mojo
- findbugs-maven-plugin
+ com.github.spotbugs
+ spotbugs-maven-pluginorg.apache.maven.pluginsmaven-pmd-plugin
-
org.apache.maven.pluginsmaven-checkstyle-plugin
diff --git a/examples/custom-queue/pom.xml b/examples/custom-queue/pom.xml
index 0b6e9d8..7992ea2 100644
--- a/examples/custom-queue/pom.xml
+++ b/examples/custom-queue/pom.xml
@@ -33,12 +33,6 @@ limitations under the License.
jar
- UTF-8
- UTF-8
-
- 1.8
- 1.8
-
io.appulse.encon.examples.custom.queue.Main
@@ -48,17 +42,6 @@ limitations under the License.
encon${project.version}
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
diff --git a/examples/databind/pom.xml b/examples/databind/pom.xml
index 734bd0b..405912e 100644
--- a/examples/databind/pom.xml
+++ b/examples/databind/pom.xml
@@ -33,21 +33,10 @@ limitations under the License.
jar
- UTF-8
- UTF-8
-
- 1.8
- 1.8
-
io.appulse.encon.examples.databind.Main
-
- org.projectlombok
- lombok
-
-
io.appulse.enconencon
@@ -58,17 +47,6 @@ limitations under the License.
encon-databind${project.version}
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
@@ -76,7 +54,7 @@ limitations under the License.
org.apache.maven.pluginsmaven-shade-plugin
- 3.1.0
+ 3.2.1
diff --git a/examples/echo-server-spring/pom.xml b/examples/echo-server-spring/pom.xml
index 8e206d4..d33b3a9 100644
--- a/examples/echo-server-spring/pom.xml
+++ b/examples/echo-server-spring/pom.xml
@@ -33,7 +33,7 @@ limitations under the License.
org.springframework.bootspring-boot-dependencies
- 2.0.4.RELEASE
+ 2.1.1.RELEASEpomimport
@@ -44,23 +44,12 @@ limitations under the License.
echo-server-springjar
-
- UTF-8
- 1.8
- 1.8
-
-
org.springframework.bootspring-boot-starter
-
- org.projectlombok
- lombok
-
-
io.appulse.enconencon-spring
@@ -77,16 +66,6 @@ limitations under the License.
spring-boot-starter-testtest
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
@@ -94,7 +73,7 @@ limitations under the License.
org.springframework.bootspring-boot-maven-plugin
- 2.0.4.RELEASE
+ 2.1.1.RELEASE
diff --git a/examples/echo-server/pom.xml b/examples/echo-server/pom.xml
index a881751..a1512b3 100644
--- a/examples/echo-server/pom.xml
+++ b/examples/echo-server/pom.xml
@@ -32,19 +32,7 @@ limitations under the License.
echo-serverjar
-
- UTF-8
- UTF-8
-
- 1.8
- 1.8
-
-
-
- org.projectlombok
- lombok
- io.appulse.enconencon
@@ -55,11 +43,5 @@ limitations under the License.
encon-databind${project.version}
-
-
- junit
- junit
- test
-
diff --git a/examples/handler-advanced/pom.xml b/examples/handler-advanced/pom.xml
index 18a625c..a443105 100644
--- a/examples/handler-advanced/pom.xml
+++ b/examples/handler-advanced/pom.xml
@@ -32,20 +32,7 @@ limitations under the License.
handler-advancedjar
-
- UTF-8
- UTF-8
-
- 1.8
- 1.8
-
-
-
- org.projectlombok
- lombok
-
-
io.appulse.enconencon
@@ -56,16 +43,5 @@ limitations under the License.
encon-handler${project.version}
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
diff --git a/examples/handler-basic/pom.xml b/examples/handler-basic/pom.xml
index 27dced7..3754a6a 100644
--- a/examples/handler-basic/pom.xml
+++ b/examples/handler-basic/pom.xml
@@ -32,20 +32,7 @@ limitations under the License.
handler-basicjar
-
- UTF-8
- UTF-8
-
- 1.8
- 1.8
-
-
-
- org.projectlombok
- lombok
-
-
io.appulse.enconencon
@@ -56,16 +43,5 @@ limitations under the License.
encon-handler${project.version}
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
diff --git a/examples/load-config-spring/pom.xml b/examples/load-config-spring/pom.xml
index 5da4b84..6b8bf3e 100644
--- a/examples/load-config-spring/pom.xml
+++ b/examples/load-config-spring/pom.xml
@@ -33,7 +33,7 @@ limitations under the License.
org.springframework.bootspring-boot-dependencies
- 2.0.4.RELEASE
+ 2.1.1.RELEASEpomimport
@@ -45,10 +45,6 @@ limitations under the License.
jar
- UTF-8
- 1.8
- 1.8
-
io.appulse.encon.examples.load.config.spring.Main
@@ -58,11 +54,6 @@ limitations under the License.
spring-boot-starter
-
- org.projectlombok
- lombok
-
-
io.appulse.enconencon-spring
@@ -79,16 +70,6 @@ limitations under the License.
spring-boot-starter-testtest
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
@@ -96,7 +77,7 @@ limitations under the License.
org.springframework.bootspring-boot-maven-plugin
- 2.0.4.RELEASE
+ 2.1.1.RELEASE
diff --git a/examples/load-config/pom.xml b/examples/load-config/pom.xml
index f9bd914..69f9b56 100644
--- a/examples/load-config/pom.xml
+++ b/examples/load-config/pom.xml
@@ -32,36 +32,11 @@ limitations under the License.
load-configjar
-
- UTF-8
- UTF-8
-
- 1.8
- 1.8
-
-
-
- org.projectlombok
- lombok
- provided
-
-
io.appulse.enconencon${project.version}
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
diff --git a/examples/simple/pom.xml b/examples/simple/pom.xml
index 859160e..5946067 100644
--- a/examples/simple/pom.xml
+++ b/examples/simple/pom.xml
@@ -33,12 +33,6 @@ limitations under the License.
jar
- UTF-8
- UTF-8
-
- 1.8
- 1.8
-
io.appulse.encon.examples.simple.Main
@@ -48,17 +42,6 @@ limitations under the License.
encon${project.version}
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
@@ -66,7 +49,7 @@ limitations under the License.
org.apache.maven.pluginsmaven-shade-plugin
- 3.1.0
+ 3.2.1
diff --git a/pom.xml b/pom.xml
index 5ae8738..d0a519c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,11 +31,13 @@ limitations under the License.
UTF-8UTF-8
- 1.8
- 1.8
+ 11
- 1.8
- 1.8
+ ${java.version}
+ ${java.version}
+
+ ${java.version}
+ ${java.version}
@@ -104,26 +106,71 @@ limitations under the License.
Artem Labazinxxlabaza@gmail.com
-
- ambivalence42
- Sokol Andrey
- sokolandrey1993@mail.ru
-
-
- isv
- Stan Ignatev
- i.v.stanislav@gmail.com
-
+
+
+ org.projectlombok
+ lombok
+ 1.18.4
+ provided
+
+
+
+ net.jcip
+ jcip-annotations
+ 1.0
+ provided
+
+
+ com.github.spotbugs
+ spotbugs-annotations
+ 3.1.9
+ provided
+
+
+ com.google.code.findbugs
+ jsr305
+ 3.0.2
+ provided
+
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ 5.3.2
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ 5.3.2
+ test
+
+
+
+ org.assertj
+ assertj-core
+ 3.11.1
+ test
+
+
+
+ org.mockito
+ mockito-core
+ 2.23.4
+ test
+
+
+ org.mockito
+ mockito-junit-jupiter
+ 2.23.4
+ test
+
+
+
-
- org.projectlombok
- lombok
- 1.18.2
-
-
io.appulselogging-java
@@ -156,31 +203,20 @@ limitations under the License.
1.6.1
-
- com.google.code.findbugs
- annotations
- 3.0.1u2
-
-
- com.google.code.findbugs
- jsr305
- 3.0.2
-
-
io.nettynetty-buffer
- 4.1.29.Final
+ 4.1.32.Finalio.nettynetty-handler
- 4.1.29.Final
+ 4.1.32.Finalio.nettynetty-transport-native-epoll
- 4.1.29.Final
+ 4.1.32.Finallinux-x86_64
@@ -209,22 +245,6 @@ limitations under the License.
jmh-generator-annprocess1.21
-
-
- junit
- junit
- 4.12
-
-
- org.assertj
- assertj-core
- 3.11.1
-
-
- org.mockito
- mockito-core
- 2.22.0
-
@@ -232,9 +252,9 @@ limitations under the License.
- org.codehaus.mojo
- findbugs-maven-plugin
- 3.0.5
+ com.github.spotbugs
+ spotbugs-maven-plugin
+ 3.1.8MaxLow
@@ -243,22 +263,22 @@ limitations under the License.
- analyze-compile
- package
+ spotbugs-validation
+ verifycheck
+
org.apache.maven.pluginsmaven-pmd-plugin
- 3.10.0
+ 3.11.0${project.build.sourceEncoding}${maven.compiler.source}
- truetruetruetrue
@@ -269,7 +289,8 @@ limitations under the License.
- package
+ pmd-validation
+ verifycheck
@@ -285,13 +306,13 @@ limitations under the License.
com.puppycrawl.toolscheckstyle
- 8.12
+ 8.15
- validate
- package
+ checkstyle-validation
+ verifycheck
@@ -310,7 +331,7 @@ limitations under the License.
org.apache.maven.pluginsmaven-javadoc-plugin
- 2.10.4
+ 3.0.1-Xdoclint:none-Xdoclint:none
@@ -320,7 +341,7 @@ limitations under the License.
UTF-8trueprotected
- 1.8
+ ${java.version}true
@@ -386,17 +407,68 @@ limitations under the License.
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.0
+
+ ${java.version}
+ ${maven.compiler.target}
+ ${maven.compiler.source}
+ ${maven.compiler.target}
+
+
+
+
+ pl.project13.maven
+ git-commit-id-plugin
+ 2.2.5
+
+
+ git-infos
+
+ revision
+
+
+
+
+ true
+ false
+ true
+ false
+ git
+
+ ${project.build.outputDirectory}/git.properties
+
+ yyyy-MM-dd'T'HH:mm:ssZ
+ ${project.basedir}/.git
+
+ git.closest.tag.commit.count
+ git.closest.tag.name
+
+
+
+
org.apache.maven.pluginsmaven-surefire-plugin
- 2.21.0
+ 2.22.1
+
+ --illegal-access=permit
+ false**/*Test.java
+ **/*Tests.java
+ **/Test*.java
+ **/it/****/*IntegrationTest.java
+ **/*IntegrationTests.java
+ **/*IT.java
+ **/IT*.java
@@ -404,14 +476,20 @@ limitations under the License.
org.apache.maven.pluginsmaven-failsafe-plugin
- 2.21.0
+ 2.22.1
+
+ --illegal-access=permit
+ **/*IntegrationTest.java
+ **/*IntegrationTests.java
+ **/*IT.java
+ **/IT*.java
+ **/it/**/*Test.java
+ **/it/**/*Tests.java
+ **/it/**/Test*.java
-
- **/*Test.java
-
From 50a460fdf317b1c2d064c7b2118a6fa50268815e Mon Sep 17 00:00:00 2001
From: Artem Labazin
Date: Mon, 10 Dec 2018 10:41:03 +0300
Subject: [PATCH 07/20] Add maven wrapper
---
.mvn/wrapper/MavenWrapperDownloader.java | 110 +++++++++
.mvn/wrapper/maven-wrapper.properties | 1 +
mvnw | 286 +++++++++++++++++++++++
mvnw.cmd | 161 +++++++++++++
4 files changed, 558 insertions(+)
create mode 100644 .mvn/wrapper/MavenWrapperDownloader.java
create mode 100644 .mvn/wrapper/maven-wrapper.properties
create mode 100755 mvnw
create mode 100644 mvnw.cmd
diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java
new file mode 100644
index 0000000..fa4f7b4
--- /dev/null
+++ b/.mvn/wrapper/MavenWrapperDownloader.java
@@ -0,0 +1,110 @@
+/*
+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.
+*/
+
+import java.net.*;
+import java.io.*;
+import java.nio.channels.*;
+import java.util.Properties;
+
+public class MavenWrapperDownloader {
+
+ /**
+ * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
+ */
+ private static final String DEFAULT_DOWNLOAD_URL =
+ "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";
+
+ /**
+ * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
+ * use instead of the default one.
+ */
+ private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
+ ".mvn/wrapper/maven-wrapper.properties";
+
+ /**
+ * Path where the maven-wrapper.jar will be saved to.
+ */
+ private static final String MAVEN_WRAPPER_JAR_PATH =
+ ".mvn/wrapper/maven-wrapper.jar";
+
+ /**
+ * Name of the property which should be used to override the default download url for the wrapper.
+ */
+ private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
+
+ public static void main(String args[]) {
+ System.out.println("- Downloader started");
+ File baseDirectory = new File(args[0]);
+ System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
+
+ // If the maven-wrapper.properties exists, read it and check if it contains a custom
+ // wrapperUrl parameter.
+ File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
+ String url = DEFAULT_DOWNLOAD_URL;
+ if(mavenWrapperPropertyFile.exists()) {
+ FileInputStream mavenWrapperPropertyFileInputStream = null;
+ try {
+ mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
+ Properties mavenWrapperProperties = new Properties();
+ mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
+ url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
+ } catch (IOException e) {
+ System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
+ } finally {
+ try {
+ if(mavenWrapperPropertyFileInputStream != null) {
+ mavenWrapperPropertyFileInputStream.close();
+ }
+ } catch (IOException e) {
+ // Ignore ...
+ }
+ }
+ }
+ System.out.println("- Downloading from: : " + url);
+
+ File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
+ if(!outputFile.getParentFile().exists()) {
+ if(!outputFile.getParentFile().mkdirs()) {
+ System.out.println(
+ "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
+ }
+ }
+ System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
+ try {
+ downloadFileFromURL(url, outputFile);
+ System.out.println("Done");
+ System.exit(0);
+ } catch (Throwable e) {
+ System.out.println("- Error downloading");
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ private static void downloadFileFromURL(String urlString, File destination) throws Exception {
+ URL website = new URL(urlString);
+ ReadableByteChannel rbc;
+ rbc = Channels.newChannel(website.openStream());
+ FileOutputStream fos = new FileOutputStream(destination);
+ fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+ fos.close();
+ rbc.close();
+ }
+
+}
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 0000000..cd0d451
--- /dev/null
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
diff --git a/mvnw b/mvnw
new file mode 100755
index 0000000..5551fde
--- /dev/null
+++ b/mvnw
@@ -0,0 +1,286 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# 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.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven2 Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# M2_HOME - location of maven2's installed home dir
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ export JAVA_HOME="`/usr/libexec/java_home`"
+ else
+ export JAVA_HOME="/Library/Java/Home"
+ fi
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+ ## resolve links - $0 may be a link to maven's home
+ PRG="$0"
+
+ # need this for relative symlinks
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+ done
+
+ saveddir=`pwd`
+
+ M2_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ M2_HOME=`cd "$M2_HOME" && pwd`
+
+ cd "$saveddir"
+ # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --unix "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+ # TODO classpath?
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ else
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ fi
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`which java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=`cd "$wdir/.."; pwd`
+ fi
+ # end of workaround
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
+ fi
+else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+ fi
+ jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
+ while IFS="=" read key value; do
+ case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+ esac
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Downloading from: $jarUrl"
+ fi
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+
+ if command -v wget > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found wget ... using wget"
+ fi
+ wget "$jarUrl" -O "$wrapperJarPath"
+ elif command -v curl > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found curl ... using curl"
+ fi
+ curl -o "$wrapperJarPath" "$jarUrl"
+ else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Falling back to using Java to download"
+ fi
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+ if [ -e "$javaClass" ]; then
+ if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Compiling MavenWrapperDownloader.java ..."
+ fi
+ # Compiling the Java class
+ ("$JAVA_HOME/bin/javac" "$javaClass")
+ fi
+ if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ # Running the downloader
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Running MavenWrapperDownloader.java ..."
+ fi
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+ fi
+ fi
+ fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+ echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/mvnw.cmd b/mvnw.cmd
new file mode 100644
index 0000000..0e344f6
--- /dev/null
+++ b/mvnw.cmd
@@ -0,0 +1,161 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven2 Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
+FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
+ IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+ echo Found %WRAPPER_JAR%
+) else (
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
+ echo Downloading from: %DOWNLOAD_URL%
+ powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
+ echo Finished downloading %WRAPPER_JAR%
+)
+@REM End of extension
+
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%
From afd95be260cbd4d503d4001860b83142a64df4f2 Mon Sep 17 00:00:00 2001
From: Artem Labazin
Date: Mon, 10 Dec 2018 11:14:43 +0300
Subject: [PATCH 08/20] Update encon-common to Java 11
---
.../appulse/encon/common/NodeDescriptor.java | 2 ++
.../encon/common/DistributionFlagTest.java | 27 ++++++++++++-------
.../encon/common/NodeDescriptorTest.java | 26 ++++++++++--------
3 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/encon-common/src/main/java/io/appulse/encon/common/NodeDescriptor.java b/encon-common/src/main/java/io/appulse/encon/common/NodeDescriptor.java
index 0ba31ed..e67de2e 100644
--- a/encon-common/src/main/java/io/appulse/encon/common/NodeDescriptor.java
+++ b/encon-common/src/main/java/io/appulse/encon/common/NodeDescriptor.java
@@ -26,6 +26,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;
+import edu.umd.cs.findbugs.annotations.SuppressWarnings;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
@@ -185,6 +186,7 @@ public static boolean removeFromCache (@NonNull NodeDescriptor descriptor) {
private static NodeDescriptor getFromCacheOrCreateNew (@NonNull String node) {
val atIndex = node.indexOf('@');
+ @SuppressWarnings("PMD.LinguisticNaming")
val isShortName = atIndex < 0 || node.indexOf('.', atIndex) < 0;
return getFromCacheOrCreateNew(node, isShortName);
}
diff --git a/encon-common/src/test/java/io/appulse/encon/common/DistributionFlagTest.java b/encon-common/src/test/java/io/appulse/encon/common/DistributionFlagTest.java
index 6b0ee46..0275a4b 100644
--- a/encon-common/src/test/java/io/appulse/encon/common/DistributionFlagTest.java
+++ b/encon-common/src/test/java/io/appulse/encon/common/DistributionFlagTest.java
@@ -23,38 +23,45 @@
import java.util.stream.Stream;
-import io.appulse.utils.test.TestMethodNamePrinter;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class DistributionFlagTest {
+class DistributionFlagTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void parse () {
+ @DisplayName("Check if distribution flag's code could be converted to its enum value")
+ void couldConvert () {
Stream.of(DistributionFlag.values()).forEach(it -> {
assertThat(DistributionFlag.parse(it.getCode()))
.hasSize(1)
.first()
.isEqualTo(it);
});
+ }
+ @Test
+ @DisplayName("Unfold integer to set of distribution flags")
+ void unfold () {
assertThat(DistributionFlag.parse(262_147))
.hasSize(3)
.contains(PUBLISHED, ATOM_CACHE, BIG_CREATION);
}
@Test
- public void bitwiseOr () {
+ @DisplayName("Fold enum values to integer")
+ void fold () {
assertThat(DistributionFlag.bitwiseOr(PUBLISHED, ATOM_CACHE, BIG_CREATION))
.isEqualTo(262_147);
}
diff --git a/encon-common/src/test/java/io/appulse/encon/common/NodeDescriptorTest.java b/encon-common/src/test/java/io/appulse/encon/common/NodeDescriptorTest.java
index 8db6b81..d8490e9 100644
--- a/encon-common/src/test/java/io/appulse/encon/common/NodeDescriptorTest.java
+++ b/encon-common/src/test/java/io/appulse/encon/common/NodeDescriptorTest.java
@@ -20,25 +20,27 @@
import java.net.InetAddress;
-import io.appulse.utils.test.TestMethodNamePrinter;
-
import org.assertj.core.api.SoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class NodeDescriptorTest {
+class NodeDescriptorTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void fullShortName () throws Exception {
+ @DisplayName("Parse short node's name with localhost host")
+ void fullShortName () throws Exception {
InetAddress address = InetAddress.getByName("localhost");
String fullName = "popa@localhost";
NodeDescriptor.removeFromCache(fullName);
@@ -72,7 +74,8 @@ public void fullShortName () throws Exception {
}
@Test
- public void shortName () throws Exception {
+ @DisplayName("Parse short node's name without host")
+ void shortName () throws Exception {
InetAddress address = InetAddress.getLoopbackAddress();
String tmp = InetAddress.getLocalHost().getHostName();
int dotIndex = tmp.indexOf('.');
@@ -112,7 +115,8 @@ public void shortName () throws Exception {
}
@Test
- public void fullLongName () throws Exception {
+ @DisplayName("Parse full node's name with host")
+ void fullLongName () throws Exception {
InetAddress address = InetAddress.getByName("localhost");
String fullName = "popa@localhost";
NodeDescriptor.removeFromCache(fullName);
From ba65495f7a3f4912569e237f6c547158542374cb Mon Sep 17 00:00:00 2001
From: Artem Labazin
Date: Mon, 10 Dec 2018 12:04:09 +0300
Subject: [PATCH 09/20] Update encon-terms for Java 11
---
.../encon/common/DistributionFlagTest.java | 7 ++--
.../encon/common/NodeDescriptorTest.java | 7 ++--
.../encon/terms/type/ErlangAtomTest.java | 33 +++++++++++--------
.../encon/terms/type/ErlangBinaryTest.java | 33 +++++++++++--------
.../encon/terms/type/ErlangBitStringTest.java | 33 +++++++++++--------
.../encon/terms/type/ErlangFloatTest.java | 25 +++++++++-----
.../encon/terms/type/ErlangIntegerTest.java | 30 ++++++++++-------
.../encon/terms/type/ErlangListTest.java | 27 ++++++++-------
.../encon/terms/type/ErlangMapTest.java | 21 +++++++-----
.../encon/terms/type/ErlangNilTest.java | 26 +++++++++------
.../encon/terms/type/ErlangPidTest.java | 31 ++++++++++-------
.../encon/terms/type/ErlangPortTest.java | 29 +++++++++-------
.../encon/terms/type/ErlangReferenceTest.java | 32 +++++++++++-------
.../encon/terms/type/ErlangStringTest.java | 23 ++++++++-----
.../encon/terms/type/ErlangTupleTest.java | 29 +++++++++-------
15 files changed, 236 insertions(+), 150 deletions(-)
diff --git a/encon-common/src/test/java/io/appulse/encon/common/DistributionFlagTest.java b/encon-common/src/test/java/io/appulse/encon/common/DistributionFlagTest.java
index 0275a4b..3975219 100644
--- a/encon-common/src/test/java/io/appulse/encon/common/DistributionFlagTest.java
+++ b/encon-common/src/test/java/io/appulse/encon/common/DistributionFlagTest.java
@@ -33,6 +33,7 @@
* @author Artem Labazin
* @since 1.0.0
*/
+@DisplayName("Check distribution flags enum")
class DistributionFlagTest {
@BeforeEach
@@ -41,7 +42,7 @@ void beforeEach (TestInfo testInfo) {
}
@Test
- @DisplayName("Check if distribution flag's code could be converted to its enum value")
+ @DisplayName("check if distribution flag's code could be converted to its enum value")
void couldConvert () {
Stream.of(DistributionFlag.values()).forEach(it -> {
assertThat(DistributionFlag.parse(it.getCode()))
@@ -52,7 +53,7 @@ void couldConvert () {
}
@Test
- @DisplayName("Unfold integer to set of distribution flags")
+ @DisplayName("unfold integer to set of distribution flags")
void unfold () {
assertThat(DistributionFlag.parse(262_147))
.hasSize(3)
@@ -60,7 +61,7 @@ void unfold () {
}
@Test
- @DisplayName("Fold enum values to integer")
+ @DisplayName("fold enum values to integer")
void fold () {
assertThat(DistributionFlag.bitwiseOr(PUBLISHED, ATOM_CACHE, BIG_CREATION))
.isEqualTo(262_147);
diff --git a/encon-common/src/test/java/io/appulse/encon/common/NodeDescriptorTest.java b/encon-common/src/test/java/io/appulse/encon/common/NodeDescriptorTest.java
index d8490e9..eaa8586 100644
--- a/encon-common/src/test/java/io/appulse/encon/common/NodeDescriptorTest.java
+++ b/encon-common/src/test/java/io/appulse/encon/common/NodeDescriptorTest.java
@@ -31,6 +31,7 @@
* @author Artem Labazin
* @since 1.0.0
*/
+@DisplayName("Check node descriptor")
class NodeDescriptorTest {
@BeforeEach
@@ -39,7 +40,7 @@ void beforeEach (TestInfo testInfo) {
}
@Test
- @DisplayName("Parse short node's name with localhost host")
+ @DisplayName("parse short node's name with localhost host")
void fullShortName () throws Exception {
InetAddress address = InetAddress.getByName("localhost");
String fullName = "popa@localhost";
@@ -74,7 +75,7 @@ void fullShortName () throws Exception {
}
@Test
- @DisplayName("Parse short node's name without host")
+ @DisplayName("parse short node's name without host")
void shortName () throws Exception {
InetAddress address = InetAddress.getLoopbackAddress();
String tmp = InetAddress.getLocalHost().getHostName();
@@ -115,7 +116,7 @@ void shortName () throws Exception {
}
@Test
- @DisplayName("Parse full node's name with host")
+ @DisplayName("parse full node's name with host")
void fullLongName () throws Exception {
InetAddress address = InetAddress.getByName("localhost");
String fullName = "popa@localhost";
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangAtomTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangAtomTest.java
index 80a4db9..2176d5f 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangAtomTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangAtomTest.java
@@ -24,11 +24,9 @@
import java.util.stream.IntStream;
-
import io.appulse.encon.terms.Erlang;
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.utils.Bytes;
-import io.appulse.utils.test.TestMethodNamePrinter;
import erlang.OtpInputStream;
import erlang.OtpOutputStream;
@@ -36,22 +34,27 @@
import lombok.SneakyThrows;
import lombok.val;
import org.assertj.core.api.SoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class ErlangAtomTest {
+@DisplayName("Check Erlang's Atom term type")
+class ErlangAtomTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void instantiate () {
+ @DisplayName("create new instance by constructor")
+ void instantiate () {
assertThat(new ErlangAtom("hello").getType())
.isEqualTo(SMALL_ATOM_UTF8);
@@ -63,7 +66,8 @@ public void instantiate () {
}
@Test
- public void newInstance () {
+ @DisplayName("create new instance from bytes")
+ void newInstance () {
val value = "hello";
val bytes = Bytes.allocate()
.put1B(SMALL_ATOM_UTF8.getCode())
@@ -87,7 +91,8 @@ public void newInstance () {
}
@Test
- public void toBytes () {
+ @DisplayName("convert instance to byte array")
+ void toBytes () {
val value = "hello";
val expected = Bytes.allocate()
.put1B(SMALL_ATOM_UTF8.getCode())
@@ -100,7 +105,8 @@ public void toBytes () {
}
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
val smallValue = "popa";
val smallAtom = new ErlangAtom(smallValue);
@@ -132,7 +138,8 @@ public void encode () {
}
@Test
- public void decode () throws Exception {
+ @DisplayName("decode instance from byte array and compare with jinterface result")
+ void decode () throws Exception {
val value1 = "hello";
val bytes1 = Bytes.allocate()
.put1B(SMALL_ATOM_UTF8.getCode())
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangBinaryTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangBinaryTest.java
index e8c8346..5696b8f 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangBinaryTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangBinaryTest.java
@@ -20,11 +20,9 @@
import static io.netty.buffer.Unpooled.wrappedBuffer;
import static org.assertj.core.api.Assertions.assertThat;
-
import io.appulse.encon.terms.Erlang;
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.utils.Bytes;
-import io.appulse.utils.test.TestMethodNamePrinter;
import erlang.OtpErlangBinary;
import erlang.OtpInputStream;
@@ -32,22 +30,27 @@
import lombok.SneakyThrows;
import lombok.val;
import org.assertj.core.api.SoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class ErlangBinaryTest {
+@DisplayName("Check Erlang's Binary term type")
+class ErlangBinaryTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void instantiate () {
+ @DisplayName("create new instance by constructor")
+ void instantiate () {
val value = new byte[] { 1, 2, 3 };
assertThat(new ErlangBinary(value).asBinary())
@@ -55,7 +58,8 @@ public void instantiate () {
}
@Test
- public void newInstance () {
+ @DisplayName("create new instance from bytes")
+ void newInstance () {
val value = new byte[] { 1, 2, 3 };
val bytes = Bytes.allocate()
@@ -77,7 +81,8 @@ public void newInstance () {
}
@Test
- public void toBytes () {
+ @DisplayName("convert instance to byte array")
+ void toBytes () {
val value = new byte[] { 1, 2, 3 };
val expected = Bytes.allocate()
@@ -91,14 +96,16 @@ public void toBytes () {
}
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
val binary = new byte[] { 1, 2, 3, 4, 5 };
assertThat(Erlang.binary(binary).toBytes())
.isEqualTo(bytes(binary));
}
@Test
- public void decode () throws Exception {
+ @DisplayName("decode instance from byte array and compare with jinterface result")
+ void decode () throws Exception {
val value = new byte[] { 1, 2, 3 };
val bytes = Bytes.allocate()
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangBitStringTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangBitStringTest.java
index 2b654cf..3378166 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangBitStringTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangBitStringTest.java
@@ -21,12 +21,10 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
import io.appulse.encon.terms.Erlang;
import io.appulse.encon.terms.exception.ErlangTermValidationException;
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.utils.Bytes;
-import io.appulse.utils.test.TestMethodNamePrinter;
import erlang.OtpErlangBitstr;
import erlang.OtpInputStream;
@@ -34,22 +32,27 @@
import lombok.SneakyThrows;
import lombok.val;
import org.assertj.core.api.SoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class ErlangBitStringTest {
+@DisplayName("Check Erlang's BitString term type")
+class ErlangBitStringTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void erlangTermValidationException () {
+ @DisplayName("checks throwing exceptions in constructor")
+ void erlangTermValidationException () {
assertThatThrownBy(() -> new ErlangBitString(new byte[] { 1 }, -1))
.isInstanceOf(ErlangTermValidationException.class)
.hasMessage("Padding must be in range 0..7");
@@ -60,7 +63,8 @@ public void erlangTermValidationException () {
}
@Test
- public void newInstance () {
+ @DisplayName("create new instance from bytes")
+ void newInstance () {
val value = new byte[] { 1, 2, 3 };
val pad = 3;
@@ -84,7 +88,8 @@ public void newInstance () {
}
@Test
- public void toBytes () {
+ @DisplayName("convert instance to byte array")
+ void toBytes () {
val bits = new byte[] { 1, 2, 3 };
val pad = 3;
@@ -100,7 +105,8 @@ public void toBytes () {
}
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
val binary = new byte[] { 1, 2, 3 };
assertThat(Erlang.bitstr(binary, 1).toBytes())
@@ -114,7 +120,8 @@ public void encode () {
}
@Test
- public void decode () throws Exception {
+ @DisplayName("decode instance from byte array and compare with jinterface result")
+ void decode () throws Exception {
val bits = new byte[] { 1, 2, 3 };
val pad = 3;
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangFloatTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangFloatTest.java
index 3053c49..d69eac2 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangFloatTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangFloatTest.java
@@ -26,28 +26,34 @@
import erlang.OtpErlangFloat;
import erlang.OtpInputStream;
import erlang.OtpOutputStream;
+
import io.appulse.encon.terms.Erlang;
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.utils.Bytes;
-import io.appulse.utils.test.TestMethodNamePrinter;
+
import lombok.SneakyThrows;
import lombok.val;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class ErlangFloatTest {
+@DisplayName("Check Erlang's Float term type")
+class ErlangFloatTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
assertThat(Erlang.number(Float.MIN_NORMAL).toBytes())
.isEqualTo(bytes(Float.MIN_NORMAL));
@@ -68,7 +74,8 @@ public void encode () {
}
@Test
- public void decode () throws Exception {
+ @DisplayName("decode instance from byte array and compare with jinterface result")
+ void decode () throws Exception {
val bytes1 = Bytes.allocate()
.put1B(FLOAT.getCode())
.put(String.format("%031.20e", Float.MAX_VALUE).getBytes(ISO_8859_1))
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangIntegerTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangIntegerTest.java
index 6cd6899..2f79da9 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangIntegerTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangIntegerTest.java
@@ -27,32 +27,35 @@
import java.util.Arrays;
import java.util.stream.IntStream;
-
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.utils.Bytes;
-import io.appulse.utils.test.TestMethodNamePrinter;
import erlang.OtpErlangLong;
import erlang.OtpInputStream;
import erlang.OtpOutputStream;
import lombok.SneakyThrows;
import lombok.val;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class ErlangIntegerTest {
+@DisplayName("Check Erlang's Integer term type")
+class ErlangIntegerTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void instantiate () {
+ @DisplayName("create new instance by constructor")
+ void instantiate () {
assertThat(new ErlangInteger(254).getType())
.isEqualTo(SMALL_INTEGER);
@@ -73,7 +76,8 @@ public void instantiate () {
}
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
assertThat(new ErlangInteger(Character.MIN_VALUE).toBytes())
.isEqualTo(bytes(Character.MIN_VALUE));
@@ -119,7 +123,8 @@ public void encode () {
}
@Test
- public void decode () throws Exception {
+ @DisplayName("decode instance from byte array and compare with jinterface result")
+ void decode () throws Exception {
val bytes1 = Bytes.allocate()
.put1B(SMALL_INTEGER.getCode())
.put1B(255)
@@ -168,7 +173,8 @@ public void decode () throws Exception {
}
@Test
- public void cached () {
+ @DisplayName("checks caching values")
+ void cached () {
ErlangInteger num1 = ErlangInteger.cached(1273);
ErlangInteger num2 = ErlangInteger.cached(117);
assertThat(num1).isNotEqualTo(num2);
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangListTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangListTest.java
index 356ffd8..875886a 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangListTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangListTest.java
@@ -22,10 +22,8 @@
import java.util.stream.Stream;
-
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.utils.Bytes;
-import io.appulse.utils.test.TestMethodNamePrinter;
import erlang.OtpErlangAtom;
import erlang.OtpErlangList;
@@ -33,22 +31,27 @@
import lombok.SneakyThrows;
import lombok.val;
import org.assertj.core.api.SoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class ErlangListTest {
+@DisplayName("Check Erlang's List term type")
+class ErlangListTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void newInstance () {
+ @DisplayName("create new instance from bytes")
+ void newInstance () {
val value = new ErlangNil();
val bytes = Bytes.allocate()
.put1B(LIST.getCode())
@@ -80,7 +83,8 @@ public void newInstance () {
}
@Test
- public void toBytes () {
+ @DisplayName("convert instance to byte array")
+ void toBytes () {
val value = new ErlangNil();
val expected = Bytes.allocate()
.put1B(LIST.getCode())
@@ -94,7 +98,8 @@ public void toBytes () {
}
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
String[] values = new String[] {
"one",
"two",
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangMapTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangMapTest.java
index 4124052..044deea 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangMapTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangMapTest.java
@@ -22,31 +22,34 @@
import java.util.LinkedHashMap;
import java.util.List;
-
import io.appulse.encon.terms.ErlangTerm;
-import io.appulse.utils.test.TestMethodNamePrinter;
import erlang.OtpErlangMap;
import erlang.OtpErlangObject;
import erlang.OtpErlangString;
import erlang.OtpOutputStream;
import lombok.SneakyThrows;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class ErlangMapTest {
+@DisplayName("Check Erlang's Map term type")
+class ErlangMapTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
LinkedHashMap value = new LinkedHashMap<>(3);
value.put("one", "1");
value.put("two", "2");
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangNilTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangNilTest.java
index 4aafb86..07109c9 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangNilTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangNilTest.java
@@ -22,27 +22,31 @@
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.utils.Bytes;
-import io.appulse.utils.test.TestMethodNamePrinter;
import erlang.OtpOutputStream;
import lombok.SneakyThrows;
import lombok.val;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class ErlangNilTest {
+@DisplayName("Check Erlang's NIL term type")
+class ErlangNilTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void newInstance () {
+ @DisplayName("create new instance from bytes")
+ void newInstance () {
val bytes = Bytes.allocate()
.put1B(NIL.getCode())
.array();
@@ -54,7 +58,8 @@ public void newInstance () {
}
@Test
- public void toBytes () {
+ @DisplayName("convert instance to byte array")
+ void toBytes () {
val expected = Bytes.allocate()
.put1B(NIL.getCode())
.array();
@@ -64,7 +69,8 @@ public void toBytes () {
}
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
assertThat(new ErlangNil().toBytes())
.isEqualTo(bytes());
}
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangPidTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangPidTest.java
index 8951b8a..b382643 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangPidTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangPidTest.java
@@ -24,28 +24,34 @@
import erlang.OtpErlangPid;
import erlang.OtpInputStream;
import erlang.OtpOutputStream;
+
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.utils.Bytes;
-import io.appulse.utils.test.TestMethodNamePrinter;
+
import lombok.SneakyThrows;
import lombok.val;
import org.assertj.core.api.SoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class ErlangPidTest {
+@DisplayName("Check Erlang's Pid term type")
+class ErlangPidTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void newInstance () {
+ @DisplayName("create new instance from bytes")
+ void newInstance () {
val node = "popa";
val id = 500;
val serial = 10;
@@ -78,7 +84,8 @@ public void newInstance () {
}
@Test
- public void toBytes () {
+ @DisplayName("convert instance to byte array")
+ void toBytes () {
val node = "popa";
val id = 500;
val serial = 10;
@@ -104,7 +111,8 @@ public void toBytes () {
}
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
assertThat(ErlangPid.builder()
.node("popa@localhost")
.id(1)
@@ -128,7 +136,8 @@ public void encode () {
}
@Test
- public void decode () throws Exception {
+ @DisplayName("decode instance from byte array and compare with jinterface result")
+ void decode () throws Exception {
byte[] bytes1 = Bytes.allocate()
.put1B(PID.getCode())
.put(new ErlangAtom("popa@localhost").toBytes())
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangPortTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangPortTest.java
index 0265952..c6f4c3b 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangPortTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangPortTest.java
@@ -23,7 +23,6 @@
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.utils.Bytes;
-import io.appulse.utils.test.TestMethodNamePrinter;
import erlang.OtpErlangPort;
import erlang.OtpInputStream;
@@ -31,22 +30,27 @@
import lombok.SneakyThrows;
import lombok.val;
import org.assertj.core.api.SoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class ErlangPortTest {
+@DisplayName("Check Erlang's Port term type")
+class ErlangPortTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void newInstance () {
+ @DisplayName("create new instance from bytes")
+ void newInstance () {
val node = "popa@localhost";
val id = 500;
val creation = 42;
@@ -74,7 +78,8 @@ public void newInstance () {
}
@Test
- public void toBytes () {
+ @DisplayName("convert instance to byte array")
+ void toBytes () {
val node = "popa@localhost";
val id = 500;
val creation = 42;
@@ -97,7 +102,8 @@ public void toBytes () {
}
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
assertThat(ErlangPort.builder()
.node("popa@localhost")
.id(1)
@@ -119,7 +125,8 @@ public void encode () {
}
@Test
- public void decode () throws Exception {
+ @DisplayName("decode instance from byte array and compare with jinterface result")
+ void decode () throws Exception {
byte[] bytes1 = Bytes.allocate()
.put1B(PORT.getCode())
.put(new ErlangAtom("popa@localhost").toBytes())
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangReferenceTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangReferenceTest.java
index 92ef439..cdcdc19 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangReferenceTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangReferenceTest.java
@@ -26,7 +26,6 @@
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.utils.Bytes;
-import io.appulse.utils.test.TestMethodNamePrinter;
import erlang.OtpErlangRef;
import erlang.OtpInputStream;
@@ -35,9 +34,10 @@
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.assertj.core.api.SoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
@@ -45,13 +45,17 @@
* @since 1.0.0
*/
@Slf4j
-public class ErlangReferenceTest {
+@DisplayName("Check Erlang's Reference term type")
+class ErlangReferenceTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void instantiate () {
+ @DisplayName("create new instance by constructor")
+ void instantiate () {
assertThat(ErlangReference.builder()
.node("popa")
.id(3)
@@ -63,7 +67,8 @@ public void instantiate () {
}
@Test
- public void newInstance () {
+ @DisplayName("create new instance from bytes")
+ void newInstance () {
val node = "popa@localhost";
val ids = new long[] { 1, 0, 0 };
val creation = 42;
@@ -100,7 +105,8 @@ public void newInstance () {
}
@Test
- public void toBytes () {
+ @DisplayName("convert instance to byte array")
+ void toBytes () {
val node = "popa@localhost";
val ids = new long[] { 1, 0, 0 };
val creation = 42;
@@ -129,7 +135,8 @@ public void toBytes () {
}
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
assertThat(ErlangReference.builder()
.node("popa@localhost")
.ids(new long[] { 1 })
@@ -168,7 +175,8 @@ public void encode () {
}
@Test
- public void decode () throws Exception {
+ @DisplayName("decode instance from byte array and compare with jinterface result")
+ void decode () throws Exception {
byte[] bytes1 = Bytes.allocate()
.put1B(REFERENCE.getCode())
.put(new ErlangAtom("popa@localhost").toBytes())
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangStringTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangStringTest.java
index 9ae437e..fad4c72 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangStringTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangStringTest.java
@@ -25,29 +25,33 @@
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.utils.Bytes;
-import io.appulse.utils.test.TestMethodNamePrinter;
import erlang.OtpErlangString;
import erlang.OtpInputStream;
import erlang.OtpOutputStream;
import lombok.SneakyThrows;
import lombok.val;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class ErlangStringTest {
+@DisplayName("Check Erlang's String term type")
+class ErlangStringTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
assertThat(new ErlangString("").toBytes())
.isEqualTo(bytes(""));
@@ -64,7 +68,8 @@ public void encode () {
}
@Test
- public void decode () throws Exception {
+ @DisplayName("decode instance from byte array and compare with jinterface result")
+ void decode () throws Exception {
val bytes = Bytes.allocate()
.put1B(STRING.getCode())
.put2B("popa".length())
diff --git a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangTupleTest.java b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangTupleTest.java
index 091cf5f..2a9666e 100644
--- a/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangTupleTest.java
+++ b/encon-terms/src/test/java/io/appulse/encon/terms/type/ErlangTupleTest.java
@@ -29,7 +29,6 @@
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.utils.Bytes;
-import io.appulse.utils.test.TestMethodNamePrinter;
import erlang.OtpErlangAtom;
import erlang.OtpErlangInt;
@@ -42,22 +41,27 @@
import lombok.SneakyThrows;
import lombok.val;
import org.assertj.core.api.SoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 1.0.0
*/
-public class ErlangTupleTest {
+@DisplayName("Check Erlang's Tuple term type")
+class ErlangTupleTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void instantiate () {
+ @DisplayName("create new instance by constructor")
+ void instantiate () {
assertThat(new ErlangTuple(new ErlangNil()).getType())
.isEqualTo(SMALL_TUPLE);
@@ -71,7 +75,8 @@ public void instantiate () {
}
@Test
- public void newInstance () {
+ @DisplayName("create new instance from bytes")
+ void newInstance () {
val value = new ErlangNil();
val bytes = Bytes.allocate()
.put1B(SMALL_TUPLE.getCode())
@@ -99,7 +104,8 @@ public void newInstance () {
}
@Test
- public void toBytes () {
+ @DisplayName("convert instance to byte array")
+ void toBytes () {
val value = new ErlangNil();
val expected = Bytes.allocate()
.put1B(SMALL_TUPLE.getCode())
@@ -112,7 +118,8 @@ public void toBytes () {
}
@Test
- public void encode () {
+ @DisplayName("encode instance to byte array and compare with jinterface output")
+ void encode () {
String[] values = new String[] {
"one",
"two",
From e4f68e135fd226f0e3ce5c1928c24a3ec3b9e142 Mon Sep 17 00:00:00 2001
From: Artem Labazin
Date: Mon, 10 Dec 2018 14:30:37 +0300
Subject: [PATCH 10/20] Update encon-config for java 11
---
.../config/ConfigurationProgrammatical.java | 3 ++
...nfigMappingEnumValueNotFoundException.java | 2 +
.../io/appulse/encon/config/DumpTest.java | 34 ++++++++++-----
.../appulse/encon/config/GetBooleanTest.java | 16 +++++--
.../io/appulse/encon/config/GetByteTest.java | 16 +++++--
.../io/appulse/encon/config/GetCharTest.java | 16 +++++--
.../appulse/encon/config/GetDoubleTest.java | 16 +++++--
.../io/appulse/encon/config/GetFloatTest.java | 16 +++++--
.../appulse/encon/config/GetIntegerTest.java | 16 +++++--
.../io/appulse/encon/config/GetLongTest.java | 16 +++++--
.../appulse/encon/config/GetObjectTest.java | 16 +++++--
.../io/appulse/encon/config/GetPojoTest.java | 12 ++++--
.../io/appulse/encon/config/GetShortTest.java | 16 +++++--
.../appulse/encon/config/GetStringTest.java | 16 +++++--
.../io/appulse/encon/config/LoadTest.java | 43 +++++++++++++------
15 files changed, 197 insertions(+), 57 deletions(-)
diff --git a/encon-config/src/main/java/io/appulse/encon/config/ConfigurationProgrammatical.java b/encon-config/src/main/java/io/appulse/encon/config/ConfigurationProgrammatical.java
index 93a92b2..8bd51f5 100644
--- a/encon-config/src/main/java/io/appulse/encon/config/ConfigurationProgrammatical.java
+++ b/encon-config/src/main/java/io/appulse/encon/config/ConfigurationProgrammatical.java
@@ -190,4 +190,7 @@ private ConfigurationProgrammatical (@Singular List configs) {
ConfigTree getConfigTree () {
return tree;
}
+
+ public static class ConfigurationProgrammaticalBuilder {
+ }
}
diff --git a/encon-config/src/main/java/io/appulse/encon/config/exception/ConfigMappingEnumValueNotFoundException.java b/encon-config/src/main/java/io/appulse/encon/config/exception/ConfigMappingEnumValueNotFoundException.java
index 437eb06..fea06b9 100644
--- a/encon-config/src/main/java/io/appulse/encon/config/exception/ConfigMappingEnumValueNotFoundException.java
+++ b/encon-config/src/main/java/io/appulse/encon/config/exception/ConfigMappingEnumValueNotFoundException.java
@@ -28,6 +28,8 @@
@EqualsAndHashCode(callSuper = true)
public class ConfigMappingEnumValueNotFoundException extends ConfigMappingUnsupportedTypeException {
+ private static final long serialVersionUID = 4085006616020486199L;
+
String nodeAsString;
public ConfigMappingEnumValueNotFoundException (Class> type, String nodeAsString) {
diff --git a/encon-config/src/test/java/io/appulse/encon/config/DumpTest.java b/encon-config/src/test/java/io/appulse/encon/config/DumpTest.java
index d1e6c2f..58f5596 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/DumpTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/DumpTest.java
@@ -28,22 +28,26 @@
import lombok.SneakyThrows;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 2.0.0
*/
-public class DumpTest {
+@DisplayName("Dumping configuration tests")
+class DumpTest {
static Path FOLDER;
- @BeforeClass
+ @BeforeAll
@SneakyThrows
- public static void beforeClass () {
+ static void beforeAll () {
FOLDER = Paths.get("dump_test_folder");
if (Files.exists(FOLDER)) {
@@ -55,9 +59,9 @@ public static void beforeClass () {
Files.createDirectories(FOLDER);
}
- @AfterClass
+ @AfterAll
@SneakyThrows
- public static void afterClass () {
+ static void afterAll () {
FOLDER = Paths.get("dump_test_folder");
if (Files.exists(FOLDER)) {
@@ -69,8 +73,14 @@ public static void afterClass () {
Files.deleteIfExists(FOLDER);
}
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
+
@Test
- public void dumpFileName () {
+ @DisplayName("dump by file name")
+ void dumpFileName () {
ResourceUtils.getResourceUrls("dump", "file.*").forEach(url -> {
Config config1 = Config.load(url);
@@ -87,7 +97,8 @@ public void dumpFileName () {
}
@Test
- public void dumpFile () {
+ @DisplayName("dump by file object")
+ void dumpFile () {
ResourceUtils.getResourceUrls("dump", "file.*").forEach(url -> {
Config config1 = Config.load(url);
@@ -104,7 +115,8 @@ public void dumpFile () {
}
@Test
- public void dumpPath () {
+ @DisplayName("dump by file path")
+ void dumpPath () {
ResourceUtils.getResourceUrls("dump", "file.*").forEach(url -> {
Config config1 = Config.load(url);
diff --git a/encon-config/src/test/java/io/appulse/encon/config/GetBooleanTest.java b/encon-config/src/test/java/io/appulse/encon/config/GetBooleanTest.java
index 70470c2..33028d9 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/GetBooleanTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/GetBooleanTest.java
@@ -24,17 +24,27 @@
import io.appulse.utils.ResourceUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 2.0.0
*/
-public class GetBooleanTest {
+@DisplayName("Extracting boolean options from config")
+class GetBooleanTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void test () {
+ @DisplayName("checks boolean options")
+ void test () {
URL url = ResourceUtils.getResourceUrls("", "boolean.yml").get(0);
Config config = Config.load(url);
diff --git a/encon-config/src/test/java/io/appulse/encon/config/GetByteTest.java b/encon-config/src/test/java/io/appulse/encon/config/GetByteTest.java
index 91ff7b8..1fc7201 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/GetByteTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/GetByteTest.java
@@ -23,17 +23,27 @@
import io.appulse.utils.ResourceUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 2.0.0
*/
-public class GetByteTest {
+@DisplayName("Extracting byte options from config")
+class GetByteTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void test () {
+ @DisplayName("checks byte options")
+ void test () {
URL url = ResourceUtils.getResourceUrls("", "byte.yml").get(0);
Config config = Config.load(url);
diff --git a/encon-config/src/test/java/io/appulse/encon/config/GetCharTest.java b/encon-config/src/test/java/io/appulse/encon/config/GetCharTest.java
index 55eaab8..1234588 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/GetCharTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/GetCharTest.java
@@ -22,17 +22,27 @@
import io.appulse.utils.ResourceUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 2.0.0
*/
-public class GetCharTest {
+@DisplayName("Extracting char options from config")
+class GetCharTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void test () {
+ @DisplayName("checks char options")
+ void test () {
URL url = ResourceUtils.getResourceUrls("", "char.yml").get(0);
Config config = Config.load(url);
diff --git a/encon-config/src/test/java/io/appulse/encon/config/GetDoubleTest.java b/encon-config/src/test/java/io/appulse/encon/config/GetDoubleTest.java
index 89e1455..c025b98 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/GetDoubleTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/GetDoubleTest.java
@@ -23,17 +23,27 @@
import io.appulse.utils.ResourceUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 2.0.0
*/
-public class GetDoubleTest {
+@DisplayName("Extracting double options from config")
+class GetDoubleTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void test () {
+ @DisplayName("checks double options")
+ void test () {
URL url = ResourceUtils.getResourceUrls("", "double.yml").get(0);
Config config = Config.load(url);
diff --git a/encon-config/src/test/java/io/appulse/encon/config/GetFloatTest.java b/encon-config/src/test/java/io/appulse/encon/config/GetFloatTest.java
index ff96625..4c3ccfd 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/GetFloatTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/GetFloatTest.java
@@ -23,17 +23,27 @@
import io.appulse.utils.ResourceUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 2.0.0
*/
-public class GetFloatTest {
+@DisplayName("Extracting float options from config")
+class GetFloatTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void test () {
+ @DisplayName("checks float options")
+ void test () {
URL url = ResourceUtils.getResourceUrls("", "float.yml").get(0);
Config config = Config.load(url);
diff --git a/encon-config/src/test/java/io/appulse/encon/config/GetIntegerTest.java b/encon-config/src/test/java/io/appulse/encon/config/GetIntegerTest.java
index 468137c..960c9e6 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/GetIntegerTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/GetIntegerTest.java
@@ -23,17 +23,27 @@
import io.appulse.utils.ResourceUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 2.0.0
*/
-public class GetIntegerTest {
+@DisplayName("Extracting integer options from config")
+class GetIntegerTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void test () {
+ @DisplayName("checks integer options")
+ void test () {
URL url = ResourceUtils.getResourceUrls("", "int.yml").get(0);
Config config = Config.load(url);
diff --git a/encon-config/src/test/java/io/appulse/encon/config/GetLongTest.java b/encon-config/src/test/java/io/appulse/encon/config/GetLongTest.java
index 2c9df1a..498528a 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/GetLongTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/GetLongTest.java
@@ -23,17 +23,27 @@
import io.appulse.utils.ResourceUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 2.0.0
*/
-public class GetLongTest {
+@DisplayName("Extracting long options from config")
+class GetLongTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void test () {
+ @DisplayName("checks long options")
+ void test () {
URL url = ResourceUtils.getResourceUrls("", "long.yml").get(0);
Config config = Config.load(url);
diff --git a/encon-config/src/test/java/io/appulse/encon/config/GetObjectTest.java b/encon-config/src/test/java/io/appulse/encon/config/GetObjectTest.java
index 245fb2b..91d0a82 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/GetObjectTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/GetObjectTest.java
@@ -24,17 +24,27 @@
import io.appulse.utils.ResourceUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 2.0.0
*/
-public class GetObjectTest {
+@DisplayName("Extracting object options from config")
+class GetObjectTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void test () {
+ @DisplayName("checks object options")
+ void test () {
URL url = ResourceUtils.getResourceUrls("", "object.yml").get(0);
Config config = Config.load(url);
diff --git a/encon-config/src/test/java/io/appulse/encon/config/GetPojoTest.java b/encon-config/src/test/java/io/appulse/encon/config/GetPojoTest.java
index fc357f0..92be49a 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/GetPojoTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/GetPojoTest.java
@@ -37,7 +37,8 @@
import lombok.experimental.FieldDefaults;
import lombok.extern.slf4j.Slf4j;
-import org.junit.Test;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
/**
*
@@ -45,7 +46,8 @@
* @since 2.0.0
*/
@Slf4j
-public class GetPojoTest {
+@DisplayName("Casting configuration tests")
+class GetPojoTest {
static NodesConfig.NodeConfig.MailboxConfig NODE_1_MAILBOX = NodesConfig.NodeConfig.MailboxConfig.builder()
.name("popa")
@@ -97,7 +99,8 @@ public class GetPojoTest {
.build();
@Test
- public void loadYamlTest () {
+ @DisplayName("load YAML configuration")
+ void loadYamlTest () {
URL url = ResourceUtils.getResourceUrls("", "pojo.yml").get(0);
Config config = Config.load(url);
@@ -105,7 +108,8 @@ public void loadYamlTest () {
}
@Test
- public void programmaticalTest () {
+ @DisplayName("create programmatical configuration")
+ void programmaticalTest () {
Config config = Config.builder()
.config(NODES_CONFIG)
.config(HANDLER)
diff --git a/encon-config/src/test/java/io/appulse/encon/config/GetShortTest.java b/encon-config/src/test/java/io/appulse/encon/config/GetShortTest.java
index a61a6d6..2eeae0f 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/GetShortTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/GetShortTest.java
@@ -23,17 +23,27 @@
import io.appulse.utils.ResourceUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 2.0.0
*/
-public class GetShortTest {
+@DisplayName("Extracting short options from config")
+class GetShortTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void test () {
+ @DisplayName("checks short options")
+ void test () {
URL url = ResourceUtils.getResourceUrls("", "short.yml").get(0);
Config config = Config.load(url);
diff --git a/encon-config/src/test/java/io/appulse/encon/config/GetStringTest.java b/encon-config/src/test/java/io/appulse/encon/config/GetStringTest.java
index 1c4e309..7c60858 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/GetStringTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/GetStringTest.java
@@ -22,17 +22,27 @@
import io.appulse.utils.ResourceUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 2.0.0
*/
-public class GetStringTest {
+@DisplayName("Extracting string options from config")
+class GetStringTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void test () {
+ @DisplayName("checks string options")
+ void test () {
URL url = ResourceUtils.getResourceUrls("", "string.yml").get(0);
Config config = Config.load(url);
diff --git a/encon-config/src/test/java/io/appulse/encon/config/LoadTest.java b/encon-config/src/test/java/io/appulse/encon/config/LoadTest.java
index bc28dfb..1ea55ce 100644
--- a/encon-config/src/test/java/io/appulse/encon/config/LoadTest.java
+++ b/encon-config/src/test/java/io/appulse/encon/config/LoadTest.java
@@ -19,6 +19,7 @@
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.io.File;
import java.net.URI;
@@ -34,22 +35,34 @@
import io.appulse.utils.ResourceUtils;
import lombok.SneakyThrows;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @author Artem Labazin
* @since 2.0.0
*/
-public class LoadTest {
+@DisplayName("Configuration loading tests")
+class LoadTest {
- @Test(expected = ConfigLoadingFileNotFoundException.class)
- public void loadNonexistentFile () {
- Config.load("nonexistent.yml");
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
}
@Test
- public void loadMap () {
+ @DisplayName("try to load nonexistent configuration file")
+ void loadNonexistentFile () {
+ assertThatThrownBy(() -> Config.load("nonexistent.yml"))
+ .isInstanceOf(ConfigLoadingFileNotFoundException.class);
+ }
+
+ @Test
+ @DisplayName("load configuration from map")
+ void loadMap () {
Map subMap = new HashMap<>();
subMap.put("name", "popa");
subMap.put("my.age", 11);
@@ -65,7 +78,8 @@ public void loadMap () {
}
// @Test
- public void loadProperties () {
+// @DisplayName("load configuration from properties")
+ void loadProperties () {
Properties properties = new Properties();
properties.put("one.two.three.four", 4);
properties.put("one.two.three.five.six", 6);
@@ -81,7 +95,8 @@ public void loadProperties () {
}
@Test
- public void loadUrl () {
+ @DisplayName("load configuration by URL")
+ void loadUrl () {
getUrlFiles().forEach(url -> {
Config config = Config.load(url);
checkConfig(config, url.toString());
@@ -89,7 +104,8 @@ public void loadUrl () {
}
@Test
- public void loadUri () {
+ @DisplayName("load configuration by URI")
+ void loadUri () {
getUriFiles().forEach(uri -> {
Config config = Config.load(uri);
checkConfig(config, uri.toString());
@@ -97,7 +113,8 @@ public void loadUri () {
}
@Test
- public void loadFile () {
+ @DisplayName("load configuration by File")
+ void loadFile () {
getUriFiles().stream().map(File::new).forEach(file -> {
Config config = Config.load(file);
checkConfig(config, file.toString());
@@ -105,7 +122,8 @@ public void loadFile () {
}
@Test
- public void loadPath () {
+ @DisplayName("load configuration by Path")
+ void loadPath () {
getUriFiles().stream().map(Paths::get).forEach(path -> {
Config config = Config.load(path);
checkConfig(config, path.toString());
@@ -113,7 +131,8 @@ public void loadPath () {
}
@Test
- public void loadFileName () {
+ @DisplayName("load configuration by file name")
+ void loadFileName () {
getUriFiles().stream().map(Paths::get).map(Path::toString).forEach(fileName -> {
Config config = Config.load(fileName);
checkConfig(config, fileName);
From 8bda40a22d924d231f5918a4bef1d0a74a431707 Mon Sep 17 00:00:00 2001
From: Artem Labazin
Date: Mon, 10 Dec 2018 14:42:22 +0300
Subject: [PATCH 11/20] Update encon-databind for Java 11
---
.../encon/databind/parser/PojoDescriptor.java | 3 ++
.../TermMapperDifferentWrappersTest.java | 30 ++++++++++++++-----
.../encon/databind/TermMapperTest.java | 16 ++++++++--
.../java/io/appulse/encon/terms/TermType.java | 4 +--
4 files changed, 41 insertions(+), 12 deletions(-)
diff --git a/encon-databind/src/main/java/io/appulse/encon/databind/parser/PojoDescriptor.java b/encon-databind/src/main/java/io/appulse/encon/databind/parser/PojoDescriptor.java
index 7d957df..c219c3b 100644
--- a/encon-databind/src/main/java/io/appulse/encon/databind/parser/PojoDescriptor.java
+++ b/encon-databind/src/main/java/io/appulse/encon/databind/parser/PojoDescriptor.java
@@ -46,4 +46,7 @@ public final class PojoDescriptor {
public String getName () {
return type.getSimpleName();
}
+
+ public static class PojoDescriptorBuilder {
+ }
}
diff --git a/encon-databind/src/test/java/io/appulse/encon/databind/TermMapperDifferentWrappersTest.java b/encon-databind/src/test/java/io/appulse/encon/databind/TermMapperDifferentWrappersTest.java
index abf9903..3a2a48e 100644
--- a/encon-databind/src/test/java/io/appulse/encon/databind/TermMapperDifferentWrappersTest.java
+++ b/encon-databind/src/test/java/io/appulse/encon/databind/TermMapperDifferentWrappersTest.java
@@ -27,21 +27,33 @@
import io.appulse.encon.databind.annotation.AsErlangList;
import io.appulse.encon.databind.annotation.AsErlangMap;
import io.appulse.encon.databind.annotation.AsErlangTuple;
+
import java.io.Serializable;
+
import lombok.experimental.FieldDefaults;
import lombok.val;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @since 1.1.0
* @author Artem Labazin
*/
+@DisplayName("Different term wrappers tests")
@FieldDefaults(level = PRIVATE, makeFinal = true)
-public class TermMapperDifferentWrappersTest {
+class TermMapperDifferentWrappersTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void defaultWrapper () {
+ @DisplayName("default wrapper")
+ void defaultWrapper () {
val erlangTerm = TermMapper.serialize(new DefaultWrapper());
assertThat(erlangTerm.getType())
.isEqualTo(SMALL_TUPLE);
@@ -51,7 +63,8 @@ public void defaultWrapper () {
}
@Test
- public void listWrapper () {
+ @DisplayName("list wrapper")
+ void listWrapper () {
val erlangTerm = TermMapper.serialize(new ListWrapper());
assertThat(erlangTerm.getType())
.isEqualTo(LIST);
@@ -61,7 +74,8 @@ public void listWrapper () {
}
@Test
- public void tupleWrapper () {
+ @DisplayName("tuple wrapper")
+ void tupleWrapper () {
val erlangTerm = TermMapper.serialize(new TupleWrapper());
assertThat(erlangTerm.getType())
.isEqualTo(SMALL_TUPLE);
@@ -71,7 +85,8 @@ public void tupleWrapper () {
}
@Test
- public void mapWrapper () {
+ @DisplayName("map wrapper")
+ void mapWrapper () {
val erlangTerm = TermMapper.serialize(new MapWrapper());
assertThat(erlangTerm.getType())
.isEqualTo(MAP);
@@ -81,7 +96,8 @@ public void mapWrapper () {
}
@Test
- public void binaryWrapper () {
+ @DisplayName("binary wrapper")
+ void binaryWrapper () {
val erlangTerm = TermMapper.serialize(new BinaryWrapper());
assertThat(erlangTerm.getType())
.isEqualTo(BINARY);
diff --git a/encon-databind/src/test/java/io/appulse/encon/databind/TermMapperTest.java b/encon-databind/src/test/java/io/appulse/encon/databind/TermMapperTest.java
index 753b694..f32987c 100644
--- a/encon-databind/src/test/java/io/appulse/encon/databind/TermMapperTest.java
+++ b/encon-databind/src/test/java/io/appulse/encon/databind/TermMapperTest.java
@@ -38,18 +38,28 @@
import lombok.NoArgsConstructor;
import lombok.experimental.FieldDefaults;
import lombok.val;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
*
* @since 1.6.0
* @author Artem Labazin
*/
+@DisplayName("Term mapping test to POJO")
@FieldDefaults(level = PRIVATE, makeFinal = true)
-public class TermMapperTest {
+class TermMapperTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void simple () {
+ @DisplayName("simple POJO mapping")
+ void simple () {
val pojo = new Pojo(
"Artem",
27,
diff --git a/encon-terms/src/main/java/io/appulse/encon/terms/TermType.java b/encon-terms/src/main/java/io/appulse/encon/terms/TermType.java
index 85b4c73..6aa25f0 100644
--- a/encon-terms/src/main/java/io/appulse/encon/terms/TermType.java
+++ b/encon-terms/src/main/java/io/appulse/encon/terms/TermType.java
@@ -487,7 +487,7 @@ public enum TermType {
*
*
* Encodes a map. The Arity field is an unsigned 4 byte integer in big-endian format that determines the
- * number of key-value pairs in the map. Key and value pairs (Ki => Vi) are encoded in section Pairs in the
+ * number of key-value pairs in the map. Key and value pairs (Ki => Vi) are encoded in section Pairs in the
* following order: K1, V1, K2, V2,..., Kn, Vn.
*
* Duplicate keys are not allowed within the same map.
@@ -661,7 +661,7 @@ public enum TermType {
FUNCTION(117, ErlangFunction.class),
/**
- * This is the new encoding of internal funs: fun F/A and fun(Arg1,..) -> ... end.
+ * This is the new encoding of internal funs: fun F/A and fun(Arg1,..) -> ... end.
*