Example #1
0
        public void ReturnErrorPublishAWorkflowForValidWorkflowServiceNameAndInvalidVersion()
        {
            client = new WorkflowsQueryServiceClient();

            pubReq = new PublishingRequest();
            pubReq.Incaller = ALIAS;
            pubReq.IncallerVersion = VERSION;
            pubReq.WorkflowName = WORKFLOWNAME;
            pubReq.WorkflowVersion = BAD_VERSION;

            pubReply = client.PublishWorkflow(pubReq);

            Assert.IsNotNull(pubReply, "pubReply is Null");
            Assert.AreEqual(SprocValues.GENERIC_CATCH_ID, pubReply.StatusReply.Errorcode, string.Format("Errorcode: {0}", pubReply.StatusReply.Errorcode));
            Assert.AreNotEqual(string.Empty, pubReply.StatusReply.ErrorMessage, string.Format("ErrorMessage: {0}", pubReply.StatusReply.ErrorMessage));

            Console.WriteLine();
        }
Example #2
0
        private void UsingClient(Uri endpointUri, Action<WorkflowsQueryServiceClient> a)
        {
            // Set up binding explicitly to decouple from the app.config of host.
            // Alternatively we could get it from the extension but there's no
            // scenario for that right now since all QueryServices use the same bindings.
            var binding = new BasicHttpBinding();
            binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
            binding.ReaderQuotas.MaxArrayLength = int.MaxValue;
            binding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
            binding.MaxReceivedMessageSize = int.MaxValue;

            var client = new WorkflowsQueryServiceClient(
                binding,
                new EndpointAddress(endpointUri)
                );
            bool success = false;
            try
            {
                a(client);
                client.Close();
                success = true;
            }
            finally
            {
                if (!success)
                {
                    client.Abort();
                }
            }
        }
Example #3
0
        /// <summary>
        /// Gets the workflow definition from the database by name and version
        /// </summary>
        /// <param name="client">The client to use for the Query Service calls</param>
        /// <param name="activityName">The name of the workflow to get</param>
        /// <param name="activityVersion">The version of the workflow to get</param>
        /// <returns>StoreActivitiesDC</returns>
        private StoreActivitiesDC GetDefinition(WorkflowsQueryServiceClient client, string activityName, string activityVersion)
        {
            var workflows = client.StoreActivitiesGet(new StoreActivitiesDC()
            {
                Incaller = Environment.UserName,
                IncallerVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString()
            });

            var activityDC = workflows.FirstOrDefault(wf => wf.ShortName.ToLower() == activityName.ToLower() && wf.Version == activityVersion);

            if (activityDC == null)
            {
                throw new InvalidOperationException("No definition found for that Name/Version");
            }
            if (activityDC.XAML == null)
            {
                throw new InvalidOperationException("No XAML found for that Name/Version");
            }
            return activityDC;
        }