summaryrefslogtreecommitdiff
path: root/CIAO/connectors/dds4ccm/tests/Policies/main.cpp
blob: e5072f852f8de488543f88d2f8d6987b971cfe30 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#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"
#include "states_test.h"
#include "string_seq.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;
}

bool
test_string_seq ()
{
  DDS::StringSeq foo (2);
  foo.length (2);
  foo[0] = CORBA::string_dup ("bar");
  foo[1] = CORBA::string_dup ("foo");
  DDS_StringSeq rti_foo;
  rti_foo <<= foo;
  DDS::StringSeq tao_foo;
  tao_foo <<= rti_foo;
  return StringSequence::check (rti_foo, tao_foo, "StringSeq");
}

int
ACE_TMAIN (int , ACE_TCHAR **)
{
  PublisherPolicyTest publisher;
  SubscriberPolicyTest subscriber;
  DatawriterPolicyTest datawriter;
  DatareaderPolicyTest datareader;
  TopicPolicyTest topic;
  StatesTest states;
  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");
      test = states.run ();
      ret += handle_result (test, "States");
      ret += test_string_seq ();
    }
  catch (...)
    {
      ACE_ERROR ((LM_ERROR, "ERROR: Unexpected exception caught."));
      return -1;
    }
  return 0;
}