jakarta-jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mstov...@apache.org
Subject cvs commit: jakarta-jmeter/src/org/apache/jmeter/save/handlers FilerHandler.java JMeterComponentHandler.java TimerHandler.java
Date Sun, 10 Jun 2001 02:22:56 GMT
mstover1    01/06/09 19:22:56

  Added:       .        build.bat lcp.bat
               src/org/apache/jmeter/save/handlers FilerHandler.java
                        JMeterComponentHandler.java TimerHandler.java
  Log:
  Can save timers and listeners
  
  Revision  Changes    Path
  1.1                  jakarta-jmeter/build.bat
  
  Index: build.bat
  ===================================================================
  echo off
  
  set LOCALCLASSPATH=%JAVA_HOME%\lib\tools.jar
  
  for %%i in (".\lib\*.jar") do CALL lcp %%i
  echo %LOCALCLASSPATH%
  
  for %%i in (..\jakarta-site2\lib\*.jar) do set LOCALCLASSPATH=%LOCALCLASSPATH%;%%i
  
  SET BUILDFILE=build.xml
  echo %LOCALCLASSPATH%
  java -classpath %LOCALCLASSPATH% org.apache.tools.ant.Main -buildfile %BUILDFILE% %1
  
  
  
  1.1                  jakarta-jmeter/lcp.bat
  
  Index: lcp.bat
  ===================================================================
  set LOCALCLASSPATH=%LOCALCLASSPATH%;%1
  
  
  
  
  1.1                  jakarta-jmeter/src/org/apache/jmeter/save/handlers/FilerHandler.java
  
  Index: FilerHandler.java
  ===================================================================
  package org.apache.jmeter.save.handlers;
  
  import org.apache.jmeter.save.Saveable;
  import java.io.Writer;
  import org.apache.jmeter.save.xml.*;
  import org.apache.jmeter.reporters.Filer;
  import org.xml.sax.Attributes;
  
  /**
   * Title:
   * Description:
   * Copyright:    Copyright (c) 2001
   * Company:
   * @author
   * @version 1.0
   */
  
  public class FilerHandler extends TagHandler
  {
  	Filer model;
  
  	public FilerHandler()
  	{
  	}
  
  	public void save(Saveable saveObject, Writer out) throws java.io.IOException
  	{
  		Filer save = (Filer)saveObject;
  		out.write("<Filer type=\"");
  		out.write(JMeterHandler.convertToXML(save.getClass().getName()));
  		out.write("\" name=\"");
  		out.write(JMeterHandler.convertToXML(save.getName()));
  		out.write("\" verbose=\"");
  		out.write(""+save.getVerbose());
  		out.write("\" append=\"");
  		out.write(""+save.getAppend());
  		out.write("\" file=\"");
  		out.write(JMeterHandler.convertToXML(save.getFile()));
  		out.write("\"/>");
  	}
  
  	public void setAtts(Attributes atts) throws java.lang.Exception
  	{
  		model = (Filer)Class.forName(atts.getValue("type")).newInstance();
  		model.setName(atts.getValue("name"));
  		model.setFile(atts.getValue("file"));
  		model.setVerbose(atts.getValue("verbose").equals("true") ? true :false);
  		model.setAppend(atts.getValue("append").equals("true") ? true :false);
  	}
  
  	public String getPrimaryTagName()
  	{
  		return "Filer";
  	}
  
  	public Object getModel()
  	{
  		return model;
  	}
  }
  
  
  1.1                  jakarta-jmeter/src/org/apache/jmeter/save/handlers/JMeterComponentHandler.java
  
  Index: JMeterComponentHandler.java
  ===================================================================
  package org.apache.jmeter.save.handlers;
  
  import org.apache.jmeter.save.*;
  import java.io.Writer;
  import org.apache.jmeter.save.xml.*;
  import org.apache.jmeter.gui.JMeterComponentModel;
  import org.xml.sax.Attributes;
  
  /**
   * Title:
   * Description:
   * Copyright:    Copyright (c) 2001
   * Company:
   * @author
   * @version 1.0
   */
  
  public class JMeterComponentHandler extends TagHandler
  {
  	JMeterComponentModel model;
  
  	public JMeterComponentHandler()
  	{
  	}
  
  	public void save(Saveable saveObject, Writer out) throws java.io.IOException
  	{
  		JMeterComponentModel save = (JMeterComponentModel)saveObject;
  		out.write("<JMeterComponent type=\"");
  		out.write(JMeterHandler.convertToXML(save.getClass().getName()));
  		out.write("\" name=\"");
  		out.write(JMeterHandler.convertToXML(save.getName()));
  		out.write("\"/>");
  	}
  
  	public void setAtts(Attributes atts) throws java.lang.Exception
  	{
  		model = (JMeterComponentModel)Class.forName(atts.getValue("type")).newInstance();
  		model.setName(atts.getValue("name"));
  	}
  
  	public String getPrimaryTagName()
  	{
  		return "JMeterComponent";
  	}
  
  	public Object getModel()
  	{
  		return model;
  	}
  }
  
  
  1.1                  jakarta-jmeter/src/org/apache/jmeter/save/handlers/TimerHandler.java
  
  Index: TimerHandler.java
  ===================================================================
  package org.apache.jmeter.save.handlers;
  
  import org.apache.jmeter.gui.JMeterComponentModel;
  import org.apache.jmeter.timers.Timer;
  import java.io.Writer;
  import org.apache.jmeter.save.xml.*;
  import org.apache.jmeter.save.*;
  
  import org.xml.sax.Attributes;
  
  /**
   * Title:
   * Description:
   * Copyright:    Copyright (c) 2001
   * Company:
   * @author
   * @version 1.0
   */
  
  public class TimerHandler extends TagHandler
  {
  	Timer timer;
  
  	public TimerHandler()
  	{
  	}
  
  	public void save(Saveable parm1, Writer out) throws java.io.IOException
  	{
  		Timer timer = (Timer)parm1;
  		out.write("<Timer type=\"");
  		out.write(JMeterHandler.convertToXML(timer.getClass().getName()));
  		out.write("\"");
  		if(timer instanceof JMeterComponentModel)
  		{
  			out.write(" name=\"");
  			out.write(JMeterHandler.convertToXML(((JMeterComponentModel)timer).getName()));
  			out.write("\"");
  		}
  		out.write(">\n");
  		out.write("<delay>");
  		out.write(Long.toString(timer.getDelay()));
  		out.write("</delay>\n");
  		out.write("<range>");
  		out.write(Double.toString(timer.getRange()));
  		out.write("</range>\n");
  		out.write("</Timer>\n");
  	}
  
  	public void setAtts(Attributes atts) throws java.lang.Exception
  	{
  		timer = (Timer)Class.forName(atts.getValue("type")).newInstance();
  		if(timer instanceof JMeterComponentModel)
  		{
  			((JMeterComponentModel)timer).setName(atts.getValue("name"));
  		}
  	}
  
  	public void delay(String data)
  	{
  		try
  		{
  			timer.setDelay(Long.parseLong(data));
  		}
  		catch(NumberFormatException e)
  		{
  			timer.setDelay(0);
  		}
  	}
  
  	public void range(String data)
  	{
  		try
  		{
  			timer.setRange(Double.parseDouble(data));
  		}
  		catch(NumberFormatException e)
  		{
  			timer.setRange(0);
  		}
  	}
  
  	public String getPrimaryTagName()
  	{
  		return "Timer";
  	}
  	public Object getModel()
  	{
  		return timer;
  	}
  }
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Mime
View raw message