2 //=============================================================================
4 * @file CC_test_utils.cpp
6 * This class provides a namespace for utility functions for the
7 * concurrency service test.
9 * @author Torben Worm <tworm@cs.wustl.edu>
11 //=============================================================================
14 #include "CC_test_utils.h"
15 #include "CC_naming_service.h"
16 #include "ace/Log_Msg.h"
18 char *CC_TestUtils::get_lock_mode_name (CosConcurrencyControl::lock_mode mode
)
20 if (mode
==CosConcurrencyControl::read
)
21 return const_cast<char*> ("read");
23 if (mode
==CosConcurrencyControl::write
)
24 return const_cast<char*> ("write");
26 if (mode
==CosConcurrencyControl::upgrade
)
27 return const_cast<char*> ("upgrade");
29 if (mode
==CosConcurrencyControl::intention_read
)
30 return const_cast<char*> ("intention_read");
32 if (mode
==CosConcurrencyControl::intention_write
)
33 return const_cast<char*> ("intention_write");
35 return const_cast<char*> ("unknown lock mode");
38 CosConcurrencyControl::LockSet_ptr
39 CC_TestUtils::create_lock_set ()
41 // Create the lock set and return an obj ref corresponding to the
43 CosConcurrencyControl::LockSet_ptr
lock_set(0);
47 CC_naming_service::Instance()->get_lock_set_factory ()->create ();
49 if (CORBA::is_nil (lock_set
))
50 ACE_ERROR_RETURN ((LM_ERROR
,
51 "null lock set objref returned by factory\n"),
54 catch (const CORBA::Exception
& ex
)
56 ex
._tao_print_exception ("CC_Client::create_lock_set");