You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by "BAZLEY, Sebastian" <Se...@london.sema.slb.com> on 2004/01/12 14:47:17 UTC
RE: cvs commit: jakarta-jmeter/src/protocol/http/org/apache/jmete
r/protocol/http/sampler HTTPSamplerBean.java
The default values are OK, but I'm not sure that they'll work as intended -
for example, if a test plan is saved with an empty value, will the default
be re-applied? I suspect the value will be populated from the test plan.
I think it might be better to define constants (static final String) and
code the getXXX routines to return these if the field is empty - especially
if the field must exist (e.g. protocol).
It would still be useful when creating a new sampler if all the required GUI
fields were automatically populated with the defaults, as is currently done
with Method.
==
What does "protocol undefined" mean? Similarly for Follow redirects and
Download resources?
It seems to me that these should be replaced with whatever defaults will be
applied by the code.
==
Follow Redirects should probably allow Edit.
Method should probably allow Edit; maybe add HEAD to the predefined list?
S.
-----Original Message-----
From: jsalvata@apache.org [mailto:jsalvata@apache.org]
Sent: 08 January 2004 22:58
To: jakarta-jmeter-cvs@apache.org
Subject: cvs commit:
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler
HTTPSamplerBean.java
jsalvata 2004/01/08 14:58:09
Modified: src/protocol/http/org/apache/jmeter/protocol/http/sampler
Tag: testbeans_experimental_branch
HTTPSamplerBean.java
Log:
* Improved defaults (sebb: opinions?).
* Using new TestElement property assignement feature.
Revision Changes Path
No revision
No revision
1.1.2.5 +5 -26
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http
/sampler/Attic/HTTPSamplerBean.java
Index: HTTPSamplerBean.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/pro
tocol/http/sampler/Attic/HTTPSamplerBean.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- HTTPSamplerBean.java 7 Jan 2004 23:34:38 -0000 1.1.2.4
+++ HTTPSamplerBean.java 8 Jan 2004 22:58:09 -0000 1.1.2.5
@@ -86,7 +86,6 @@
import org.apache.jmeter.samplers.Sampler;
import org.apache.jmeter.testbeans.TestBean;
-import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.property.CollectionProperty;
import org.apache.jmeter.testelement.property.PropertyIterator;
@@ -199,18 +198,18 @@
/*
* Public properties:
*/
- private String fileField= "";
+ private String fileField= ""; // TODO: is this valid?
Choose a sensible default or check it's non-null.
private File filename= null;
- private String protocol= "";
+ private String protocol= "http";
private String path= "";
private String encodedPath= "";
private boolean followRedirects= true;
- private String Method= "";
+ private String Method= "GET";
private boolean useKeepAlive= false;
private int port= UNSPECIFIED_PORT;
- private String domain= "";
+ private String domain= ""; // TODO: choose a sensible
default or check it's non-null.
private Arguments arguments= null;
- private String mimeType= "";
+ private String mimeType= ""; // TODO: is this valid?
Choose a sensible one or check it's non-null.
private boolean imageParser= false;
/*
@@ -248,26 +247,6 @@
arg.setAlwaysEncoded(false);
}
this.getArguments().addArgument(arg);
- }
-
- public void addTestElement(TestElement el)
- {
- if (el instanceof CookieManager)
- {
- setCookieManager((CookieManager)el);
- }
- else if (el instanceof HeaderManager)
- {
- setHeaderManager((HeaderManager)el);
- }
- else if (el instanceof AuthManager)
- {
- setAuthManager((AuthManager)el);
- }
- else
- {
- super.addTestElement(el);
- }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-jmeter/src/protocol/http/org/apache/jmete
r/protocol/http/sampler HTTPSamplerBean.java
Posted by Jordi Salvat i Alabart <js...@atg.com>.
En/na BAZLEY, Sebastian ha escrit:
> The default values are OK, but I'm not sure that they'll work as intended -
> for example, if a test plan is saved with an empty value, will the default
> be re-applied? I suspect the value will be populated from the test plan.
>
> I think it might be better to define constants (static final String) and
> code the getXXX routines to return these if the field is empty - especially
> if the field must exist (e.g. protocol).
Those defaults will apply if the corresponding field in the GUI is left
as Undefined: the prepare() method in TestBean will not call the setXXX
method in that case.
Those are different from GUI initial values, which are the matter of a
later change I did.
> It would still be useful when creating a new sampler if all the required GUI
> fields were automatically populated with the defaults, as is currently done
> with Method.
I did this in an earlier version: the GUI would create an instance of
the bean using it's parameter-less constructor and extract the current
property values, then use those as defaults for the GUI. Made sense as a
concept, but didn't turn really well in practice: for most fields, we
want the GUI initial value to be "undefined", so that it can be obtained
from an "HTTP Defaults Bean", but we want a default value to be used if,
even after applying all configuration elements, the property is still
undefined.
> ==
>
> What does "protocol undefined" mean? Similarly for Follow redirects and
> Download resources?
My position is that, for each property, we should either:
a) Provide a meaning and have the documentation (and the 'tips' of the
property labels) explain it.
or
b) Have the sampler report an error if you try to run it with a property
that is undefined and should not be.
Anyways, this is not very different from what we had: what did an empty
("") domain mean? It meant to use the defaults provided by config
elements or, eventually, point to localhost (don't ask me why, but the
HTTPConnection seems to connect to localhost if you ask it to open UTL
http:///).
> It seems to me that these should be replaced with whatever defaults will be
> applied by the code.
>
> ==
>
> Follow Redirects should probably allow Edit.
>
> Method should probably allow Edit; maybe add HEAD to the predefined list?
All fields should provide Edit, unless we have a very strong reason not
to. Edit allows using variables & functions, and hence provides greater
flexibility for uses we have not foreseen. The only reason why it is
removed now is explained in a comment in HTTPSamplerBeanBeanInfo:
// The following are added for demo purposes only. TODO: remove
--
Salut,
Jordi.
> S.
> -----Original Message-----
> From: jsalvata@apache.org [mailto:jsalvata@apache.org]
> Sent: 08 January 2004 22:58
> To: jakarta-jmeter-cvs@apache.org
> Subject: cvs commit:
> jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler
> HTTPSamplerBean.java
>
>
> jsalvata 2004/01/08 14:58:09
>
> Modified: src/protocol/http/org/apache/jmeter/protocol/http/sampler
> Tag: testbeans_experimental_branch
> HTTPSamplerBean.java
> Log:
> * Improved defaults (sebb: opinions?).
> * Using new TestElement property assignement feature.
>
> Revision Changes Path
> No revision
> No revision
> 1.1.2.5 +5 -26
> jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http
> /sampler/Attic/HTTPSamplerBean.java
>
> Index: HTTPSamplerBean.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/pro
> tocol/http/sampler/Attic/HTTPSamplerBean.java,v
> retrieving revision 1.1.2.4
> retrieving revision 1.1.2.5
> diff -u -r1.1.2.4 -r1.1.2.5
> --- HTTPSamplerBean.java 7 Jan 2004 23:34:38 -0000 1.1.2.4
> +++ HTTPSamplerBean.java 8 Jan 2004 22:58:09 -0000 1.1.2.5
> @@ -86,7 +86,6 @@
> import org.apache.jmeter.samplers.Sampler;
>
> import org.apache.jmeter.testbeans.TestBean;
> -import org.apache.jmeter.testelement.TestElement;
> import org.apache.jmeter.testelement.property.CollectionProperty;
> import org.apache.jmeter.testelement.property.PropertyIterator;
>
> @@ -199,18 +198,18 @@
> /*
> * Public properties:
> */
> - private String fileField= "";
> + private String fileField= ""; // TODO: is this valid?
> Choose a sensible default or check it's non-null.
> private File filename= null;
> - private String protocol= "";
> + private String protocol= "http";
> private String path= "";
> private String encodedPath= "";
> private boolean followRedirects= true;
> - private String Method= "";
> + private String Method= "GET";
> private boolean useKeepAlive= false;
> private int port= UNSPECIFIED_PORT;
> - private String domain= "";
> + private String domain= ""; // TODO: choose a sensible
> default or check it's non-null.
> private Arguments arguments= null;
> - private String mimeType= "";
> + private String mimeType= ""; // TODO: is this valid?
> Choose a sensible one or check it's non-null.
> private boolean imageParser= false;
>
> /*
> @@ -248,26 +247,6 @@
> arg.setAlwaysEncoded(false);
> }
> this.getArguments().addArgument(arg);
> - }
> -
> - public void addTestElement(TestElement el)
> - {
> - if (el instanceof CookieManager)
> - {
> - setCookieManager((CookieManager)el);
> - }
> - else if (el instanceof HeaderManager)
> - {
> - setHeaderManager((HeaderManager)el);
> - }
> - else if (el instanceof AuthManager)
> - {
> - setAuthManager((AuthManager)el);
> - }
> - else
> - {
> - super.addTestElement(el);
> - }
> }
>
> /**
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org