void rebind (ACE_Naming_Context *ns_context, int result) { // do the rebinds for (int i = 1; i <= ACE_NS_MAX_ENTRIES; i++) { ACE_OS::sprintf (name, "%s%d", "name", i); ACE_WString w_name (name); ACE_OS::sprintf (value, "%s%d", "value", -i); ACE_WString w_value (value); ACE_OS::sprintf (type, "%s%d", "type", -i); if (ns_context->rebind (w_name, w_value, type) != result) { ACE_ERROR ((LM_ERROR, "rebind failed!")); } } }
static void test_rebind (ACE_Naming_Context &ns_context) { int array [ACE_NS_MAX_ENTRIES]; randomize (array, sizeof array / sizeof (int)); // do the rebinds for (size_t i = 0; i < ACE_NS_MAX_ENTRIES; i++) { ACE_OS::sprintf (name, "%s%d", "name", array[i]); ACE_WString w_name (name); ACE_OS::sprintf (value, "%s%d", "value", -array[i]); ACE_WString w_value (value); ACE_OS::sprintf (type, "%s%d", "type", -array[i]); ACE_ASSERT (ns_context.rebind (w_name, w_value, type) != -1); } }
void bind (ACE_Naming_Context *ns_context, int result) { // do the binds for (int i = 1; i <= ACE_NS_MAX_ENTRIES; i++) { if (i % 50 == 0) ACE_DEBUG ((LM_DEBUG, ".")); ACE_OS::sprintf (name, "%s%d", "name", i); ACE_WString w_name (name); ACE_OS::sprintf (value, "%s%d", "value", i); ACE_WString w_value (value); ACE_OS::sprintf (type, "%s%d", "type", i); if (ns_context->bind (w_name, w_value, type) != result) { ACE_ERROR ((LM_ERROR, "bind failed!")); } } ACE_DEBUG ((LM_DEBUG, "\n")); }
static void test_bind (ACE_Naming_Context &ns_context) { int array [ACE_NS_MAX_ENTRIES]; initialize_array (array, sizeof (array) / sizeof (array[0])); randomize (array, sizeof (array) / sizeof (array[0])); // do the binds for (size_t i = 0; i < ACE_NS_MAX_ENTRIES; i++) { ACE_OS::sprintf (name, "%s%d", "name", array[i]); ACE_NS_WString w_name (name); ACE_OS::sprintf (value, "%s%d", "value", array[i]); ACE_NS_WString w_value (value); ACE_OS::sprintf (type, "%s%d", "type", array [i]); int bind_result = ns_context.bind (w_name, w_value, type); ACE_TEST_ASSERT (bind_result != -1); } }