Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReceiveBatchesInOrder()
        public virtual void ShouldReceiveBatchesInOrder()
        {
            // GIVEN
            Configuration config  = new Configuration_OverriddenAnonymousInnerClass(this, DEFAULT);
            Stage         stage   = new Stage("Test stage", null, config, ORDER_SEND_DOWNSTREAM);
            long          batches = 1000;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long items = batches * config.batchSize();
            long items = batches * config.BatchSize();

            stage.Add(new PullingProducerStepAnonymousInnerClass(this, stage.Control(), config, items));

            for (int i = 0; i < 3; i++)
            {
                stage.Add(new ReceiveOrderAssertingStep(stage.Control(), "Step" + i, config, i, false));
            }
            stage.Add(new ReceiveOrderAssertingStep(stage.Control(), "Final step", config, 0, true));

            // WHEN
            StageExecution execution = stage.Execute();

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (Step<?> step : execution.steps())
            foreach (Step <object> step in execution.Steps())
            {
                // we start off with two in each step
                step.Processors(1);
            }
            (new ExecutionSupervisor(ExecutionMonitors.Invisible())).supervise(execution);

            // THEN
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (Step<?> step : execution.steps())
            foreach (Step <object> step in execution.Steps())
            {
                assertEquals("For " + step, batches, step.Stats().stat(Keys.done_batches).asLong());
            }
            stage.Close();
        }
Example #2
0
 /// <summary>
 /// Using an <seealso cref="ExecutionMonitors.invisible() invisible"/> monitor. </summary>
 /// <param name="stage"> <seealso cref="Stage"/> to supervise. </param>
 /// <seealso cref= #superviseDynamicExecution(ExecutionMonitor, Stage) </seealso>
 public static void SuperviseDynamicExecution(Stage stage)
 {
     SuperviseDynamicExecution(ExecutionMonitors.Invisible(), stage);
 }