summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Log/Basic_Log_Test/client.cpp
blob: d3a01e870ddd835cc4e84ede6b4aad7d229cb142 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// $Id$

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

int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  BasicLog_Test log_test;

  ACE_DEBUG((LM_DEBUG, "\nBasic Log test \n\n"));

  try
    {
      if (log_test.init(argc, argv) == -1)
        {
          ACE_ERROR_RETURN((LM_ERROR,
                            "xx - Failed initializing BasicLog_Test.\n"),
                           -1);
        }

      // We may want to replace this with a run on the BasicLog_Test.
      // If we cannot create a log, there is no use continuing.
      // Create a log with max size (octets) of 1000.
      if (log_test.test_CreateLog(1000) == -1)
        {
          ACE_ERROR_RETURN((LM_ERROR,
                            "xx - Failed creating log and bailing out.\n"),
                           -1);
        }
      else
        {
          ACE_DEBUG((LM_DEBUG,
                     "** - The creating log test succeeded.\n\n"));
        }

      // go easy until this works
      //@@ use ACE_U64_TO_U32 to convert ULongLong to ULong
      //in call to test_retrieval
    /*  if (log_test.test_retrieval(10) == -1)
        {
          ACE_DEBUG((LM_ERROR,"The test of retrieval failed.\n"));
        }
      else
        {
          ACE_DEBUG((LM_ERROR,"The test of retrieval succeeded.\n"));
        }
    */
      if (log_test.test_log_destroy() == -1)
        {
          ACE_ERROR_RETURN((LM_ERROR,
                            "xx - Failed destroying  log.\n\n"),
                           -1);
        }
      else
        {
          ACE_DEBUG((LM_DEBUG,
                     "** - The destroying log test succeeded.\n\n"));
        }

      if (log_test.test_CreateLog(1000) == -1)
        {
          ACE_ERROR_RETURN((LM_ERROR,
                            "xx - Failed creating log and bailing out.\n\n"),
                           -1);
        }

      if (log_test.test_capacity_alarm_threshold() == -1)
        {
          ACE_ERROR((LM_ERROR,"xx - The capacity alarm threshold test failed.\n\n"));
        }
      else
        {
          ACE_DEBUG((LM_DEBUG,"** - The capacity alarm threshold test succeeded.\n\n"));
        }

      if (log_test.test_LogAction() == -1)
        {
          ACE_ERROR((LM_ERROR,"xx - The log action test failed.\n\n"));
        }
      else
        {
          ACE_DEBUG((LM_DEBUG,"** - The log action test succeeded.\n\n"));
        }

      if (log_test.test_adminState() == -1)
        {
          ACE_ERROR((LM_ERROR,"xx - The administration test failed.\n\n"));
        }
      else
        {
          ACE_DEBUG((LM_DEBUG,"** - The administration test succeeded.\n\n"));
        }

      if (log_test.test_logSize() == -1)
        {
          ACE_ERROR((LM_ERROR,"xx - The log size test failed.\n\n"));
        }
      else
        {
          ACE_DEBUG((LM_DEBUG,"** - The log size test succeeded.\n\n"));
        }

      /* if (log_test.test_logCompaction(30) == -1)
        {
          ACE_DEBUG((LM_ERROR,"xx - The test of log compaction failed.\n\n"));
        }
      else
        {
          ACE_DEBUG((LM_ERROR,"** - The test of log compaction succeeded.\n\n"));
        }
      */

      if (log_test.test_week_mask() == -1)
        {
          ACE_ERROR((LM_ERROR,"xx - The week mask test failed.\n\n"));
        }
      else
        {
          ACE_DEBUG((LM_DEBUG,"** - The week mask test succeeded.\n\n"));
        }
    }
  catch (const ::CORBA::Exception &e)
    {
      e._tao_print_exception("Caught CORBA exception");
      return 1;
    }

  return 0;
}