woolfel     2004/03/15 21:01:55

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/control/gui
                        HttpTestSampleGui.java
               src/protocol/http/org/apache/jmeter/protocol/http/sampler
                        HTTPSampler.java
  Log:
  added field for monitor to indicate a sampler is used for monitors

  peter lin

  
  Revision  Changes    Path
  1.18      +14 -3     
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui.java
  
  Index: HttpTestSampleGui.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- HttpTestSampleGui.java    5 Mar 2004 01:38:02 -0000       1.17
  +++ HttpTestSampleGui.java    16 Mar 2004 05:01:55 -0000      1.18
  @@ -42,6 +42,7 @@
   {
       private UrlConfigGui urlConfigGui;
       private JCheckBox getImages;
  +    private JCheckBox isMon;
   
       public HttpTestSampleGui()
       {
  @@ -54,6 +55,7 @@
           urlConfigGui.configure(element);
           //NOTUSED String testClass = 
element.getPropertyAsString(TestElement.TEST_CLASS);
           getImages.setSelected(((HTTPSampler) element).isImageParser());
  +        isMon.setSelected(((HTTPSampler) element).isMonitor());
       }
   
       public TestElement createTestElement()
  @@ -80,6 +82,11 @@
           {
               ((HTTPSampler)sampler).setImageParser(false);
           }
  +        if (isMon.isSelected()){
  +                     ((HTTPSampler)sampler).setMonitor("true");
  +        } else {
  +                     ((HTTPSampler)sampler).setMonitor("false");
  +        }
           this.configureTestElement(sampler);
       }
   
  @@ -118,8 +125,12 @@
               new JCheckBox(
                   JMeterUtils.getResString("web_testing_retrieve_images"));
           retrieveImagesPanel.add(getImages);
  -
  +        JPanel isMonitorPanel = new JPanel();
  +        isMon = new JCheckBox(
  +            JMeterUtils.getResString("monitor_is_title"));
  +        isMonitorPanel.add(isMon);
           optionalTasksPanel.add(retrieveImagesPanel);
  +             optionalTasksPanel.add(isMonitorPanel);
           return optionalTasksPanel;
       }
           
  
  
  
  1.89      +25 -4     
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.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- HTTPSampler.java  9 Mar 2004 14:55:39 -0000       1.88
  +++ HTTPSampler.java  16 Mar 2004 05:01:55 -0000      1.89
  @@ -112,6 +112,7 @@
       public final static String MULTIPART_FORM= "multipart_form";
       public final static String ENCODED_PATH= "HTTPSampler.encoded_path";
       public final static String IMAGE_PARSER= "HTTPSampler.image_parser";
  +     public final static String MONITOR = "HTTPSampler.monitor";
   
       /** A number to indicate that the port has not been set.  **/
       public static final int UNSPECIFIED_PORT= 0;
  @@ -326,6 +327,18 @@
           return getPropertyAsBoolean(USE_KEEPALIVE);
       }
   
  +     public void setMonitor(String value){
  +         this.setProperty(MONITOR,value);
  +     }
  +     
  +     public String getMonitor(){
  +             return this.getPropertyAsString(MONITOR);
  +     }
  +     
  +     public boolean isMonitor(){
  +             return this.getPropertyAsBoolean(MONITOR);
  +     }
  +
       public void addEncodedArgument(String name, String value, String metaData)
       {
           log.debug(
  @@ -516,6 +529,11 @@
           res.setResponseCode(NON_HTTP_RESPONSE_CODE);
           res.setResponseMessage(NON_HTTP_RESPONSE_MESSAGE);
           res.setSuccessful(false);
  +        try {
  +                     res.setURL(getUrl());
  +        } catch (MalformedURLException ex){
  +        }
  +        res.setMonitor(this.isMonitor());
           return res;
       }
   
  @@ -1021,7 +1039,11 @@
                log.debug("Start : sample" + urlStr);
   
           HTTPSampleResult res= new HTTPSampleResult();
  -
  +        if(this.getPropertyAsBoolean(MONITOR)){
  +            res.setMonitor(true);
  +        } else {
  +                     res.setMonitor(false);
  +        }
                res.setSampleLabel(urlStr);
                res.sampleStart(); // Count the retries as well in the time
   
  @@ -1164,7 +1186,6 @@
           catch (IOException e)
           {
                res.sampleEnd();
  -             res.setURL(url);
               return errorResult(e, url.toString(), res.getTime());
           }
           finally
  
  
  

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

Reply via email to