Thanks for your replies...
I used the TCPSampler as a base. I have attached corba.zip the source code
in case you are interested. You can ignore classes MethodTask and
VerifyHome.

The CorbaConfigGui has a JFileChooser to select the input data file (a
.properties file), select the method chosen and display the input data for
that chosen method. The CorbaSampler is used as the 'model' (as in MVC) to
store these choices.
The CorbaSamplerGUI does this:
    public void configure(TestElement element)
    {
        super.configure(element);
        CorbaDefaultPanel.configure(element);
    }

    public TestElement createTestElement()
    {
        CorbaSampler sampler = new CorbaSampler();
        modifyTestElement(sampler);
        return sampler;
    }
    public void modifyTestElement(TestElement sampler)
    {
        sampler.clear();
        ((CorbaSampler) sampler).addTestElement(
            CorbaDefaultPanel.createTestElement());
        this.configureTestElement(sampler);
    }



-----Original Message-----
From: Michael Stover [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 18, 2005 5:47 PM
To: JMeter Developers List
Subject: [Fwd: Re: sampler being created more than once??]

Actually, createTestElement is precisely where the element should be
created, and you can run into problems if you do not create a new one
with each call to this method.

I suspect the real problem lies elsewhere - maybe the sampler being made
here isn't using the properties map from AbstractTestElement?  If data
is being stored in instance variables, that won't work unless it
implements TestBean too.

-Mike

On Tue, 2005-01-18 at 14:59, sebb wrote:
> On Mon, 17 Jan 2005 16:39:43 -0600, Anil Philip
> <[EMAIL PROTECTED]> wrote:
> > I am writing a CorbaSampler (aka TCPSampler()).
> > 
> > In my SamplerGUI, am I creating the sampler in the correct place?
> 
> I don't think so.
> 
> GUI sampler classes should only do what is necessary to ensure that
> the display agrees with the test element.
> 
> They should not create anything needed by the sampler, otherwise the
> sampler won't work in non-GUI mode...
>  
> >    public TestElement createTestElement()
> > 
> >     {
> > 
> >         CorbaSampler sampler = new CorbaSampler();
> > 
> >         modifyTestElement(sampler);
> > 
> >         return sampler;
> > 
> >     }
> > 
> > However I find that createTestElement() is indirectly called from
several
> > places by JMeter (26 places!).
> > 
> > So after I initially create JMeter, I set some data in it. In the
sample()
> > call, I try to retrieve the data but find that a *new* instance of
> > CorbaSampler() has been created! So that now my data is lost.
> 
> Not surprising ...!
>  
> > Thanks,
> > 
> > Anil Philip
> > 
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
-- 
Michael Stover <[EMAIL PROTECTED]>
Apache Software Foundation


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


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

Reply via email to