summaryrefslogtreecommitdiff
path: root/CIAO/connectors/dds4ccm/tests/Policies/main.cpp
blob: 985081f29ae5eb9fed4300f4a219ccd2d32938e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// $Id$

#include "ace/OS_main.h"
#include "ace/Log_Msg.h"

#include "pub_qos_test.h"
#include "sub_qos_test.h"
#include "dw_qos_test.h"
#include "dr_qos_test.h"
#include "tp_qos_test.h"
#include "dp_qos_test.h"

int handle_result (const int & result,
                   const char * test)
{
  int ret = 0;
  if (result == -1)
    {
      ACE_ERROR ((LM_ERROR, "ERROR POLICIES : "
                            "Exception caught while testing "
                            "%C QoS\n",
                            test));
    }
  else if (result > 0)
    {
      ret = result;
      ACE_ERROR ((LM_ERROR, "ERROR POLICIES : "
                            "<%d> errors found while testing "
                            "%C QoS\n",
                            result, test));
    }
  else
    {
      ACE_DEBUG ((LM_DEBUG, "%C QoS test passed!\n",
                             test));
    }
  return ret;
}

int
ACE_TMAIN (int , ACE_TCHAR **)
{
  PublisherPolicyTest publisher;
  SubscriberPolicyTest subscriber;
  DatawriterPolicyTest datawriter;
  DatareaderPolicyTest datareader;
  TopicPolicyTest topic;
  DomainParticipantPolicyTest domainparticipant;

  int ret = 0;
  int test = 0;
  try
    {
      test = publisher.run ();
      ret += handle_result (test, "Publisher");
      test = subscriber.run ();
      ret += handle_result (test, "Subscriber");
      test = datawriter.run ();
      ret += handle_result (test, "Datawriter");
      test = datareader.run ();
      ret += handle_result (test, "DataReader");
      test = topic.run ();
      ret += handle_result (test, "Topic");
      test = domainparticipant.run ();
      ret += handle_result (test, "DomainParticipant");
    }
  catch (...)
    {
      ACE_ERROR ((LM_ERROR, "ERROR: Unexpected exception caught."));
      return -1;
    }
  return 0;
}