jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1556881 - /jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java
Date Thu, 09 Jan 2014 17:08:55 GMT
Author: sebb
Date: Thu Jan  9 17:08:55 2014
New Revision: 1556881

URL: http://svn.apache.org/r1556881
Log:
Support version property references - e.g. b.version = ${a.version}

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java?rev=1556881&r1=1556880&r2=1556881&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java Thu Jan  9 17:08:55 2014
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileReader;
 import java.io.FilenameFilter;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -102,7 +103,9 @@ public class JMeterVersionTest extends J
 //      <classpathentry kind="lib" path="lib/activation-1.1.1.jar"/>
 //      <classpathentry kind="lib" path="lib/jtidy-r938.jar"/>
         final Pattern p = Pattern.compile("\\s+<classpathentry kind=\"lib\" path=\"lib/(?:api/)?(.+)-([^-]+)\\.jar\"/>");
+        final Pattern versionPat = Pattern.compile("\\$\\{(.+)\\.version\\}");
         String line;
+        final ArrayList<String> toRemove = new ArrayList<String>();
         while((line=eclipse.readLine()) != null){
             final Matcher m = p.matcher(line);
             if (m.matches()) {
@@ -122,7 +125,14 @@ public class JMeterVersionTest extends J
                         jar = tmp;
                     }
                 }
-                final String expected = versions.get(jar);
+                String expected = versions.get(jar);
+                // Process ${xxx.version} references
+                final Matcher mp = versionPat.matcher(expected);
+                if (mp.matches()) {
+                    String key = mp.group(1);
+                    expected = versions.get(key);
+                    toRemove.add(key); // in case it is not itself used we remove it later
+                }
                 propNames.remove(jar);
                 if (expected == null) {
                     fail("Versions list does not contain: " + jar);
@@ -133,6 +143,10 @@ public class JMeterVersionTest extends J
                 }
             }
         }
+        // remove any possibly unused references
+        for(Object key : toRemove.toArray()) {
+            propNames.remove(key);            
+        }
         eclipse.close();
         if (propNames.size() > 0) {
             fail("Should have no names left: "+Arrays.toString(propNames.toArray()) + ".
Check eclipse.classpath");



Mime
View raw message