示例#1
0
 public void TestMethod5()
 {
     ClientUtilManager.Ask().DelayedSOAPRequest()
     .After(TimeSpan.FromSeconds(10))
     .ToConfigEndpoint("BasicHttpBinding_UnitTestService")
     .Request <IUnitTestService>(p =>
                                 p.BlockFor(TimeSpan.FromSeconds(15))
                                 )
     .Schedule();
 }
示例#2
0
 public void TestMethod1()
 {
     ClientUtilManager.Ask().DelayedHttpRequest()
     .SetHeader("x-test", "ciao")
     .SetParameter("val", "3")
     .Method("POST")
     .To(new Uri("http://requestb.in/142s9c81"))
     .After(TimeSpan.FromSeconds(5))
     .WithRetry(1)
     .Schedule();
 }
示例#3
0
 public void TestMethod4()
 {
     ClientUtilManager.Ask().PeriodicSOAPRequest()
     .After(TimeSpan.FromSeconds(10))
     .Every(TimeSpan.FromSeconds(5))
     .WithAllottedTime(TimeSpan.FromMinutes(2))
     .AsFireAndForget()
     .ToConfigEndpoint("BasicHttpBinding_UnitTestService")
     .Request <IUnitTestService>(p =>
                                 p.SendDateTimeToUrl("http://requestb.in/12wvclh1")
                                 )
     .Schedule();
 }
示例#4
0
 public void TestMethod7()
 {
     string jobId = ClientUtilManager.Ask().PeriodicSOAPRequest()
                    .After(TimeSpan.FromSeconds(10))
                    .Every(TimeSpan.FromSeconds(5))
                    .WithAllottedTime(TimeSpan.FromMinutes(2))
                    .AsFireAndForget()
                    .ToConfigEndpoint("BasicHttpBinding_UnitTestService")
                    .Request <IUnitTestService>(p =>
                                                p.SuccedAt(DateTime.Now + TimeSpan.FromSeconds(30))
                                                )
                    .Schedule();
 }
示例#5
0
 public void TestMethod3()
 {
     ClientUtilManager.Ask().DelayedSOAPRequest()
     .After(TimeSpan.FromSeconds(500))
     .ToConfigEndpoint("BasicHttpBinding_ISchedulerService")
     .Request <ISchedulerService>(p =>
                                  p.DelayedHttpRequestMessage("post", new Uri("http://requestb.in/142s9c81"), new Dictionary <string, string>()
     {
         { "x-cli", "yesN2" }
     }, new Dictionary <string, string>()
     {
         { "par", "yesN2" }
     }, TimeSpan.FromSeconds(5), 0, false))
     .Schedule();
 }
示例#6
0
 public void TestMethod2()
 {
     ClientUtilManager.Ask().DelayedSOAPRequest()
     .After(TimeSpan.FromSeconds(5))
     .WithBinding(new BasicHttpBinding())
     .Request <ISchedulerService>(p =>
                                  p.DelayedHttpRequestMessage("post", new Uri("http://requestb.in/142s9c81"), new Dictionary <string, string>()
     {
         { "x-cli", "yesN2" }
     }, new Dictionary <string, string>()
     {
         { "par", "yesN2" }
     }, TimeSpan.FromSeconds(5), 0, false))
     .To(new Uri("http://Code.test.aliaslab.net/SchedulerService/SchedulerService.svczzz"))
     //.To(new Uri("http://localhost:2213/SchedulerService.svc"))
     .Schedule();
 }
        public string Schedule()
        {
            if (_messageJson == null)
            {
                throw new ArgumentException("The message must be set");
            }
            if (_channelName == null)
            {
                throw new ArgumentException("The channelname must be set.");
            }

            using (ChannelFactory <ISchedulerService> ch = new ChannelFactory <ISchedulerService>(ClientUtilManager.Ask().EndpointConfigurationName))
            {
                ISchedulerService svc = ch.CreateChannel();

                if (!string.IsNullOrEmpty(_CRONString))
                {
                    return(svc.CRONChannelMessage(_channelName, _broadcast, _messageJson, _CRONString, _timeLimit, _fireAndForget));
                }
                else
                {
                    return(svc.PeriodicChannelMessage(_channelName, _broadcast, _messageJson, _delay, _period, _timeLimit, _fireAndForget));
                }
            }
        }
示例#8
0
        public string Schedule()
        {
            if (_messageJson == null)
            {
                throw new ArgumentException("The message must be set");
            }
            if (_channelName == null)
            {
                throw new ArgumentException("The channelname must be set.");
            }

            using (ChannelFactory <ISchedulerService> ch = new ChannelFactory <ISchedulerService>(ClientUtilManager.Ask().EndpointConfigurationName))
            {
                ISchedulerService svc = ch.CreateChannel();

                return(svc.DelayedChannelMessage(_channelName, _broadcast, _messageJson, _delay, _retryCount, _fireAndForget));
            }
        }
        public string Schedule()
        {
            if (_dirty)
            {
                throw new InvalidOperationException("The data that produced the request has changed. Produce another request.");
            }
            if (_to == null)
            {
                throw new ArgumentException("The To must be set");
            }

            using (ChannelFactory <ISchedulerService> ch = new ChannelFactory <ISchedulerService>(ClientUtilManager.Ask().EndpointConfigurationName))
            {
                ISchedulerService svc = ch.CreateChannel();

                return(svc.DelayedSOAPRequestMessage(_to.Host, _to.Port, Encoding.UTF8.GetBytes(SOAPRequestHelper.GetMangeldRequest(_soapMessage, _to)), _delay, _retryCount, _fireAndForget));
            }
        }
示例#10
0
        protected virtual void StopJob(bool success)
        {
            using (ILoggingOperation log = _logger.NormalOperation())
                using (ChannelFactory <ISchedulerService> ch = new ChannelFactory <ISchedulerService>(ClientUtilManager.Ask().EndpointConfigurationName))
                {
                    log.Wrap(() =>
                    {
                        ISchedulerService svc = ch.CreateChannel();

                        JobContextData data = GetContextData();
                        if (data == null)
                        {
                            log.Debug("No JobContextData found.");
                        }
                        else
                        {
                            svc.StopJob(data.JobId, success);
                        }
                    });
                }
        }
示例#11
0
 public UnitTest1()
 {
     ClientUtilManager.Init();
 }
示例#12
0
        public string Schedule()
        {
            if (_to == null)
            {
                throw new ArgumentException("The To must be set");
            }

            using (ChannelFactory <ISchedulerService> ch = new ChannelFactory <ISchedulerService>(ClientUtilManager.Ask().EndpointConfigurationName))
            {
                ISchedulerService svc = ch.CreateChannel();

                return(svc.DelayedHttpRequestMessage(_method, _to, _headers, _parameters, _delay, _retryCount, _fireAndForget));
            }
        }
        public string Schedule()
        {
            if (_to == null)
            {
                throw new ArgumentException("The To must be set");
            }

            using (ChannelFactory <ISchedulerService> ch = new ChannelFactory <ISchedulerService>(ClientUtilManager.Ask().EndpointConfigurationName))
            {
                ISchedulerService svc = ch.CreateChannel();

                if (!string.IsNullOrEmpty(_CRONString))
                {
                    return(svc.CRONHttpRequestMessage(_method, _to, _headers, _parameters, _CRONString, _timeLimit, _fireAndForget));
                }
                else
                {
                    return(svc.PeriodicHttpRequestMessage(_method, _to, _headers, _parameters, _delay, _period, _timeLimit, _fireAndForget));
                }
            }
        }