You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/04/21 07:43:39 UTC

[groovy] branch GROOVY_3_0_X updated (29e6d03 -> bf09d58)

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a change to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git.


    from 29e6d03  GROOVY-10044: Bump versions plugin to 0.38.0
     new e25b09e  Set `java.rmi.server.hostname` to make `JmxClientConnectorFactoryTest` robust
     new bf09d58  Cleanup code to trigger CI builds of GitHub Actions

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../builder/JmxClientConnectorFactoryTest.groovy   | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

[groovy] 02/02: Cleanup code to trigger CI builds of GitHub Actions

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit bf09d58f9c9e12cfe486ec34211d8283ac5508e6
Author: Daniel Sun <su...@apache.org>
AuthorDate: Wed Apr 21 15:20:18 2021 +0800

    Cleanup code to trigger CI builds of GitHub Actions
    
    (cherry picked from commit e8ee293cdf6b015adc44500bc71e59485e0dde27)
---
 .../groovy/jmx/builder/JmxClientConnectorFactoryTest.groovy       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/subprojects/groovy-jmx/src/test/groovy/groovy/jmx/builder/JmxClientConnectorFactoryTest.groovy b/subprojects/groovy-jmx/src/test/groovy/groovy/jmx/builder/JmxClientConnectorFactoryTest.groovy
index c029884..68b3f9d 100644
--- a/subprojects/groovy-jmx/src/test/groovy/groovy/jmx/builder/JmxClientConnectorFactoryTest.groovy
+++ b/subprojects/groovy-jmx/src/test/groovy/groovy/jmx/builder/JmxClientConnectorFactoryTest.groovy
@@ -77,12 +77,12 @@ class JmxClientConnectorFactoryTest extends GroovyTestCase {
 
     static String getHostAddress() {
         try {
-            Enumeration<NetworkInterface> allNetInterfaces = NetworkInterface.getNetworkInterfaces();
+            Enumeration<NetworkInterface> allNetInterfaces = NetworkInterface.getNetworkInterfaces()
             while (allNetInterfaces.hasMoreElements()) {
-                NetworkInterface netInterface = (NetworkInterface) allNetInterfaces.nextElement();
-                Enumeration<InetAddress> addresses = netInterface.getInetAddresses();
+                NetworkInterface netInterface = (NetworkInterface) allNetInterfaces.nextElement()
+                Enumeration<InetAddress> addresses = netInterface.getInetAddresses()
                 while (addresses.hasMoreElements()) {
-                    InetAddress ip = (InetAddress) addresses.nextElement();
+                    InetAddress ip = (InetAddress) addresses.nextElement()
                     if (ip != null
                             && ip instanceof Inet4Address
                             && !ip.isLoopbackAddress()

[groovy] 01/02: Set `java.rmi.server.hostname` to make `JmxClientConnectorFactoryTest` robust

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit e25b09e8fe69e34527d431fc8cf49eca37fb8cfd
Author: Daniel Sun <su...@apache.org>
AuthorDate: Wed Apr 21 13:57:40 2021 +0800

    Set `java.rmi.server.hostname` to make `JmxClientConnectorFactoryTest` robust
    
    (cherry picked from commit 756870e44e878c016f8ecd083951f43c1193a410)
---
 .../builder/JmxClientConnectorFactoryTest.groovy   | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/subprojects/groovy-jmx/src/test/groovy/groovy/jmx/builder/JmxClientConnectorFactoryTest.groovy b/subprojects/groovy-jmx/src/test/groovy/groovy/jmx/builder/JmxClientConnectorFactoryTest.groovy
index 1fae057..c029884 100644
--- a/subprojects/groovy-jmx/src/test/groovy/groovy/jmx/builder/JmxClientConnectorFactoryTest.groovy
+++ b/subprojects/groovy-jmx/src/test/groovy/groovy/jmx/builder/JmxClientConnectorFactoryTest.groovy
@@ -30,6 +30,9 @@ class JmxClientConnectorFactoryTest extends GroovyTestCase {
 
     void setUp() {
         super.setUp()
+        def hostAddress = getHostAddress()
+        println "hostAddress: ${hostAddress}"
+        System.setProperty("java.rmi.server.hostname", hostAddress)
         builder = new JmxBuilder()
         rmi = JmxConnectorHelper.createRmiRegistry(defaultPort)
     }
@@ -71,4 +74,27 @@ class JmxClientConnectorFactoryTest extends GroovyTestCase {
             client.connect()
         }
     }
+
+    static String getHostAddress() {
+        try {
+            Enumeration<NetworkInterface> allNetInterfaces = NetworkInterface.getNetworkInterfaces();
+            while (allNetInterfaces.hasMoreElements()) {
+                NetworkInterface netInterface = (NetworkInterface) allNetInterfaces.nextElement();
+                Enumeration<InetAddress> addresses = netInterface.getInetAddresses();
+                while (addresses.hasMoreElements()) {
+                    InetAddress ip = (InetAddress) addresses.nextElement();
+                    if (ip != null
+                            && ip instanceof Inet4Address
+                            && !ip.isLoopbackAddress()
+                            && ip.getHostAddress().indexOf(":") == -1) {
+                        return ip.getHostAddress()
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace()
+        }
+        return null
+    }
+
 }
\ No newline at end of file