jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1811029 - in /jmeter/trunk: ./ bin/ src/components/org/apache/jmeter/control/ src/core/org/apache/jmeter/gui/action/ src/core/org/apache/jmeter/gui/tree/ src/protocol/http/org/apache/jmeter/protocol/http/proxy/ xdocs/
Date Tue, 03 Oct 2017 20:24:22 GMT
Author: pmouawad
Date: Tue Oct  3 20:24:21 2017
New Revision: 1811029

URL: http://svn.apache.org/viewvc?rev=1811029&view=rev
Log:
Bug 61529 - Migration to Java 9
This closes #308
Bugzilla Id: 61529

Modified:
    jmeter/trunk/bin/jmeter
    jmeter/trunk/build.xml
    jmeter/trunk/src/components/org/apache/jmeter/control/ModuleController.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/ApplyNamingConvention.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/bin/jmeter
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/jmeter?rev=1811029&r1=1811028&r2=1811029&view=diff
==============================================================================
--- jmeter/trunk/bin/jmeter (original)
+++ jmeter/trunk/bin/jmeter Tue Oct  3 20:24:21 2017
@@ -23,24 +23,43 @@
 ##   JVM_ARGS="-Xms512m -Xmx512m" jmeter etc.
 ##
 ##   ==============================================
-
-# Minimal version to run JMeter
-MINIMAL_VERSION=1.8.0
-
-# Check if Java is present and the minimal version requirement
-_java=`type java | awk '{ print $ NF }'`
-CURRENT_VERSION=`"$_java" -version 2>&1 | awk -F'"' '/version/ {print $2}'`
-minimal_version=`echo $MINIMAL_VERSION | awk -F'.' '{ print $2 }'`
-current_version=`echo $CURRENT_VERSION | awk -F'.' '{ print $2 }'`
-if [ $current_version ]; then
-        if [ $current_version -lt $minimal_version ]; then
-                 echo "Error: Java version is too low to run JMeter. Needs at least Java
>= ${MINIMAL_VERSION}." 
-                 exit 1
-        fi
-    else
-         echo "Not able to find Java executable or version. Please check your Java installation."
-         exit 1
+# Make sure prerequisite environment variables are set
+if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
+  if $darwin; then
+    # 
+    if [ -x '/usr/libexec/java_home' ] ; then
+      export JAVA_HOME=`/usr/libexec/java_home`
+    # 
+    elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then
+      export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"
+    fi
+  else
+    JAVA_PATH=`which java 2>/dev/null`
+    if [ "x$JAVA_PATH" != "x" ]; then
+      JAVA_PATH=`dirname $JAVA_PATH 2>/dev/null`
+      JRE_HOME=`dirname $JAVA_PATH 2>/dev/null`
+    fi
+    if [ "x$JRE_HOME" = "x" ]; then
+      # XXX: Should we try other locations?
+      if [ -x /usr/bin/java ]; then
+        JRE_HOME=/usr
+      fi
+    fi
+  fi
+  if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
+    echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
+    echo "At least one of these environment variable is needed to run this program"
+    exit 1
+  fi
+fi
+if [ -z "$JAVA_HOME" -a "$1" = "debug" ]; then
+  echo "JAVA_HOME should point to a JDK in order to run in debug mode."
+  exit 1
 fi
+if [ -z "$JRE_HOME" ]; then
+  JRE_HOME="$JAVA_HOME"
+fi
+
 
 JMETER_OPTS=""
 case `uname` in
@@ -100,4 +119,4 @@ SERVER="-server"
 
 ARGS="$SERVER $DUMP $HEAP $VERBOSE_GC $GC_ALGO $SYSTEM_PROPS"
 
-java $ARGS $JVM_ARGS $JMETER_OPTS -jar "$PRGDIR/ApacheJMeter.jar" "$@"
+$JAVA_HOME/bin/java $ARGS $JVM_ARGS $JMETER_OPTS -jar "$PRGDIR/ApacheJMeter.jar" "$@"

