jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1199459 - in /jmeter/trunk: src/core/org/apache/jmeter/ src/core/org/apache/jmeter/engine/ src/core/org/apache/jmeter/services/ src/functions/org/apache/jmeter/functions/ xdocs/
Date Tue, 08 Nov 2011 21:14:34 GMT
Author: pmouawad
Date: Tue Nov  8 21:14:34 2011
New Revision: 1199459

URL: http://svn.apache.org/viewvc?rev=1199459&view=rev
Log:
Bug 51091 - New function returning the name of the current "Test Plan"

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
    jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java
    jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngine.java
    jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java
    jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java
    jmeter/trunk/src/functions/org/apache/jmeter/functions/TestPlanName.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java?rev=1199459&r1=1199458&r2=1199459&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/JMeter.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/JMeter.java Tue Nov  8 21:14:34 2011
@@ -233,6 +233,8 @@ public class JMeter implements JMeterPlu
             try {
                 File f = new File(testFile);
                 log.info("Loading file: " + f);
+                FileServer.getFileServer().setBaseForScript(f);
+
                 reader = new FileInputStream(f);
                 HashTree tree = SaveService.loadTree(reader);
 

Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java?rev=1199459&r1=1199458&r2=1199459&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java Tue Nov  8 21:14:34
2011
@@ -124,10 +124,11 @@ public class ClientJMeterEngine implemen
              * See https://issues.apache.org/bugzilla/show_bug.cgi?id=48350
             */
             File baseDirRelative = FileServer.getFileServer().getBaseDirRelative();
+            String scriptName = FileServer.getFileServer().getScriptName();
             synchronized(LOCK)
             {
                 methodName="rconfigure()";
-                remote.rconfigure(testTree, host, baseDirRelative);
+                remote.rconfigure(testTree, host, baseDirRelative, scriptName);
             }
             log.info("sent test to " + host + " basedir='"+baseDirRelative+"'"); // $NON-NLS-1$
             if (savep != null){

Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngine.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngine.java?rev=1199459&r1=1199458&r2=1199459&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngine.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngine.java Tue Nov  8 21:14:34
2011
@@ -29,7 +29,7 @@ import org.apache.jorphan.collections.Ha
  * This is the interface for the RMI server engine, i.e. {@link RemoteJMeterEngineImpl}
  */
 public interface RemoteJMeterEngine extends Remote {
-    void rconfigure(HashTree testTree, String host, File jmxBase) throws RemoteException;
+    void rconfigure(HashTree testTree, String host, File jmxBase, String scriptName) throws
RemoteException;
 
     void rrunTest() throws RemoteException, JMeterEngineException;
 

Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java?rev=1199459&r1=1199458&r2=1199459&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java Tue Nov  8
21:14:34 2011
@@ -132,7 +132,7 @@ public class RemoteJMeterEngineImpl exte
      * @param testTree
      *            the feature to be added to the ThreadGroup attribute
      */
-    public void rconfigure(HashTree testTree, String host, File jmxBase) throws RemoteException
{
+    public void rconfigure(HashTree testTree, String host, File jmxBase, String scriptName)
throws RemoteException {
         log.info("Creating JMeter engine on host "+host+" base '"+jmxBase+"'");
         synchronized(LOCK) { // close window where another remote client might jump in
             if (backingEngine != null && backingEngine.isActive()) {
@@ -143,6 +143,7 @@ public class RemoteJMeterEngineImpl exte
             backingEngine = new StandardJMeterEngine(host);
             backingEngine.configure(testTree); // sets active = true
         }
+        FileServer.getFileServer().setScriptName(scriptName);
         FileServer.getFileServer().setBase(jmxBase);
     }
 

Modified: jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java?rev=1199459&r1=1199458&r2=1199459&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java Tue Nov  8 21:14:34 2011
@@ -81,6 +81,8 @@ public class FileServer {
 
     private final Random random = new Random();
 
+	private String scriptName;
+
     // Cannot be instantiated
     private FileServer() {
         base = new File(DEFAULT_BASE);
@@ -142,6 +144,7 @@ public class FileServer {
         }
         files.clear();
         // getParentFile() may not work on relative paths
+        setScriptName(scriptPath.getName());
         base = scriptPath.getAbsoluteFile().getParentFile();
         log.info("Set new base '"+base+"'");
     }
@@ -460,4 +463,18 @@ public class FileServer {
         }
         return relativeName;
     }
+
+    /**
+     * @return JMX Script name
+     */
+	public String getScriptName() {
+		return scriptName;
+	}
+
+	/**
+	 * @param scriptName Script name
+	 */
+	public void setScriptName(String scriptName) {
+		this.scriptName = scriptName;
+	}
 }

Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/TestPlanName.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/TestPlanName.java?rev=1199459&r1=1199458&r2=1199459&view=diff
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/TestPlanName.java (original)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/TestPlanName.java Tue Nov  8 21:14:34
2011
@@ -23,13 +23,12 @@ import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.jmeter.engine.util.CompoundVariable;
-import org.apache.jmeter.gui.GuiPackage;
 import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.samplers.Sampler;
+import org.apache.jmeter.services.FileServer;
 
 /**
  * Returns Test Plan name
- * FIXME : Implementation need to handle remote run and non gui mode
  */
 public class TestPlanName extends AbstractFunction {
 
@@ -48,7 +47,7 @@ public class TestPlanName extends Abstra
     @Override
     public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
             throws InvalidVariableException {
-    	String testPlanFile = GuiPackage.getInstance().getTestPlanFile();
+    	String testPlanFile = FileServer.getFileServer().getScriptName();
         return testPlanFile;
     }
 

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1199459&r1=1199458&r2=1199459&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Tue Nov  8 21:14:34 2011
@@ -205,6 +205,7 @@ these occurs, Sampler is marked as faile
 <li>Bug 52085 - Allow multiple selection in arguments panel</li>
 <li>Bug 52099 - Allow to set the transaction isolation in the JDBC Connection Configuration</li>
 <li>Bug 52116 - Allow to add (paste) entries from the clipboard to an arguments list</li>
+<li>Bug 51091 - New function returning the name of the current "Test Plan"</li>
 </ul>
 
 <h2>Non-functional changes</h2>



Mime
View raw message