You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2011/11/16 13:20:15 UTC
svn commit: r1202658 - in /jmeter/trunk:
src/core/org/apache/jmeter/util/NameUpdater.java xdocs/changes.xml
Author: sebb
Date: Wed Nov 16 12:20:15 2011
New Revision: 1202658
URL: http://svn.apache.org/viewvc?rev=1202658&view=rev
Log:
Bug 52161 - Enable plugins to add own translation rules in addition to upgrade.properties.
Modified:
jmeter/trunk/src/core/org/apache/jmeter/util/NameUpdater.java
jmeter/trunk/xdocs/changes.xml
Modified: jmeter/trunk/src/core/org/apache/jmeter/util/NameUpdater.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/NameUpdater.java?rev=1202658&r1=1202657&r2=1202658&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/util/NameUpdater.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/NameUpdater.java Wed Nov 16 12:20:15 2011
@@ -25,6 +25,9 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
import java.util.Properties;
import org.apache.jorphan.logging.LoggingManager;
@@ -37,6 +40,9 @@ public final class NameUpdater {
private static final Logger log = LoggingManager.getLoggerForClass();
+ private static final String NAME_UPDATER_PROPERTIES =
+ "META-INF/resources/org.apache.jmeter.nameupdater.properties"; // $NON-NLS-1$
+
static {
nameMap = new Properties();
FileInputStream fis = null;
@@ -53,6 +59,44 @@ public final class NameUpdater {
} finally {
JOrphanUtils.closeQuietly(fis);
}
+
+ //load additionnal name conversion rules from plugins
+ Enumeration<URL> enu = null;
+
+ try {
+ enu = JMeterUtils.class.getClassLoader().getResources(NAME_UPDATER_PROPERTIES);
+ } catch (IOException e) {
+ log.error("Error in finding additional nameupdater.properties files: ", e);
+ }
+
+ if(enu != null) {
+ while(enu.hasMoreElements()) {
+ URL ressourceUrl = enu.nextElement();
+ log.info("Processing "+ressourceUrl.toString());
+ Properties prop = new Properties();
+ InputStream is = null;
+ try {
+ is = ressourceUrl.openStream();
+ prop.load(is);
+ } catch (IOException e) {
+ log.error("Error processing upgrade file: " + ressourceUrl.getPath(), e);
+ } finally {
+ JOrphanUtils.closeQuietly(is);
+ }
+
+ @SuppressWarnings("unchecked") // names are Strings
+ Enumeration<String> propertyNames = (Enumeration<String>) prop.propertyNames();
+ while (propertyNames.hasMoreElements()) {
+ String key = propertyNames.nextElement();
+ if (!nameMap.contains(key)) {
+ nameMap.put(key, prop.get(key));
+ log.info("Added additional nameMap entry: " + key);
+ } else {
+ log.warn("Additional nameMap entry: '" + key + "' rejected as already defined.");
+ }
+ }
+ }
+ }
}
public static String getCurrentName(String className) {
Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1202658&r1=1202657&r2=1202658&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Wed Nov 16 12:20:15 2011
@@ -212,6 +212,8 @@ This behaviour can be changed with prope
<li>Bug 51091 - New function returning the name of the current "Test Plan"</li>
<li>Bug 52160 - Don't display TestBeanGui items which are flagged as hidden</li>
<li>Bug 51886 - SampleSender configuration resolved partly on client and partly on server</li>
+<li>Bug 52161 - Enable plugins to add own translation rules in addition to upgrade.properties.
+Loads any additional properties found in META-INF/resources/org.apache.jmeter.nameupdater.properties files</li>
</ul>
<h2>Non-functional changes</h2>