From 365663e36887e9b84074208d86b58efc97f831f7 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Thu, 20 Aug 2020 08:58:55 -0400 Subject: [PATCH] NO-JIRA javadoc on NetUtil --- .../activemq/artemis/utils/network/NetUtil.java | 16 ++++++++++++++++ .../artemis/utils/network/NetUtilResource.java | 3 +++ 2 files changed, 19 insertions(+) diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtil.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtil.java index 873137201a..3074058e52 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtil.java +++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtil.java @@ -37,6 +37,22 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Test; +/** + * This utility class will use sudo commands to start "fake" network cards on a given address. + * It's used on tests that need to emmulate network outages and split brains. + * + * If you write a new test using this class, please make special care on undoing the config, + * especially in case of failures. + * + * Usually the class {@link NetUtilResource} is pretty accurate on undoing this, but you also need to *test your test* well. + * + * You need special sudo authorizations on your system to let this class work: + * + * Add the following at the end of your /etc/sudoers (use the sudo visudo command)"); + * # ------------------------------------------------------- "); + * yourUserName ALL = NOPASSWD: /sbin/ifconfig"); + * # ------------------------------------------------------- "); + * */ public class NetUtil { public static boolean checkIP(String ip) throws Exception { diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtilResource.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtilResource.java index b58f3f6c31..bbdba7c9a9 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtilResource.java +++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtilResource.java @@ -19,6 +19,9 @@ package org.apache.activemq.artemis.utils.network; import org.junit.rules.ExternalResource; +/** + * Just a rule where you can use to automate cleanup on NetUtil. + * */ public class NetUtilResource extends ExternalResource { @Override