Do you have access to the Java part of the application? More particular, the
class that sends the object?
If not, you could dive into the code, get the statements from the code that
do the actual sending, and use those in your Jython script.
A quick example using socket connection in jython:
from java.net import Socket
from java.io import PrintStream
class TestRunner:
def __call__(self):
client = Socket("hostname", 8989)
out = PrintStream(client.getOutputStream())
f = open("request.out", 'r')
message = f.read()
f.close()
out.println(message)
out.close()
client.close()
hope this helps you further,
Marc.
On Dec 17, 2007 4:12 PM, Gurkan Ustunkar <gurko80@...> wrote:
> Hello Marc,
>
> Here is the setting:
>
> I have a server and clients that communicate with the server.
>
> two type of communication takes place between server and client.. one is
> http. this is used when file transferring in between takes place..
> however the one I want to test is not a standart protocol. client creates
> objects and send them over socketconnection to the specified port of the
> server.. I have now a sample serialized object (in a file called
> request.out) and want to send this to the the server using multiple
> threads to simulate the load on the server..
>
> to sum up the client runs a java application and this application creates
> objects and send them to server using socketconnection.
>
> so what I try to do with grinder is to read the request.out I created with
> the client application and send the object to the server application (just
> to imitate what client does).. What you understand is correct :)
>
> SENDER - the client is being imitated and I want to test the load on the
> RECEIVER - the server if 100 clients send the same object to the server..
>
> ----- Original Message ----
> From: Marc Van Giel <marc.vangiel@...>
> To: grinder-use <grinder-use@...>
> Sent: Monday, December 17, 2007 4:46:00 PM
> Subject: Re: [Grinder-use] socketconnection java object load test
>
> Hi Gurkan,
>
> I would gladly assist, but I'm not familiar with the interface you are
> trying to test.
>
> Please explain to me, without going to much into detail, the way your
> send/receive works.
> Do you have access to the Java classes that do the sending?
> What is being send? Why the de-serialization?
>
> If I understand correctly, you only need to serialize to send, correct?
> SENDER "sends request.out" ---> RECEIVER "deserializes request.out" --->
> object
>
> And SENDER is being simulated/tested by The Grinder, correct?
>
> regards,
> Marc.
>
> On Dec 17, 2007 2:46 PM, Gurkan Ustunkar <gurko80@... > wrote:
>
> > Hi Marc,
> >
> > I really appreciate your help.
> >
> > Say I am able to deserialize the object, how can I set the server ID
> > (script for that). This is not a http message. So I have no headers. So the
> > example scripts are of no help..
> >
> > I just want to:
> >
> > 1. deserialize the object from file request.out
> > 2. send the result to port 8989 of my server.
> >
> >
> > ----- Original Message ----
> > From: Marc Van Giel <marc.vangiel@... >
> > To: grinder-use <grinder-use@...>
> > Sent: Thursday, December 13, 2007 11:44:37 AM
> > Subject: Re: [Grinder-use] socketconnection java object load test
> >
> > Hi,
> >
> > If it's possible in Java, it should be possible in Grinder.
> > Jython let's you use java seamlessly.
> >
> >
> > from java.io import ObjectOutput, File
> > from
> > java.io import ObjectOutputStream, ObjectInputStream
> > from java.io import FileOutputStream, FileInputStream
> >
> > // Serialize to a file
> > ObjectOutput out = new ObjectOutputStream(new FileOutputStream(*"objfile.ser"*));
> > out.writeObject(object);
> > out.close();
> >
> > // Deserialize
> > File file = new File(*"objfile.ser"*);
> > ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
> > *ObjectType* obj = (*ObjectType***) in.readObject();
> > in.close();
> >
> >
> > best regards,
> > Marc.
> >
> >
> > On Dec 11, 2007 4:01 PM, Gurkan Ustunkar < gurko80@...> wrote:
> >
> > >
> > > Hello Again,
> > >
> > > I think I am getting somewhere.. Is it possible to deserialize an
> > > object using grinder?
> > >
> > > I could not figure out using ObjectInputStream
> > >
> > >
> > >
> > > what I just want to do is to read the object that is serialized (say
> > > object.out) and send the resulting object to the IP I will specify.
> > >
> > >
> > >
> > > Thanks in advance..
> > >
> > > ----- Original Message ----
> > > From: Marc Van Giel <marc.vangiel@... >
> > > To: grinder-use < grinder-use@...>
> > > Sent: Tuesday, December 11, 2007 12:56:06 PM
> > > Subject: Re: [Grinder-use] socketconnection java object load test
> > >
> > > Check out the script that sends messages.
> > >
> > > Small test example:
> > >
> > > from my.java.lib
> > > import MySenderObject
> > > from net.grinder.script.Grinder
> > >
> > > import grinder
> > > from net.grinder.script import Test
> > >
> > >
> > > class TestRunner:
> > > def __call__(self):
> > > log = grinder.logger.output
> > >
> > > sender = MySenderObject()
> > > instrumentedSender = Test(1, "Send a message").wrap(sender)
> > >
> > > log("Sending the message")
> > >
> > > message = "sos"
> > > instrumentedSender.send(message)
> > >
> > >
> > > Just replace the sender object with your actual implementation class.
> > >
> > > cheers,
> > > Marc.
> > >
> > > On Dec 11, 2007 11:12 AM, Gurkan Ustunkar <gurko80@...> wrote:
> > >
> > > >
> > > > Hello Marc,
> > > >
> > > > Thank you for the quick answer.
> > > >
> > > > I am not sure of the syntax to use for this:
> > > >
> > > > "wrap your java class that does the sending in the Grinder Test
> > > > object, and call the 'send' method from it."
> > > >
> > > > I have checked the example scripts but they haven't been much of
> > > > help.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ----- Original Message ----
> > > > From: Marc Van Giel <marc.vangiel@... >
> > > > To: grinder-use <grinder-use@...>
> > > > Sent: Tuesday, December 11, 2007 11:59:34 AM
> > > > Subject: Re: [Grinder-use] socketconnection java object load test
> > > >
> > > > Hello,
> > > >
> > > > It should be doable. Easiest way is to wrap your java class that
> > > > does the sending in the Grinder Test object, and call the 'send' method from
> > > > it.
> > > >
> > > > Check out the examples on the Grinder Script Gallery page (
> > > > http://grinder.sourceforge.net/g3/script-gallery.html)
> > > >
> > > > cheers,
> > > > Marc.
> > > >
> > > > On Dec 11, 2007 10:12 AM, Gurkan Ustunkar < gurko80@...>
> > > > wrote:
> > > >
> > > > > Hello,
> > > > >
> > > > > I am a newbie so sorry if the question is so obvious.
> > > > >
> > > > > I have recently downloaded grinder 3 beta33 and I am trying
> > > > > to perform a load test on our server. We have a simple network application
> > > > > (java) and in this application we are sending an object to the server using
> > > > > socketconnection. We have clients all over the place. So a distributed
> > > > > testing of the load is necessary.
> > > > >
> > > > > I haven't quite figured it out to send the object (or similarly
> > > > > call the relevant java code via grinder) to the server yet. Can it be
> > > > > doable? If so how?
> > > > >
> > > > > Any help is highly appreciated.
> > > > >
> > > > > Regards,
> > > > >
> > > > > Gurkan
> > > > >
> > > > >
> > > > > ------------------------------
> > > > > Looking for last minute shopping deals? Find them fast with Yahoo!
> > > > > Search.
> > > > > <http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping>
> > > > >
> > > > > --
> > > > > This message has been scanned for viruses and
> > > > > dangerous content by *MailScanner* <http://www.mailscanner.info/>,
> > > > > and is
> > > > > believed to be clean.
> > > > >
> > > > >
> > > > > -------------------------------------------------------------------------
> > > > > SF.Net email is sponsored by:
> > > > > Check out the new SourceForge.net <http://sourceforge.net/>Marketplace.
> > > > > It's the best place to buy or sell services for
> > > > > just about anything Open Source.
> > > > > http://sourceforge.net/services/buy/index.php
> > > > > _______________________________________________
> > > > > grinder-use mailing list
> > > > > grinder-use@...
> > > > > https://lists.sourceforge.net/lists/listinfo/grinder-use
> > > > >
> > > > >
> > > >
> > > >
> > > > ------------------------------
> > > > Never miss a thing. Make Yahoo your homepage.<http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs>
> > > >
> > > > --
> > > > This message has been scanned for viruses and
> > > > dangerous content by *MailScanner* <http://www.mailscanner.info/>,
> > > > and is
> > > > believed to be clean.
> > > >
> > > >
> > > > -------------------------------------------------------------------------
> > > > SF.Net email is sponsored by:
> > > > Check out the new SourceForge.net <http://sourceforge.net/>Marketplace.
> > > > It's the best place to buy or sell services for
> > > > just about anything Open Source.
> > > > http://sourceforge.net/services/buy/index.php
> > > > _______________________________________________
> > > > grinder-use mailing list
> > > > grinder-use@...
> > > > https://lists.sourceforge.net/lists/listinfo/grinder-use
> > > >
> > > >
> > >
> > >
> > > ------------------------------
> > > Never miss a thing. Make Yahoo your homepage.<http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs>
> > >
> > > --
> > > This message has been scanned for viruses and
> > > dangerous content by *MailScanner* <http://www.mailscanner.info/>, and
> > > is
> > > believed to be clean.
> > >
> > >
> > > -------------------------------------------------------------------------
> > > SF.Net email is sponsored by:
> > > Check out the new SourceForge.net <http://sourceforge.net/>Marketplace.
> > > It's the best place to buy or sell services for
> > > just about anything Open Source.
> > > http://sourceforge.net/services/buy/index.php
> > > _______________________________________________
> > > grinder-use mailing list
> > > grinder-use@...
> > > https://lists.sourceforge.net/lists/listinfo/grinder-use
> > >
> > >
> >
> >
> >
> > ------------------------------
> > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
> > it now.<http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ+>
> >
> > --
> > This message has been scanned for viruses and
> > dangerous content by *MailScanner* <http://www.mailscanner.info/>, and
> > is
> > believed to be clean.
> >
> >
> > -------------------------------------------------------------------------
> > SF.Net email is sponsored by:
> > Check out the new SourceForge.net <http://sourceforge.net/> Marketplace.
> > It's the best place to buy or sell services
> > for just about anything Open Source.
> > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> >
> > _______________________________________________
> > grinder-use mailing list
> > grinder-use@...
> > https://lists.sourceforge.net/lists/listinfo/grinder-use
> >
> >
>
>
> ------------------------------
> Never miss a thing. Make Yahoo your homepage.<http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs>
>
> --
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services
> for just about anything Open Source.
>
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> grinder-use mailing list
> grinder-use@...
> https://lists.sourceforge.net/lists/listinfo/grinder-use
>
>
|