mstover1    2003/06/05 09:22:22

  Modified:    src/core/org/apache/jmeter/gui/action ActionRouter.java
                        ExitCommand.java Save.java
               src/jorphan/org/apache/jorphan/collections HashTree.java
                        ListedHashTree.java
               src/protocol/http/org/apache/jmeter/protocol/http/modifier
                        UserParameterModifier.java
               src/protocol/http/org/apache/jmeter/protocol/http/sampler
                        HTTPSampler.java
  Log:
  fixing checking if test plan changed since last save
  Fixing HTTP User Parameters Modifier
  
  Revision  Changes    Path
  1.13      +58 -21    
jakarta-jmeter/src/core/org/apache/jmeter/gui/action/ActionRouter.java
  
  Index: ActionRouter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/action/ActionRouter.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ActionRouter.java 29 May 2003 13:33:56 -0000      1.12
  +++ ActionRouter.java 5 Jun 2003 16:22:21 -0000       1.13
  @@ -103,33 +103,48 @@
           {
               public void run()
               {
  +                performAction(e);
  +            }
  +
  +        });
  +    }
  +
  +    private void performAction(final ActionEvent e)
  +    {
  +        try
  +        {
  +            GuiPackage.getInstance().updateCurrentNode();
  +            Set commandObjects = (Set) commands.get(e.getActionCommand());
  +            Iterator iter = commandObjects.iterator();
  +            while (iter.hasNext())
  +            {
                   try
                   {
  -                    GuiPackage.getInstance().updateCurrentNode();
  -                    Set commandObjects = (Set) commands.get(e.getActionCommand());
  -                    Iterator iter = commandObjects.iterator();
  -                    while (iter.hasNext())
  -                    {
  -                        try
  -                        {
  -                            Command c = (Command) iter.next();
  -                            preActionPerformed(c.getClass(), e);
  -                            c.doAction(e);
  -                            postActionPerformed(c.getClass(), e);
  -                        }
  -                        catch (Exception err)
  -                        {
  -                            log.error("", err);
  -                        }
  -                    }
  +                    Command c = (Command) iter.next();
  +                    preActionPerformed(c.getClass(), e);
  +                    c.doAction(e);
  +                    postActionPerformed(c.getClass(), e);
                   }
  -                catch (NullPointerException er)
  +                catch (Exception err)
                   {
  -                    log.error("", er);
  -                    JMeterUtils.reportErrorToUser("Sorry, this feature (" + 
e.getActionCommand() + ") not yet implemented");
  +                    log.error("", err);
                   }
               }
  -        });
  +        }
  +        catch (NullPointerException er)
  +        {
  +            log.error("", er);
  +            JMeterUtils.reportErrorToUser("Sorry, this feature (" + 
e.getActionCommand() + ") not yet implemented");
  +        }
  +    }
  +
  +    /**
  +     * To execute an action immediately in the current thread.
  +     * @param e
  +     */
  +    public void doActionNow(ActionEvent e)
  +    {
  +        performAction(e);
       }
   
       public Set getAction(String actionName)
  @@ -149,6 +164,28 @@
               }
           }
           return set;
  +    }
  +
  +    public Command getAction(String actionName, Class actionClass)
  +    {
  +        Set commandObjects = (Set) commands.get(actionName);
  +        Iterator iter = commandObjects.iterator();
  +        while (iter.hasNext())
  +        {
  +            try
  +            {
  +                Command com = (Command) iter.next();
  +                if (com.getClass().equals(actionClass))
  +                {
  +                    return com;
  +                }
  +            }
  +            catch (Exception err)
  +            {
  +                log.error("", err);
  +            }
  +        }
  +        return null;
       }
   
       public Command getAction(String actionName, String className)
  
  
  
  1.6       +1 -1      
