sebb        2005/09/23 16:02:50

  Modified:    src/core/org/apache/jmeter/testelement Tag: rel-2-1
                        TestPlan.java
               src/core/org/apache/jmeter/control/gui Tag: rel-2-1
                        TestPlanGui.java
  Log:
  Rename setClassPath(String[]) as setClassPathArray(String[]) to agree with 
getClassPathArray()
  Simplify concatenation of strings
  Use constant String for separator
  Document what appear to be unused items
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.17.2.5  +29 -16    
jakarta-jmeter/src/core/org/apache/jmeter/testelement/TestPlan.java
  
  Index: TestPlan.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/testelement/TestPlan.java,v
  retrieving revision 1.17.2.4
  retrieving revision 1.17.2.5
  diff -u -r1.17.2.4 -r1.17.2.5
  --- TestPlan.java     23 Sep 2005 17:51:17 -0000      1.17.2.4
  +++ TestPlan.java     23 Sep 2005 23:02:50 -0000      1.17.2.5
  @@ -47,6 +47,7 @@
   public class TestPlan extends AbstractTestElement implements Serializable, 
TestListener {
        private static Logger log = LoggingManager.getLoggerForClass();
   
  +    // Does not appear to be needed
        public final static String THREAD_GROUPS = "TestPlan.thread_groups";
   
        public final static String FUNCTIONAL_MODE = "TestPlan.functional_mode";
  @@ -56,17 +57,23 @@
        public final static String SERIALIZE_THREADGROUPS = 
"TestPlan.serialize_threadgroups";
   
       public final static String CLASSPATHS = "TestPlan.user_define_classpath";
  +    private static final String CLASSPATH_SEPARATOR = ",";
       
        public final static String COMMENTS = "TestPlan.comments";
   
  +    // Does not appear to be needed
        public final static String BASEDIR = "basedir";
   
  +    // Does not appear to be needed
        private transient List threadGroups = new LinkedList();
   
  +    // Does not appear to be needed
        private transient List configs = new LinkedList();
   
  +    // Does not appear to be needed
        private static List itemsCanAdd = new LinkedList();
   
  +    // Does not appear to be needed
        private static TestPlan plan;
   
        // There's only 1 test plan, so can cache the mode here
  @@ -77,6 +84,8 @@
                // returned in 
org.apache.jmeter.threads.ThreadGroup.getClassLabel()
                // method. If it's not you will not be able to add a Thread 
Group
                // element to a Test Plan.
  +
  +        // Does not appear to be needed
                itemsCanAdd.add(JMeterUtils.getResString("threadgroup"));
        }
   
  @@ -90,7 +99,9 @@
                setName(name);
                // setFunctionalMode(false);
                // setSerialized(false);
  -             setProperty(new CollectionProperty(THREAD_GROUPS, 
threadGroups));
  +
  +        // Does not appear to be needed
  +        setProperty(new CollectionProperty(THREAD_GROUPS, threadGroups));
        }
       
       public void prepareForPreCompile()
  @@ -111,10 +122,12 @@
                setProperty(new TestElementProperty(USER_DEFINED_VARIABLES, 
vars));
        }
   
  +    // Does not appear to be needed
        public String getBasedir() {
                return getPropertyAsString(BASEDIR);
        }
   
  +    // Does not appear to be needed
        public void setBasedir(String b) {
                setProperty(BASEDIR, b);
        }
  @@ -159,24 +172,19 @@
           setProperty(CLASSPATHS,text);
       }
       
  -    public void setTestPlanClasspath(String[] text) {
  -        String cat = "";
  -        if (text.length > 1) {
  -            for (int idx=0; idx < text.length; idx++) {
  -                if (idx > 0) {
  -                    cat += "," + text[idx];
  -                } else {
  -                    cat += text[idx];
  -                }
  +    public void setTestPlanClasspathArray(String[] text) {
  +        StringBuffer cat = new StringBuffer();
  +        for (int idx=0; idx < text.length; idx++) {
  +            if (idx > 0) {
  +                cat.append(CLASSPATH_SEPARATOR);
               }
  -        } else if (text != null && text.length == 1){
  -            cat = text[0];
  +            cat.append(text[idx]);
           }
  -        this.setTestPlanClasspath(cat);
  +        this.setTestPlanClasspath(cat.toString());
       }
       
       public String[] getTestPlanClasspathArray() {
  -        return JOrphanUtils.split(this.getTestPlanClasspath(),",");
  +        return 
JOrphanUtils.split(this.getTestPlanClasspath(),CLASSPATH_SEPARATOR);
       }
       
       /**
  @@ -200,6 +208,7 @@
                getVariables().addArgument(name, value);
        }
   
  +    // Does not appear to be needed
        public static TestPlan createTestPlan(String name) {
                if (plan == null) {
                        if (name == null) {
  @@ -219,6 +228,7 @@
                }
        }
   
  +    // Does not appear to be needed
        public void addJMeterComponent(TestElement child) {
                if (child instanceof ThreadGroup) {
                        addThreadGroup((ThreadGroup) child);
  @@ -230,6 +240,7 @@
         * 
         * @return the ThreadGroups value
         */
  +    // Does not appear to be needed
        public Collection getThreadGroups() {
                return threadGroups;
        }
  @@ -240,6 +251,7 @@
         * @param c
         *            the feature to be added to the ConfigElement attribute
         */
  +    // Does not appear to be needed
        public void addConfigElement(ConfigElement c) {
                configs.add(c);
        }
  @@ -250,6 +262,7 @@
         * @param group
         *            the feature to be added to the ThreadGroup attribute
         */
  +    // Does not appear to be needed
        public void addThreadGroup(ThreadGroup group) {
                threadGroups.add(group);
        }
  
  
  
  No                   revision
  No                   revision
  1.19.2.2  +3 -3      
jakarta-jmeter/src/core/org/apache/jmeter/control/gui/TestPlanGui.java
  
  Index: TestPlanGui.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/control/gui/TestPlanGui.java,v
  retrieving revision 1.19.2.1
  retrieving revision 1.19.2.2
  diff -u -r1.19.2.1 -r1.19.2.2
  --- TestPlanGui.java  21 Sep 2005 19:38:30 -0000      1.19.2.1
  +++ TestPlanGui.java  23 Sep 2005 23:02:50 -0000      1.19.2.2
  @@ -116,7 +116,7 @@
                        tp.setSerialized(serializedMode.isSelected());
                        tp.setUserDefinedVariables((Arguments) 
argsPanel.createTestElement());
                        tp.setProperty(TestPlan.COMMENTS, 
commentPanel.getText());
  -            tp.setTestPlanClasspath(browseJar.getFiles());
  +            tp.setTestPlanClasspathArray(browseJar.getFiles());
                }
        }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to