public void OnNext(IActiveContext value)
 {
     if (value.Id.Equals(FailEvaluatorContextId))
     {
         // Close context and trigger failure immediately.
         value.Dispose();
     }
     else
     {
         if (value.Id.Equals(ContextId0))
         {
             // Stack Context with ContextId1 on top of Context with ContextId0.
             value.SubmitContext(GetContextStopExceptionContextConfiguration(ContextId1));
         }
         else
         {
             // Verify the stacked Context and close it.
             Assert.Equal(ContextId1, value.Id);
             value.Dispose();
         }
     }
 }
예제 #2
0
            public void OnNext(IActiveContext value)
            {
                Logger.Log(Level.Verbose, "ContextId: " + value.Id);
                switch (value.Id)
                {
                case ContextOneId:
                    var contextConfig =
                        Common.Context.ContextConfiguration.ConfigurationModule.Set(
                            Common.Context.ContextConfiguration.Identifier, ContextTwoId)
                        .Build();
                    var stackingContextConfig =
                        TangFactory.GetTang()
                        .NewConfigurationBuilder()
                        .BindImplementation(GenericType <IInjectableInterface> .Class,
                                            GenericType <InjectableInterfaceImpl> .Class)
                        .Build();

                    Assert.False(value.ParentId.IsPresent());

                    value.SubmitContext(Configurations.Merge(stackingContextConfig, contextConfig));
                    break;

                case ContextTwoId:
                    Assert.True(value.ParentId.IsPresent());
                    Assert.Equal(value.ParentId.Value, ContextOneId);

                    value.SubmitTask(
                        TaskConfiguration.ConfigurationModule.Set(TaskConfiguration.Identifier, "contextStackTestTask")
                        .Set(TaskConfiguration.Task, GenericType <TestContextStackTask> .Class)
                        .Build());
                    break;

                default:
                    throw new Exception("Unexpected ContextId: " + value.Id);
                }
            }
예제 #3
0
            public void OnNext(IActiveContext value)
            {
                Logger.Log(Level.Info, "IActiveContext: " + value.Id);

                if (_first)
                {
                    Assert.Equal(value.Id, ContextId1);
                    _first = false;
                    value.SubmitContext(
                        ContextConfiguration.ConfigurationModule
                        .Set(ContextConfiguration.Identifier, ContextId2)
                        .Set(ContextConfiguration.OnContextStart, GenericType <ContextStartHandler> .Class)
                        .Build());
                }
                else
                {
                    Assert.Equal(value.Id, ContextId2);
                    var c = TaskConfiguration.ConfigurationModule
                            .Set(TaskConfiguration.Identifier, TaskId)
                            .Set(TaskConfiguration.Task, GenericType <TestTask> .Class)
                            .Build();
                    value.SubmitTask(c);
                }
            }
 public void OnNext(IActiveContext value)
 {
     Assert.Equal(ContextId0, value.Id);
     value.SubmitContext(GetContextStartExceptionContextConfiguration(ContextId1));
 }