[cwscore-commit] CVS update: MODIFIED: test, notification_producer_test.c ...

Joe Bester commit at globus.org
Thu May 18 10:20:10 CDT 2006


  User: bester  
  Date: 06/05/18 10:20:10

  Modified:    c/core/notification/producer/test Makefile.am
                        notification_producer_test.c
  Added:       c/core/notification/producer/test TESTS.pl
                        notification-producer-test.pl
  Log:
  Merge of XPath expression handling in core wsrf providers for subscriptions
  and resource property queries from query_resource_properties_impl_branch
  (More or less from memory):
      Leak fixes throughout C WS Core
      Added bindings for core wsrf service wsdls (easier to write generic wsrf
      clients)
      Improved doc and implementation of some soap message handle attrs
      New test cases for wsrp:QueryResourceProperties and wsnt:Subscribe which
      exercise some of the new XPath code
      Got rid of some unneeded mallocs in the deserializer.
      Improved error message from ws-Addressing handler
  
  Revision  Changes    Path
  1.3       +2 -1      wsrf/c/core/notification/producer/test/Makefile.am
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Makefile.am
  ===================================================================
  RCS file: /home/globdev/CVS/globus-packages/wsrf/c/core/notification/producer/test/Makefile.am,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- Makefile.am	21 Jun 2005 12:53:21 -0000	1.2
  +++ Makefile.am	18 May 2006 15:20:09 -0000	1.3
  @@ -4,13 +4,14 @@
   SUBDIRS= pkgdata
   
   test_PROGRAMS = notification-producer-test
  +test_SCRIPTS = notification-producer-test.pl TESTS.pl
   
   INCLUDES = -I$(GLOBUS_LOCATION)/include/$(GLOBUS_FLAVOR_NAME)/wsrf/services
   
   notification_producer_test_SOURCES = notification_producer_test.c
   notification_producer_test_LDADD = $(GPT_PGM_LINKS)
   
  -EXTRA_DIST = version.h.in
  +EXTRA_DIST = version.h.in $(test_SCRIPTS)
   
   include $(top_srcdir)/globus_automake_post
   include $(top_srcdir)/globus_automake_post_top
  
  
  
  1.5       +1720 -305 wsrf/c/core/notification/producer/test/notification_producer_test.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: notification_producer_test.c
  ===================================================================
  RCS file: /home/globdev/CVS/globus-packages/wsrf/c/core/notification/producer/test/notification_producer_test.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- notification_producer_test.c	19 Jan 2006 05:57:56 -0000	1.4
  +++ notification_producer_test.c	18 May 2006 15:20:10 -0000	1.5
  @@ -18,17 +18,24 @@
   #include "globus_wsrf_resource.h"
   #include "globus_notification_producer.h"
   #include "globus_notification_consumer.h"
  +#include "globus_xml_buffer.h"
  +#include "notif_ConcreteTopicExpressionType.h"
  +#include "xpath_XPathExpressionType.h"
  +#include "xpath_NamespaceMapEntryType.h"
   
   typedef int (*test_case)(void);
   
   #define SIZEOF_ARRAY(x) sizeof(x) / sizeof(x[0])
   #define SIMPLE_TOPIC_EXPRESSION \
           "http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Simple"
  +#define CONCRETE_TOPIC_EXPRESSION \
  +        "http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Concrete"
  +#define FULL_TOPIC_EXPRESSION \
  +        "http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Full"
   
   #define NOTIFICATION_TEST_NS \
           "http://www.globus.org/namespaces/2005/03/notification/test"
   
  -
   int
   create_destroy_test(void)
   {
  @@ -171,6 +178,125 @@
   }
   /* create_topic_test() */
   
  +int
  +create_child_topic_test(void)
  +{
  +    int                                 rc;
  +    globus_result_t                     result;
  +    globus_uuid_t                       uuid;
  +    wsnt_TopicExpressionType            topic_expression;
  +    notif_ConcreteTopicExpressionType * concrete_topic;
  +    xsd_NCName *                        child;
  +    int                                 i;
  +
  +    rc = globus_module_activate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto out;
  +    }
  +
  +    rc = globus_uuid_create(&uuid);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto deactivate_out;
  +    }
  +
  +    result = globus_notification_producer_create(uuid.text, NULL, NULL);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto deactivate_out;
  +    }
  +
  +    result = xsd_anyURI_init(&topic_expression._Dialect);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_producer_out;
  +    }
  +    *topic_expression._Dialect = globus_libc_strdup(CONCRETE_TOPIC_EXPRESSION);
  +    if (*topic_expression._Dialect == NULL)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    }
  +
  +    result = xsd_any_init(&topic_expression.any);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    } 
  +    topic_expression.any->any_info = &notif_ConcreteTopicExpressionType_contents_info;
  +
  +    result = notif_ConcreteTopicExpressionType_init(&concrete_topic);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    topic_expression.any->value = concrete_topic;
  +
  +    concrete_topic->Root.Namespace = globus_libc_strdup(NOTIFICATION_TEST_NS);
  +    if (concrete_topic->Root.Namespace == NULL)
  +    {
  +        rc = 1;
  +        goto destroy_any_out;
  +    }
  +    concrete_topic->Root.local = globus_libc_strdup("root");
  +    if (concrete_topic->Root.local == NULL)
  +    {
  +        rc = 1;
  +        goto destroy_any_out;
  +    }
  +
  +    for (i = 0; i < 10; i++)
  +    {
  +        result = globus_notification_producer_topic_create(
  +                uuid.text,
  +                &topic_expression);
  +
  +        if (result != GLOBUS_SUCCESS)
  +        {
  +            rc = 1;
  +
  +            goto destroy_any_out;
  +        }
  +        child = xsd_NCName_array_push(&concrete_topic->Path);
  +        if (child == NULL)
  +        {
  +            rc = 1;
  +            goto destroy_any_out;
  +        }
  +        *child = globus_common_create_string("child%02d", i+1);
  +        if (*child == NULL)
  +        {
  +            rc = 1;
  +            goto destroy_any_out;
  +        }
  +    }
  +
  +destroy_any_out:
  +    xsd_any_destroy(topic_expression.any);
  +destroy_dialect_out:
  +    xsd_anyURI_destroy(topic_expression._Dialect);
  +destroy_producer_out:
  +    result = globus_notification_producer_destroy(uuid.text);
  +deactivate_out:
  +    globus_module_deactivate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +out:
  +    return rc != GLOBUS_SUCCESS;
  +}
  +/* create_child_topic_test() */
   
   int
   create_multiple_topic_test(void)
  @@ -402,15 +528,16 @@
   }
   /* create_destroy_topic_test() */
   
  -
   int
  -change_topic_test(void)
  +create_destroy_child_topic_test(void)
   {
       int                                 rc;
       globus_result_t                     result;
       globus_uuid_t                       uuid;
       wsnt_TopicExpressionType            topic_expression;
  -    xsd_anyType *                       message;
  +    notif_ConcreteTopicExpressionType * concrete_topic;
  +    xsd_NCName *                        child;
  +    int                                 i;
   
       rc = globus_module_activate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
   
  @@ -442,7 +569,7 @@
   
           goto destroy_producer_out;
       }
  -    *topic_expression._Dialect = globus_libc_strdup(SIMPLE_TOPIC_EXPRESSION);
  +    *topic_expression._Dialect = globus_libc_strdup(CONCRETE_TOPIC_EXPRESSION);
       if (*topic_expression._Dialect == NULL)
       {
           rc = 1;
  @@ -458,33 +585,32 @@
   
           goto destroy_dialect_out;
       } 
  -    topic_expression.any->any_info = &xsd_QName_contents_info;
  -    result = xsd_QName_init((xsd_QName **) &topic_expression.any->value);
  +    topic_expression.any->any_info = &notif_ConcreteTopicExpressionType_contents_info;
   
  +    result = notif_ConcreteTopicExpressionType_init(&concrete_topic);
       if (result != GLOBUS_SUCCESS)
       {
           rc = 1;
   
           goto destroy_any_out;
       }
  -    ((xsd_QName *)topic_expression.any->value)->Namespace = 
  -            globus_libc_strdup(NOTIFICATION_TEST_NS);
  +    topic_expression.any->value = concrete_topic;
   
  -    if (((xsd_QName *)topic_expression.any->value)->Namespace == NULL)
  +    concrete_topic->Root.Namespace = globus_libc_strdup(NOTIFICATION_TEST_NS);
  +    if (concrete_topic->Root.Namespace == NULL)
       {
           rc = 1;
  -
           goto destroy_any_out;
       }
  -    ((xsd_QName *)topic_expression.any->value)->local = 
  -            globus_libc_strdup("expression");
  -    if (((xsd_QName *)topic_expression.any->value)->local == NULL)
  +    concrete_topic->Root.local = globus_libc_strdup("root");
  +    if (concrete_topic->Root.local == NULL)
       {
           rc = 1;
  -
           goto destroy_any_out;
       }
   
  +    for (i = 0; i < 10; i++)
  +    {
       result = globus_notification_producer_topic_create(
               uuid.text,
               &topic_expression);
  @@ -495,51 +621,33 @@
   
           goto destroy_any_out;
       }
  -
  -    result = xsd_anyType_init(&message);
  -    if (result != GLOBUS_SUCCESS)
  +        child = xsd_NCName_array_push(&concrete_topic->Path);
  +        if (child == NULL)
       {
           rc = 1;
  -
           goto destroy_any_out;
       }
  -    message->any_info = &xsd_string_info;
  -    result = xsd_string_init_cstr(
  -            (xsd_string **) &message->value,
  -            globus_libc_strdup("changed"));
  -    if (result != GLOBUS_SUCCESS)
  +        *child = globus_common_create_string("child%02d", i+1);
  +        if (*child == NULL)
       {
           rc = 1;
  -
  -        goto destroy_message_out;
  +            goto destroy_any_out;
       }
  -
  -    result = globus_notification_producer_topic_changed(
  -            uuid.text,
  -            &topic_expression,
  -            message,
  -            NULL,
  -            NULL);
  -    if (result != GLOBUS_SUCCESS)
  -    {
  -        rc = 1;
  -
  -        goto destroy_message_out;
       }
  -
  +    for (i = concrete_topic->Path.length-1; i >=0 ; i--)
  +    {
  +        xsd_NCName_destroy_contents(&concrete_topic->Path.elements[concrete_topic->Path.length-1]);
  +        concrete_topic->Path.length--;
       result = globus_notification_producer_topic_destroy(
               uuid.text,
               &topic_expression);
  -
       if (result != GLOBUS_SUCCESS)
       {
           rc = 1;
  -
           goto destroy_any_out;
       }
  +    }
   
  -destroy_message_out:
  -    xsd_anyType_destroy(message);
   destroy_any_out:
       xsd_any_destroy(topic_expression.any);
   destroy_dialect_out:
  @@ -551,16 +659,17 @@
   out:
       return rc != GLOBUS_SUCCESS;
   }
  -/* change_topic_test() */
  +/* create_destroy_child_topic_test() */
   
   int
  -change_multiple_times_topic_test(void)
  +create_destroy_parent_topic_test(void)
   {
       int                                 rc;
       globus_result_t                     result;
       globus_uuid_t                       uuid;
       wsnt_TopicExpressionType            topic_expression;
  -    xsd_anyType *                       message[10];
  +    notif_ConcreteTopicExpressionType * concrete_topic;
  +    xsd_NCName *                        child;
       int                                 i;
   
       rc = globus_module_activate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  @@ -593,7 +702,7 @@
   
           goto destroy_producer_out;
       }
  -    *topic_expression._Dialect = globus_libc_strdup(SIMPLE_TOPIC_EXPRESSION);
  +    *topic_expression._Dialect = globus_libc_strdup(CONCRETE_TOPIC_EXPRESSION);
       if (*topic_expression._Dialect == NULL)
       {
           rc = 1;
  @@ -609,33 +718,32 @@
   
           goto destroy_dialect_out;
       } 
  -    topic_expression.any->any_info = &xsd_QName_contents_info;
  -    result = xsd_QName_init((xsd_QName **) &topic_expression.any->value);
  +    topic_expression.any->any_info = &notif_ConcreteTopicExpressionType_contents_info;
   
  +    result = notif_ConcreteTopicExpressionType_init(&concrete_topic);
       if (result != GLOBUS_SUCCESS)
       {
           rc = 1;
   
           goto destroy_any_out;
       }
  -    ((xsd_QName *)topic_expression.any->value)->Namespace = 
  -            globus_libc_strdup(NOTIFICATION_TEST_NS);
  +    topic_expression.any->value = concrete_topic;
   
  -    if (((xsd_QName *)topic_expression.any->value)->Namespace == NULL)
  +    concrete_topic->Root.Namespace = globus_libc_strdup(NOTIFICATION_TEST_NS);
  +    if (concrete_topic->Root.Namespace == NULL)
       {
           rc = 1;
  -
           goto destroy_any_out;
       }
  -    ((xsd_QName *)topic_expression.any->value)->local = 
  -            globus_libc_strdup("expression");
  -    if (((xsd_QName *)topic_expression.any->value)->local == NULL)
  +    concrete_topic->Root.local = globus_libc_strdup("root");
  +    if (concrete_topic->Root.local == NULL)
       {
           rc = 1;
  -
           goto destroy_any_out;
       }
   
  +    for (i = 0; i < 10; i++)
  +    {
       result = globus_notification_producer_topic_create(
               uuid.text,
               &topic_expression);
  @@ -646,59 +754,29 @@
   
           goto destroy_any_out;
       }
  -
  -    for (i = 0; i < SIZEOF_ARRAY(message); i++)
  -    {
  -        result = xsd_anyType_init(&message[i]);
  -        if (result != GLOBUS_SUCCESS)
  +        child = xsd_NCName_array_push(&concrete_topic->Path);
  +        if (child == NULL)
           {
               rc = 1;
  -
               goto destroy_any_out;
           }
  -        message[i]->any_info = &xsd_string_info;
  -        result = xsd_string_init_cstr(
  -                (xsd_string **) &message[i]->value,
  -                globus_common_create_string("changed%02d", i+1));
  -        if (result != GLOBUS_SUCCESS)
  -        {
  -            rc = 1;
  -            i++;
  -
  -            goto destroy_messages_out;
  -        }
  -
  -        result = globus_notification_producer_topic_changed(
  -                uuid.text,
  -                &topic_expression,
  -                message[i],
  -                NULL,
  -                NULL);
  -        if (result != GLOBUS_SUCCESS)
  +        *child = globus_common_create_string("child%02d", i+1);
  +        if (*child == NULL)
           {
               rc = 1;
  -            i++;
  -
  -            goto destroy_messages_out;
  +            goto destroy_any_out;
           }
       }
  -
  +    xsd_NCName_array_destroy_contents(&concrete_topic->Path);
       result = globus_notification_producer_topic_destroy(
               uuid.text,
               &topic_expression);
  -
       if (result != GLOBUS_SUCCESS)
       {
           rc = 1;
  -
           goto destroy_any_out;
       }
   
  -destroy_messages_out:
  -    for(; i > 0; i--)
  -    {
  -        xsd_anyType_destroy(message[i-1]);
  -    }
   destroy_any_out:
       xsd_any_destroy(topic_expression.any);
   destroy_dialect_out:
  @@ -710,40 +788,16 @@
   out:
       return rc != GLOBUS_SUCCESS;
   }
  -/* change_multiple_times_topic_test() */
  -typedef struct
  -{
  -    globus_mutex_t                      lock;
  -    globus_cond_t                       cond;
  -    globus_bool_t                       done;
  -}
  -notification_monitor_t;
  -
  -static
  -void
  -change_callback(
  -    void *                              arg,
  -    const wsnt_TopicExpressionType *    topic_expression,
  -    const xsd_anyType *                 new_value)
  -{
  -    notification_monitor_t *            monitor = arg;
  -
  -    globus_mutex_lock(&monitor->lock);
  -    monitor->done = GLOBUS_TRUE;
  -    globus_cond_signal(&monitor->cond);
  -    globus_mutex_unlock(&monitor->lock);
  -}
  -/* change_callback() */
  +/* create_destroy_parent_topic_test() */
   
   int
  -change_topic_with_callback_test(void)
  +change_topic_test(void)
   {
       int                                 rc;
       globus_result_t                     result;
       globus_uuid_t                       uuid;
       wsnt_TopicExpressionType            topic_expression;
       xsd_anyType *                       message;
  -    notification_monitor_t              monitor;
   
       rc = globus_module_activate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
   
  @@ -847,77 +901,1307 @@
           goto destroy_message_out;
       }
   
  -    globus_mutex_init(&monitor.lock, NULL);
  -    globus_cond_init(&monitor.cond, NULL);
  -    monitor.done = GLOBUS_FALSE;
  -
  -    globus_mutex_lock(&monitor.lock);
       result = globus_notification_producer_topic_changed(
               uuid.text,
               &topic_expression,
               message,
  -            change_callback,
  -            &monitor);
  +            NULL,
  +            NULL);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_message_out;
  +    }
  +
  +    result = globus_notification_producer_topic_destroy(
  +            uuid.text,
  +            &topic_expression);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +
  +destroy_message_out:
  +    xsd_anyType_destroy(message);
  +destroy_any_out:
  +    xsd_any_destroy(topic_expression.any);
  +destroy_dialect_out:
  +    xsd_anyURI_destroy(topic_expression._Dialect);
  +destroy_producer_out:
  +    result = globus_notification_producer_destroy(uuid.text);
  +deactivate_out:
  +    globus_module_deactivate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +out:
  +    return rc != GLOBUS_SUCCESS;
  +}
  +/* change_topic_test() */
  +
  +int
  +change_child_topic_test(void)
  +{
  +    int                                 rc;
  +    globus_result_t                     result;
  +    globus_uuid_t                       uuid;
  +    wsnt_TopicExpressionType            topic_expression;
  +    notif_ConcreteTopicExpressionType * concrete_topic;
  +    xsd_NCName *                        child;
  +    xsd_anyType *                       message;
  +    int                                 i;
  +
  +    rc = globus_module_activate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto out;
  +    }
  +
  +    rc = globus_uuid_create(&uuid);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto deactivate_out;
  +    }
  +
  +    result = globus_notification_producer_create(uuid.text, NULL, NULL);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto deactivate_out;
  +    }
  +
  +    result = xsd_anyURI_init(&topic_expression._Dialect);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_producer_out;
  +    }
  +    *topic_expression._Dialect = globus_libc_strdup(CONCRETE_TOPIC_EXPRESSION);
  +    if (*topic_expression._Dialect == NULL)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    }
  +
  +    result = xsd_any_init(&topic_expression.any);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    } 
  +    topic_expression.any->any_info = &notif_ConcreteTopicExpressionType_contents_info;
  +
  +    result = notif_ConcreteTopicExpressionType_init(&concrete_topic);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    topic_expression.any->value = concrete_topic;
  +
  +    concrete_topic->Root.Namespace = globus_libc_strdup(NOTIFICATION_TEST_NS);
  +    if (concrete_topic->Root.Namespace == NULL)
  +    {
  +        rc = 1;
  +        goto destroy_any_out;
  +    }
  +    concrete_topic->Root.local = globus_libc_strdup("root");
  +    if (concrete_topic->Root.local == NULL)
  +    {
  +        rc = 1;
  +        goto destroy_any_out;
  +    }
  +
  +    for (i = 0; i < 10; i++)
  +    {
  +        result = globus_notification_producer_topic_create(
  +                uuid.text,
  +                &topic_expression);
  +
  +        if (result != GLOBUS_SUCCESS)
  +        {
  +            rc = 1;
  +
  +            goto destroy_any_out;
  +        }
  +        child = xsd_NCName_array_push(&concrete_topic->Path);
  +        if (child == NULL)
  +        {
  +            rc = 1;
  +            goto destroy_any_out;
  +        }
  +        *child = globus_common_create_string("child%02d", i+1);
  +        if (*child == NULL)
  +        {
  +            rc = 1;
  +            goto destroy_any_out;
  +        }
  +    }
  +
  +    /* Delete unused one */
  +    xsd_NCName_destroy_contents(&concrete_topic->Path.elements[
  +            --concrete_topic->Path.length]);
  +
  +    result = xsd_anyType_init(&message);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    message->any_info = &xsd_string_info;
  +    result = xsd_string_init_cstr(
  +            (xsd_string **) &message->value,
  +            globus_libc_strdup("changed"));
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_message_out;
  +    }
  +
  +    result = globus_notification_producer_topic_changed(
  +            uuid.text,
  +            &topic_expression,
  +            message,
  +            NULL,
  +            NULL);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_message_out;
  +    }
  +
  +destroy_message_out:
  +    xsd_anyType_destroy(message);
  +destroy_any_out:
  +    xsd_any_destroy(topic_expression.any);
  +destroy_dialect_out:
  +    xsd_anyURI_destroy(topic_expression._Dialect);
  +destroy_producer_out:
  +    result = globus_notification_producer_destroy(uuid.text);
  +deactivate_out:
  +    globus_module_deactivate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +out:
  +    return rc != GLOBUS_SUCCESS;
  +}
  +/* change_child_topic_test() */
  +
  +int
  +change_parent_topic_test(void)
  +{
  +    int                                 rc;
  +    globus_result_t                     result;
  +    globus_uuid_t                       uuid;
  +    wsnt_TopicExpressionType            topic_expression;
  +    notif_ConcreteTopicExpressionType * concrete_topic;
  +    xsd_NCName *                        child;
  +    xsd_anyType *                       message;
  +    int                                 i;
  +
  +    rc = globus_module_activate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto out;
  +    }
  +
  +    rc = globus_uuid_create(&uuid);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto deactivate_out;
  +    }
  +
  +    result = globus_notification_producer_create(uuid.text, NULL, NULL);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto deactivate_out;
  +    }
  +
  +    result = xsd_anyURI_init(&topic_expression._Dialect);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_producer_out;
  +    }
  +    *topic_expression._Dialect = globus_libc_strdup(CONCRETE_TOPIC_EXPRESSION);
  +    if (*topic_expression._Dialect == NULL)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    }
  +
  +    result = xsd_any_init(&topic_expression.any);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    } 
  +    topic_expression.any->any_info = &notif_ConcreteTopicExpressionType_contents_info;
  +
  +    result = notif_ConcreteTopicExpressionType_init(&concrete_topic);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    topic_expression.any->value = concrete_topic;
  +
  +    concrete_topic->Root.Namespace = globus_libc_strdup(NOTIFICATION_TEST_NS);
  +    if (concrete_topic->Root.Namespace == NULL)
  +    {
  +        rc = 1;
  +        goto destroy_any_out;
  +    }
  +    concrete_topic->Root.local = globus_libc_strdup("root");
  +    if (concrete_topic->Root.local == NULL)
  +    {
  +        rc = 1;
  +        goto destroy_any_out;
  +    }
  +
  +    for (i = 0; i < 10; i++)
  +    {
  +        result = globus_notification_producer_topic_create(
  +                uuid.text,
  +                &topic_expression);
  +
  +        if (result != GLOBUS_SUCCESS)
  +        {
  +            rc = 1;
  +
  +            goto destroy_any_out;
  +        }
  +        child = xsd_NCName_array_push(&concrete_topic->Path);
  +        if (child == NULL)
  +        {
  +            rc = 1;
  +            goto destroy_any_out;
  +        }
  +        *child = globus_common_create_string("child%02d", i+1);
  +        if (*child == NULL)
  +        {
  +            rc = 1;
  +            goto destroy_any_out;
  +        }
  +    }
  +
  +    /* Delete child topics from our TopicExpression path so that
  +     * we will change to root topic
  +     */ 
  +    xsd_NCName_array_destroy_contents(&concrete_topic->Path);
  +
  +    result = xsd_anyType_init(&message);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    message->any_info = &xsd_string_info;
  +    result = xsd_string_init_cstr(
  +            (xsd_string **) &message->value,
  +            globus_libc_strdup("changed"));
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_message_out;
  +    }
  +
  +    result = globus_notification_producer_topic_changed(
  +            uuid.text,
  +            &topic_expression,
  +            message,
  +            NULL,
  +            NULL);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_message_out;
  +    }
  +
  +destroy_message_out:
  +    xsd_anyType_destroy(message);
  +destroy_any_out:
  +    xsd_any_destroy(topic_expression.any);
  +destroy_dialect_out:
  +    xsd_anyURI_destroy(topic_expression._Dialect);
  +destroy_producer_out:
  +    result = globus_notification_producer_destroy(uuid.text);
  +deactivate_out:
  +    globus_module_deactivate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +out:
  +    return rc != GLOBUS_SUCCESS;
  +}
  +/* change_parent_topic_test() */
  +
  +int
  +change_multiple_times_topic_test(void)
  +{
  +    int                                 rc;
  +    globus_result_t                     result;
  +    globus_uuid_t                       uuid;
  +    wsnt_TopicExpressionType            topic_expression;
  +    xsd_anyType *                       message[10];
  +    int                                 i;
  +
  +    rc = globus_module_activate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto out;
  +    }
  +
  +    rc = globus_uuid_create(&uuid);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto deactivate_out;
  +    }
  +
  +    result = globus_notification_producer_create(uuid.text, NULL, NULL);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto deactivate_out;
  +    }
  +
  +    result = xsd_anyURI_init(&topic_expression._Dialect);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_producer_out;
  +    }
  +    *topic_expression._Dialect = globus_libc_strdup(SIMPLE_TOPIC_EXPRESSION);
  +    if (*topic_expression._Dialect == NULL)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    }
  +
  +    result = xsd_any_init(&topic_expression.any);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    } 
  +    topic_expression.any->any_info = &xsd_QName_contents_info;
  +    result = xsd_QName_init((xsd_QName **) &topic_expression.any->value);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    ((xsd_QName *)topic_expression.any->value)->Namespace = 
  +            globus_libc_strdup(NOTIFICATION_TEST_NS);
  +
  +    if (((xsd_QName *)topic_expression.any->value)->Namespace == NULL)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    ((xsd_QName *)topic_expression.any->value)->local = 
  +            globus_libc_strdup("expression");
  +    if (((xsd_QName *)topic_expression.any->value)->local == NULL)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +
  +    result = globus_notification_producer_topic_create(
  +            uuid.text,
  +            &topic_expression);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +
  +    for (i = 0; i < SIZEOF_ARRAY(message); i++)
  +    {
  +        result = xsd_anyType_init(&message[i]);
  +        if (result != GLOBUS_SUCCESS)
  +        {
  +            rc = 1;
  +
  +            goto destroy_any_out;
  +        }
  +        message[i]->any_info = &xsd_string_info;
  +        result = xsd_string_init_cstr(
  +                (xsd_string **) &message[i]->value,
  +                globus_common_create_string("changed%02d", i+1));
  +        if (result != GLOBUS_SUCCESS)
  +        {
  +            rc = 1;
  +            i++;
  +
  +            goto destroy_messages_out;
  +        }
  +
  +        result = globus_notification_producer_topic_changed(
  +                uuid.text,
  +                &topic_expression,
  +                message[i],
  +                NULL,
  +                NULL);
  +        if (result != GLOBUS_SUCCESS)
  +        {
  +            rc = 1;
  +            i++;
  +
  +            goto destroy_messages_out;
  +        }
  +    }
  +
  +    result = globus_notification_producer_topic_destroy(
  +            uuid.text,
  +            &topic_expression);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +
  +destroy_messages_out:
  +    for(; i > 0; i--)
  +    {
  +        xsd_anyType_destroy(message[i-1]);
  +    }
  +destroy_any_out:
  +    xsd_any_destroy(topic_expression.any);
  +destroy_dialect_out:
  +    xsd_anyURI_destroy(topic_expression._Dialect);
  +destroy_producer_out:
  +    result = globus_notification_producer_destroy(uuid.text);
  +deactivate_out:
  +    globus_module_deactivate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +out:
  +    return rc != GLOBUS_SUCCESS;
  +}
  +/* change_multiple_times_topic_test() */
  +typedef struct
  +{
  +    globus_mutex_t                      lock;
  +    globus_cond_t                       cond;
  +    globus_bool_t                       done;
  +}
  +notification_monitor_t;
  +
  +static
  +void
  +change_callback(
  +    void *                              arg,
  +    const wsnt_TopicExpressionType *    topic_expression,
  +    const xsd_anyType *                 new_value)
  +{
  +    notification_monitor_t *            monitor = arg;
  +
  +    globus_mutex_lock(&monitor->lock);
  +    monitor->done = GLOBUS_TRUE;
  +    globus_cond_signal(&monitor->cond);
  +    globus_mutex_unlock(&monitor->lock);
  +}
  +/* change_callback() */
  +
  +int
  +change_topic_with_callback_test(void)
  +{
  +    int                                 rc;
  +    globus_result_t                     result;
  +    globus_uuid_t                       uuid;
  +    wsnt_TopicExpressionType            topic_expression;
  +    xsd_anyType *                       message;
  +    notification_monitor_t              monitor;
  +
  +    rc = globus_module_activate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto out;
  +    }
  +
  +    rc = globus_uuid_create(&uuid);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto deactivate_out;
  +    }
  +
  +    result = globus_notification_producer_create(uuid.text, NULL, NULL);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto deactivate_out;
  +    }
  +
  +    result = xsd_anyURI_init(&topic_expression._Dialect);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_producer_out;
  +    }
  +    *topic_expression._Dialect = globus_libc_strdup(SIMPLE_TOPIC_EXPRESSION);
  +    if (*topic_expression._Dialect == NULL)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    }
  +
  +    result = xsd_any_init(&topic_expression.any);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    } 
  +    topic_expression.any->any_info = &xsd_QName_contents_info;
  +    result = xsd_QName_init((xsd_QName **) &topic_expression.any->value);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    ((xsd_QName *)topic_expression.any->value)->Namespace = 
  +            globus_libc_strdup(NOTIFICATION_TEST_NS);
  +
  +    if (((xsd_QName *)topic_expression.any->value)->Namespace == NULL)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    ((xsd_QName *)topic_expression.any->value)->local = 
  +            globus_libc_strdup("expression");
  +    if (((xsd_QName *)topic_expression.any->value)->local == NULL)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +
  +    result = globus_notification_producer_topic_create(
  +            uuid.text,
  +            &topic_expression);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +
  +    result = xsd_anyType_init(&message);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    message->any_info = &xsd_string_info;
  +    result = xsd_string_init_cstr(
  +            (xsd_string **) &message->value,
  +            globus_libc_strdup("changed"));
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_message_out;
  +    }
  +
  +    globus_mutex_init(&monitor.lock, NULL);
  +    globus_cond_init(&monitor.cond, NULL);
  +    monitor.done = GLOBUS_FALSE;
  +
  +    globus_mutex_lock(&monitor.lock);
  +    result = globus_notification_producer_topic_changed(
  +            uuid.text,
  +            &topic_expression,
  +            message,
  +            change_callback,
  +            &monitor);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto unlock_monitor_out;
  +    }
  +
  +    while (!monitor.done)
  +    {
  +        globus_cond_wait(&monitor.cond, &monitor.lock);
  +    }
  +
  +    result = globus_notification_producer_topic_destroy(
  +            uuid.text,
  +            &topic_expression);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto unlock_monitor_out;
  +    }
  +
  +unlock_monitor_out:
  +    globus_mutex_unlock(&monitor.lock);
  +    globus_mutex_destroy(&monitor.lock);
  +destroy_message_out:
  +    xsd_anyType_destroy(message);
  +destroy_any_out:
  +    xsd_any_destroy(topic_expression.any);
  +destroy_dialect_out:
  +    xsd_anyURI_destroy(topic_expression._Dialect);
  +destroy_producer_out:
  +    result = globus_notification_producer_destroy(uuid.text);
  +deactivate_out:
  +    globus_module_deactivate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +out:
  +    return rc != GLOBUS_SUCCESS;
  +}
  +/* change_topic_with_callback_test() */
  +
  +int
  +change_child_topic_with_callback_test(void)
  +{
  +    int                                 rc;
  +    globus_result_t                     result;
  +    globus_uuid_t                       uuid;
  +    wsnt_TopicExpressionType            topic_expression;
  +    notif_ConcreteTopicExpressionType * concrete_topic;
  +    xsd_NCName *                        child;
  +    int                                 i;
  +    xsd_anyType *                       message;
  +    notification_monitor_t              monitor;
  +
  +    rc = globus_module_activate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto out;
  +    }
  +
  +    rc = globus_uuid_create(&uuid);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto deactivate_out;
  +    }
  +
  +    result = globus_notification_producer_create(uuid.text, NULL, NULL);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto deactivate_out;
  +    }
  +
  +    result = xsd_anyURI_init(&topic_expression._Dialect);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_producer_out;
  +    }
  +    *topic_expression._Dialect = globus_libc_strdup(CONCRETE_TOPIC_EXPRESSION);
  +    if (*topic_expression._Dialect == NULL)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    }
  +
  +    result = xsd_any_init(&topic_expression.any);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    } 
  +    topic_expression.any->any_info = &notif_ConcreteTopicExpressionType_contents_info;
  +
  +    result = notif_ConcreteTopicExpressionType_init(&concrete_topic);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    topic_expression.any->value = concrete_topic;
  +
  +    concrete_topic->Root.Namespace = globus_libc_strdup(NOTIFICATION_TEST_NS);
  +    if (concrete_topic->Root.Namespace == NULL)
  +    {
  +        rc = 1;
  +        goto destroy_any_out;
  +    }
  +    concrete_topic->Root.local = globus_libc_strdup("root");
  +    if (concrete_topic->Root.local == NULL)
  +    {
  +        rc = 1;
  +        goto destroy_any_out;
  +    }
  +
  +    for (i = 0; i < 10; i++)
  +    {
  +        result = globus_notification_producer_topic_create(
  +                uuid.text,
  +                &topic_expression);
  +
  +        if (result != GLOBUS_SUCCESS)
  +        {
  +            rc = 1;
  +
  +            goto destroy_any_out;
  +        }
  +        child = xsd_NCName_array_push(&concrete_topic->Path);
  +        if (child == NULL)
  +        {
  +            rc = 1;
  +            goto destroy_any_out;
  +        }
  +        *child = globus_common_create_string("child%02d", i+1);
  +        if (*child == NULL)
  +        {
  +            rc = 1;
  +            goto destroy_any_out;
  +        }
  +    }
  +    xsd_NCName_destroy_contents(&concrete_topic->Path.elements[
  +            --concrete_topic->Path.length]);
  +
  +    result = xsd_anyType_init(&message);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    message->any_info = &xsd_string_info;
  +    result = xsd_string_init_cstr(
  +            (xsd_string **) &message->value,
  +            globus_libc_strdup("changed"));
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_message_out;
  +    }
  +    globus_mutex_init(&monitor.lock, NULL);
  +    globus_cond_init(&monitor.cond, NULL);
  +    monitor.done = GLOBUS_FALSE;
  +
  +    globus_mutex_lock(&monitor.lock);
  +    result = globus_notification_producer_topic_changed(
  +            uuid.text,
  +            &topic_expression,
  +            message,
  +            change_callback,
  +            &monitor);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto unlock_monitor_out;
  +    }
  +
  +    while (!monitor.done)
  +    {
  +        globus_cond_wait(&monitor.cond, &monitor.lock);
  +    }
  +unlock_monitor_out:
  +    globus_mutex_unlock(&monitor.lock);
  +destroy_message_out:
  +    xsd_anyType_destroy(message);
  +destroy_any_out:
  +    xsd_any_destroy(topic_expression.any);
  +destroy_dialect_out:
  +    xsd_anyURI_destroy(topic_expression._Dialect);
  +destroy_producer_out:
  +    result = globus_notification_producer_destroy(uuid.text);
  +deactivate_out:
  +    globus_module_deactivate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +out:
  +    return rc != GLOBUS_SUCCESS;
  +}
  +/* change_child_topic_with_callback_test() */
  +
  +static
  +void
  +notify_callback(
  +    void *                              arg,
  +    wsnt_TopicExpressionType *          topic,
  +    wsa_EndpointReferenceType *         producer,
  +    xsd_anyType *                       message)
  +{
  +    notification_monitor_t *            monitor = arg;
  +
  +    globus_mutex_lock(&monitor->lock);
  +    monitor->done = GLOBUS_TRUE;
  +    globus_cond_signal(&monitor->cond);
  +    globus_mutex_unlock(&monitor->lock);
  +}
  +/* notify_callback() */
  +
  +int
  +create_destroy_subscription_test(void)
  +{
  +    int                                 rc;
  +    globus_result_t                     result;
  +    globus_uuid_t                       uuid;
  +    wsnt_TopicExpressionType            topic_expression;
  +    globus_service_engine_t             engine;
  +    wsnt_SubscribeType *                Subscribe;
  +    wsnt_SubscribeResponseType          SubscribeResponse;
  +    xsd_QName                           test_expression = 
  +    {
  +        NOTIFICATION_TEST_NS,
  +        "expression"
  +    };
  +
  +    rc = globus_module_activate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto out;
  +    }
  +
  +    rc = globus_module_activate(GLOBUS_NOTIFICATION_CONSUMER_MODULE);
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto deactivate_producer_out;
  +
  +    }
  +    rc = globus_module_activate(GLOBUS_SERVICE_ENGINE_MODULE);
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto deactivate_consumer_out;
  +    }
  +
  +    rc = globus_uuid_create(&uuid);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto deactivate_service_engine_out;
  +    }
  +
  +    result = globus_notification_producer_create(uuid.text, NULL, NULL);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto deactivate_service_engine_out;
  +    }
  +
  +    result = xsd_anyURI_init_cstr(
  +            &topic_expression._Dialect,
  +            globus_libc_strdup(SIMPLE_TOPIC_EXPRESSION));
  +    if (result != GLOBUS_SUCCESS || *topic_expression._Dialect == NULL)
  +    {
  +        rc = 1;
  +
  +        goto destroy_producer_out;
  +    }
  +
  +    result = xsd_any_init(&topic_expression.any);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    } 
  +    topic_expression.any->any_info = &xsd_QName_contents_info;
  +
  +    result = xsd_QName_copy(
  +            (xsd_QName **) &topic_expression.any->value,
  +            &test_expression);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +
  +    result = globus_notification_producer_topic_create(
  +            uuid.text,
  +            &topic_expression);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +
  +    result = globus_service_engine_init(
  +            &engine, NULL, NULL, NULL, GLOBUS_FALSE);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +        goto destroy_topic_out;
  +    }
  +
  +    result = wsnt_SubscribeType_init(&Subscribe);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +        goto destroy_engine_out;
  +    }
  +
  +    result = globus_notification_create_consumer(
  +            &Subscribe->ConsumerReference,
  +            engine,
  +            notify_callback,
  +            NULL);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_Subscribe_out;
  +    }
  +
  +    result = wsnt_TopicExpressionType_copy_contents(
  +            &Subscribe->TopicExpression,
  +            &topic_expression);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_Subscribe_out;
  +    }
  +
  +    result = xsd_boolean_init(&Subscribe->UseNotify);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_Subscribe_out;
  +    }
  +    
  +    *Subscribe->UseNotify = GLOBUS_TRUE;
  +
  +    memset(&SubscribeResponse, '\0', sizeof(wsnt_SubscribeResponseType));
  +
  +    result = globus_notification_producer_subscribe(
  +            uuid.text,
  +            engine,
  +            Subscribe,
  +            &SubscribeResponse);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_Subscribe_out;
  +    }
  +
  +    result = globus_notification_producer_destroy_subscription(
  +            SubscribeResponse.SubscriptionReference);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_SubscribeResponse_out;
  +    }
  +
  +    result = globus_notification_destroy_consumer(
  +            &Subscribe->ConsumerReference);
  +
  +destroy_SubscribeResponse_out:
  +    wsnt_SubscribeResponseType_destroy_contents(&SubscribeResponse);
  +destroy_Subscribe_out:
  +    wsnt_SubscribeType_destroy(Subscribe);
  +destroy_engine_out:
  +    globus_service_engine_destroy(engine);
  +destroy_topic_out:
  +    globus_notification_producer_topic_destroy(
  +            uuid.text,
  +            &topic_expression);
  +destroy_any_out:
  +    xsd_any_destroy(topic_expression.any);
  +destroy_dialect_out:
  +    xsd_anyURI_destroy(topic_expression._Dialect);
  +destroy_producer_out:
  +    result = globus_notification_producer_destroy(uuid.text);
  +deactivate_service_engine_out:
  +    globus_module_deactivate(GLOBUS_SERVICE_ENGINE_MODULE);
  +deactivate_consumer_out:
  +    globus_module_deactivate(GLOBUS_NOTIFICATION_CONSUMER_MODULE);
  +deactivate_producer_out:
  +    globus_module_deactivate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +out:
  +    return rc != GLOBUS_SUCCESS;
  +}
  +/* create_destroy_subscription_test() */
  +
  +int
  +create_destroy_child_subscription_test(void)
  +{
  +    int                                 rc;
  +    globus_result_t                     result;
  +    globus_uuid_t                       uuid;
  +    wsnt_TopicExpressionType            topic_expression;
  +    globus_service_engine_t             engine;
  +    wsnt_SubscribeType *                Subscribe;
  +    wsnt_SubscribeResponseType          SubscribeResponse;
  +    notif_ConcreteTopicExpressionType * concrete_topic;
  +    int                                 i;
  +    xsd_NCName *                        child;
  +
  +    rc = globus_module_activate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto out;
  +    }
  +
  +    rc = globus_module_activate(GLOBUS_NOTIFICATION_CONSUMER_MODULE);
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto deactivate_producer_out;
  +
  +    }
  +    rc = globus_module_activate(GLOBUS_SERVICE_ENGINE_MODULE);
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto deactivate_consumer_out;
  +    }
  +
  +    rc = globus_uuid_create(&uuid);
  +
  +    if (rc != GLOBUS_SUCCESS)
  +    {
  +        goto deactivate_service_engine_out;
  +    }
  +
  +    result = globus_notification_producer_create(uuid.text, NULL, NULL);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto deactivate_service_engine_out;
  +    }
  +
  +    result = xsd_anyURI_init_cstr(
  +            &topic_expression._Dialect,
  +            globus_libc_strdup(SIMPLE_TOPIC_EXPRESSION));
  +    if (result != GLOBUS_SUCCESS || *topic_expression._Dialect == NULL)
  +    {
  +        rc = 1;
  +
  +        goto destroy_producer_out;
  +    }
  +
  +    result = xsd_any_init(&topic_expression.any);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_dialect_out;
  +    } 
  +    topic_expression.any->any_info = &notif_ConcreteTopicExpressionType_contents_info;
  +
  +    result = notif_ConcreteTopicExpressionType_init(&concrete_topic);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_any_out;
  +    }
  +    topic_expression.any->value = concrete_topic;
  +
  +    concrete_topic->Root.Namespace = globus_libc_strdup(NOTIFICATION_TEST_NS);
  +    if (concrete_topic->Root.Namespace == NULL)
  +    {
  +        rc = 1;
  +        goto destroy_any_out;
  +    }
  +    concrete_topic->Root.local = globus_libc_strdup("root");
  +    if (concrete_topic->Root.local == NULL)
  +    {
  +        rc = 1;
  +        goto destroy_any_out;
  +    }
  +
  +    for (i = 0; i < 10; i++)
  +    {
  +        result = globus_notification_producer_topic_create(
  +                uuid.text,
  +                &topic_expression);
  +
  +        if (result != GLOBUS_SUCCESS)
  +        {
  +            rc = 1;
  +
  +            goto destroy_any_out;
  +        }
  +        child = xsd_NCName_array_push(&concrete_topic->Path);
  +        if (child == NULL)
  +        {
  +            rc = 1;
  +            goto destroy_any_out;
  +        }
  +        *child = globus_common_create_string("child%02d", i+1);
  +        if (*child == NULL)
  +        {
  +            rc = 1;
  +            goto destroy_any_out;
  +        }
  +    }
  +
  +    xsd_NCName_destroy_contents(&concrete_topic->Path.elements[
  +            --concrete_topic->Path.length]);
  +
  +    result = globus_service_engine_init(
  +            &engine, NULL, NULL, NULL, GLOBUS_FALSE);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +        goto destroy_topic_out;
  +    }
  +
  +    result = wsnt_SubscribeType_init(&Subscribe);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +        goto destroy_engine_out;
  +    }
  +
  +    result = globus_notification_create_consumer(
  +            &Subscribe->ConsumerReference,
  +            engine,
  +            notify_callback,
  +            NULL);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_Subscribe_out;
  +    }
  +
  +    result = wsnt_TopicExpressionType_copy_contents(
  +            &Subscribe->TopicExpression,
  +            &topic_expression);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_Subscribe_out;
  +    }
  +
  +    result = xsd_boolean_init(&Subscribe->UseNotify);
       if (result != GLOBUS_SUCCESS)
       {
           rc = 1;
   
  -        goto unlock_monitor_out;
  +        goto destroy_Subscribe_out;
       }
   
  -    while (!monitor.done)
  -    {
  -        globus_cond_wait(&monitor.lock, &monitor.cond);
  -    }
  +    *Subscribe->UseNotify = GLOBUS_TRUE;
   
  -    result = globus_notification_producer_topic_destroy(
  +    memset(&SubscribeResponse, '\0', sizeof(wsnt_SubscribeResponseType));
  +
  +    result = globus_notification_producer_subscribe(
               uuid.text,
  -            &topic_expression);
  +            engine,
  +            Subscribe,
  +            &SubscribeResponse);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_Subscribe_out;
  +    }
   
  +    result = globus_notification_producer_destroy_subscription(
  +            SubscribeResponse.SubscriptionReference);
       if (result != GLOBUS_SUCCESS)
       {
           rc = 1;
   
  -        goto unlock_monitor_out;
  +        goto destroy_SubscribeResponse_out;
       }
   
  -unlock_monitor_out:
  -    globus_mutex_unlock(&monitor.lock);
  -    globus_mutex_destroy(&monitor.lock);
  -destroy_message_out:
  -    xsd_anyType_destroy(message);
  +    result = globus_notification_destroy_consumer(
  +            &Subscribe->ConsumerReference);
  +
  +destroy_SubscribeResponse_out:
  +    wsnt_SubscribeResponseType_destroy_contents(&SubscribeResponse);
  +destroy_Subscribe_out:
  +    wsnt_SubscribeType_destroy(Subscribe);
  +destroy_engine_out:
  +    globus_service_engine_destroy(engine);
  +destroy_topic_out:
  +    globus_notification_producer_topic_destroy(
  +            uuid.text,
  +            &topic_expression);
   destroy_any_out:
       xsd_any_destroy(topic_expression.any);
   destroy_dialect_out:
       xsd_anyURI_destroy(topic_expression._Dialect);
   destroy_producer_out:
       result = globus_notification_producer_destroy(uuid.text);
  -deactivate_out:
  +deactivate_service_engine_out:
  +    globus_module_deactivate(GLOBUS_SERVICE_ENGINE_MODULE);
  +deactivate_consumer_out:
  +    globus_module_deactivate(GLOBUS_NOTIFICATION_CONSUMER_MODULE);
  +deactivate_producer_out:
       globus_module_deactivate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
   out:
       return rc != GLOBUS_SUCCESS;
   }
  -/* change_topic_with_callback_test() */
  -
  -static
  -void
  -notify_callback(
  -    void *                              arg,
  -    wsnt_TopicExpressionType *          topic,
  -    wsa_EndpointReferenceType *         producer,
  -    xsd_anyType *                       message)
  -{
  -    notification_monitor_t *            monitor = arg;
  -
  -    globus_mutex_lock(&monitor->lock);
  -    monitor->done = GLOBUS_TRUE;
  -    globus_cond_signal(&monitor->cond);
  -    globus_mutex_unlock(&monitor->lock);
  -}
  -/* notify_callback() */
  +/* create_destroy_child_subscription_test() */
   
   int
  -create_destroy_subscription_test(void)
  +create_destroy_multiple_subscription_test(void)
   {
       int                                 rc;
       globus_result_t                     result;
  @@ -925,7 +2209,8 @@
       wsnt_TopicExpressionType            topic_expression;
       globus_service_engine_t             engine;
       wsnt_SubscribeType *                Subscribe;
  -    wsnt_SubscribeResponseType          SubscribeResponse;
  +    wsnt_SubscribeResponseType          SubscribeResponse[10];
  +    int                                 i;
       xsd_QName                           test_expression = 
       {
           NOTIFICATION_TEST_NS,
  @@ -1056,34 +2341,41 @@
       
       *Subscribe->UseNotify = GLOBUS_TRUE;
   
  -    memset(&SubscribeResponse, '\0', sizeof(wsnt_SubscribeResponseType));
  +    for (i = 0; i < SIZEOF_ARRAY(SubscribeResponse); i++)
  +    {
  +        memset(&SubscribeResponse[i], '\0', sizeof(wsnt_SubscribeResponseType));
   
       result = globus_notification_producer_subscribe(
               uuid.text,
               engine,
               Subscribe,
  -            &SubscribeResponse);
  +                &SubscribeResponse[i]);
       if (result != GLOBUS_SUCCESS)
       {
           rc = 1;
  -
  -        goto destroy_Subscribe_out;
  +        }
       }
   
  +    for (i = 0; i < SIZEOF_ARRAY(SubscribeResponse); i++)
  +    {
       result = globus_notification_producer_destroy_subscription(
  -            SubscribeResponse.SubscriptionReference);
  +                SubscribeResponse[i].SubscriptionReference);
       if (result != GLOBUS_SUCCESS)
       {
           rc = 1;
  +        }
  +    }
   
  -        goto destroy_SubscribeResponse_out;
  +    for (i = 0; i < SIZEOF_ARRAY(SubscribeResponse); i++)
  +    {
  +        wsnt_SubscribeResponseType_destroy_contents(
  +                &SubscribeResponse[i]);
       }
   
  +
       result = globus_notification_destroy_consumer(
               &Subscribe->ConsumerReference);
   
  -destroy_SubscribeResponse_out:
  -    wsnt_SubscribeResponseType_destroy_contents(&SubscribeResponse);
   destroy_Subscribe_out:
       wsnt_SubscribeType_destroy(Subscribe);
   destroy_engine_out:
  @@ -1107,19 +2399,37 @@
   out:
       return rc != GLOBUS_SUCCESS;
   }
  -/* create_destroy_subscription_test() */
  +/* create_destroy_multiple_subscription_test() */
  +
  +static
  +void
  +engine_stop_callback(
  +    globus_result_t                     result,
  +    globus_service_engine_t             engine,
  +    void *                              arg)
  +{
  +    notification_monitor_t *            monitor = arg;
  +
  +    globus_mutex_lock(&monitor->lock);
  +    monitor->done = GLOBUS_TRUE;
  +    globus_cond_signal(&monitor->cond);
  +    globus_mutex_unlock(&monitor->lock);
  +}
  +/* engine_stop_callback() */
   
   int
  -create_destroy_multiple_subscription_test(void)
  +subscribe_and_notify_test(void)
   {
       int                                 rc;
       globus_result_t                     result;
       globus_uuid_t                       uuid;
       wsnt_TopicExpressionType            topic_expression;
       globus_service_engine_t             engine;
  +    xsd_anyType *                       message;
       wsnt_SubscribeType *                Subscribe;
  -    wsnt_SubscribeResponseType          SubscribeResponse[10];
  -    int                                 i;
  +    wsnt_SubscribeResponseType          SubscribeResponse;
  +    notification_monitor_t              monitor;
  +    notification_monitor_t              engine_monitor;
       xsd_QName                           test_expression = 
       {
           NOTIFICATION_TEST_NS,
  @@ -1209,19 +2519,37 @@
           goto destroy_topic_out;
       }
   
  +    globus_mutex_init(&engine_monitor.lock, NULL);
  +    globus_cond_init(&engine_monitor.cond, NULL);
  +    engine_monitor.done = GLOBUS_FALSE;
  +    result = globus_service_engine_register_start(
  +            engine,
  +            engine_stop_callback,
  +            &engine_monitor);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
  +
  +        goto destroy_engine_out;
  +    }
  +
       result = wsnt_SubscribeType_init(&Subscribe);
   
       if (result != GLOBUS_SUCCESS)
       {
           rc = 1;
  -        goto destroy_engine_out;
  +        goto stop_engine_out;
       }
   
  +    globus_mutex_init(&monitor.lock, NULL);
  +    globus_cond_init(&monitor.cond, NULL);
  +    monitor.done = GLOBUS_FALSE;
  +
       result = globus_notification_create_consumer(
               &Subscribe->ConsumerReference,
               engine,
               notify_callback,
  -            NULL);
  +            &monitor);
   
       if (result != GLOBUS_SUCCESS)
       {
  @@ -1250,37 +2578,90 @@
       
       *Subscribe->UseNotify = GLOBUS_TRUE;
   
  -    for (i = 0; i < SIZEOF_ARRAY(SubscribeResponse); i++)
  -    {
  -        memset(&SubscribeResponse[i], '\0', sizeof(wsnt_SubscribeResponseType));
  +    memset(&SubscribeResponse, '\0', sizeof(wsnt_SubscribeResponseType));
   
           result = globus_notification_producer_subscribe(
                   uuid.text,
                   engine,
                   Subscribe,
  -                &SubscribeResponse[i]);
  +            &SubscribeResponse);
           if (result != GLOBUS_SUCCESS)
           {
               rc = 1;
  +
  +        goto destroy_Subscribe_out;
           }
  -    }
  +    result = xsd_anyType_init(&message);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
   
  -    for (i = 0; i < SIZEOF_ARRAY(SubscribeResponse); i++)
  +        goto destroy_SubscribeResponse_out;
  +    }
  +    message->any_info = &xsd_string_info;
  +    result = xsd_string_init_cstr(
  +            (xsd_string **) &message->value,
  +            globus_libc_strdup("changed"));
  +    if (result != GLOBUS_SUCCESS)
       {
  -        result = globus_notification_producer_destroy_subscription(
  -                SubscribeResponse[i].SubscriptionReference);
  +        rc = 1;
  +
  +        goto destroy_message_out;
  +    }
  +
  +    result = globus_notification_producer_topic_changed(
  +            uuid.text,
  +            &topic_expression,
  +            message,
  +            NULL,
  +            NULL);
  +
           if (result != GLOBUS_SUCCESS)
           {
               rc = 1;
  +
  +        goto destroy_message_out;
           }
  +
  +    globus_mutex_lock(&monitor.lock);
  +    while (!monitor.done)
  +    {
  +        globus_cond_wait(&monitor.cond, &monitor.lock);
       }
  +    globus_mutex_unlock(&monitor.lock);
  +
  +    globus_mutex_destroy(&monitor.lock);
  +    globus_cond_destroy(&monitor.cond);
  +
  +    result = globus_notification_producer_destroy_subscription(
  +            SubscribeResponse.SubscriptionReference);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        rc = 1;
   
  +        goto destroy_message_out;
  +    }
   
       result = globus_notification_destroy_consumer(
               &Subscribe->ConsumerReference);
   
  +destroy_message_out:
  +    xsd_anyType_destroy(message);
  +destroy_SubscribeResponse_out:
  +    wsnt_SubscribeResponseType_destroy_contents(&SubscribeResponse);
   destroy_Subscribe_out:
       wsnt_SubscribeType_destroy(Subscribe);
  +stop_engine_out:
  +    globus_mutex_lock(&engine_monitor.lock);
  +    globus_service_engine_register_stop(engine);
  +
  +    while(!engine_monitor.done)
  +    {
  +        globus_cond_wait(&engine_monitor.cond, &engine_monitor.lock);
  +    }
  +    globus_mutex_unlock(&engine_monitor.lock);
  +    globus_mutex_destroy(&engine_monitor.lock);
  +    globus_cond_destroy(&engine_monitor.cond);
   destroy_engine_out:
       globus_service_engine_destroy(engine);
   destroy_topic_out:
  @@ -1302,26 +2683,10 @@
   out:
       return rc != GLOBUS_SUCCESS;
   }
  -/* create_destroy_multiple_subscription_test() */
  -
  -static
  -void
  -engine_stop_callback(
  -    globus_result_t                     result,
  -    globus_service_engine_t             engine,
  -    void *                              arg)
  -{
  -    notification_monitor_t *            monitor = arg;
  -
  -    globus_mutex_lock(&monitor->lock);
  -    monitor->done = GLOBUS_TRUE;
  -    globus_cond_signal(&monitor->cond);
  -    globus_mutex_unlock(&monitor->lock);
  -}
  -/* engine_stop_callback() */
  +/* subscribe_and_notify_test() */
   
   int
  -subscribe_and_notify_test(void)
  +subscribe_full_and_notify_test(void)
   {
       int                                 rc;
       globus_result_t                     result;
  @@ -1338,6 +2703,8 @@
           NOTIFICATION_TEST_NS,
           "expression"
       };
  +    xpath_XPathExpressionType *         xpath_expression;
  +    xpath_NamespaceMapEntryType *       namespace_map_entry;
   
       rc = globus_module_activate(GLOBUS_NOTIFICATION_PRODUCER_MODULE);
   
  @@ -1461,9 +2828,8 @@
           goto destroy_Subscribe_out;
       }
   
  -    result = wsnt_TopicExpressionType_copy_contents(
  -            &Subscribe->TopicExpression,
  -            &topic_expression);
  +    result = wsnt_TopicExpressionType_init_contents(
  +            &Subscribe->TopicExpression);
       if (result != GLOBUS_SUCCESS)
       {
           rc = 1;
  @@ -1481,6 +2847,22 @@
       
       *Subscribe->UseNotify = GLOBUS_TRUE;
   
  +    xsd_any_init(&Subscribe->TopicExpression.any);
  +    result = xsd_anyURI_init_cstr(
  +            &Subscribe->TopicExpression._Dialect,
  +            globus_libc_strdup(FULL_TOPIC_EXPRESSION));
  +    xpath_XPathExpressionType_init(&xpath_expression);
  +
  +    Subscribe->TopicExpression.any->value = xpath_expression;
  +    Subscribe->TopicExpression.any->any_info = &xpath_XPathExpressionType_contents_info;
  +
  +    namespace_map_entry =
  +        xpath_NamespaceMapEntryType_array_push(&xpath_expression->NamespaceMap);
  +
  +    namespace_map_entry->Prefix = globus_libc_strdup("testns");
  +    namespace_map_entry->Namespace = globus_libc_strdup(NOTIFICATION_TEST_NS);
  +    xpath_expression->ExpressionString = globus_common_create_string("testns:expression");
  +
       memset(&SubscribeResponse, '\0', sizeof(wsnt_SubscribeResponseType));
   
       result = globus_notification_producer_subscribe(
  @@ -1586,8 +2968,7 @@
   out:
       return rc != GLOBUS_SUCCESS;
   }
  -/* subscribe_and_notify_test() */
  -
  +/* subscribe_full_and_notify_test() */
   int
   get_empty_message_test(void)
   {
  @@ -4696,7 +6077,7 @@
   }
   /* resume_non_existing_subscription_test() */
   
  -int main()
  +int main(int argc, char * argv[])
   {
       int i;
       int rc;
  @@ -4706,14 +6087,22 @@
           /* functionality tests */
           create_destroy_test,
           create_topic_test,
  +        create_child_topic_test,
           create_multiple_topic_test,
           create_destroy_topic_test,
  +        create_destroy_child_topic_test,
  +        create_destroy_parent_topic_test,
           change_topic_test,
  +        change_child_topic_test,
  +        change_parent_topic_test,
           change_multiple_times_topic_test,
           change_topic_with_callback_test,
  +        change_child_topic_with_callback_test,
           create_destroy_subscription_test,
  +        create_destroy_child_subscription_test,
           create_destroy_multiple_subscription_test,
           subscribe_and_notify_test,
  +        subscribe_full_and_notify_test,
           get_empty_message_test,
           change_topic_and_get_message_test,
           enumerate_no_topics_test,
  @@ -4742,6 +6131,31 @@
           resume_non_existing_subscription_test
       };
   
  +    if (argc == 2)
  +    {
  +        rc = sscanf(argv[1], "%d", &i);
  +
  +        if (rc != 1)
  +        {
  +            fprintf(stderr, "Invalid argument: %s\n", argv[1]);
  +            exit(1);
  +        }
  +        printf("1..1\n");
  +
  +        rc = (tests[--i])();
  +
  +        if (rc == 0)
  +        {
  +            printf("ok %d\n", i+1);
  +        }
  +        else
  +        {
  +            printf("not ok %d\n", i+1);
  +            failed++;
  +        }
  +    }
  +    else
  +    {
       printf("1..%d\n", SIZEOF_ARRAY(tests));
       
       for (i = 0; i < SIZEOF_ARRAY(tests); i++)
  @@ -4758,6 +6172,7 @@
               failed++;
           }
       }
  +    }
   
       return failed;
   }
  
  
  
  1.2       +5 -0      wsrf/c/core/notification/producer/test/TESTS.pl
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TESTS.pl
  ===================================================================
  RCS file: TESTS.pl
  diff -N TESTS.pl
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ TESTS.pl	18 May 2006 15:20:10 -0000	1.2
  @@ -0,0 +1,5 @@
  +#! /usr/bin/perl
  +
  +use Test::Harness;
  +
  +runtests(qw(notification-producer-test.pl))
  
  
  
  1.2       +3 -0      wsrf/c/core/notification/producer/test/notification-producer-test.pl
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: notification-producer-test.pl
  ===================================================================
  RCS file: notification-producer-test.pl
  diff -N notification-producer-test.pl
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ notification-producer-test.pl	18 May 2006 15:20:10 -0000	1.2
  @@ -0,0 +1,3 @@
  +#! /usr/bin/perl
  +
  +system("./notification-producer-test");
  
  
  




More information about the cwscore-commit mailing list