Exemplo n.º 1
0
		public override void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext)
		{
			// the fork and join are created in the parent block but we'll add them
			// also as referencable objects to this block's scope a few lines below
			_parentBlock = creationContext.ProcessBlock;
			this._join = new JoinImpl();
			this._fork = new ForkImpl();

			creationContext.ProcessBlock = this;
			base.ReadProcessData(xmlElement, creationContext);
			XmlElement joinElement = xmlElement.GetChildElement("join");
			creationContext.Check((joinElement != null), "element join is missing");
			XmlElement forkElement = xmlElement.GetChildElement("fork");
			creationContext.Check((joinElement != null), "element fork is missing");
			((JoinImpl) this._join).ReadProcessData(joinElement, creationContext);
			((ForkImpl) this._fork).ReadProcessData(forkElement, creationContext);
			creationContext.ProcessBlock = _parentBlock;

			this._nodes.Add(_join);
			this._nodes.Add(_fork);

			// add the fork and join as referencable objects in the proper scope
			creationContext.AddReferencableObject(_fork.Name, _parentBlock, typeof (INode), _fork);
			creationContext.AddReferencableObject(_join.Name, this, typeof (INode), _join);
		}
Exemplo n.º 2
0
        public override void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext)
        {
            // the fork and join are created in the parent block but we'll add them
            // also as referencable objects to this block's scope a few lines below
            _parentBlock = creationContext.ProcessBlock;
            this._join   = new JoinImpl();
            this._fork   = new ForkImpl();

            creationContext.ProcessBlock = this;
            base.ReadProcessData(xmlElement, creationContext);
            XmlElement joinElement = xmlElement.GetChildElement("join");

            creationContext.Check((joinElement != null), "element join is missing");
            XmlElement forkElement = xmlElement.GetChildElement("fork");

            creationContext.Check((joinElement != null), "element fork is missing");
            ((JoinImpl)this._join).ReadProcessData(joinElement, creationContext);
            ((ForkImpl)this._fork).ReadProcessData(forkElement, creationContext);
            creationContext.ProcessBlock = _parentBlock;

            this._nodes.Add(_join);
            this._nodes.Add(_fork);

            // add the fork and join as referencable objects in the proper scope
            creationContext.AddReferencableObject(_fork.Name, _parentBlock, typeof(INode), _fork);
            creationContext.AddReferencableObject(_join.Name, this, typeof(INode), _join);
        }
Exemplo n.º 3
0
        public virtual ForkImpl CreateFork()
		{
			ForkImpl fork = new ForkImpl(_processDefinition);
			this._fork = fork;
			this.AddNode(fork);
			return fork;
		}
Exemplo n.º 4
0
        public virtual ForkImpl CreateFork()
        {
            ForkImpl fork = new ForkImpl(_processDefinition);

            this._fork = fork;
            this.AddNode(fork);
            return(fork);
        }
Exemplo n.º 5
0
        //private static readonly ILog log = LogManager.GetLogger(typeof(AndFork));

        public void Fork(IForkContext forkContext)
        {
            //log.Debug("starting to fork...");

            IFork fork = (IFork)forkContext.GetNode();

            foreach (ITransition transition in fork.LeavingTransitions)
            {
                //log.Debug("forking flow for transition " + leavingTransition.Name);
                forkContext.ForkFlow(transition.Name);
            }
        }
Exemplo n.º 6
0
        public async Task Run(TestContext ctx, [TestHost] HttpServer server,
                              [Fork(5, RandomDelay = 1500)] IFork fork, [Repeat(50)] int repeat,
                              [ForkHandler] Handler handler, CancellationToken cancellationToken)
        {
            var support = DependencyInjector.Get <IPortableSupport> ();

            ctx.LogMessage("FORK START: {0} {1}", fork.ID, support.CurrentThreadId);

            await TestRunner.RunTraditional(ctx, server, handler, cancellationToken);

            ctx.LogMessage("FORK DONE: {0} {1}", fork.ID, support.CurrentThreadId);
        }
