summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsmit <msmit@remedy.nl>2010-06-01 07:19:31 +0000
committermsmit <msmit@remedy.nl>2010-06-01 07:19:31 +0000
commita5f43ac1b9274edcb0b5db0ad0b91aba314354a2 (patch)
tree2f6be22e1f7b88f62de8332aa0cd8fc4f1353bcb
parent349c15058d1cb90d265edd34e015c77875ef8c81 (diff)
downloadATCD-a5f43ac1b9274edcb0b5db0ad0b91aba314354a2.tar.gz
Tue Jun 1 07:16:02 UTC 2010 Marcel Smit <msmit@remedy.nl>
* tests/CIF/Navigation/client.cpp: Resolved test error. * tests/CIF/Receptacle/client.cpp: Organized code.
-rw-r--r--CIAO/ChangeLog8
-rw-r--r--CIAO/tests/CIF/Navigation/client.cpp1
-rw-r--r--CIAO/tests/CIF/Receptacle/client.cpp170
3 files changed, 104 insertions, 75 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog
index 0f534075f0e..1739605c5f7 100644
--- a/CIAO/ChangeLog
+++ b/CIAO/ChangeLog
@@ -1,3 +1,11 @@
+Tue Jun 1 07:16:02 UTC 2010 Marcel Smit <msmit@remedy.nl>
+
+ * tests/CIF/Navigation/client.cpp:
+ Resolved test error.
+
+ * tests/CIF/Receptacle/client.cpp:
+ Organized code.
+
Mon May 31 13:58:17 UTC 2010 Marcel Smit <msmit@remedy.nl>
* bin/ciao_tests.lst:
diff --git a/CIAO/tests/CIF/Navigation/client.cpp b/CIAO/tests/CIF/Navigation/client.cpp
index a9b27446035..f2984d4a70f 100644
--- a/CIAO/tests/CIF/Navigation/client.cpp
+++ b/CIAO/tests/CIF/Navigation/client.cpp
@@ -121,7 +121,6 @@ run_test (::Navigation_ptr nav)
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Expected exception caught:");
- ++ret;
}
#endif
}
diff --git a/CIAO/tests/CIF/Receptacle/client.cpp b/CIAO/tests/CIF/Receptacle/client.cpp
index e2d030d6fd6..516e1a13ad9 100644
--- a/CIAO/tests/CIF/Receptacle/client.cpp
+++ b/CIAO/tests/CIF/Receptacle/client.cpp
@@ -9,87 +9,99 @@ const char * artifact_name = "Receptacle";
const char * entrypoint_name1 = "Receptacle";
const char * entrypoint_name2 = "Provider";
+::Components::Cookie *
+connect (Receptacle_ptr rec,
+ ::CORBA::Object_ptr facet)
+{
+ ::Components::Cookie_var ck;
+ try
+ {
+ ck = rec->connect ("rec_foo", facet);
+ }
+ catch (const ::Components::InvalidName &)
+ {
+ ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
+ "Error: InvalidName "
+ "exception during connect\n"));
+ }
+ catch (const ::Components::InvalidConnection &)
+ {
+ ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
+ "Error: InvalidConnection "
+ "exception during connect\n"));
+ }
+ catch (const ::Components::AlreadyConnected &)
+ {
+ ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
+ "Error: AlreadyConnected "
+ "exception during connect\n"));
+ }
+ catch (const ::Components::ExceededConnectionLimit &)
+ {
+ ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
+ "Error: ExceededConnectionLimit "
+ "exception during connect\n"));
+ }
+ return ck._retn ();
+}
+
+::CORBA::Object_ptr
+disconnect (Receptacle_ptr rec,
+ ::Components::Cookie * ck)
+{
+ ::CORBA::Object_var obj;
+ try
+ {
+ obj = rec->disconnect ("rec_foo", ck);
+ }
+ catch (const ::Components::InvalidName &)
+ {
+ ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
+ "Error: InvalidName "
+ "exception during connect\n"));
+ }
+ catch (const ::Components::InvalidConnection &)
+ {
+ ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
+ "Error: InvalidConnection "
+ "exception during connect\n"));
+ }
+ catch (const ::Components::CookieRequired &)
+ {
+ ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
+ "Error: CookieRequired "
+ "exception during connect\n"));
+ }
+ catch (const ::Components::NoConnection &)
+ {
+ ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
+ "Error: NoConnection "
+ "exception during connect\n"));
+ }
+ return obj._retn ();
+}
+
int
run_test (Receptacle_ptr rec,
Provider_ptr ,
::CORBA::Object_ptr facet)
{
+ int ret = 0;
try
{
- //CONNECT
- ::Components::Cookie_var ck;
- try
+ ::Components::Cookie_var ck = connect (rec, facet);
+ if (ck.in ())
{
- ck = rec->connect ("rec_foo", facet);
ACE_DEBUG ((LM_DEBUG, "Receptacle run_test - "
"connect test passed !\n"));
}
- catch (const ::Components::InvalidName &)
- {
- ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
- "Error: InvalidName "
- "exception during connect\n"));
- }
- catch (const ::Components::InvalidConnection &)
- {
- ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
- "Error: InvalidConnection "
- "exception during connect\n"));
- }
- catch (const ::Components::AlreadyConnected &)
- {
- ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
- "Error: AlreadyConnected "
- "exception during connect\n"));
- }
- catch (const ::Components::ExceededConnectionLimit &)
- {
- ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
- "Error: ExceededConnectionLimit "
- "exception during connect\n"));
- }
- // DISCONNECT
- try
- {
- ::CORBA::Object_var obj = rec->disconnect ("rec_foo", ck);
- if (obj->_is_equivalent(facet))
- {
- ACE_DEBUG ((LM_DEBUG, "Receptacle run_test - "
- "disconnect test passed !\n"));
- }
- else
- {
- ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
- "Error : Returned object unequal to "
- "original object: "
- "expected <%@> - received <%@>\n",
- facet, obj.in ()));
- }
- }
- catch (const ::Components::InvalidName &)
- {
- ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
- "Error: InvalidName "
- "exception during connect\n"));
- }
- catch (const ::Components::InvalidConnection &)
- {
- ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
- "Error: InvalidConnection "
- "exception during connect\n"));
- }
- catch (const ::Components::CookieRequired &)
- {
- ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
- "Error: CookieRequired "
- "exception during connect\n"));
- }
- catch (const ::Components::NoConnection &)
+ ::CORBA::Object_var obj = disconnect (rec, ck.in ());
+ if (!::CORBA::is_nil (obj.in ()))
{
- ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
- "Error: NoConnection "
- "exception during connect\n"));
+ ACE_DEBUG ((LM_DEBUG, "Receptacle run_test - "
+ "disconnect test passed !\n"));
}
+
// TODO:
// Exception tests for connect/disconnect
// #if !defined (CCM_LW)
@@ -104,16 +116,14 @@ run_test (Receptacle_ptr rec,
// raises (InvalidName);
// #endif
}
-
catch (...)
{
ACE_ERROR ((LM_ERROR, "Receptacle run_test - "
"Error: Unknown "
"exception during run_test\n"));
+ ++ret;
}
-
-
- return 0;
+ return ret;
}
int
@@ -122,6 +132,7 @@ ACE_TMAIN (int argc, ACE_TCHAR **argv)
using namespace ::CIAO::Deployment;
CIF_Common cmd;
+ int ret = 0;
try
{
if (cmd.init (argc, argv, artifact_name) != 0)
@@ -179,7 +190,7 @@ ACE_TMAIN (int argc, ACE_TCHAR **argv)
"while providing facet\n"));
}
- run_test (rec.in (), prov.in (), facet.in ());
+ ret = run_test (rec.in (), prov.in (), facet.in ());
cmd.shutdown (server1.in (), cont1.in (), comp1.in (), false);
cmd.shutdown (server2.in (), cont2.in (), comp2.in ());
@@ -199,5 +210,16 @@ ACE_TMAIN (int argc, ACE_TCHAR **argv)
ACE_ERROR ((LM_ERROR, "Error: Caught unknown exception\n"));
return 1;
}
- return 0;
+ if (ret != 0)
+ {
+ ACE_ERROR ((LM_ERROR, "ACE_TMAIN : "
+ " %d error found during tests.\n",
+ ret));
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR, "ACE_TMAIN : "
+ " No error found during tests.\n"));
+ }
+ return ret;
}