jakarta-jmeter/src/core/org/apache/jmeter/gui/action/ExitCommand.java
  
  Index: ExitCommand.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/action/ExitCommand.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ExitCommand.java  1 May 2003 19:47:17 -0000       1.5
  +++ ExitCommand.java  5 Jun 2003 16:22:21 -0000       1.6
  @@ -116,7 +116,7 @@
               }
               else if (chosenOption == JOptionPane.YES_OPTION)
               {
  -                ActionRouter.getInstance().actionPerformed(new 
ActionEvent(e.getSource(), e.getID(), Save.SAVE_ALL));
  +                ActionRouter.getInstance().doActionNow(new 
ActionEvent(e.getSource(), e.getID(), Save.SAVE_ALL));
                   if (!GuiPackage.getInstance().isDirty())
                   {
                       System.exit(0);
  
  
  
  1.12      +1 -1      jakarta-jmeter/src/core/org/apache/jmeter/gui/action/Save.java
  
  Index: Save.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/action/Save.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Save.java 5 Jun 2003 15:02:06 -0000       1.11
  +++ Save.java 5 Jun 2003 16:22:21 -0000       1.12
  @@ -163,7 +163,7 @@
                        chosenFile = testPlanFile;
                }
   
  -        ActionRouter.getInstance().actionPerformed(new 
ActionEvent(subTree.clone(),e.getID(),CheckDirty.SUB_TREE_SAVED));
  +        ActionRouter.getInstance().doActionNow(new 
ActionEvent(subTree,e.getID(),CheckDirty.SUB_TREE_SAVED));
           try
                   {
                       convertSubTree(subTree);
  
  
  
  1.3       +10 -1     
jakarta-jmeter/src/jorphan/org/apache/jorphan/collections/HashTree.java
  
  Index: HashTree.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/jorphan/org/apache/jorphan/collections/HashTree.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HashTree.java     7 Apr 2003 14:35:24 -0000       1.2
  +++ HashTree.java     5 Jun 2003 16:22:21 -0000       1.3
  @@ -564,9 +564,18 @@
        public Object clone()
        {
                HashTree newTree = new HashTree();
  -             newTree.data = (Map)((HashMap)data).clone();
  +        cloneTree(newTree);
                return newTree;
        }
  +    protected void cloneTree(HashTree newTree)
  +    {
  +        Iterator iter = list().iterator();
  +        while(iter.hasNext())
  +        {
  +            Object key = iter.next();
  +            newTree.set(key,(HashTree)getTree(key).clone());
  +        }
  +    }
        
        /**
         * Creates a new tree.  This method exists to allow inheriting classes to 
generate the
  
  
  
  1.3       +1 -2      
jakarta-jmeter/src/jorphan/org/apache/jorphan/collections/ListedHashTree.java
  
  Index: ListedHashTree.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/jorphan/org/apache/jorphan/collections/ListedHashTree.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ListedHashTree.java       16 Apr 2003 20:35:26 -0000      1.2
  +++ ListedHashTree.java       5 Jun 2003 16:22:22 -0000       1.3
  @@ -83,8 +83,7 @@
        public Object clone()
        {
                ListedHashTree newTree = new ListedHashTree();
  -             newTree.data = (Map)((HashMap)data).clone();
  -             newTree.order = (List)((LinkedList)order).clone();
  +        cloneTree(newTree);
                return newTree;
        }
   
  
  
  
  1.8       +14 -7     
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/modifier/UserParameterModifier.java
  
  Index: UserParameterModifier.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/modifier/UserParameterModifier.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- UserParameterModifier.java        3 May 2003 15:34:33 -0000       1.7
  +++ UserParameterModifier.java        5 Jun 2003 16:22:22 -0000       1.8
  @@ -102,12 +102,9 @@
        public UserParameterModifier()
        {
        } //end constructor
  -     //-------------------------------------------
  -     // Methods
  -     //-------------------------------------------
  -     
/*----------------------------------------------------------------------------------------------
  -      * Methods overriden/implemented from 
org.apache.jmeter.config.AbstractConfigElement
  -      
*--------------------------------------------------------------------------------------------*/
  +
  +    
  +
        /**
         * Runs before the start of every test. Reload the Sequencer with the
         * latest parameter data for each user
  @@ -197,5 +194,15 @@
        */
       public void testIterationStart(LoopIterationEvent event)
       {}
  +
  +    /* (non-Javadoc)
  +     * @see java.lang.Object#clone()
  +     */
  +    public Object clone()
  +    {
  +        UserParameterModifier clone = (UserParameterModifier) super.clone();
  +        clone.allAvailableUsers = allAvailableUsers;
  +        return clone;
  +    }
   
   }
  
  
  
  1.42      +3 -3      
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
  
  Index: HTTPSampler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- HTTPSampler.java  5 Jun 2003 15:02:06 -0000       1.41
  +++ HTTPSampler.java  5 Jun 2003 16:22:22 -0000       1.42
  @@ -478,7 +478,7 @@
           {
               pathAndQuery = "/" + pathAndQuery;
           }
  -        if (getPort() == UNSPECIFIED_PORT)
  +        if (getPort() == UNSPECIFIED_PORT || getPort() == 80 )
           {
               return new URL(getProtocol(), getDomain(), pathAndQuery);
           }
  
  
  

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

Reply via email to