1 # File: Stem/Test/Echo.pm
3 # This file is part of Stem.
4 # Copyright (C) 1999, 2000, 2001 Stem Systems, Inc.
6 # Stem is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # Stem is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Stem; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # For a license to use the Stem under conditions other than those
21 # described here, to purchase support for this software, or to purchase a
22 # commercial warranty contract, please contact Stem Systems at:
24 # Stem Systems, Inc. 781-643-7504
25 # 79 Everett St. info@stemsystems.com
30 package Stem::Test::Echo ;
34 my $attr_spec = [ { } ];
38 my( $class ) = shift ;
40 my $self = Stem::Class::parse_args( $attr_spec, @_ ) ;
41 return $self unless ref $self ;
46 # send this cell messages if you want test default delivery speed
47 # this will handle all messages not covered by other methods
51 my ( $self, $msg ) = @_ ;
53 my $reply_msg = $msg->reply() ;
55 $reply_msg->dispatch() ;
60 # send this cell data messages if you want to just echo the data
64 my ( $self, $msg ) = @_ ;
66 #print $msg->dump( 'ECHO data_in' ) ;
68 my $reply_msg = $msg->reply(
73 #print $reply_msg->dump( 'ECHO data reply' ) ;
75 $reply_msg->dispatch() ;
80 # send this cell 'echo' type messages if you want test plain reply speed
84 my ( $self, $msg ) = @_ ;
86 $msg->reply()->dispatch() ;
91 # send this cell 'echo_data' type messages if you want test reply with data
95 my ( $self, $msg ) = @_ ;
97 #print $msg->dump( 'ECHO_DATA' ) ;
99 my $data = $msg->data() ;
101 my $reply_msg = $msg->reply( data => { echo => $data } ) ;
103 $reply_msg->dispatch() ;
108 # send this cell 'echo' cmd messages if you want test plain command speed
117 # send this cell 'echo_data' cmd messages if you want test command
122 my ( $self, $msg ) = @_ ;
124 my $data = $msg->data() ;
137 Stem::Test::Echo - This cell accepts messages and sends back reply
138 messages or command data. It can be used to test message receipt,
139 replies, and command returns and to benchmark message throughput.
144 'class' => 'Stem::Test::Echo',
145 'name' => 'test_echo',
150 This cell accepts various messages, all of which will echo some
151 message back to the sender.
153 An echo type message will do a reply with no data.
155 An echo_data type message will do a reply with the sent data.
157 An echo command message will return a null string.
159 An echo_data command message will return the data.
161 Any other message type or command will do a plain reply like
162 an 'echo' type message.