Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRemoveCPUsFromWayTooFastStep()
        public virtual void ShouldRemoveCPUsFromWayTooFastStep()
        {
            // GIVEN
            Configuration config = config(10, 3);
            // available processors = 2 is enough because it will see the fast step as only using 20% of a processor
            // and it rounds down. So there's room for assigning one more.
            DynamicProcessorAssigner assigner = new DynamicProcessorAssigner(config);

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ControlledStep<?> slowStep = spy(stepWithStats("slow", 1, avg_processing_time, 6L, done_batches, 10L).setProcessors(2));
            ControlledStep <object> slowStep = spy(stepWithStats("slow", 1, avg_processing_time, 6L, done_batches, 10L).setProcessors(2));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ControlledStep<?> fastStep = spy(stepWithStats("fast", 0, avg_processing_time, 2L, done_batches, 10L).setProcessors(2));
            ControlledStep <object> fastStep = spy(stepWithStats("fast", 0, avg_processing_time, 2L, done_batches, 10L).setProcessors(2));

            StageExecution execution = ExecutionOf(config, slowStep, fastStep);

            assigner.Start(execution);

            // WHEN checking
            assigner.Check(execution);

            // THEN one processor should be removed from the fast step
            verify(fastStep, times(1)).processors(-1);
        }
Пример #2
0
        private StageExecution Execution(long doneBatches, Configuration config)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: Step<?> step = ControlledStep.stepWithStats("Test", 0, done_batches, doneBatches);
            Step <object>  step      = ControlledStep.StepWithStats("Test", 0, done_batches, doneBatches);
            StageExecution execution = new StageExecution("Test", null, config, Collections.singletonList(step), 0);

            return(execution);
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: public static ControlledStep<?> stepWithStats(String name, int maxProcessors, java.util.Map<org.neo4j.unsafe.impl.batchimport.stats.Key,long> statistics)
        public static ControlledStep <object> StepWithStats(string name, int maxProcessors, IDictionary <Key, long> statistics)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ControlledStep<?> step = new ControlledStep<>(name, maxProcessors);
            ControlledStep <object> step = new ControlledStep <object>(name, maxProcessors);

            foreach (KeyValuePair <Key, long> statistic in statistics.SetOfKeyValuePairs())
            {
                step.SetStat(statistic.Key, statistic.Value.longValue());
            }
            return(step);
        }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAssignAdditionalCPUToBottleNeckStep()
        public virtual void ShouldAssignAdditionalCPUToBottleNeckStep()
        {
            // GIVEN
            Configuration            config   = config(10, 5);
            DynamicProcessorAssigner assigner = new DynamicProcessorAssigner(config);

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ControlledStep<?> slowStep = stepWithStats("slow", 0, avg_processing_time, 10L, done_batches, 10L);
            ControlledStep <object> slowStep = stepWithStats("slow", 0, avg_processing_time, 10L, done_batches, 10L);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ControlledStep<?> fastStep = stepWithStats("fast", 0, avg_processing_time, 2L, done_batches, 10L);
            ControlledStep <object> fastStep = stepWithStats("fast", 0, avg_processing_time, 2L, done_batches, 10L);

            StageExecution execution = ExecutionOf(config, slowStep, fastStep);

            assigner.Start(execution);

            // WHEN
            assigner.Check(execution);

            // THEN
            assertEquals(5, slowStep.Processors(0));
            assertEquals(1, fastStep.Processors(0));
        }
Пример #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleZeroAverage()
        public virtual void ShouldHandleZeroAverage()
        {
            // GIVEN
            Configuration            config   = config(10, 5);
            DynamicProcessorAssigner assigner = new DynamicProcessorAssigner(config);

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ControlledStep<?> aStep = stepWithStats("slow", 0, avg_processing_time, 0L, done_batches, 0L);
            ControlledStep <object> aStep = stepWithStats("slow", 0, avg_processing_time, 0L, done_batches, 0L);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ControlledStep<?> anotherStep = stepWithStats("fast", 0, avg_processing_time, 0L, done_batches, 0L);
            ControlledStep <object> anotherStep = stepWithStats("fast", 0, avg_processing_time, 0L, done_batches, 0L);

            StageExecution execution = ExecutionOf(config, aStep, anotherStep);

            assigner.Start(execution);

            // WHEN
            assigner.Check(execution);

            // THEN
            assertEquals(1, aStep.Processors(0));
            assertEquals(1, anotherStep.Processors(0));
        }
Пример #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRemoveCPUsButNotSoThatTheFastStepBecomesBottleneck()
        public virtual void ShouldRemoveCPUsButNotSoThatTheFastStepBecomesBottleneck()
        {
            // GIVEN
            Configuration            config   = config(10, 3);
            DynamicProcessorAssigner assigner = new DynamicProcessorAssigner(config);

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ControlledStep<?> slowStep = spy(stepWithStats("slow", 1, avg_processing_time, 10L, done_batches, 10L));
            ControlledStep <object> slowStep = spy(stepWithStats("slow", 1, avg_processing_time, 10L, done_batches, 10L));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ControlledStep<?> fastStep = spy(stepWithStats("fast", 0, avg_processing_time, 7L, done_batches, 10L).setProcessors(3));
            ControlledStep <object> fastStep = spy(stepWithStats("fast", 0, avg_processing_time, 7L, done_batches, 10L).setProcessors(3));

            StageExecution execution = ExecutionOf(config, slowStep, fastStep);

            assigner.Start(execution);

            // WHEN checking the first time
            assigner.Check(execution);

            // THEN one processor should be removed from the fast step
            verify(fastStep, never()).processors(1);
            verify(fastStep, never()).processors(-1);
        }