summaryrefslogtreecommitdiff
path: root/ace/UUIDTest.cpp
blob: a63532a26126800de7f17f8c33d7473fc902ec0d (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
//$Id$
// UUIDTest.cpp
// $Revision$ $Date$

#include <string>
//#include "JCAFCore/src/Common/Exception.h"
#include "ace/UUID.h"

class Tester
{
public:
  Tester();
  ~Tester();

  int init( int argc, char* argv[]);
  void fini();
  int test();

private:
  int test1( void);
  int test2( void);
  int test3( void);
  int test4( void);
  void test5( void*& d);
};

Tester::Tester()
{
}

Tester::~Tester()
{
}

int Tester::init( int, char*[])
{
  return 0;
}

void Tester::fini( void)
{
}

int Tester::test()
{
//    if (test1() == -1)
//      return -1;
//    if (test2() == -1)
//      return -1;
  ACE_DEBUG ((LM_DEBUG,
	      "%s\n",
	      ACE_UUID_GENERATOR::instance ()->generateUUID ().to_string ()->c_str ()));
  
  return 0;
}



// main ------------------------------------------------------------------------

int main(int argc, char* argv[])

{
  ACE::init();
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Starting %s test at %D\n"), "UUIDTest"));

  int retValue = EXIT_SUCCESS;
  int testRetValue = 0;
  try  {

    Tester tester;

    if (tester.init( argc, argv) == -1) {

      ACE_DEBUG((
          LM_DEBUG,
          "UUIDTest: Tester::init failed\n"));
      return EXIT_FAILURE;

    }
    testRetValue = tester.test();
    tester.fini();

  } catch( std::exception& ex) {

    ACE_ERROR((
        LM_ERROR,
        ACE_TEXT( "(%P|%t)")
        ACE_TEXT( "UUIDTest - got exception %s\n"),
        ex.what()));
    testRetValue = -1;

  } catch( ...) {

    ACE_DEBUG((
        LM_DEBUG,
        "UUIDTest - unknown exception\n"));
    testRetValue = -1;

  }
  if (testRetValue == 0) {

    ACE_DEBUG((
        LM_DEBUG,
        "UUIDTest succeeded\n"));

  } else {

    ACE_DEBUG((
        LM_DEBUG,
        "UUIDTest failed\n"));
    retValue = EXIT_FAILURE;

  }
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Ending %s test at %D\n"), "UUIDTest"));
  ACE::fini();
  return retValue;
}