summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2007-02-13 08:09:46 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2007-02-13 08:09:46 +0000
commitd5d1c87305e835beb999c18d56e71b8230a2dbc0 (patch)
tree6ca1dba71f489033538087c4aef03e99b32ffcc3
parent3e28e5560e775081bbf5322273c970db26865a76 (diff)
downloadATCD-d5d1c87305e835beb999c18d56e71b8230a2dbc0.tar.gz
Tue Feb 13 07:41:14 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r--TAO/tests/AMI/AMI.mpc1
-rw-r--r--TAO/tests/AMI/ami_test_i.cpp23
-rw-r--r--TAO/tests/AMI/ami_test_i.h12
-rw-r--r--TAO/tests/AMI/client.cpp64
-rwxr-xr-xTAO/tests/AMI/run_test.pl17
-rw-r--r--TAO/tests/AMI/simple_client.cpp3
6 files changed, 84 insertions, 36 deletions
diff --git a/TAO/tests/AMI/AMI.mpc b/TAO/tests/AMI/AMI.mpc
index eb64c8382f6..1752743fd2e 100644
--- a/TAO/tests/AMI/AMI.mpc
+++ b/TAO/tests/AMI/AMI.mpc
@@ -26,6 +26,7 @@ project(*Client): messaging, taoexe, portableserver, ami {
client.cpp
ami_testS.cpp
ami_testC.cpp
+ ami_test_i.cpp
}
IDL_Files {
}
diff --git a/TAO/tests/AMI/ami_test_i.cpp b/TAO/tests/AMI/ami_test_i.cpp
index 89ae759ce04..2b3c097b6b6 100644
--- a/TAO/tests/AMI/ami_test_i.cpp
+++ b/TAO/tests/AMI/ami_test_i.cpp
@@ -19,10 +19,16 @@
ACE_RCSID(AMI, ami_test_i, "$Id$")
-AMI_Test_i::AMI_Test_i (CORBA::ORB_ptr orb)
+AMI_Test_i::AMI_Test_i (CORBA::ORB_ptr orb,
+ CORBA::Long in_l,
+ const char * in_str,
+ bool check_params)
: orb_ (CORBA::ORB::_duplicate (orb)),
number_ ((CORBA::Long) 931232),
- yadda_ ((CORBA::Long) 140474)
+ yadda_ ((CORBA::Long) 140474),
+ in_l_ (in_l),
+ in_str_(CORBA::string_dup(in_str)),
+ check_params_(check_params)
{
}
@@ -46,11 +52,20 @@ AMI_Test_i::foo (CORBA::Long_out out_l,
throw A::DidTheRightThing();
}
+ if (check_params_)
+ {
+ if (in_l_ != in_l || ACE_OS::strcmp(in_str_, in_str) != 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Parameter corruption on in parameters: %d %d %s %s.\n",
+ in_l_, in_l, in_str_, in_str));
+ }
+ return 0;
+ }
+
return 931234;
}
-
-
void
AMI_Test_i::shutdown (void)
{
diff --git a/TAO/tests/AMI/ami_test_i.h b/TAO/tests/AMI/ami_test_i.h
index d622f225d41..9ff1fe8cfb8 100644
--- a/TAO/tests/AMI/ami_test_i.h
+++ b/TAO/tests/AMI/ami_test_i.h
@@ -26,7 +26,9 @@ class AMI_Test_i : public POA_A::AMI_Test
{
public:
/// ctor
- AMI_Test_i (CORBA::ORB_ptr orb);
+ AMI_Test_i (CORBA::ORB_ptr orb,
+ CORBA::Long in_l = 0, const char * in_str = 0,
+ bool check_params = false);
// The AMI_Test methods.
CORBA::Long foo (CORBA::Long_out out_l,
@@ -47,7 +49,13 @@ private:
CORBA::Long number_;
CORBA::Long yadda_;
-};
+ CORBA::Long in_l_;
+
+ CORBA::String_var in_str_;
+
+ bool check_params_;
+};
#endif /* TAO_AMI_TEST_I_H */
+
diff --git a/TAO/tests/AMI/client.cpp b/TAO/tests/AMI/client.cpp
index e03fb3dc157..5b2f2442b33 100644
--- a/TAO/tests/AMI/client.cpp
+++ b/TAO/tests/AMI/client.cpp
@@ -16,7 +16,7 @@
#include "ace/Get_Opt.h"
#include "ace/Task.h"
-#include "ami_testS.h"
+#include "ami_test_i.h"
ACE_RCSID (AMI,
client,
@@ -27,16 +27,24 @@ int nthreads = 5;
int niterations = 5;
int debug = 0;
int number_of_replies = 0;
+bool collocated = false;
+
+CORBA::Long in_number = 931232;
+const char * in_str = "Let's talk AMI.";
+int parameter_corruption = 0;
int
parse_args (int argc, char *argv[])
{
- ACE_Get_Opt get_opts (argc, argv, "dk:n:i:");
+ ACE_Get_Opt get_opts (argc, argv, "cdk:n:i:");
int c;
while ((c = get_opts ()) != -1)
switch (c)
{
+ case 'c':
+ collocated = true;
+ break;
case 'd':
debug = 1;
break;
@@ -54,6 +62,7 @@ parse_args (int argc, char *argv[])
ACE_ERROR_RETURN ((LM_ERROR,
"usage: %s "
"-d "
+ "-c"
"-k <ior> "
"-n <nthreads> "
"-i <niterations> "
@@ -65,6 +74,7 @@ parse_args (int argc, char *argv[])
return 0;
}
+
/**
* @class Client
*
@@ -95,11 +105,19 @@ public:
class Handler : public POA_A::AMI_AMI_TestHandler
{
public:
- Handler (void) {};
+ Handler (void)
+ {
+ };
void foo (CORBA::Long result,
CORBA::Long out_l)
{
+ if (result == 0)
+ {
+ ACE_ERROR((LM_ERROR, "ERROR: Callback method detected parameter corruption."));
+ parameter_corruption = 1;
+ }
+
if (debug)
{
ACE_DEBUG ((LM_DEBUG,
@@ -150,11 +168,11 @@ public:
ACE_DEBUG ((LM_DEBUG,
"Callback method <set_yadda_excep> called: \n"));
};
- ~Handler (void) {};
+ ~Handler (void)
+ {
+ };
- void inout_arg_test (
- const char *
- )
+ void inout_arg_test (const char *)
{
ACE_DEBUG ((LM_DEBUG,
"Callback method <set_yadda_excep> called: \n"));
@@ -179,11 +197,21 @@ main (int argc, char *argv[])
if (parse_args (argc, argv) != 0)
return 1;
- CORBA::Object_var object =
- orb->string_to_object (ior);
+ A::AMI_Test_var server;
- A::AMI_Test_var server =
- A::AMI_Test::_narrow (object.in ());
+ if (!collocated)
+ {
+ CORBA::Object_var object =
+ orb->string_to_object (ior);
+
+ server = A::AMI_Test::_narrow (object.in ());
+ }
+ else
+ {
+ AMI_Test_i * servant =
+ new AMI_Test_i(orb.in(), in_number, in_str, true);
+ server = servant->_this();
+ }
if (CORBA::is_nil (server.in ()))
{
@@ -235,8 +263,7 @@ main (int argc, char *argv[])
while (number_of_replies > 0)
{
- CORBA::Boolean pending =
- orb->work_pending();
+ CORBA::Boolean pending = orb->work_pending();
if (pending)
{
@@ -251,13 +278,10 @@ main (int argc, char *argv[])
(nthreads*niterations) - number_of_replies));
}
-
client.thr_mgr ()->wait ();
ACE_DEBUG ((LM_DEBUG, "threads finished\n"));
- //client.ami_test_var_->shutdown ();
-
root_poa->destroy (1, // ethernalize objects
0 // wait for completion
);
@@ -270,7 +294,7 @@ main (int argc, char *argv[])
return 1;
}
- return 0;
+ return parameter_corruption;
}
// ****************************************************************
@@ -288,13 +312,9 @@ Client::svc (void)
{
try
{
- CORBA::Long number = 931232;
-
for (int i = 0; i < this->niterations_; ++i)
{
- ami_test_var_->sendc_foo (the_handler_var_.in (),
- number,
- "Let's talk AMI.");
+ ami_test_var_->sendc_foo (the_handler_var_.in (), in_number, in_str);
}
if (debug)
{
diff --git a/TAO/tests/AMI/run_test.pl b/TAO/tests/AMI/run_test.pl
index 4797af89617..dda1be7f98b 100755
--- a/TAO/tests/AMI/run_test.pl
+++ b/TAO/tests/AMI/run_test.pl
@@ -16,10 +16,10 @@ $iterations = '1';
foreach $i (@ARGV) {
if ($i eq '-mux') {
$client_conf = PerlACE::LocalFile ("muxed$PerlACE::svcconf_ext");
- }
+ }
elsif ($i eq '-debug') {
$debug_level = '1';
- }
+ }
elsif ($i eq '-exclusive') {
$client_conf = PerlACE::LocalFile ("exclusive$PerlACE::svcconf_ext");
}
@@ -42,7 +42,7 @@ if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) {
print STDERR "ERROR: cannot find file <$iorfile>\n";
$SV->Kill (); $SV->TimedWait (1);
exit 1;
-}
+}
$CL = new PerlACE::Process ("simple_client",
"-ORBsvcconf $client_conf "
@@ -62,11 +62,16 @@ $client2 = $CL2->SpawnWaitKill (60);
$server = $SV->WaitKill (10);
+$CL3 = new PerlACE::Process ("client",
+ "-c -ORBdebuglevel $debug_level");
+
+$client3 = $CL3->SpawnWaitKill (60);
+
unlink $iorfile;
-if ($server != 0 || $client != 0 || $client2 != 0) {
+if ($server != 0 || $client != 0 || $client2 != 0 || $client3 != 0) {
exit 1;
}
-
+
exit 0;
-
+
diff --git a/TAO/tests/AMI/simple_client.cpp b/TAO/tests/AMI/simple_client.cpp
index add285c7b5f..b244bc91722 100644
--- a/TAO/tests/AMI/simple_client.cpp
+++ b/TAO/tests/AMI/simple_client.cpp
@@ -222,8 +222,7 @@ main (int argc, char *argv[])
// Begin test of attributes
ami_test_var->sendc_get_yadda (the_handler_var.in ());
- ami_test_var->sendc_set_yadda (the_handler_var.in (),
- 4711);
+ ami_test_var->sendc_set_yadda (the_handler_var.in (), 4711);
ami_test_var->sendc_get_yadda (the_handler_var.in ());