Modified: jmeter/trunk/build.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/build.xml?rev=1811029&r1=1811028&r2=1811029&view=diff
==============================================================================
--- jmeter/trunk/build.xml (original)
+++ jmeter/trunk/build.xml Tue Oct  3 20:24:21 2017
@@ -18,7 +18,8 @@
 <project name="JMeter" default="install" basedir="."
     xmlns:rat="antlib:org.apache.rat.anttasks"
     xmlns:jacoco="antlib:org.jacoco.ant"
-    xmlns="antlib:org.apache.tools.ant" >
+    xmlns="antlib:org.apache.tools.ant" 
+    xmlns:if="ant:if" >
   <description>
 
   N.B. To build JMeter from a release you need both the binary and source archives,
@@ -321,6 +322,9 @@
     <!-- docs.force uses the opposite sense to the anakia check -->
     <isfalse value="${docs.force}"/>
   </condition>
+  <condition property="java9">
+      <equals arg1="${ant.java.version}" arg2="9"/>
+  </condition>
 
   <!-- Directory where jars needed for creating documentation live -->
   <property name="lib.doc" value="lib/doc"/>
@@ -596,6 +600,7 @@
 
   <target name="ant-version" depends="_check_ant-version">
     <echo level="info">ant.version = ${ant.version}</echo>
+    <echo level="info">java.version = ${ant.java.version}</echo>
   </target>
 
   <target name="_check_ant-version">
@@ -897,6 +902,8 @@
       <classpath>
         <pathelement location="${dest.jar.jmeter}/ApacheJMeter.jar"/>
       </classpath>
+      <jvmarg value="--add-modules" if:set="java9" />
+      <jvmarg value="java.activation" if:set="java9" />
       <jvmarg value="${jacoco_params}run_gui:java(server)"/>
       <sysproperty key="jmeter.home" value="${basedir}"/>
     </java>
@@ -2449,6 +2456,8 @@ run JMeter unless all the JMeter jars ar
             <path refid="classpath"/>
             <path refid="logging.classpath"/>
           </classpath>
+          <jvmarg value="--add-modules" if:set="java9" />
+          <jvmarg value="java.activation" if:set="java9" />
           <jvmarg value="${jacoco_params}batchtest:daemon:java(server)"/>
           <sysproperty key="java.awt.headless" value="true"/>
           <!-- Bug 59723 -->
@@ -2560,6 +2569,8 @@ run JMeter unless all the JMeter jars ar
         <path refid="classpath"/>
         <path refid="logging.classpath"/>
       </classpath>
+      <jvmarg value="--add-modules" if:set="java9" />
+      <jvmarg value="java.activation" if:set="java9" />
       <jvmarg value="${jacoco_params}batchtest:java(${taskname})"/>
       <!-- Detect if non-GUI runs OK headless by forcing it to try using non-headless
mode -->
       <sysproperty key="user.language" value="en"/>
@@ -2868,6 +2879,8 @@ run JMeter unless all the JMeter jars ar
         <path refid="classpath"/>
         <path refid="logging.classpath"/>
       </classpath>
+      <jvmarg value="--add-modules" if:set="java9" />
+      <jvmarg value="java.activation" if:set="java9" />
       <jvmarg value="-server"/>
       <jvmarg value="${jacoco_params}_test:java"/>
       <jvmarg value="-Dfile.encoding=${test.encoding}"/>

