+ *
+ * @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:
- *
- *
* 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.
*
* Structure:
*
diff --git a/encon-terms/src/main/java/io/appulse/encon/terms/type/ErlangAtom.java b/encon-terms/src/main/java/io/appulse/encon/terms/type/ErlangAtom.java
index a0b9232..f9cf9f8 100644
--- a/encon-terms/src/main/java/io/appulse/encon/terms/type/ErlangAtom.java
+++ b/encon-terms/src/main/java/io/appulse/encon/terms/type/ErlangAtom.java
@@ -21,25 +21,20 @@
import static io.appulse.encon.terms.TermType.SMALL_ATOM_UTF8;
import static java.nio.charset.StandardCharsets.ISO_8859_1;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static java.util.Locale.ENGLISH;
import static lombok.AccessLevel.PRIVATE;
import java.nio.charset.Charset;
-import java.util.Arrays;
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.encon.terms.TermType;
import io.appulse.encon.terms.exception.IllegalErlangTermTypeException;
-import io.appulse.utils.cache.LruCache;
import io.netty.buffer.ByteBuf;
-import io.netty.util.ByteProcessor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import lombok.ToString;
import lombok.experimental.FieldDefaults;
-import lombok.experimental.NonFinal;
/**
* An atom is a literal, a constant with name. An atom is to be enclosed in
@@ -51,83 +46,48 @@
* @author Artem Labazin
*/
@ToString
+@SuppressWarnings("deprecation")
@EqualsAndHashCode(callSuper = true, of = "bytes")
@FieldDefaults(level = PRIVATE, makeFinal = true)
public class ErlangAtom extends ErlangTerm {
private static final long serialVersionUID = -2748345367418129439L;
- private static final int MAX_ATOM_CODE_POINTS_LENGTH = 255;
-
- private static final int MAX_SMALL_ATOM_BYTES_LENGTH = 255;
-
- private static final LruCache CACHE = new LruCache<>(1000);
+ public static final ErlangAtom ATOM_TRUE = new ErlangAtom(true);
- private static final ErlangAtom ATOM_TRUE = cached(Boolean.TRUE.toString().toLowerCase(ENGLISH));
+ public static final ErlangAtom ATOM_FALSE = new ErlangAtom(false);
- private static final ErlangAtom ATOM_FALSE = cached(Boolean.FALSE.toString().toLowerCase(ENGLISH));
-
- public static ErlangAtom cached (boolean value) {
- return value
- ? ATOM_TRUE
- : ATOM_FALSE;
- }
-
- public static ErlangAtom cached (String value) {
- Charset charset = UTF_8;
- byte[] bytes = value.getBytes(charset);
- int hashCode = Arrays.hashCode(bytes);
- return CACHE.computeIfAbsent(hashCode, key -> new ErlangAtom(value, charset, bytes));
- }
-
- @SuppressWarnings("deprecation")
- public static ErlangAtom cached (TermType type, ByteBuf buffer) {
- ByteArrayHashCode byteProcessor = new ByteArrayHashCode();
-
- int length = type == SMALL_ATOM || type == SMALL_ATOM_UTF8
- ? buffer.readUnsignedByte()
- : buffer.readUnsignedShort();
-
- buffer.forEachByte(buffer.readerIndex(), length, byteProcessor);
+ private static final int MAX_ATOM_CODE_POINTS_LENGTH = 255;
- return CACHE.compute(byteProcessor.getHashCode(), (key, value) -> {
- if (value == null) {
- return new ErlangAtom(type, buffer, length);
- } else {
- buffer.skipBytes(length);
- return value;
- }
- });
- }
+ private static final int MAX_SMALL_ATOM_BYTES_LENGTH = 255;
- @NonFinal
- String value;
+ @Getter(lazy = true, value = PRIVATE)
+ String value = createString();
byte[] bytes;
transient Charset charset;
/**
- * Constructs Erlang's atom object with specific {@link String} value.
+ * Constructs Erlang's term object with specific {@link TermType} from {@link ByteBuf}.
*
- * @param value {@link String} atom's value
+ * @param type object's type
+ *
+ * @param buffer byte buffer
*/
- public ErlangAtom (@NonNull String value) {
- super();
+ public ErlangAtom (TermType type, ByteBuf buffer) {
+ super(type);
- this.value = value.codePointCount(0, value.length()) <= MAX_ATOM_CODE_POINTS_LENGTH
- ? value
- // Throwing an exception would be better I think, but truncation
- // seems to be the way it has been done in other parts of OTP...
- : new String(value.codePoints().toArray(), 0, MAX_ATOM_CODE_POINTS_LENGTH);
+ int length = type == SMALL_ATOM || type == SMALL_ATOM_UTF8
+ ? buffer.readUnsignedByte()
+ : buffer.readUnsignedShort();
- charset = UTF_8;
- bytes = this.value.getBytes(charset);
- if (bytes.length > MAX_SMALL_ATOM_BYTES_LENGTH) {
- setType(ATOM_UTF8);
- } else {
- setType(SMALL_ATOM_UTF8);
- }
+ charset = type == SMALL_ATOM_UTF8 || type == ATOM_UTF8
+ ? UTF_8
+ : ISO_8859_1;
+
+ bytes = new byte[length];
+ buffer.readBytes(bytes);
}
/**
@@ -136,46 +96,31 @@ public ErlangAtom (@NonNull String value) {
* @param value {@code boolean} atom's value
*/
public ErlangAtom (boolean value) {
- super(SMALL_ATOM_UTF8);
- charset = UTF_8;
- this.value = Boolean.toString(value);
- bytes = value
- ? Boolean.TRUE.toString().getBytes(charset)
- : Boolean.FALSE.toString().getBytes(charset);
+ this(Boolean.toString(value), UTF_8);
}
/**
- * Constructs Erlang's term object with specific {@link TermType} from {@link ByteBuf}.
- *
- * @param type object's type
- *
- * @param buffer byte buffer
+ * Constructs Erlang's atom object with specific {@link String} value.
*
- * @param length amount of useful bytes
+ * @param value {@link String} atom's value
*/
- private ErlangAtom (TermType type, ByteBuf buffer, int length) {
- super(type);
-
- charset = type == SMALL_ATOM_UTF8 || type == ATOM_UTF8
- ? UTF_8
- : ISO_8859_1;
-
- bytes = new byte[length];
- buffer.readBytes(bytes);
+ public ErlangAtom (String value) {
+ this(value, UTF_8);
}
- @SuppressWarnings("PMD.ArrayIsStoredDirectly")
- private ErlangAtom (String value, Charset charset, byte[] bytes) {
+ public ErlangAtom (@NonNull String value, @NonNull Charset charset) {
super();
- this.value = value.codePointCount(0, value.length()) <= MAX_ATOM_CODE_POINTS_LENGTH
- ? value
- // Throwing an exception would be better I think, but truncation
- // seems to be the way it has been done in other parts of OTP...
- : new String(value.codePoints().toArray(), 0, MAX_ATOM_CODE_POINTS_LENGTH);
+ if (value.codePointCount(0, value.length()) <= MAX_ATOM_CODE_POINTS_LENGTH) {
+ this.value.set(value);
+ } else {
+ // Throwing an exception would be better I think, but truncation
+ // seems to be the way it has been done in other parts of OTP...
+ this.value.set(new String(value.codePoints().toArray(), 0, MAX_ATOM_CODE_POINTS_LENGTH));
+ }
this.charset = charset;
- this.bytes = bytes;
+ this.bytes = getValue().getBytes(charset);
if (bytes.length > MAX_SMALL_ATOM_BYTES_LENGTH) {
setType(ATOM_UTF8);
} else {
@@ -195,10 +140,7 @@ public boolean asBoolean (boolean defaultValue) {
@Override
public String asText (String defaultValue) {
- if (value == null) {
- value = new String(bytes, charset);
- }
- return value;
+ return getValue();
}
@Override
@@ -233,16 +175,7 @@ protected void serialize (ByteBuf buffer) {
buffer.writeBytes(bytes);
}
- @Getter
- @FieldDefaults(level = PRIVATE)
- private static class ByteArrayHashCode implements ByteProcessor {
-
- int hashCode = 1;
-
- @Override
- public boolean process (byte value) throws Exception {
- hashCode = 31 * hashCode + value;
- return true;
- }
+ private String createString () {
+ return new String(bytes, charset);
}
}
diff --git a/encon-terms/src/main/java/io/appulse/encon/terms/type/ErlangPid.java b/encon-terms/src/main/java/io/appulse/encon/terms/type/ErlangPid.java
index cd512ee..efc783f 100644
--- a/encon-terms/src/main/java/io/appulse/encon/terms/type/ErlangPid.java
+++ b/encon-terms/src/main/java/io/appulse/encon/terms/type/ErlangPid.java
@@ -17,8 +17,6 @@
package io.appulse.encon.terms.type;
import static io.appulse.encon.terms.TermType.PID;
-import static io.appulse.encon.terms.TermType.SMALL_ATOM;
-import static io.appulse.encon.terms.TermType.SMALL_ATOM_UTF8;
import static java.util.Optional.ofNullable;
import static lombok.AccessLevel.PRIVATE;
@@ -27,10 +25,8 @@
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.encon.terms.TermType;
import io.appulse.encon.terms.exception.IllegalErlangTermTypeException;
-import io.appulse.utils.cache.LruCache;
import io.netty.buffer.ByteBuf;
-import io.netty.util.ByteProcessor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@@ -51,34 +47,6 @@ public class ErlangPid extends ErlangTerm {
private static final long serialVersionUID = 7083159089429831665L;
- private static final LruCache CACHE = new LruCache<>(1000);
-
- @SuppressWarnings("deprecation")
- public static ErlangPid cached (TermType type, ByteBuf buffer) {
- int index = buffer.readerIndex();
- byte nodeNameType = buffer.readByte();
- int nodeNameLength = nodeNameType == SMALL_ATOM.getCode() || nodeNameType == SMALL_ATOM_UTF8.getCode()
- ? buffer.readUnsignedByte()
- : buffer.readUnsignedShort();
-
- int length = type == PID
- ? nodeNameLength + 9
- : nodeNameLength + 12;
-
- ByteArrayHashCode byteProcessor = new ByteArrayHashCode();
- buffer.forEachByte(buffer.readerIndex(), length, byteProcessor);
-
- return CACHE.compute(byteProcessor.getHashCode(), (key, value) -> {
- if (value == null) {
- buffer.readerIndex(index);
- return new ErlangPid(type, buffer);
- } else {
- buffer.skipBytes(length);
- return value;
- }
- });
- }
-
@NonFinal
NodeDescriptor descriptor;
@@ -183,17 +151,4 @@ protected void serialize (ByteBuf buffer) {
throw new IllegalErlangTermTypeException(getClass(), getType());
}
}
-
- @Getter
- @FieldDefaults(level = PRIVATE)
- private static class ByteArrayHashCode implements ByteProcessor {
-
- int hashCode = 1;
-
- @Override
- public boolean process (byte value) throws Exception {
- hashCode = 31 * hashCode + value;
- return true;
- }
- }
}
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",
diff --git a/encon/pom.xml b/encon/pom.xml
index 331126a..879baba 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,9 @@ limitations under the License.
client
-
- com.google.code.findbugs
- annotations
- provided
-
-
- com.google.code.findbugs
- jsr305
- provided
-
-
org.yamlsnakeyaml
- 1.21
@@ -99,21 +81,6 @@ limitations under the License.
servertest
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
-
- org.mockito
- mockito-core
- test
-
@@ -128,14 +95,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/src/main/java/io/appulse/encon/ModuleRemoteProcedureCall.java b/encon/src/main/java/io/appulse/encon/ModuleRemoteProcedureCall.java
index 74b6e30..302b0bd 100644
--- a/encon/src/main/java/io/appulse/encon/ModuleRemoteProcedureCall.java
+++ b/encon/src/main/java/io/appulse/encon/ModuleRemoteProcedureCall.java
@@ -373,7 +373,7 @@ public ErlangTerm getSync () {
*
* @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
+ * performed. It also could return {@code null} if the specified
* waiting time elapses before an element is available
*/
public ErlangTerm getSync (long timeout, TimeUnit unit) {
diff --git a/encon/src/main/java/io/appulse/encon/NodesConfig.java b/encon/src/main/java/io/appulse/encon/NodesConfig.java
index 3b7d202..83f3db7 100644
--- a/encon/src/main/java/io/appulse/encon/NodesConfig.java
+++ b/encon/src/main/java/io/appulse/encon/NodesConfig.java
@@ -281,4 +281,7 @@ public CompressionConfig (@NonNull CompressionConfig other) {
}
}
}
+
+ public static class NodeConfigBuilder {
+ }
}
diff --git a/encon/src/main/java/io/appulse/encon/connection/handshake/message/Message.java b/encon/src/main/java/io/appulse/encon/connection/handshake/message/Message.java
index fd6c9b1..018eff4 100644
--- a/encon/src/main/java/io/appulse/encon/connection/handshake/message/Message.java
+++ b/encon/src/main/java/io/appulse/encon/connection/handshake/message/Message.java
@@ -18,6 +18,8 @@
import static lombok.AccessLevel.PRIVATE;
+import java.lang.reflect.Constructor;
+
import io.netty.buffer.ByteBuf;
import lombok.Getter;
import lombok.NonNull;
@@ -38,7 +40,8 @@ public static T parse (@NonNull ByteBuf buffer, @NonNull Cla
if (!MessageType.check(buffer.readByte(), type)) {
throw new IllegalArgumentException();
}
- T result = type.newInstance();
+ Constructor constructor = type.getConstructor();
+ T result = constructor.newInstance();
result.read(buffer);
return result;
}
diff --git a/encon/src/test/java/io/appulse/encon/GeneratorPidTest.java b/encon/src/test/java/io/appulse/encon/GeneratorPidTest.java
index c4fa9bd..040dd67 100644
--- a/encon/src/test/java/io/appulse/encon/GeneratorPidTest.java
+++ b/encon/src/test/java/io/appulse/encon/GeneratorPidTest.java
@@ -19,26 +19,31 @@
import static org.assertj.core.api.Assertions.assertThat;
import io.appulse.encon.common.NodeDescriptor;
-import io.appulse.utils.test.TestMethodNamePrinter;
+
import lombok.val;
import org.assertj.core.api.SoftAssertions;
-import org.junit.Rule;
-import org.junit.rules.TestRule;
-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 1.0.0
*/
-public class GeneratorPidTest {
+@DisplayName("Pid generator tests")
+class GeneratorPidTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void generate () {
+ @DisplayName("generate")
+ void generate () {
val descriptor = NodeDescriptor.from("popa");
val creation = 1;
diff --git a/encon/src/test/java/io/appulse/encon/GeneratorPortTest.java b/encon/src/test/java/io/appulse/encon/GeneratorPortTest.java
index 65617fe..3c01f81 100644
--- a/encon/src/test/java/io/appulse/encon/GeneratorPortTest.java
+++ b/encon/src/test/java/io/appulse/encon/GeneratorPortTest.java
@@ -19,26 +19,31 @@
import static org.assertj.core.api.Assertions.assertThat;
import io.appulse.encon.common.NodeDescriptor;
-import io.appulse.utils.test.TestMethodNamePrinter;
+
import lombok.val;
import org.assertj.core.api.SoftAssertions;
-import org.junit.Rule;
-import org.junit.rules.TestRule;
-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 1.0.0
*/
-public class GeneratorPortTest {
+@DisplayName("Port generator tests")
+class GeneratorPortTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void generate () {
+ @DisplayName("generate")
+ void generate () {
val descriptor = NodeDescriptor.from("popa");
val creation = 1;
diff --git a/encon/src/test/java/io/appulse/encon/GeneratorReferenceTest.java b/encon/src/test/java/io/appulse/encon/GeneratorReferenceTest.java
index bedb085..ae43d90 100644
--- a/encon/src/test/java/io/appulse/encon/GeneratorReferenceTest.java
+++ b/encon/src/test/java/io/appulse/encon/GeneratorReferenceTest.java
@@ -19,26 +19,30 @@
import static org.assertj.core.api.Assertions.assertThat;
import io.appulse.encon.common.NodeDescriptor;
-import io.appulse.utils.test.TestMethodNamePrinter;
import lombok.val;
import org.assertj.core.api.SoftAssertions;
-import org.junit.Rule;
-import org.junit.rules.TestRule;
-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 1.0.0
*/
-public class GeneratorReferenceTest {
+@DisplayName("Reference generator tests")
+class GeneratorReferenceTest {
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void generateReference () {
+ @DisplayName("generate")
+ void generateReference () {
val descriptor = NodeDescriptor.from("popa");
val creation = 1;
diff --git a/encon/src/test/java/io/appulse/encon/NodeTest.java b/encon/src/test/java/io/appulse/encon/NodeTest.java
index 2c31a9c..ed866c1 100644
--- a/encon/src/test/java/io/appulse/encon/NodeTest.java
+++ b/encon/src/test/java/io/appulse/encon/NodeTest.java
@@ -31,8 +31,8 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadLocalRandom;
-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;
@@ -40,23 +40,21 @@
import io.appulse.encon.mailbox.exception.ReceivedExitException;
import io.appulse.encon.terms.ErlangTerm;
import io.appulse.encon.terms.type.ErlangAtom;
-import io.appulse.utils.test.TestMethodNamePrinter;
import io.appulse.epmd.java.server.cli.CommonOptions;
import io.appulse.epmd.java.server.command.server.ServerCommandExecutor;
import io.appulse.epmd.java.server.command.server.ServerCommandOptions;
import io.appulse.utils.SocketUtils;
-import java.util.concurrent.ThreadLocalRandom;
-
import lombok.val;
import lombok.extern.slf4j.Slf4j;
import org.assertj.core.api.SoftAssertions;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+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;
/**
*
@@ -64,7 +62,8 @@
* @since 1.0.0
*/
@Slf4j
-public class NodeTest {
+@DisplayName("Node tests")
+class NodeTest {
private static final String ELIXIR_ECHO_SERVER = "echo@localhost";
@@ -72,14 +71,10 @@ public class NodeTest {
private static ServerCommandExecutor epmdServer;
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
-
-
Node node;
- @BeforeClass
- public static void beforeClass () {
+ @BeforeAll
+ static void beforeAll () {
if (SocketUtils.isPortAvailable(4369)) {
executor = Executors.newSingleThreadExecutor();
epmdServer = new ServerCommandExecutor(new CommonOptions(), new ServerCommandOptions());
@@ -87,8 +82,8 @@ public static void beforeClass () {
}
}
- @AfterClass
- public static void afterClass () {
+ @AfterAll
+ static void afterAll () {
ofNullable(epmdServer)
.ifPresent(ServerCommandExecutor::close);
@@ -96,8 +91,13 @@ public static void afterClass () {
.ifPresent(ExecutorService::shutdown);
}
- @After
- public void after () throws Exception {
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
+
+ @AfterEach
+ void afterEach () throws Exception {
if (node != null) {
node.close();
node = null;
@@ -106,7 +106,8 @@ public void after () throws Exception {
}
@Test
- public void register () {
+ @DisplayName("node registration")
+ void register () {
val name = createName();
node = Nodes.singleNode(name, true);
@@ -135,7 +136,8 @@ public void register () {
}
@Test
- public void ping () throws Exception {
+ @DisplayName("sending ping message")
+ void ping () throws Exception {
val name1 = createName();
val name2 = createName();
node = Nodes.singleNode(name1, NodeConfig.builder()
@@ -173,7 +175,8 @@ public void ping () throws Exception {
}
@Test
- public void instantiating () throws Exception {
+ @DisplayName("simple instantiating")
+ void instantiating () throws Exception {
val name = createName();
node = Nodes.singleNode(name, NodeConfig.builder()
.shortName(true)
@@ -183,7 +186,8 @@ public void instantiating () throws Exception {
}
@Test
- public void sendFromOneToAnotherNode () throws Exception {
+ @DisplayName("send message from one node to another")
+ void sendFromOneToAnotherNode () throws Exception {
val name1 = createName();
val name2 = createName();
@@ -215,7 +219,8 @@ public void sendFromOneToAnotherNode () throws Exception {
}
@Test
- public void sendWithRedirect () throws Exception {
+ @DisplayName("send message from A node, through Elixir echo, to B node")
+ void sendWithRedirect () throws Exception {
val config = NodeConfig.builder()
.shortName(true)
.cookie("secret")
@@ -274,7 +279,8 @@ public void sendWithRedirect () throws Exception {
}
@Test
- public void send () throws Exception {
+ @DisplayName("send message to Elixir echo server and catch back")
+ void send () throws Exception {
val name = createName();
node = Nodes.singleNode(name, NodeConfig.builder()
.shortName(true)
@@ -316,7 +322,8 @@ public void send () throws Exception {
}
@Test
- public void link () throws Exception {
+ @DisplayName("link two nodes")
+ void link () throws Exception {
val name = createName();
node = Nodes.singleNode(name, true);
@@ -344,7 +351,8 @@ public void link () throws Exception {
}
@Test
- public void exit () throws Exception {
+ @DisplayName("send exit message from node A to node B")
+ void exit () throws Exception {
val name = createName();
node = Nodes.singleNode(name, true);
@@ -371,7 +379,8 @@ public void exit () throws Exception {
}
@Test
- public void remoteProcedureCall () throws Exception {
+ @DisplayName("send RPC message to Elixir echo server")
+ void remoteProcedureCall () throws Exception {
val name = createName();
node = Nodes.singleNode(name, NodeConfig.builder()
.shortName(true)
diff --git a/encon/src/test/java/io/appulse/encon/NodesTest.java b/encon/src/test/java/io/appulse/encon/NodesTest.java
index 24c035c..1a4e8ba 100644
--- a/encon/src/test/java/io/appulse/encon/NodesTest.java
+++ b/encon/src/test/java/io/appulse/encon/NodesTest.java
@@ -27,33 +27,29 @@
import io.appulse.epmd.java.server.command.server.ServerCommandExecutor;
import io.appulse.epmd.java.server.command.server.ServerCommandOptions;
import io.appulse.utils.SocketUtils;
-import io.appulse.utils.test.TestMethodNamePrinter;
import io.appulse.encon.NodesConfig.NodeConfig;
-import lombok.val;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
+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 1.0.0
*/
-public class NodesTest {
+@DisplayName("Nodes cluster tests")
+class NodesTest {
private static ExecutorService executor;
private static ServerCommandExecutor epmdServer;
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
-
- @BeforeClass
- public static void beforeClass () {
+ @BeforeAll
+ static void beforeClass () {
if (SocketUtils.isPortAvailable(4369)) {
executor = Executors.newSingleThreadExecutor();
epmdServer = new ServerCommandExecutor(new CommonOptions(), new ServerCommandOptions());
@@ -61,8 +57,8 @@ public static void beforeClass () {
}
}
- @AfterClass
- public static void afterClass () {
+ @AfterAll
+ static void afterClass () {
ofNullable(epmdServer)
.ifPresent(ServerCommandExecutor::close);
@@ -70,8 +66,14 @@ public static void afterClass () {
.ifPresent(ExecutorService::shutdown);
}
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
+
@Test
- public void instantiating () {
+ @DisplayName("start several nodes from programmatically config")
+ void instantiating () {
Config config = Config.builder()
.config(NodesConfig.builder()
.node("kojima1", NodeConfig.DEFAULT)
diff --git a/encon/src/test/java/io/appulse/encon/connection/ConnectionModuleTest.java b/encon/src/test/java/io/appulse/encon/connection/ConnectionModuleTest.java
index aaae7c9..0cf1389 100644
--- a/encon/src/test/java/io/appulse/encon/connection/ConnectionModuleTest.java
+++ b/encon/src/test/java/io/appulse/encon/connection/ConnectionModuleTest.java
@@ -20,17 +20,27 @@
import java.util.concurrent.CompletableFuture;
-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 1.0.0
*/
-public class ConnectionModuleTest {
+@DisplayName("Connection module tests")
+class ConnectionModuleTest {
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
@Test
- public void futureTests () {
+ @DisplayName("future POC")
+ void futureTests () {
CompletableFuture future = CompletableFuture.completedFuture("Hello world");
assertThat(future)
.isCompleted()
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/custom-queue/src/test/java/io/appulse/encon/examples/custom/queue/MainTest.java b/examples/custom-queue/src/test/java/io/appulse/encon/examples/custom/queue/MainTest.java
index e129bc8..04175d3 100644
--- a/examples/custom-queue/src/test/java/io/appulse/encon/examples/custom/queue/MainTest.java
+++ b/examples/custom-queue/src/test/java/io/appulse/encon/examples/custom/queue/MainTest.java
@@ -29,17 +29,17 @@
import io.appulse.encon.mailbox.Mailbox;
import io.appulse.encon.terms.ErlangTerm;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
*
* @since 1.6.2
* @author Artem Labazin
*/
-public class MainTest {
+class MainTest {
@Test
- public void test () throws Exception {
+ void test () throws Exception {
ExecutorService executorService = Executors.newSingleThreadExecutor();
executorService.execute(() -> Main.main(null));
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/databind/src/test/java/io/appulse/encon/examples/databind/MainTest.java b/examples/databind/src/test/java/io/appulse/encon/examples/databind/MainTest.java
index 59e1cec..6c6b0b3 100644
--- a/examples/databind/src/test/java/io/appulse/encon/examples/databind/MainTest.java
+++ b/examples/databind/src/test/java/io/appulse/encon/examples/databind/MainTest.java
@@ -30,17 +30,17 @@
import io.appulse.encon.mailbox.Mailbox;
import io.appulse.encon.terms.ErlangTerm;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
*
* @since 1.6.2
* @author Artem Labazin
*/
-public class MainTest {
+class MainTest {
@Test
- public void test () throws Exception {
+ void test () throws Exception {
ExecutorService executorService = Executors.newSingleThreadExecutor();
executorService.execute(() -> Main.main(null));
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-spring/src/main/java/io/appulse/encon/examples/echo/server/spring/MyPojo1.java b/examples/echo-server-spring/src/main/java/io/appulse/encon/examples/echo/server/spring/MyPojo1.java
index ab43073..f0a7457 100644
--- a/examples/echo-server-spring/src/main/java/io/appulse/encon/examples/echo/server/spring/MyPojo1.java
+++ b/examples/echo-server-spring/src/main/java/io/appulse/encon/examples/echo/server/spring/MyPojo1.java
@@ -32,7 +32,7 @@
/**
*
* @since 1.6.0
- * @author alabazin
+ * @author Artem Labazin
*/
@Data
@Builder
diff --git a/examples/echo-server-spring/src/test/java/io/appulse/encon/examples/echo/server/spring/MainTest.java b/examples/echo-server-spring/src/test/java/io/appulse/encon/examples/echo/server/spring/MainTest.java
index 56ced74..8067d50 100644
--- a/examples/echo-server-spring/src/test/java/io/appulse/encon/examples/echo/server/spring/MainTest.java
+++ b/examples/echo-server-spring/src/test/java/io/appulse/encon/examples/echo/server/spring/MainTest.java
@@ -35,19 +35,19 @@
import io.appulse.epmd.java.server.command.server.ServerCommandExecutor;
import io.appulse.epmd.java.server.command.server.ServerCommandOptions;
import io.appulse.utils.SocketUtils;
-import io.appulse.utils.test.TestMethodNamePrinter;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.runner.RunWith;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+import org.springframework.test.context.junit4.SpringRunner;
/**
*
@@ -60,24 +60,15 @@
EchoClient.class,
EnconProperties.class
})
-@RunWith(SpringRunner.class)
-public class MainTest {
+@ExtendWith(SpringExtension.class)
+class MainTest {
private static ExecutorService executor;
private static ServerCommandExecutor epmdServer;
- @Rule
- public TestRule watcher = new TestMethodNamePrinter();
-
- @Autowired
- EchoClient client;
-
- @Autowired
- EchoServer server;
-
- @BeforeClass
- public static void beforeClass () {
+ @BeforeAll
+ static void beforeAll () {
if (SocketUtils.isPortAvailable(4369)) {
executor = Executors.newSingleThreadExecutor();
epmdServer = new ServerCommandExecutor(new CommonOptions(), new ServerCommandOptions());
@@ -85,8 +76,8 @@ public static void beforeClass () {
}
}
- @AfterClass
- public static void afterClass () {
+ @AfterAll
+ static void afterAll () {
ofNullable(epmdServer)
.ifPresent(ServerCommandExecutor::close);
@@ -94,8 +85,19 @@ public static void afterClass () {
.ifPresent(ExecutorService::shutdown);
}
+ @Autowired
+ EchoClient client;
+
+ @Autowired
+ EchoServer server;
+
+ @BeforeEach
+ void beforeEach (TestInfo testInfo) {
+ System.out.println("- " + testInfo.getDisplayName());
+ }
+
@Test
- public void term () {
+ void term () {
ErlangTerm request = tuple(
client.pid(),
tuple(
@@ -115,7 +117,7 @@ public void term () {
}
@Test
- public void pojo () {
+ void pojo () {
MyPojo2 request = new MyPojo2(
client.pid(),
"Artem",
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/echo-server/src/main/java/io/appulse/encon/examples/echo/server/EchoClientNode.java b/examples/echo-server/src/main/java/io/appulse/encon/examples/echo/server/EchoClientNode.java
index 705d71a..d6ea068 100644
--- a/examples/echo-server/src/main/java/io/appulse/encon/examples/echo/server/EchoClientNode.java
+++ b/examples/echo-server/src/main/java/io/appulse/encon/examples/echo/server/EchoClientNode.java
@@ -35,13 +35,13 @@
* @author Artem Labazin
*/
@FieldDefaults(level = PRIVATE, makeFinal = true)
-class EchoClientNode implements Closeable {
+public class EchoClientNode implements Closeable {
Node node;
Mailbox mailbox;
- EchoClientNode (String cookie) {
+ public EchoClientNode (String cookie) {
NodeConfig config = NodeConfig.builder()
.shortName(TRUE)
.cookie(cookie)
diff --git a/examples/echo-server/src/main/java/io/appulse/encon/examples/echo/server/EchoServerNode.java b/examples/echo-server/src/main/java/io/appulse/encon/examples/echo/server/EchoServerNode.java
index 04171ad..185fd4a 100644
--- a/examples/echo-server/src/main/java/io/appulse/encon/examples/echo/server/EchoServerNode.java
+++ b/examples/echo-server/src/main/java/io/appulse/encon/examples/echo/server/EchoServerNode.java
@@ -40,13 +40,13 @@
*/
@Slf4j
@FieldDefaults(level = PRIVATE, makeFinal = true)
-class EchoServerNode implements Runnable, Closeable {
+public class EchoServerNode implements Runnable, Closeable {
Node node;
Mailbox mailbox;
- EchoServerNode (String nodeName, String cookie, String mailboxName) {
+ public EchoServerNode (String nodeName, String cookie, String mailboxName) {
NodeConfig config = NodeConfig.builder()
.shortName(TRUE)
.cookie(cookie)
diff --git a/examples/echo-server/src/test/java/io/appulse/encon/examples/echo/server/MainTest.java b/examples/echo-server/src/test/java/io/appulse/encon/examples/echo/server/MainTest.java
index e5e83dc..03e9bd7 100644
--- a/examples/echo-server/src/test/java/io/appulse/encon/examples/echo/server/MainTest.java
+++ b/examples/echo-server/src/test/java/io/appulse/encon/examples/echo/server/MainTest.java
@@ -20,9 +20,9 @@
import static io.appulse.encon.terms.Erlang.number;
import static io.appulse.encon.terms.Erlang.string;
import static io.appulse.encon.terms.Erlang.tuple;
-import static org.junit.Assert.assertEquals;
import static java.util.Arrays.asList;
import static java.util.Collections.singleton;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -39,16 +39,16 @@
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
*
* @since 1.6.0
* @author Artem Labazin
*/
-public class MainTest {
+class MainTest {
final String SERVER_NODE_NAME = "echo-server";
final String SERVER_MAILBOX_NAME = "echo";
@@ -59,8 +59,8 @@ public class MainTest {
EchoServerNode server;
EchoClientNode client;
- @Before
- public void before () {
+ @BeforeEach
+ void beforeEach () {
server = new EchoServerNode(SERVER_NODE_NAME, COOKIE, SERVER_MAILBOX_NAME);
client = new EchoClientNode(COOKIE);
@@ -68,15 +68,15 @@ public void before () {
executor.execute(server);
}
- @After
- public void after () {
+ @AfterEach
+ void afterEach () {
client.close();
server.close();
executor.shutdown();
}
@Test
- public void term () {
+ void term () {
ErlangTerm request = tuple(
atom("ok"),
number(42),
@@ -91,7 +91,7 @@ public void term () {
}
@Test
- public void pojo () {
+ void pojo () {
MyPojo request = new MyPojo(
"Artem",
27,
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-advanced/src/test/java/io/appulse/encon/examples/handler/advanced/MainTest.java b/examples/handler-advanced/src/test/java/io/appulse/encon/examples/handler/advanced/MainTest.java
index 0776ce6..5c2f073 100644
--- a/examples/handler-advanced/src/test/java/io/appulse/encon/examples/handler/advanced/MainTest.java
+++ b/examples/handler-advanced/src/test/java/io/appulse/encon/examples/handler/advanced/MainTest.java
@@ -28,17 +28,17 @@
import io.appulse.encon.Nodes;
import io.appulse.encon.mailbox.Mailbox;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
*
* @since 1.6.2
* @author Artem Labazin
*/
-public class MainTest {
+class MainTest {
@Test
- public void test () throws Exception {
+ void test () throws Exception {
Server server = new Server();
server.start();
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/handler-basic/src/test/java/io/appulse/encon/examples/handler/basic/MainTest.java b/examples/handler-basic/src/test/java/io/appulse/encon/examples/handler/basic/MainTest.java
index 7d2348e..d84c8fe 100644
--- a/examples/handler-basic/src/test/java/io/appulse/encon/examples/handler/basic/MainTest.java
+++ b/examples/handler-basic/src/test/java/io/appulse/encon/examples/handler/basic/MainTest.java
@@ -26,17 +26,17 @@
import io.appulse.encon.mailbox.Mailbox;
import io.appulse.encon.terms.ErlangTerm;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
*
* @since 1.6.2
* @author Artem Labazin
*/
-public class MainTest {
+class MainTest {
@Test
- public void test () throws Exception {
+ void test () throws Exception {
Server server = new Server();
server.start();
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-spring/src/test/java/io/appulse/encon/examples/load/config/spring/MainTest.java b/examples/load-config-spring/src/test/java/io/appulse/encon/examples/load/config/spring/MainTest.java
index fcb04a5..4522701 100644
--- a/examples/load-config-spring/src/test/java/io/appulse/encon/examples/load/config/spring/MainTest.java
+++ b/examples/load-config-spring/src/test/java/io/appulse/encon/examples/load/config/spring/MainTest.java
@@ -16,7 +16,6 @@
package io.appulse.encon.examples.load.config.spring;
-
import static io.appulse.encon.common.DistributionFlag.BIG_CREATION;
import static io.appulse.encon.common.DistributionFlag.BIT_BINARIES;
import static io.appulse.encon.common.DistributionFlag.EXTENDED_PIDS_PORTS;
@@ -38,12 +37,12 @@
import io.appulse.encon.config.Config;
import lombok.extern.slf4j.Slf4j;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
-import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
/**
*
@@ -51,9 +50,9 @@
* @author Artem Labazin
*/
@Slf4j
-@RunWith(SpringRunner.class)
+@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = Main.class)
-public class MainTest {
+class MainTest {
@Autowired
Config defaultConfig;
@@ -62,7 +61,7 @@ public class MainTest {
ApplicationContext context;
@Test
- public void test () {
+ void test () {
try {
assertThat(context.containsBean("node-1")).isTrue();
assertThat(context.containsBean("node-2")).isTrue();
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/load-config/src/test/java/io/appulse/encon/examples/load/config/MainTest.java b/examples/load-config/src/test/java/io/appulse/encon/examples/load/config/MainTest.java
index e8e6aec..7e860d9 100644
--- a/examples/load-config/src/test/java/io/appulse/encon/examples/load/config/MainTest.java
+++ b/examples/load-config/src/test/java/io/appulse/encon/examples/load/config/MainTest.java
@@ -36,7 +36,7 @@
import io.appulse.encon.Node;
import lombok.extern.slf4j.Slf4j;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
*
@@ -44,10 +44,10 @@
* @author Artem Labazin
*/
@Slf4j
-public class MainTest {
+class MainTest {
@Test
- public void test () {
+ void test () {
Server server = new Server();
server.start();
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/examples/simple/src/test/java/io/appulse/encon/examples/simple/MainTest.java b/examples/simple/src/test/java/io/appulse/encon/examples/simple/MainTest.java
index 5c7e2e6..c4663a6 100644
--- a/examples/simple/src/test/java/io/appulse/encon/examples/simple/MainTest.java
+++ b/examples/simple/src/test/java/io/appulse/encon/examples/simple/MainTest.java
@@ -29,17 +29,17 @@
import io.appulse.encon.mailbox.Mailbox;
import io.appulse.encon.terms.ErlangTerm;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
*
* @since 1.6.2
* @author Artem Labazin
*/
-public class MainTest {
+class MainTest {
@Test
- public void test () throws Exception {
+ void test () throws Exception {
ExecutorService executorService = Executors.newSingleThreadExecutor();
executorService.execute(() -> Main.main(null));
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%
diff --git a/pom.xml b/pom.xml
index 5ae8738..b68ad06 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
@@ -149,6 +196,12 @@ limitations under the License.
server1.0.2
+
+
+ org.yaml
+ snakeyaml
+ 1.23
+ org.erlang.otp
@@ -156,31 +209,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 +251,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 +258,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 +269,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 +295,8 @@ limitations under the License.
- package
+ pmd-validation
+ verifycheck
@@ -285,13 +312,13 @@ limitations under the License.
com.puppycrawl.toolscheckstyle
- 8.12
+ 8.15
- validate
- package
+ checkstyle-validation
+ verifycheck
@@ -310,7 +337,7 @@ limitations under the License.
org.apache.maven.pluginsmaven-javadoc-plugin
- 2.10.4
+ 3.0.1-Xdoclint:none-Xdoclint:none
@@ -320,7 +347,7 @@ limitations under the License.
UTF-8trueprotected
- 1.8
+ ${java.version}true
@@ -386,17 +413,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 +482,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 49184323defbfbb9fc6bee5cf16eda189732fb18 Mon Sep 17 00:00:00 2001
From: Artem Labazin
Date: Fri, 8 Feb 2019 16:46:26 +0300
Subject: [PATCH 07/17] Update dependencies
---
encon-handler/pom.xml | 2 +-
encon-spring/pom.xml | 2 +-
examples/echo-server-spring/pom.xml | 4 +--
examples/load-config-spring/pom.xml | 6 ++--
pom.xml | 45 +++++++++++++++++++++--------
5 files changed, 40 insertions(+), 19 deletions(-)
diff --git a/encon-handler/pom.xml b/encon-handler/pom.xml
index 2c837d5..53e5fac 100644
--- a/encon-handler/pom.xml
+++ b/encon-handler/pom.xml
@@ -46,7 +46,7 @@ limitations under the License.
cglibcglib
- 3.2.9
+ 3.2.10
diff --git a/encon-spring/pom.xml b/encon-spring/pom.xml
index 1ec3654..19a9093 100644
--- a/encon-spring/pom.xml
+++ b/encon-spring/pom.xml
@@ -51,7 +51,7 @@ limitations under the License.
org.springframework.bootspring-boot-starter
- 2.1.1.RELEASE
+ 2.1.2.RELEASE
diff --git a/examples/echo-server-spring/pom.xml b/examples/echo-server-spring/pom.xml
index d33b3a9..fbd60da 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.1.1.RELEASE
+ 2.1.2.RELEASEpomimport
@@ -73,7 +73,7 @@ limitations under the License.
org.springframework.bootspring-boot-maven-plugin
- 2.1.1.RELEASE
+ 2.1.2.RELEASE
diff --git a/examples/load-config-spring/pom.xml b/examples/load-config-spring/pom.xml
index 6b8bf3e..1fb4874 100644
--- a/examples/load-config-spring/pom.xml
+++ b/examples/load-config-spring/pom.xml
@@ -33,11 +33,11 @@ limitations under the License.
org.springframework.bootspring-boot-dependencies
- 2.1.1.RELEASE
+ 2.1.2.RELEASEpomimport
-
+
io.appulse.encon.examples
@@ -77,7 +77,7 @@ limitations under the License.
org.springframework.bootspring-boot-maven-plugin
- 2.1.1.RELEASE
+ 2.1.2.RELEASE
diff --git a/pom.xml b/pom.xml
index b68ad06..da233dd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -125,7 +125,7 @@ limitations under the License.
com.github.spotbugsspotbugs-annotations
- 3.1.9
+ 3.1.11provided
@@ -138,13 +138,13 @@ limitations under the License.
org.junit.jupiterjunit-jupiter-engine
- 5.3.2
+ 5.4.0testorg.junit.jupiterjunit-jupiter-params
- 5.3.2
+ 5.4.0test
@@ -158,13 +158,13 @@ limitations under the License.
org.mockitomockito-core
- 2.23.4
+ 2.24.0testorg.mockitomockito-junit-jupiter
- 2.23.4
+ 2.24.0test
@@ -196,7 +196,7 @@ limitations under the License.
server1.0.2
-
+
org.yamlsnakeyaml
@@ -212,17 +212,17 @@ limitations under the License.
io.nettynetty-buffer
- 4.1.32.Final
+ 4.1.33.Finalio.nettynetty-handler
- 4.1.32.Final
+ 4.1.33.Finalio.nettynetty-transport-native-epoll
- 4.1.32.Final
+ 4.1.33.Finallinux-x86_64
@@ -260,7 +260,7 @@ limitations under the License.
com.github.spotbugsspotbugs-maven-plugin
- 3.1.8
+ 3.1.11MaxLow
@@ -312,7 +312,7 @@ limitations under the License.
com.puppycrawl.toolscheckstyle
- 8.15
+ 8.17
@@ -413,6 +413,27 @@ limitations under the License.
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ 1.4.1
+
+
+ enforce-maven
+
+ enforce
+
+
+
+
+ 3.0.5
+
+
+
+
+
+
+
org.apache.maven.pluginsmaven-compiler-plugin
@@ -428,7 +449,7 @@ limitations under the License.
pl.project13.mavengit-commit-id-plugin
- 2.2.5
+ 2.2.6git-infos
From b1b87d29a88a6391bd22f8eec6d4572c6d421ec3 Mon Sep 17 00:00:00 2001
From: Artem Labazin
Date: Sat, 9 Feb 2019 17:52:06 +0300
Subject: [PATCH 08/17] Fix type misunderstanding
---
.../io/appulse/encon/databind/parser/FieldParser.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/encon-databind/src/main/java/io/appulse/encon/databind/parser/FieldParser.java b/encon-databind/src/main/java/io/appulse/encon/databind/parser/FieldParser.java
index 1c83e85..e76943d 100644
--- a/encon-databind/src/main/java/io/appulse/encon/databind/parser/FieldParser.java
+++ b/encon-databind/src/main/java/io/appulse/encon/databind/parser/FieldParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 the original author or authors.
+ * Copyright 2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
import io.appulse.encon.databind.annotation.AsErlangList;
@@ -116,7 +117,7 @@ public static FieldDescriptor parse (@NonNull Field field) {
}
private static Serializer> parseSerializer (Field field) {
- val optional = AnnotationUtils.findAnnotation(field, TermSerialize.class)
+ Optional> optional = AnnotationUtils.findAnnotation(field, TermSerialize.class)
.map(TermSerialize::value)
.map(it -> SERIALIZERS.computeIfAbsent(it, NEW_SERIALIZER));
@@ -125,7 +126,7 @@ private static Serializer> parseSerializer (Field field) {
}
Class> type = field.getType();
- Serializer result = Serializer.findInPredefined(type);
+ Serializer> result = Serializer.findInPredefined(type);
if (result != null) {
return result;
}
@@ -143,7 +144,7 @@ private static Serializer> parseSerializer (Field field) {
}
private static Deserializer> parseDeserializer (Field field) {
- val optional = AnnotationUtils.findAnnotation(field, TermDeserialize.class)
+ Optional> optional = AnnotationUtils.findAnnotation(field, TermDeserialize.class)
.map(TermDeserialize::value)
.map(it -> DESERIALIZERS.computeIfAbsent(it, NEW_DESERIALIZER));
From d5f01b50b6a5506418cc19dbb1556cb100b3f512 Mon Sep 17 00:00:00 2001
From: Artem Labazin
Date: Sat, 9 Feb 2019 17:52:45 +0300
Subject: [PATCH 09/17] Update main POM
---
pom.xml | 71 ++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 58 insertions(+), 13 deletions(-)
diff --git a/pom.xml b/pom.xml
index da233dd..2bbae0c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,7 +1,7 @@