You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2011/07/03 02:29:37 UTC
svn commit: r1142350 [17/18] - in
/incubator/airavata/donations/ogce-donation/modules/ws-messaging: broker/
broker/customLibs/ broker/customLibs/activeMQ/ broker/src/ broker/src/main/
broker/src/main/java/ broker/src/main/java/wsmg/ broker/src/main/jav...
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsd/calder_notification_types.xsd
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsd/calder_notification_types.xsd?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsd/calder_notification_types.xsd (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsd/calder_notification_types.xsd Sun Jul 3 00:29:24 2011
@@ -0,0 +1,95 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<schema
+ targetNamespace="http://www.calderproject.org/calder_notification_types"
+ xmlns:cnt="http://www.calderproject.org/calder_notification_types"
+ xmlns:wft="http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ attributeFormDefault="qualified"
+ elementFormDefault="qualified">
+
+ <!-- ========================================================================================== -->
+ <!-- Authors: -->
+ <!-- Yogesh L. Simmhan* -->
+ <!-- Alek Slominski -->
+ <!-- Marcus Christie -->
+ <!-- Scott Jensen -->
+ <!-- -->
+ <!-- Version: 2.1 -->
+ <!-- Date: 2006-08-15 -->
+ <!-- -->
+ <!-- Copyright (c) 2006 Extreme! Lab, Indiana University. All rights reserved. -->
+ <!-- This software is open source. See http://extreme.indiana.edu/license.txt for license. -->
+ <!-- ========================================================================================== -->
+
+ <complexType name="CalderNotificationType">
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="radarName" type="string" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="CalderClusterNotificationType">
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="ctrlon" type="float">
+ <annotation><documentation xml:lang="en">
+ Center Longitude (-180 ... 180)
+ </documentation></annotation>
+ </element>
+
+ <element name="ctrlat" type="float">
+ <annotation><documentation xml:lang="en">
+ Center Latitude (-90 ... +90)
+ </documentation></annotation>
+ </element>
+
+ <element name="westbc" type="float">
+ <annotation><documentation xml:lang="en">
+ Longitude of left side of bounding box (-180..180). This is also
+the "westbc"
+ element in the LEAD Metadata Schema.
+ </documentation></annotation>
+ </element>
+
+ <element name="eastbc" type="float">
+ <annotation><documentation xml:lang="en">
+ Longitude of right side of bounding box (-180..180). This is also
+the "eastbc"
+ element in the LEAD Metadata Schema.
+ </documentation></annotation>
+ </element>
+
+ <element name="southbc" type="float">
+ <annotation><documentation xml:lang="en">
+ Latitude of bottom side of bounding box (-90..90). This is also
+the "southbc"
+ element in the LEAD Metadata Schema.
+ </documentation></annotation>
+ </element>
+
+ <element name="northbc" type="float">
+ <annotation><documentation xml:lang="en">
+ Latitude of top side of bounding box (-90..90). This is also the
+"northbc"
+ element in the LEAD Metadata Schema.
+ </documentation></annotation>
+ </element>
+
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+
+ <element name="queryStarted" type="cnt:CalderNotificationType" />
+ <element name="queryFailedToStart" type="cnt:CalderNotificationType" />
+ <element name="queryActive" type="cnt:CalderNotificationType" />
+ <element name="queryExpired" type="cnt:CalderNotificationType" />
+ <element name="triggerFound" type="cnt:CalderNotificationType" />
+ <element name="queryPublishResult" type="cnt:CalderClusterNotificationType" />
+ <element name="queryNoDetection" type="cnt:CalderNotificationType" />
+</schema>
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsd/notification_types.xsd
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsd/notification_types.xsd?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsd/notification_types.xsd (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsd/notification_types.xsd Sun Jul 3 00:29:24 2011
@@ -0,0 +1,591 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<schema
+ targetNamespace="http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking"
+ xmlns:wft="http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ attributeFormDefault="qualified"
+ elementFormDefault="qualified">
+
+ <!-- ========================================================================================== -->
+ <!-- Authors: -->
+ <!-- Yogesh L. Simmhan* -->
+ <!-- Alek Slominski -->
+ <!-- Marcus Christie -->
+ <!-- Scott Jensen -->
+ <!-- -->
+ <!-- Version: 2.1 -->
+ <!-- Date: 2006-08-15 -->
+ <!-- -->
+ <!-- Copyright (c) 2006 Extreme! Lab, Indiana University. All rights reserved. -->
+ <!-- This software is open source. See http://extreme.indiana.edu/license.txt for license. -->
+ <!-- ========================================================================================== -->
+
+
+ <!-- ========================================================================================== -->
+
+ <annotation>
+ <documentation>
+ *) Workflows and services can be abstract (template) or concrete (instance).
+ Unless otherwise noted, we always refer to the concrete instance of the workflow/service below
+ *) All workflows are also services.
+ *) Services may be part of zero or more workflows
+ *) When Services execute in the context of a workflow,
+ an invocation of the service is associated with the workflowID of the workflow whose context
+ in which it is being invoked (also called parent workflow),
+ the timestep of this invocation in the parent workflow,
+ and the node ID that uniquely identifies this service within the parent workflow instance.
+ *) Workflows can also be invoked in the context of another parent workflow.
+ *) Workflow ID always refers to the "parent workflow ID". When refering to the invocation of a workflow,
+ its instance ID is called the Service ID.
+ *) Workflows that are not invoked from another workflow do not have a context of execution
+ (parent workflow is not present => Workflow ID is NULL)
+ *) Schema design notes
+ - This schema uses the "Venetian Blind" schema design pattern
+ - It uses Upper Camel Case for schema types and lower camel case for
+ element and attribute names
+ </documentation>
+ </annotation>
+
+ <simpleType name="ServiceIDType">
+ <annotation>
+ <documentation>
+ ID to uniquely identify the service instance.
+ This is usually formed from the targetnamespace and porttype name of the service's WSDL.
+ This ID may refer to the instance ID for a service or for a workflow.
+ </documentation>
+ </annotation>
+ <restriction base="anyURI"/>
+ </simpleType>
+
+ <simpleType name="WorkflowNodeIDType">
+ <annotation>
+ <documentation>
+ String that identifies uniquely a node in workflow graph.
+ The node ID is unique in the scope of a workflow ID.
+ </documentation>
+ </annotation>
+ <restriction base="string"/>
+ </simpleType>
+
+ <simpleType name="WorkflowTimestepType">
+ <annotation>
+ <documentation>
+ The timestep within workflow execution at which this invocation is made.
+ This is a logical time that monotonically increments for each invocation in a workflow.
+ </documentation>
+ </annotation>
+ <restriction base="int"/>
+ </simpleType>
+
+ <simpleType name="DataProductIDType">
+ <annotation>
+ <documentation>
+ Unique logical ID for a data product in the form of a UUID.
+ Physical URL for the data products can be resolved using this ID.
+ </documentation>
+ </annotation>
+ <restriction base="anyURI"/>
+ </simpleType>
+
+ <!-- ========================================================================================== -->
+
+ <complexType name="BaseIDType">
+ <attribute name="workflowID" type="wft:ServiceIDType" use="optional">
+ <annotation>
+ <documentation>
+ The workflow context within which this service is executing.
+ If this service is itself a workflow and not executing as part of another workflow
+ (i.e. this is the root of the invocation trace) then the workflow ID is absent.
+ Otherwise, this is the service ID of the workflow instance.
+ </documentation>
+ </annotation>
+ </attribute>
+
+ <attribute name="serviceID" type="wft:ServiceIDType" use="required">
+ <annotation>
+ <documentation>
+ ID to uniquely identify a service instance. The service instance can
+ be part of zero or more workflow.
+ This is formed from the targetnamespace of the service's CWSDL.
+ </documentation>
+ </annotation>
+ </attribute>
+
+ <attribute name="workflowNodeID" type="wft:WorkflowNodeIDType" use="optional">
+ <annotation>
+ <documentation>
+ Distinct ID of a node within a Workflow graph. unique within the workflowID,
+ not necessarily the order of execution.
+ </documentation>
+ </annotation>
+ </attribute>
+
+ <attribute name="workflowTimestep" type="wft:WorkflowTimestepType" use="optional">
+ <annotation>
+ <documentation>
+ The timestep within workflow execution at which this invocation is made.
+ 32bit integer. Timestep is a numerically ordered monotonically increasing sequence
+ within wf execution that allows relative ordering of invocations.
+ It is unique within the workflowID for each invocation in the workflow.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+
+ <!-- base type for all notifications -->
+ <complexType name="BaseNotificationType">
+ <annotation>
+ <documentation>This is the base type for all notification activities that are produced</documentation>
+ </annotation>
+ <sequence>
+
+ <element name="notificationSource" type="wft:BaseIDType">
+ <annotation>
+ <documentation>
+ This identifies the entity/invocation context from which this notifcation is being sent.
+ </documentation>
+ </annotation>
+ </element>
+
+ <element name="timestamp" type="dateTime" />
+
+ <element name="description" type="string" minOccurs="0">
+ <annotation>
+ <documentation>Optional human friendly description of this notification.</documentation>
+ </annotation>
+ </element>
+
+ <element name="annotation" type="anyType" minOccurs="0">
+ <annotation>
+ <documentation>Optional additional metadata for this notification. See common.AnnotationConsts file.</documentation>
+ </annotation>
+ </element>
+
+ </sequence>
+
+ <attribute name="infoModelVersion"
+ form="unqualified"
+ type="NMTOKEN"
+ use="required">
+ <!-- we set form as unqualified to allow WS-Messenger YFilter to match it -->
+ <!-- NMToken := (Letter | Digit | '.' | '-' | '_' | ':')+ -->
+ <annotation>
+ <documentation>
+ String identifying notification schema version (used for verifying compatible schema and filtering).
+ </documentation>
+ </annotation>
+ </attribute>
+
+ </complexType>
+
+
+ <complexType name="MessageType">
+ <sequence>
+ <element name="header" type="anyType" minOccurs="0" /> <!-- e.g. soap:header -->
+ <element name="body" type="anyType" minOccurs="0" /> <!-- e.g. soap:body --> <!-- fixme: change to message -->
+ </sequence>
+ </complexType>
+
+ <complexType name="FaultMessageType">
+ <complexContent>
+ <extension base="wft:MessageType" />
+ </complexContent>
+ </complexType>
+
+ <complexType name="InvocationMessageType">
+ <complexContent>
+ <extension base="wft:MessageType" />
+ </complexContent>
+ </complexType>
+
+
+ <complexType name="FailureMessageType">
+ <sequence>
+ <element name="trace" type="anyType" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ </complexType>
+
+
+ <!-- ========================================================================================== -->
+ <!-- workflow provenance types -->
+ <!-- ========================================================================================== -->
+
+ <!-- sent when the service is first created and is ready to accept invocations -->
+ <element name="serviceInitialized" type="wft:BaseNotificationType" />
+
+ <!-- sent when the service is terminated and will not accept any further invocations -->
+ <element name="serviceTerminated" type="wft:BaseNotificationType" />
+
+ <!-- sent when the workflow is first created and is ready to accept invocations -->
+ <!--element name="workflowInitialized" type="wft:BaseNotificationType"-->
+ <element name="workflowInitialized">
+ <complexType>
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="initialPriority" type="string" minOccurs="0" />
+ <element name="workflowTemplateId" type="wft:ServiceIDType" minOccurs="0" />
+ <element name="workflowCreatorDn" type="string" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <!-- sent when the workflow is terminated and will not accept any further invocations -->
+ <element name="workflowTerminated" type="wft:BaseNotificationType" />
+
+ <!-- sent when the workflow execution is paused: invocations will be accepted but no new messages will be sent by the workflow -->
+ <element name="workflowPaused" type="wft:BaseNotificationType" />
+
+ <!-- sent when the workflow execution is resumed -->
+ <element name="workflowResumed" type="wft:BaseNotificationType" />
+
+ <!-- workflow priority tracking -->
+ <element name="workflowPriorityChanged">
+ <complexType>
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="newPriority" type="string" />
+ <element name="oldPriority" type="string" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <!-- ========================================================================================== -->
+
+ <complexType name="InvocationRequestType" abstract="true">
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="request" type="wft:InvocationMessageType" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="RequestInitiatorType">
+ <complexContent>
+ <extension base="wft:InvocationRequestType">
+ <sequence>
+ <!-- used by wf (client) to set service info, when invoking service -->
+ <element name="receiver" type="wft:BaseIDType" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="RequestReceiverType">
+ <complexContent>
+ <extension base="wft:InvocationRequestType">
+ <sequence>
+ <!-- used by service to set workflow(client) info, when invoked by workflow (client) -->
+ <element name="initiator" type="wft:BaseIDType" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+
+ <!-- ========================================================================================== -->
+
+ <complexType name="AcknowledgementType" abstract="true">
+ <complexContent>
+ <extension base="wft:BaseNotificationType" >
+ <sequence>
+ <element name="receiver" type="wft:BaseIDType" minOccurs="0" /> <!-- target of the action that succeeded -->
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="AcknowledgeSuccessType">
+ <complexContent>
+ <extension base="wft:AcknowledgementType" />
+ </complexContent>
+ </complexType>
+
+ <complexType name="AcknowledgeFailureType">
+ <complexContent>
+ <extension base="wft:AcknowledgementType">
+ <sequence>
+ <element name="failure" type="wft:FailureMessageType" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- ========================================================================================== -->
+
+ <!-- sent by workflow when a service is invoked by it. -->
+ <element name="invokingService" type="wft:RequestInitiatorType" />
+
+
+ <!-- sent by workflow when it is invoked. -->
+ <element name="workflowInvoked" type="wft:RequestReceiverType" />
+
+ <!-- sent by service when it is invoked. -->
+ <element name="serviceInvoked" type="wft:RequestReceiverType" />
+
+
+ <!-- sent by workflow when it invoked a service successfully. -->
+ <element name="invokingServiceSucceeded" type="wft:AcknowledgeSuccessType" />
+
+ <!-- sent by workflow when it failed to invoke a service successfully. -->
+ <element name="invokingServiceFailed" type="wft:AcknowledgeFailureType" />
+
+
+ <!-- ========================================================================================== -->
+
+ <complexType name="InvocationResultType" abstract="true">
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="result" type="wft:InvocationMessageType" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="InvocationFaultType" abstract="true">
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="fault" type="wft:FaultMessageType" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="ResultReceiverType">
+ <complexContent>
+ <extension base="wft:InvocationResultType">
+ <sequence>
+ <!-- used by wf (client) to set service info, when receiving result from service -->
+ <element name="responder" type="wft:BaseIDType" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="FaultReceiverType">
+ <complexContent>
+ <extension base="wft:InvocationFaultType">
+ <sequence>
+ <!-- used by wf (client) to set service info, when receiving result from service -->
+ <element name="responder" type="wft:BaseIDType" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="ResultResponderType">
+ <complexContent>
+ <extension base="wft:InvocationResultType">
+ <sequence>
+ <!-- used by service to set workflow(client) info, when returning result to workflow (client) -->
+ <element name="receiver" type="wft:BaseIDType" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="FaultResponderType">
+ <complexContent>
+ <extension base="wft:InvocationFaultType">
+ <sequence>
+ <!-- used by service to set workflow(client) info, when returning result to workflow (client) -->
+ <element name="receiver" type="wft:BaseIDType" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- ========================================================================================== -->
+
+ <!-- sent by service when it returns the result for an invocation. -->
+ <element name="sendingResult" type="wft:ResultResponderType" /> <!-- add workflowSendingResult -->
+
+ <!-- sent by service when it returns a fault for an invocation. -->
+ <element name="sendingFault" type="wft:FaultResponderType" /> <!-- add workflowSendingFault -->
+
+
+ <!-- sent by workflow when it receives the result for an invocation. -->
+ <element name="receivedResult" type="wft:ResultReceiverType" /> <!-- add workflowReceivedResult -->
+
+ <!-- sent by workflow when it receives a fault for an invocation. -->
+ <element name="receivedFault" type="wft:FaultReceiverType" /> <!-- add workflowFaultResult -->
+
+
+ <!-- sent by service when it has successfully sent the result for an invocation. -->
+ <element name="sendingResponseSucceeded" type="wft:AcknowledgeSuccessType" />
+
+ <!-- sent by service when it has successfully sent a fault for an invocation. -->
+ <element name="sendingResponseFailed" type="wft:AcknowledgeFailureType" />
+
+ <!-- ========================================================================================== -->
+
+
+ <!-- ========================================================================================== -->
+ <!-- data provenance types -->
+ <!-- ========================================================================================== -->
+
+ <!-- general complex data types -->
+ <complexType name="DataProductType">
+ <sequence>
+ <element name="id" type="wft:DataProductIDType" />
+ <element name="location" type="anyURI" minOccurs="0" maxOccurs="unbounded" />
+ <element name="sizeInBytes" type="long" minOccurs="0" />
+ <element name="timestamp" type="dateTime" minOccurs="0" /> <!-- context sensitive. time at which data product was produced or consumed. -->
+ <element name="description" type="string" minOccurs="0">
+ <annotation>
+ <documentation>Optional human friendly description of this data product.</documentation>
+ </annotation>
+ </element>
+ <element name="annotation" type="anyType" minOccurs="0">
+ <annotation>
+ <documentation>Optional additional metadata for this data product.</documentation>
+ </annotation>
+ </element>
+ </sequence>
+ </complexType>
+
+ <complexType name="DataProductNotificationType">
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="dataProduct" type="wft:DataProductType" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- sent when a file is used by the jython app. -->
+ <element name="dataConsumed" type="wft:DataProductNotificationType" />
+
+ <!-- sent when a file is generated by the jython app. -->
+ <element name="dataProduced" type="wft:DataProductNotificationType" />
+
+
+ <!-- ========================================================================================== -->
+ <!-- performance audit types -->
+ <!-- ========================================================================================== -->
+
+
+ <!-- sent when the application launches a GRAM job, to facilitate -->
+ <!-- auditing and accounting of TeraGrid jobs -->
+ <!-- SJ The type name needed Type added at the end -->
+ <complexType name="ApplicationAuditType">
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="jobHandle" type="anyURI"/>
+ <element name="host" type="string" />
+ <element name="queueName" type="string" minOccurs="0"/>
+ <element name="jobId" type="string" minOccurs="0"/>
+ <element name="distinguishedName" type="string" />
+ <element name="projectId" type="string" minOccurs="0"/>
+ <element name="rsl" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="applicationAudit" type="wft:ApplicationAuditType" />
+
+
+ <!-- sent at the end of a computational block in the jython app -->
+ <!-- with the time in milliseconds taken for that computational block -->
+ <element name="computationDuration">
+ <complexType>
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="durationInMillis" type="long" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <!-- sent at the end of sending a file to remote location (thro' gridftp?) by the jython app -->
+ <!-- with the time in milliseconds taken to send that file -->
+ <!-- TODO: later add support for time for multiple files in a single notification? -->
+ <complexType name="DataTransferDurationType">
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="id" type="wft:DataProductIDType" />
+ <element name="source" type="anyURI" />
+ <element name="target" type="anyURI" />
+ <element name="sizeInBytes" type="long" minOccurs="0" default="-1" />
+ <element name="durationInMillis" type="long" default="-1" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="dataSendDuration" type="wft:DataTransferDurationType" />
+ <element name="dataReceiveDuration" type="wft:DataTransferDurationType" />
+
+ <!-- ========================================================================================== -->
+ <!-- generic log message types -->
+ <!-- ========================================================================================== -->
+
+
+ <!-- sent when an interesting file is created by the jython app that can be viewed thro' a URL -->
+ <!-- used to display as a link on the portal -->
+ <element name="publishURL">
+ <complexType>
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="title" type="string" minOccurs="0" />
+ <element name="location" type="anyURI" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <!-- generic log message at different levels of importance that can be produced by the jython app -->
+ <element name="logInfo" type="wft:BaseNotificationType" />
+ <element name="logException" type="wft:BaseNotificationType" />
+ <element name="logWarning" type="wft:BaseNotificationType" />
+ <element name="logDebug" type="wft:BaseNotificationType" />
+
+
+ <!-- ========================================================================================== -->
+ <!-- resource broker message types -->
+ <!-- ========================================================================================== -->
+
+ <complexType name="ResourceMappingType">
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="mappedResource" type="string" />
+ <element name="retryStatusCount" type="int" default="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="JobStatusType">
+ <complexContent>
+ <extension base="wft:BaseNotificationType">
+ <sequence>
+ <element name="jobStatus" type="string" />
+ <element name="retryCount" type="int" default="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="resourceMapping" type="wft:ResourceMappingType" />
+ <element name="jobStatus" type="wft:JobStatusType" />
+
+</schema>
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsdconfig/calder_notification_types.xsdconfig
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsdconfig/calder_notification_types.xsdconfig?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsdconfig/calder_notification_types.xsdconfig (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsdconfig/calder_notification_types.xsdconfig Sun Jul 3 00:29:24 2011
@@ -0,0 +1,13 @@
+<!-- An xsdconfig file must begin with a "config" element in the
+ http://www.bea.com/2002/09/xbean/config namespace. Also, be sure
+ to declare any namespaces used to qualify types in your schema (here,
+ the namespace corresponding to the pol prefix. -->
+<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config">
+
+ <!-- Use the "namespace" element to map a namespace to the Java package
+ name that should be generated. -->
+ <xb:namespace uri="http://www.calderproject.org/calder_notification_types">
+ <xb:package>edu.indiana.extreme.lead.calder.types</xb:package>
+ </xb:namespace>
+
+</xb:config>
Propchange: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsdconfig/calder_notification_types.xsdconfig
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsdconfig/notification_types_ng.xsdconfig
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsdconfig/notification_types_ng.xsdconfig?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsdconfig/notification_types_ng.xsdconfig (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsdconfig/notification_types_ng.xsdconfig Sun Jul 3 00:29:24 2011
@@ -0,0 +1,13 @@
+<!-- An xsdconfig file must begin with a "config" element in the
+ http://www.bea.com/2002/09/xbean/config namespace. Also, be sure
+ to declare any namespaces used to qualify types in your schema (here,
+ the namespace corresponding to the pol prefix. -->
+<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config">
+
+ <!-- Use the "namespace" element to map a namespace to the Java package
+ name that should be generated. -->
+ <xb:namespace uri="http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking">
+ <xb:package>edu.indiana.extreme.lead.workflow_tracking.types</xb:package>
+ </xb:namespace>
+
+</xb:config>
Propchange: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/xsdconfig/notification_types_ng.xsdconfig
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/LeadCallbackHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/LeadCallbackHandlerTest.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/LeadCallbackHandlerTest.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/LeadCallbackHandlerTest.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,181 @@
+/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- //- -----100-columns-wide------>*/
+/*
+ * Copyright (c) 2004 Extreme! Lab, Indiana University. All rights reserved.
+ *
+ * This software is open source. See the bottom of this file for the licence.
+ *
+ * $Id: LeadCallbackHandlerTest.java,v 1.6 2008/06/21 21:02:06 cherath Exp $
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking;
+
+import java.io.StringReader;
+import java.net.URL;
+import java.util.Properties;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import wsmg.client.WseClientAPI;
+import wsmg.client.WseMsgBrokerClient;
+import edu.indiana.extreme.lead.commons.WorkFlowUtils;
+import edu.indiana.extreme.lead.workflow_tracking.client.Callback;
+import edu.indiana.extreme.lead.workflow_tracking.client.LeadNotificationManager;
+import edu.indiana.extreme.lead.workflow_tracking.client.NotificationType;
+import edu.indiana.extreme.lead.workflow_tracking.client.Subscription;
+import edu.indiana.extreme.lead.workflow_tracking.util.CommonUtils;
+import edu.indiana.extreme.lead.workflow_tracking.util.TestConfigKeys;
+
+/**
+ * @author dinesh
+ */
+
+public class LeadCallbackHandlerTest extends TestCase {
+
+ Properties configs = new Properties();
+ String BROKER_URL;
+ String MESSAGEBOX_URL;
+ int consumerPort;
+ String AXIS_REPO;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ URL configURL = ClassLoader
+ .getSystemResource(TestConfigKeys.CONFIG_FILE_NAME);
+ configs.load(configURL.openStream());
+ BROKER_URL = configs
+ .getProperty(TestConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+ MESSAGEBOX_URL = configs.getProperty(TestConfigKeys.MSGBOX_SERVICE_EPR);
+ consumerPort = Integer.parseInt(configs
+ .getProperty(TestConfigKeys.CONSUMER_PORT));
+ AXIS_REPO = configs.getProperty(TestConfigKeys.AXIS2_REPO);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ boolean wait = false;
+ int repetition = 3;
+ private Subscription subscription;
+
+ class TestMsgCallback implements Callback {
+
+ public TestMsgCallback(int reps) {
+ repititions = reps;
+ }
+
+ BlockingQueue<Boolean> msgQueue = new LinkedBlockingQueue<Boolean>();
+ int count = 0;
+ int repititions;
+
+ public void deliverMessage(String topic,
+ NotificationType notificationType, XmlObject messageObj) {
+
+ count++;
+ System.out.println("Subscription received " + count
+ + "th notification of type:");
+ if (repititions <= count) {
+ msgQueue.add(new Boolean(true));
+ }
+
+ }
+
+ public BlockingQueue<Boolean> getQueue() {
+ return msgQueue;
+ }
+
+ }
+
+ @Test
+ public void testRoundTrip() throws Exception {
+ wait = true;
+
+ TestMsgCallback c1 = new TestMsgCallback(repetition);
+ TestMsgCallback c2 = new TestMsgCallback(repetition);
+
+ subscription = LeadNotificationManager.createSubscription(BROKER_URL,
+ "topic", c1, consumerPort);
+ Thread.sleep(100);
+ Subscription subscription2 = LeadNotificationManager
+ .createSubscription(BROKER_URL, "topic", c2, consumerPort + 1);
+
+ WseMsgBrokerClient client = new WseMsgBrokerClient();
+ client.init(BROKER_URL);
+ client.setTimeoutInMilliSeconds(20000L);
+
+ OMElement msg = WorkFlowUtils.reader2OMElement(new StringReader(
+ CommonUtils.WORKFLOW_INITIALIZED_NOTIFICATION));
+
+ for (int i = 0; i < repetition; i++) {
+ client.publish("topic", msg);
+ Thread.sleep(100);
+ }
+
+ Boolean b1 = c1.getQueue().take();
+ Boolean b2 = c2.getQueue().take();
+
+ System.out.println(b1);
+ System.out.println(b2);
+
+ subscription.destroy();
+ subscription2.destroy();
+
+ }
+
+ @Test
+ public void testRoundTripWithDifferentTopics() throws Exception {
+ wait = true;
+
+ TestMsgCallback c1 = new TestMsgCallback(repetition);
+ TestMsgCallback c2 = new TestMsgCallback(repetition);
+
+ subscription = LeadNotificationManager.createSubscription(BROKER_URL,
+ "topic10", c1, consumerPort);
+ Subscription subscription2 = LeadNotificationManager
+ .createSubscription(BROKER_URL, "topic20", c2, consumerPort + 1);
+
+ WseMsgBrokerClient client = new WseMsgBrokerClient();
+ client.init(BROKER_URL);
+
+ OMElement msg = WorkFlowUtils.reader2OMElement(new StringReader(
+ CommonUtils.WORKFLOW_INITIALIZED_NOTIFICATION));
+
+ for (int i = 0; i < repetition; i++) {
+ client.publish("topic10", msg);
+ Thread.sleep(100);
+ }
+
+ for (int i = 0; i < repetition; i++) {
+ client.publish("topic20", msg);
+ Thread.sleep(100);
+ }
+
+ Boolean b1 = c1.getQueue().take();
+ Boolean b2 = c2.getQueue().take();
+
+ System.out.println(b1);
+ System.out.println(b2);
+
+ subscription2.destroy();
+ subscription.destroy();
+ }
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/LeadNotificationManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/LeadNotificationManagerTest.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/LeadNotificationManagerTest.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/LeadNotificationManagerTest.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,29 @@
+package edu.indiana.extreme.lead.workflow_tracking;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import edu.indiana.extreme.lead.workflow_tracking.client.LeadNotificationManager;
+
+public class LeadNotificationManagerTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public final void testGetBrokerPublishEPR() {
+
+ String endpointRefAsStr = LeadNotificationManager.getBrokerPublishEPR(
+ "http://brokerurl", "testtopic");
+
+ System.out.println(endpointRefAsStr);
+
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/MultipleSubscriptionTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/MultipleSubscriptionTest.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/MultipleSubscriptionTest.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/MultipleSubscriptionTest.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,99 @@
+package edu.indiana.extreme.lead.workflow_tracking;
+
+import java.net.URL;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.AxisFault;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+import edu.indiana.extreme.lead.workflow_tracking.util.CommonUtils;
+import edu.indiana.extreme.lead.workflow_tracking.util.TestConfigKeys;
+import edu.indiana.extreme.lead.workflow_tracking.util.SubscriberThread;
+
+import wsmg.client.WseClientAPI;
+import wsmg.client.WseMsgBrokerClient;
+
+/**
+ * @author dinesh
+ */
+
+public class MultipleSubscriptionTest extends TestCase implements
+ ThreadMessagePassingCallback {
+
+ static Properties configs = new Properties();
+ String BROKER_URL;
+ String MESSAGEBOX_URL;
+ int consumerPort;
+ public static final int NOTIFICATIONS_PUBLISHED = 4;
+ public static final int NUMBER_OF_SUBSCRIBERS = 4;
+ private int succesfulclients = 0;
+ String AXIS_REPO;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ URL configURL = ClassLoader
+ .getSystemResource(TestConfigKeys.CONFIG_FILE_NAME);
+ configs.load(configURL.openStream());
+ BROKER_URL = configs
+ .getProperty(TestConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+ MESSAGEBOX_URL = configs.getProperty(TestConfigKeys.MSGBOX_SERVICE_EPR);
+ consumerPort = Integer.parseInt(configs
+ .getProperty(TestConfigKeys.CONSUMER_PORT));
+ AXIS_REPO = configs.getProperty(TestConfigKeys.AXIS2_REPO);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ public void testMultipleSubscribers() throws Exception {
+
+ SubscriberThread[] subscribers = new SubscriberThread[NUMBER_OF_SUBSCRIBERS];
+ for (int i = 0; i < NUMBER_OF_SUBSCRIBERS; ++i) {
+ subscribers[i] = new SubscriberThread(this, BROKER_URL,
+ "topic" + i, consumerPort + i);
+ subscribers[i].start();
+
+ }
+
+ Thread.sleep(5000);
+
+ WseMsgBrokerClient client = new WseMsgBrokerClient();
+ client.init(BROKER_URL);
+
+ for (int j = 0; j < NUMBER_OF_SUBSCRIBERS; j++) {
+ for (int i = 0; i < NOTIFICATIONS_PUBLISHED; i++) {
+
+ client.publish("topic" + j,
+ CommonUtils.WORKFLOW_INITIALIZED_NOTIFICATION);
+
+ Thread.sleep(100);
+ }
+ }
+
+ while (succesfulclients < NUMBER_OF_SUBSCRIBERS) {
+ Thread.sleep(1000);
+ }
+
+ }
+
+ public void done() {
+ System.out.println("Done Multiple subscription test");
+ succesfulclients++;
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/RenewSubscriptionTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/RenewSubscriptionTest.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/RenewSubscriptionTest.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/RenewSubscriptionTest.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,150 @@
+package edu.indiana.extreme.lead.workflow_tracking;
+
+import java.net.URL;
+import java.rmi.RemoteException;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import wsmg.client.MsgBrokerClientException;
+import wsmg.client.WseMsgBrokerClient;
+import edu.indiana.extreme.lead.workflow_tracking.client.Callback;
+import edu.indiana.extreme.lead.workflow_tracking.client.LeadNotificationManager;
+import edu.indiana.extreme.lead.workflow_tracking.client.NotificationType;
+import edu.indiana.extreme.lead.workflow_tracking.client.Subscription;
+import edu.indiana.extreme.lead.workflow_tracking.util.TestConfigKeys;
+
+/**
+ * @author dinesh
+ */
+
+public class RenewSubscriptionTest extends TestCase implements Callback {
+
+ static Properties configs = new Properties();
+ String BROKER_URL;
+ String MESSAGEBOX_URL;
+ int consumerPort;
+ public static final String TOPIC = "testTopic";
+ private static final String MESSAGE_BOX_ID = "929799u028887273u9899400999999";
+ public static int count = 0;
+ public int messages = 10;
+ public static Object mutex = new Object();
+ Subscription sub;
+ String AXIS_REPO;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ URL configURL = ClassLoader
+ .getSystemResource(TestConfigKeys.CONFIG_FILE_NAME);
+ configs.load(configURL.openStream());
+ BROKER_URL = configs
+ .getProperty(TestConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+ MESSAGEBOX_URL = configs.getProperty(TestConfigKeys.MSGBOX_SERVICE_EPR);
+ consumerPort = Integer.parseInt(configs
+ .getProperty(TestConfigKeys.CONSUMER_PORT));
+ // AXIS_REPO=configs.getProperty(TestConfigKeys.AXIS2_REPO);
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testRenewSubscriptionTest() throws Exception {
+
+ String brokerPublishEPR = null;
+
+ sub = LeadNotificationManager.createMessageBoxSubscription(
+ MESSAGEBOX_URL, BROKER_URL, TOPIC, null, this, false);
+
+ brokerPublishEPR = sub.getBrokerURL();
+ System.out.println(brokerPublishEPR);
+
+ WseMsgBrokerClient client = new WseMsgBrokerClient();
+ client.init(brokerPublishEPR);
+
+ OMElement msg = OMAbstractFactory.getOMFactory().createOMElement(
+ "testMessage", null);
+ msg.setText("some message");
+ client.publish(TOPIC, msg);
+
+ Thread.sleep(10000);
+ for (int i = 0; i < messages; ++i) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ try {
+ sub = LeadNotificationManager.renewMessageboxSubscription(
+ BROKER_URL, sub.getMessageBoxEPR(), sub
+ .getSubscriptionID(), TOPIC, null, false);
+ } catch (AxisFault e) {
+ e.printStackTrace();
+ }
+ }
+
+ Thread.sleep(10000);
+
+ for (int i = 0; i < messages; ++i) {
+ client.publish(TOPIC, msg);
+
+ Thread.sleep(100);
+
+ }
+
+ while (true) {
+
+ Thread.sleep(1000);
+
+ }
+ }
+
+ public void deliverMessage(String topic, NotificationType notificationType,
+ XmlObject messageObj) {
+ System.out.println(messageObj.toString());
+ System.out.println("A message received by handler correctly");
+ synchronized (mutex) {
+ count++;
+ }
+ if (count == messages + 1) {
+ try {
+ sub.destroy();
+ } catch (RemoteException e1) {
+ e1.printStackTrace();
+ }
+ System.out.println("Destroyed");
+ WseMsgBrokerClient client = new WseMsgBrokerClient();
+ client.init(BROKER_URL);
+ try {
+ client.publish(TOPIC, "some message");
+ } catch (MsgBrokerClientException e) {
+ e.printStackTrace();
+ }
+ }
+
+ System.out.println(count + " <=" + (messages + 1));
+
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/ThreadMessagePassingCallback.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/ThreadMessagePassingCallback.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/ThreadMessagePassingCallback.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/ThreadMessagePassingCallback.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,11 @@
+package edu.indiana.extreme.lead.workflow_tracking;
+
+
+/**
+ * @author Chathura Herath (cherath@cs.indiana.edu)
+ */
+
+public interface ThreadMessagePassingCallback {
+
+ public void done();
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/impl/publish/Test.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/impl/publish/Test.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/impl/publish/Test.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/impl/publish/Test.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,23 @@
+package edu.indiana.extreme.lead.workflow_tracking.impl.publish;
+
+import org.apache.xmlbeans.XmlCursor;
+
+import edu.indiana.extreme.lead.workflow_tracking.types.BaseNotificationType;
+import edu.indiana.extreme.lead.workflow_tracking.types.WorkflowInitializedDocument;
+import edu.indiana.extreme.lead.workflow_tracking.util.XmlBeanUtils;
+
+public class Test {
+public static void main(String[] args) {
+ WorkflowInitializedDocument activity = WorkflowInitializedDocument.Factory.newInstance();
+ BaseNotificationType activityType = activity.addNewWorkflowInitialized();
+
+
+
+ XmlCursor c = activity.newCursor();
+ c.toNextToken();
+
+ System.out.println(c.getObject().getClass());
+
+ System.out.println(((BaseNotificationType)c.getObject()).getDescription());
+}
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/impl/publish/TestWSMPublisher.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/impl/publish/TestWSMPublisher.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/impl/publish/TestWSMPublisher.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/impl/publish/TestWSMPublisher.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,107 @@
+package edu.indiana.extreme.lead.workflow_tracking.impl.publish;
+
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestWSMPublisher {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public final void testWSMPublisherConstructor1() {
+
+ EndpointReference brokerEpr = new EndpointReference(
+ "http://invalid/broker/address");
+ WSMPublisher publisher = new WSMPublisher(10, false, brokerEpr);
+
+ }
+
+ @Test
+ public final void testWSMPublisherConstructor2() {
+
+ try {
+ WSMPublisher publisher = new WSMPublisher(10, false,
+ "http://invalid/broker/address", "TestTopic1");
+
+ } catch (IOException e) {
+ fail("Test failed");
+ }
+
+ }
+
+ @Test
+ public final void testWSMPublisherConstructor3() {
+ try {
+
+ EndpointReference epr = new EndpointReference(
+ "http://invalid/broker/address");
+
+ WSMPublisher publisher = new WSMPublisher(10, false, epr
+ .getAddress());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public final void testWSMPublisherConstructor4() {
+ try {
+
+ EndpointReference epr = new EndpointReference(
+ "http://invalid/broker/address");
+
+ // According to addressing format.
+ String eprFormat = "<BrokerEPR><wsa:Address xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">%s</wsa:Address></BrokerEPR>";
+
+ String str = String.format(eprFormat,
+ "http://invalid/broker/address");
+
+ WSMPublisher publisher = new WSMPublisher(10, false, str, true);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public final void testWSMPublisherConstructor5() {
+// try {
+//
+// EndpointReference epr = new EndpointReference(
+// "http://invalid/broker/address");
+//
+// AnnotationProps annotationProps = AnnotationProps.newProps(
+// AnnotationConsts.ExperimentID, "TestexperId1");
+// annotationProps.set(AnnotationConsts.ServiceLocation,
+// "testServiceAddress");
+//
+// ConstructorProps props = ConstructorProps.newProps();
+// props.set(ConstructorConsts.BROKER_EPR, epr.getAddress());
+// props.set(ConstructorConsts.ENABLE_ASYNC_PUBLISH, "false");
+// props.set(ConstructorConsts.ENABLE_BATCH_PROVENANCE, "false");
+// props.set(ConstructorConsts.ANNOTATIONS, annotationProps);
+//
+// Notifier notifier = NotifierFactory.createGenericNotifier();
+//
+// } catch (Exception e) {
+// e.printStackTrace();
+// fail();
+// }
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/MessagePullerTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/MessagePullerTest.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/MessagePullerTest.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/MessagePullerTest.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,134 @@
+package edu.indiana.extreme.lead.workflow_tracking.messagebox;
+
+import java.io.StringReader;
+import java.net.URL;
+import java.util.Properties;
+import java.util.UUID;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.log4j.Logger;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+import wsmg.client.WseMsgBrokerClient;
+import edu.indiana.extreme.lead.commons.WorkFlowUtils;
+import edu.indiana.extreme.lead.workflow_tracking.client.Callback;
+import edu.indiana.extreme.lead.workflow_tracking.client.LeadNotificationManager;
+import edu.indiana.extreme.lead.workflow_tracking.client.NotificationType;
+import edu.indiana.extreme.lead.workflow_tracking.client.Subscription;
+import edu.indiana.extreme.lead.workflow_tracking.util.CommonUtils;
+import edu.indiana.extreme.lead.workflow_tracking.util.TestConfigKeys;
+
+/**
+ * @author Chathura Herath (cherath@cs.indiana.edu)
+ */
+
+public class MessagePullerTest extends TestCase {
+
+ static Properties configs = new Properties();
+ String BROKER_URL;
+ String MESSAGEBOX_URL;
+ int consumerPort;
+ public static final String TEST_TOPIC = "3a9c7b20-0475-11db-ba88-b61b57d3be03";
+ private static final String MESSAGE_BOX_ID = UUID.randomUUID().toString();
+ public static int count = 0;
+ public int messages = 10;
+ public static Object mutex = new Object();
+ private org.apache.log4j.Logger logger = Logger
+ .getLogger(MessagePullerTest.class);
+ Subscription sub;
+ String AXIS_REPO;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ URL configURL = ClassLoader
+ .getSystemResource(TestConfigKeys.CONFIG_FILE_NAME);
+ configs.load(configURL.openStream());
+ BROKER_URL = configs
+ .getProperty(TestConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+ MESSAGEBOX_URL = configs.getProperty(TestConfigKeys.MSGBOX_SERVICE_EPR);
+ consumerPort = Integer.parseInt(configs
+ .getProperty(TestConfigKeys.CONSUMER_PORT));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ private boolean wait = true;
+
+ public void testMessagePulling() throws Exception {
+ Subscription subscription = null;
+
+ Callback testCallback1 = new Callback() {
+ public void deliverMessage(String topic, NotificationType type,
+ XmlObject messageObj) {
+ System.out
+ .println("Notification Received, notification of type:"
+ + type);
+ assertEquals(type, NotificationType.WorkflowInitialized);
+ wait = false;
+ }
+ };
+
+ subscription = LeadNotificationManager.createMessageBoxSubscription(
+ MESSAGEBOX_URL, BROKER_URL, TEST_TOPIC, null, testCallback1);
+
+ System.out.println(subscription.getMessageBoxEPR());
+ System.out.println(subscription.getSubscriptionID());
+
+ WseMsgBrokerClient client = new WseMsgBrokerClient();
+ client.init(BROKER_URL);
+
+ OMElement msg = WorkFlowUtils.reader2OMElement(new StringReader(
+ CommonUtils.WORKFLOW_INITIALIZED_NOTIFICATION));
+
+ client.publish(TEST_TOPIC, msg);
+
+ EndpointReference MSG_BOX_EPR = subscription.getMessageBoxEPR();
+ System.out.println(MSG_BOX_EPR);
+ String subscriptionID = subscription.getSubscriptionID();
+ Callback testCallback2 = new Callback() {
+
+ public void deliverMessage(String topic, NotificationType type,
+ XmlObject messageObj) {
+
+ System.out
+ .println("Notification Received, notification of type:"
+ + type);
+ assertEquals(type, NotificationType.WorkflowInitialized);
+ wait = false;
+
+ }
+ };
+ subscription = LeadNotificationManager
+ .startListeningToSavedSubscription(BROKER_URL, MSG_BOX_EPR,
+ subscriptionID, TEST_TOPIC, null, testCallback2, true);
+
+ System.out.println(subscription.getMessageBoxEPR());
+
+ while (wait) {
+
+ Thread.sleep(1000);
+
+ }
+
+ System.out.println("MessagePuller test completed");
+ subscription.destroy();
+ }
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/MultipleSubscriptionForMessageBoxTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/MultipleSubscriptionForMessageBoxTest.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/MultipleSubscriptionForMessageBoxTest.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/MultipleSubscriptionForMessageBoxTest.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,108 @@
+package edu.indiana.extreme.lead.workflow_tracking.messagebox;
+
+import java.io.StringReader;
+import java.net.URL;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.log4j.Logger;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import wsmg.client.WseMsgBrokerClient;
+import edu.indiana.extreme.lead.commons.WorkFlowUtils;
+import edu.indiana.extreme.lead.workflow_tracking.ThreadMessagePassingCallback;
+import edu.indiana.extreme.lead.workflow_tracking.util.CommonUtils;
+import edu.indiana.extreme.lead.workflow_tracking.util.TestConfigKeys;
+
+/**
+ * @author Chathura Herath (cherath@cs.indiana.edu)
+ */
+
+public class MultipleSubscriptionForMessageBoxTest extends TestCase implements
+ ThreadMessagePassingCallback {
+
+ static Properties configs = new Properties();
+ String BROKER_URL;
+ String MESSAGEBOX_URL;
+ int consumerPort;
+ public static final String TEST_TOPIC = "3a9c7b20-0475-11db-ba88-b61b57d3be03";
+ public static final int NOTIFICATIONS_PUBLISHED = 10;
+ public static final int NUMBER_OF_SUBSCRIBERS = 1;
+ private org.apache.log4j.Logger logger = Logger
+ .getLogger(MultipleSubscriptionForMessageBoxTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ URL configURL = ClassLoader
+ .getSystemResource(TestConfigKeys.CONFIG_FILE_NAME);
+ configs.load(configURL.openStream());
+ BROKER_URL = configs
+ .getProperty(TestConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+ MESSAGEBOX_URL = configs.getProperty(TestConfigKeys.MSGBOX_SERVICE_EPR);
+ consumerPort = Integer.parseInt(configs
+ .getProperty(TestConfigKeys.CONSUMER_PORT));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ private int succesfulclients = 0;
+
+ @Test
+ public void testMultipleSubscribers() throws Exception {
+
+ SubscriberThread[] subscribers = new SubscriberThread[NUMBER_OF_SUBSCRIBERS];
+ for (int i = 0; i < NUMBER_OF_SUBSCRIBERS; ++i) {
+ subscribers[i] = new SubscriberThread(MESSAGEBOX_URL, BROKER_URL,
+ TEST_TOPIC, this, "MytestId331234" + Integer.toString(i));
+ subscribers[i].start();
+
+ }
+
+ Thread.sleep(100);
+
+ WseMsgBrokerClient client = new WseMsgBrokerClient();
+ client.init(BROKER_URL);
+
+ OMElement msg = WorkFlowUtils.reader2OMElement(new StringReader(
+ CommonUtils.WORKFLOW_INITIALIZED_NOTIFICATION));
+
+ for (int j = 0; j < NUMBER_OF_SUBSCRIBERS; j++) {
+ for (int i = 0; i < NOTIFICATIONS_PUBLISHED; i++) {
+
+ client.publish(TEST_TOPIC, msg);
+
+ Thread.sleep(100);
+ }
+ }
+
+ while (succesfulclients < NUMBER_OF_SUBSCRIBERS - 1) {
+ Thread.sleep(1000);
+ }
+ Thread.sleep(5000);
+ System.out.println("All successful");
+ System.exit(0);
+
+ }
+
+ public void done() {
+ succesfulclients++;
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/RenewSubscriptionTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/RenewSubscriptionTest.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/RenewSubscriptionTest.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/RenewSubscriptionTest.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,106 @@
+package edu.indiana.extreme.lead.workflow_tracking.messagebox;
+
+import java.net.URL;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import wsmg.client.WseMsgBrokerClient;
+import edu.indiana.extreme.lead.workflow_tracking.client.Callback;
+import edu.indiana.extreme.lead.workflow_tracking.client.LeadNotificationManager;
+import edu.indiana.extreme.lead.workflow_tracking.client.NotificationType;
+import edu.indiana.extreme.lead.workflow_tracking.client.Subscription;
+import edu.indiana.extreme.lead.workflow_tracking.util.TestConfigKeys;
+
+/**
+ * @author Chathura Herath (cherath@cs.indiana.edu)
+ */
+
+public class RenewSubscriptionTest extends TestCase implements Callback {
+
+ static Properties configs = new Properties();
+ String BROKER_URL;
+ String MESSAGEBOX_URL;
+ int consumerPort;
+ public static final String TEST_TOPIC = "3a9c7b20-0475-11db-ba88-b61b57d3be03";
+ public static int count = 0;
+ public int messages = 10;
+ public static Object mutex = new Object();
+ Subscription sub;
+ private static String TOPIC = "RENEW_TOPIC" + Math.random();
+ private static int counter = 0;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ URL configURL = ClassLoader
+ .getSystemResource(TestConfigKeys.CONFIG_FILE_NAME);
+ configs.load(configURL.openStream());
+ BROKER_URL = configs
+ .getProperty(TestConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+ MESSAGEBOX_URL = configs.getProperty(TestConfigKeys.MSGBOX_SERVICE_EPR);
+ consumerPort = Integer.parseInt(configs
+ .getProperty(TestConfigKeys.CONSUMER_PORT));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testRenewSubscription() throws Exception {
+ Subscription sub = LeadNotificationManager
+ .createMessageBoxSubscription(MESSAGEBOX_URL, BROKER_URL,
+ TOPIC, null, this, false);
+
+ WseMsgBrokerClient client = new WseMsgBrokerClient();
+ client.init(BROKER_URL);
+
+ OMElement msg = OMAbstractFactory.getOMFactory().createOMElement(
+ "test", null);
+ msg.setText("mustwork");
+ client.publish(TOPIC, msg);
+ //sub.destroy();
+
+ msg.setText("destroyed");
+ client.publish(TOPIC, msg);
+ Subscription sub2 = LeadNotificationManager
+ .renewMessageboxSubscription(BROKER_URL,
+ sub.getMessageBoxEPR(), sub.getSubscriptionID(), TOPIC,
+ null, false);
+
+ msg.setText("mustworkagain");
+ client.publish(TOPIC, msg);
+
+ System.out.println(sub2.getSubscriptionID());
+ while (counter < 2) {
+ Thread.sleep(1000);
+ }
+ Thread.sleep(10000);
+ }
+
+ public void deliverMessage(String topic, NotificationType notificationType,
+ XmlObject messageObj) {
+ System.out.println("Callbacked");
+ System.out.println(messageObj.toString());
+ counter++;
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/SubscriberThread.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/SubscriberThread.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/SubscriberThread.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/SubscriberThread.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,84 @@
+package edu.indiana.extreme.lead.workflow_tracking.messagebox;
+
+import java.rmi.RemoteException;
+
+import org.apache.log4j.Logger;
+import org.apache.xmlbeans.XmlObject;
+
+import edu.indiana.extreme.lead.workflow_tracking.ThreadMessagePassingCallback;
+import edu.indiana.extreme.lead.workflow_tracking.client.Callback;
+import edu.indiana.extreme.lead.workflow_tracking.client.LeadNotificationManager;
+import edu.indiana.extreme.lead.workflow_tracking.client.NotificationType;
+import edu.indiana.extreme.lead.workflow_tracking.client.Subscription;
+
+
+/**
+ * @author Chathura Herath (cherath@cs.indiana.edu)
+ */
+
+public class SubscriberThread extends Thread {
+
+ private ThreadMessagePassingCallback callback;
+
+
+
+ private int subCount =0;
+ private Subscription subscription;
+ private String brokerURL;
+ private String topic;
+ private String messageboxUrl;
+ private String msgBoxId;
+ private org.apache.log4j.Logger logger = Logger.getLogger(SubscriberThread.class);
+
+
+
+ public SubscriberThread(String messageboxUrl, String brokerURL, String topic, ThreadMessagePassingCallback callback,String msgBoxId) {
+ super();
+ this.msgBoxId=msgBoxId;
+ this.callback = callback;
+ this.brokerURL = brokerURL;
+ this.topic = topic;
+ this.messageboxUrl = messageboxUrl;
+ }
+
+
+
+ @Override
+ public void run(){
+ try {
+ subscription = LeadNotificationManager.createMessageBoxSubscription(messageboxUrl, brokerURL, topic, null, new Callback() {
+
+ public void deliverMessage(String topic, NotificationType type, XmlObject messageObj) {
+
+ subCount++;
+ System.out.println("Subscription received "+subCount+"th notification of type:"+type);
+ assert(type== NotificationType.WorkflowInitialized);
+ System.out.println("subcount="+subCount+" =="+MultipleSubscriptionForMessageBoxTest.NOTIFICATIONS_PUBLISHED);
+ if(subCount == MultipleSubscriptionForMessageBoxTest.NOTIFICATIONS_PUBLISHED){
+ System.out.println("subscription destroyed");
+ try {
+ subscription.destroy();
+ } catch (RemoteException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ callback.done();
+ }
+ }
+ }, true);
+ } catch (Exception e) {
+ logger.error("exception in suscriber thread :"+e);
+ e.printStackTrace();
+ }
+ while(true){
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ logger.error("exception in suscriber thread sleep: "+e);
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/restart/MessageBoxClientRestartTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/restart/MessageBoxClientRestartTest.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/restart/MessageBoxClientRestartTest.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/restart/MessageBoxClientRestartTest.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,126 @@
+package edu.indiana.extreme.lead.workflow_tracking.messagebox.restart;
+
+import java.io.StringReader;
+import java.net.URL;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.log4j.Logger;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import wsmg.client.WseMsgBrokerClient;
+import edu.indiana.extreme.lead.commons.WorkFlowUtils;
+import edu.indiana.extreme.lead.workflow_tracking.client.Callback;
+import edu.indiana.extreme.lead.workflow_tracking.client.LeadNotificationManager;
+import edu.indiana.extreme.lead.workflow_tracking.client.NotificationType;
+import edu.indiana.extreme.lead.workflow_tracking.client.Subscription;
+import edu.indiana.extreme.lead.workflow_tracking.util.CommonUtils;
+import edu.indiana.extreme.lead.workflow_tracking.util.TestConfigKeys;
+
+/**
+ * @author Chathura Herath (cherath@cs.indiana.edu)
+ */
+
+public class MessageBoxClientRestartTest extends TestCase {
+
+ private static final String TOPIC = "RestartclientTopic2";
+ private boolean wait = true;
+ static Properties configs = new Properties();
+ String BROKER_URL;
+ String MESSAGEBOX_URL;
+ int consumerPort;
+ public static final int NOTIFICATIONS_PUBLISHED = 4;
+ public static final int NUMBER_OF_SUBSCRIBERS = 4;
+ private org.apache.log4j.Logger logger = Logger
+ .getLogger(MessageBoxClientRestartTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ URL configURL = ClassLoader
+ .getSystemResource(TestConfigKeys.CONFIG_FILE_NAME);
+ configs.load(configURL.openStream());
+ BROKER_URL = configs
+ .getProperty(TestConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+ MESSAGEBOX_URL = configs.getProperty(TestConfigKeys.MSGBOX_SERVICE_EPR);
+ consumerPort = Integer.parseInt(configs
+ .getProperty(TestConfigKeys.CONSUMER_PORT));
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testRestart() throws Exception {
+ Subscription subscription = null;
+
+ MessageBoxCreateThread thread = new MessageBoxCreateThread(BROKER_URL,
+ MESSAGEBOX_URL, TOPIC);
+ thread.start();
+
+ Thread.sleep(100);
+ thread.stop();
+
+ Thread.sleep(5000);
+
+ System.out.println("bringing down the Puller\n Publishing Messages");
+ WseMsgBrokerClient client = new WseMsgBrokerClient();
+ client.init(BROKER_URL);
+
+ OMElement msg = WorkFlowUtils.reader2OMElement(new StringReader(
+ CommonUtils.WORKFLOW_INITIALIZED_NOTIFICATION));
+
+ client.publish(TOPIC, msg);
+
+ System.out.println("Messages published");
+ System.out.println("Creating another puller");
+ EndpointReference epr = thread.getWsaEndpointReference();
+ String subscriptionID = thread.getSubscriptionID();
+ String topic = thread.getTopic();
+ System.out.println(epr);
+ System.out.println(subscriptionID);
+
+ subscription = LeadNotificationManager
+ .startListeningToSavedSubscription(BROKER_URL, epr,
+ subscriptionID, topic, null, new Callback() {
+
+ public void deliverMessage(String topic,
+ NotificationType type, XmlObject messageObj) {
+
+ System.out
+ .println("Notification Received, notification of type:"
+ + type);
+ System.out.println("Topic[" + topic + "]");
+ assertEquals(type,
+ NotificationType.WorkflowInitialized);
+ wait = false;
+
+ }
+ }, false);
+
+ System.out.println(subscription.getMessageBoxEPR());
+
+ while (wait) {
+ Thread.sleep(1000);
+
+ }
+ }
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/restart/MessageBoxCreateThread.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/restart/MessageBoxCreateThread.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/restart/MessageBoxCreateThread.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/test/java/edu/indiana/extreme/lead/workflow_tracking/messagebox/restart/MessageBoxCreateThread.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,74 @@
+package edu.indiana.extreme.lead.workflow_tracking.messagebox.restart;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.log4j.Logger;
+import org.apache.xmlbeans.XmlObject;
+
+import edu.indiana.extreme.lead.workflow_tracking.client.Callback;
+import edu.indiana.extreme.lead.workflow_tracking.client.LeadNotificationManager;
+import edu.indiana.extreme.lead.workflow_tracking.client.NotificationType;
+import edu.indiana.extreme.lead.workflow_tracking.client.Subscription;
+
+/**
+ * @author Chathura Herath (cherath@cs.indiana.edu)
+ */
+
+public class MessageBoxCreateThread extends Thread {
+ private String brokerLocation;
+ private String messageboxLocation;
+ private String topic;
+ private Subscription subscription;
+ private org.apache.log4j.Logger logger = Logger.getLogger(MessageBoxCreateThread.class);
+ public MessageBoxCreateThread(String brokerLocation,
+ String messageboxLocation, String topic) {
+ super();
+ this.brokerLocation = brokerLocation;
+ this.messageboxLocation = messageboxLocation;
+ this.topic = topic;
+
+ }
+
+ @Override
+ public void run() {
+ Subscription subscription = null;
+ try {
+ subscription = LeadNotificationManager
+ .createMessageBoxSubscription(this.messageboxLocation,
+ this.brokerLocation, this.topic, null, new Callback() {
+
+ public void deliverMessage(String topic,
+ NotificationType type,
+ XmlObject messageObj) {
+
+ throw new RuntimeException(
+ "This piece of code probably shouldnt have been called");
+
+ }
+ }, true);
+
+ System.out.println("Created messageBox");
+ } catch (Exception e1) {
+ logger.error("error in message box creat thread :"+e1);
+ e1.printStackTrace();
+ }
+ this.subscription = subscription;
+ }
+
+ public String getSubscriptionID() {
+ return this.subscription.getSubscriptionID();
+ }
+
+
+ public EndpointReference getWsaEndpointReference() {
+ return this.subscription.getMessageBoxEPR();
+ }
+
+ public String getTopic(){
+ return this.subscription.getTopic();
+ }
+
+
+
+
+}
+