Modified: jmeter/trunk/src/components/org/apache/jmeter/control/ModuleController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/control/ModuleController.java?rev=1811029&r1=1811028&r2=1811029&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/control/ModuleController.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/control/ModuleController.java Tue Oct  3
20:24:21 2017
@@ -197,9 +197,9 @@ public class ModuleController extends Ge
     }
 
     private void createSubTree(HashTree tree, JMeterTreeNode node) {
-        Enumeration<JMeterTreeNode> e = node.children();
+        Enumeration<?> e = node.children();
         while (e.hasMoreElements()) {
-            JMeterTreeNode subNode = e.nextElement();
+            JMeterTreeNode subNode = (JMeterTreeNode)e.nextElement();
             tree.add(subNode);
             createSubTree(tree.getTree(subNode), subNode);
         }
@@ -213,9 +213,9 @@ public class ModuleController extends Ge
     }
 
     private static void cloneChildren(JMeterTreeNode to, JMeterTreeNode from) {
-        Enumeration<JMeterTreeNode> enumr = from.children();
+        Enumeration<?> enumr = from.children();
         while (enumr.hasMoreElements()) {
-            JMeterTreeNode child = enumr.nextElement();
+            JMeterTreeNode child = (JMeterTreeNode) enumr.nextElement();
             JMeterTreeNode childClone = (JMeterTreeNode) child.clone();
             childClone.setUserObject(((TestElement) child.getUserObject()).clone());
             to.add(childClone);

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/ApplyNamingConvention.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/ApplyNamingConvention.java?rev=1811029&r1=1811028&r2=1811029&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/ApplyNamingConvention.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/ApplyNamingConvention.java Tue Oct
 3 20:24:21 2017
@@ -75,11 +75,11 @@ public class ApplyNamingConvention exten
             JMeterTreeNode currentNode) {
         TreeNodeNamingPolicy namingPolicy = guiPackage.getNamingPolicy();
         guiPackage.updateCurrentNode();
-        Enumeration<JMeterTreeNode> enumeration = currentNode.children();
+        Enumeration<?> enumeration = currentNode.children();
         int index = 0;
         namingPolicy.resetState(currentNode);
         while(enumeration.hasMoreElements()) {
-            JMeterTreeNode childNode = enumeration.nextElement();
+            JMeterTreeNode childNode = (JMeterTreeNode)enumeration.nextElement();
             namingPolicy.rename(currentNode, childNode, index);
             index++;
         }        

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java?rev=1811029&r1=1811028&r2=1811029&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java Tue Oct  3 20:24:21
2017
@@ -173,9 +173,9 @@ public class JMeterTreeModel extends Def
         if (type.isInstance(node.getUserObject())) {
             nodeList.add(node);
         }
-        Enumeration<JMeterTreeNode> enumNode = node.children();
+        Enumeration<?> enumNode = node.children();
         while (enumNode.hasMoreElements()) {
-            JMeterTreeNode child = enumNode.nextElement();
+            JMeterTreeNode child = (JMeterTreeNode)enumNode.nextElement();
             traverseAndFind(type, child, nodeList);
         }
     }
@@ -184,9 +184,9 @@ public class JMeterTreeModel extends Def
         if (userObject == node.getUserObject()) {
             return node;
         }
-        Enumeration<JMeterTreeNode> enumNode = node.children();
+        Enumeration<?> enumNode = node.children();
         while (enumNode.hasMoreElements()) {
-            JMeterTreeNode child = enumNode.nextElement();
+            JMeterTreeNode child = (JMeterTreeNode)enumNode.nextElement();
             JMeterTreeNode result = traverseAndFind(userObject, child);
             if (result != null) {
                 return result;
@@ -202,9 +202,9 @@ public class JMeterTreeModel extends Def
      */
     public HashTree getCurrentSubTree(JMeterTreeNode node) {
         ListedHashTree hashTree = new ListedHashTree(node);
-        Enumeration<JMeterTreeNode> enumNode = node.children();
+        Enumeration<?> enumNode = node.children();
         while (enumNode.hasMoreElements()) {
-            JMeterTreeNode child = enumNode.nextElement();
+            JMeterTreeNode child = (JMeterTreeNode)enumNode.nextElement();
             hashTree.add(node, getCurrentSubTree(child));
         }
         return hashTree;

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java?rev=1811029&r1=1811028&r2=1811029&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java Tue Oct  3 20:24:21
2017
@@ -195,10 +195,4 @@ public class JMeterTreeNode extends Defa
         }
     }
 
-    // Override in order to provide type safety
-    @Override
-    @SuppressWarnings("unchecked")
-    public Enumeration<JMeterTreeNode> children() {
-        return (Enumeration<JMeterTreeNode>) super.children();
-    }
 }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?rev=1811029&r1=1811028&r2=1811029&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Tue Oct  3 20:24:21 2017
@@ -1000,9 +1000,9 @@ public class ProxyControl extends Generi
         ValueReplacer replacer = new ValueReplacer(variables);
         JMeterTreeNode mySelf = model.getNodeOf(this);
         if(mySelf != null) {
-            Enumeration<JMeterTreeNode> children = mySelf.children();
+            Enumeration<?> children = mySelf.children();
             while (children.hasMoreElements()) {
-                JMeterTreeNode templateNode = children.nextElement();
+                JMeterTreeNode templateNode = (JMeterTreeNode)children.nextElement();
                 if (templateNode.isEnabled()) {
                     TestElement template = templateNode.getTestElement();
                     if (template instanceof Timer) {
@@ -1379,9 +1379,9 @@ public class ProxyControl extends Generi
         JMeterTreeModel treeModel = getJmeterTreeModel();
         JMeterTreeNode myNode = treeModel.getNodeOf(this);
         if(myNode != null) {
-            Enumeration<JMeterTreeNode> kids = myNode.children();
+            Enumeration<?> kids = myNode.children();
             while (kids.hasMoreElements()) {
-                JMeterTreeNode subNode = kids.nextElement();
+                JMeterTreeNode subNode = (JMeterTreeNode)kids.nextElement();
                 if (subNode.isEnabled()) {
                     TestElement testElement = subNode.getTestElement();
                     if (testElement instanceof SampleListener) {
@@ -1400,9 +1400,9 @@ public class ProxyControl extends Generi
         JMeterTreeModel treeModel = getJmeterTreeModel();
         JMeterTreeNode myNode = treeModel.getNodeOf(this);
         if(myNode != null) {
-            Enumeration<JMeterTreeNode> kids = myNode.children();
+            Enumeration<?> kids = myNode.children();
             while (kids.hasMoreElements()) {
-                JMeterTreeNode subNode = kids.nextElement();
+                JMeterTreeNode subNode = (JMeterTreeNode)kids.nextElement();
                 if (subNode.isEnabled()) {
                     TestElement testElement = subNode.getTestElement();
                     if (testElement instanceof TestStateListener) {
@@ -1421,9 +1421,9 @@ public class ProxyControl extends Generi
         JMeterTreeModel treeModel = getJmeterTreeModel();
         JMeterTreeNode myNode = treeModel.getNodeOf(this);
         if(myNode != null) {
-            Enumeration<JMeterTreeNode> kids = myNode.children();
+            Enumeration<?> kids = myNode.children();
             while (kids.hasMoreElements()) {
-                JMeterTreeNode subNode = kids.nextElement();
+                JMeterTreeNode subNode = (JMeterTreeNode)kids.nextElement();
                 if (subNode.isEnabled()) {
                     TestElement testElement = subNode.getTestElement();
                     if (testElement instanceof TestStateListener) { // TL - TE

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1811029&r1=1811028&r2=1811029&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Tue Oct  3 20:24:21 2017
@@ -115,6 +115,7 @@ Summary
 <h3>General</h3>
 <ul>
     <li><bug>61549</bug>Thread Group : Remove start and end date</li>
+    <li><bug>61529</bug>Migration to Java 9. Partly contributed by Ubik
Load Pack (support at ubikloadpack.com)</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>
@@ -170,6 +171,7 @@ Summary
 <ul>
     <li>Igor Panainte (panainte.i at gmail.com)</li>
     <li>Emilian Bold (emi at apache.org)</li>
+    <li><a href="http://ubikloadpack.com">Ubik Load Pack</a></li>
 </ul>
 <p>We also thank bug reporters who helped us improve JMeter. <br/>
 For this release we want to give special thanks to the following reporters for the clear
reports and tests made after our fixes:</p>



Mime
View raw message