Exemplo n.º 7
0
        public async Task Run(TestContext ctx, HttpServer server,
                              [Fork(5, RandomDelay = 1500)] IFork fork, [Repeat(50)] int repeat,
                              [ForkHandler] Handler handler, CancellationToken cancellationToken)
        {
            var support = DependencyInjector.Get <IPortableSupport> ();

            ctx.LogMessage("FORK START: {0} {1}", fork.ID, support.CurrentThreadId);

            using (var operation = new TraditionalOperation(server, handler, true))
                await operation.Run(ctx, cancellationToken).ConfigureAwait(false);

            ctx.LogMessage("FORK DONE: {0} {1}", fork.ID, support.CurrentThreadId);
        }
Exemplo n.º 8
0
        public void Fork(IForkContext forkContext)
        {
            log.Debug("starting to fork...");

            IFork       fork = (IFork)forkContext.GetNode();
            IEnumerator iter = fork.LeavingTransitions.GetEnumerator();

            while (iter.MoveNext())
            {
                ITransition leavingTransition = (ITransition)iter.Current;

                log.Debug("forking flow for transition " + leavingTransition.Name);
                forkContext.ForkFlow(leavingTransition.Name);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Adds the given element to the collection
        /// </summary>
        /// <param name="item">The item to add</param>
        public virtual void Add(BikeShop.BicycleChallenge.IComponent item)
        {
            if ((this._parent.Frame == null))
            {
                IFrame frameCasted = item.As <IFrame>();
                if ((frameCasted != null))
                {
                    this._parent.Frame = frameCasted;
                    return;
                }
            }
            if ((this._parent.Fork == null))
            {
                IFork forkCasted = item.As <IFork>();
                if ((forkCasted != null))
                {
                    this._parent.Fork = forkCasted;
                    return;
                }
            }
            IWheel wheelsCasted = item.As <IWheel>();

            if ((wheelsCasted != null))
            {
                if ((this._parent.Wheels.Count < 2))
                {
                    this._parent.Wheels.Add(wheelsCasted);
                }
            }
            if ((this._parent.HandleBar == null))
            {
                IHandleBar handleBarCasted = item.As <IHandleBar>();
                if ((handleBarCasted != null))
                {
                    this._parent.HandleBar = handleBarCasted;
                    return;
                }
            }
            if ((this._parent.RearSuspension == null))
            {
                IRearSuspension rearSuspensionCasted = item.As <IRearSuspension>();
                if ((rearSuspensionCasted != null))
                {
                    this._parent.RearSuspension = rearSuspensionCasted;
                    return;
                }
            }
        }
Exemplo n.º 10
0
        public async Task RunPuppy(TestContext ctx, HttpServer server,
                                   [Fork(5, RandomDelay = 1500)] IFork fork, [Repeat(50)] int repeat,
                                   [ForkHandler] Handler handler, CancellationToken cancellationToken)
        {
            var support = DependencyInjector.Get <IPortableSupport> ();

            ctx.LogMessage("FORK START: {0} {1}", fork.ID, support.CurrentThreadId);

            var uri = new Uri(PostPuppy);

            var request = new TraditionalRequest(uri);

            handler.ConfigureRequest(ctx, request, request.Request.RequestUri);

            var response = await request.Send(ctx, cancellationToken);

            bool ok;

            if (response.Error != null)
            {
                if (response.Content != null)
                {
                    ctx.OnError(new WebException(response.Content.AsString(), response.Error));
                }
                else
                {
                    ctx.OnError(response.Error);
                }
                ok = false;
            }
            else
            {
                ok = ctx.Expect(HttpStatusCode.OK, Is.EqualTo(response.Status), "status code");
                if (ok)
                {
                    ok &= ctx.Expect(response.IsSuccess, Is.True, "success status");
                }
            }

            ctx.LogMessage("FORK DONE: {0} {1} {2}", fork.ID, support.CurrentThreadId, ok);
        }
Exemplo n.º 11
0
 public CheckableWrapper(IFork fork)
 {
     this.fork = fork;
 }