Example #1
0
        public void NextValueShouldUseAllValuesInCircleForAllThreadsWhenDatapoolThreadCompleteAndCircular()
        {
            metadataMock.Setup(md => md.IsRandom).Returns(false);
            metadataMock.Setup(md => md.DistributionMode).Returns(DatapoolThreadDistributionMode.ThreadComplete);
            metadataMock.Setup(md => md.IsCircular).Returns(true);
            grinderContextMock.Setup(c => c.GetProperty(Constants.AgentCountKey, "1")).Returns("1");
            grinderContextMock.Setup(c => c.GetProperty(Constants.ProcessCountKey, "1")).Returns("1");
            grinderContextMock.Setup(c => c.GetProperty(Constants.ThreadCountKey, "1")).Returns("2");
            grinderContextMock.Setup(gc => gc.AgentNumber).Returns(0);
            grinderContextMock.Setup(gc => gc.FirstProcessNumber).Returns(0);
            grinderContextMock.Setup(gc => gc.ProcessNumber).Returns(0);
            grinderContextMock.Setup(gc => gc.ProcessName).Returns("TestProcessYYY");
            grinderContextMock.Setup(gc => gc.RunNumber).Returns(1);
            var datapool = new Datapool <TestValue>(grinderContextMock.Object, metadataMock.Object);

            grinderContextMock.Setup(gc => gc.ThreadNumber).Returns(0);
            Assert.That(datapool.NextValue(), Is.SameAs(values[0]));
            Assert.That(datapool.NextValue(), Is.SameAs(values[1]));
            Assert.That(datapool.NextValue(), Is.SameAs(values[0]));

            grinderContextMock.Setup(gc => gc.ThreadNumber).Returns(1);
            Assert.That(datapool.NextValue(), Is.SameAs(values[0]));
            Assert.That(datapool.NextValue(), Is.SameAs(values[1]));
            Assert.That(datapool.NextValue(), Is.SameAs(values[0]));
        }
Example #2
0
        public void NextValueShouldThrowExceptionWhenDatapoolIsThreadUniqueAndThreadNumberIsNotLessThanThreadCount()
        {
            SetupThreadUniqueContextFor2Agents3Processes4ThreadsAnd49TestValues();
            var datapool = new Datapool <TestValue>(grinderContextMock.Object, metadataMock.Object);

            grinderContextMock.Setup(gc => gc.ThreadNumber).Returns(4);
            Assert.Throws(Is.InstanceOf <IllegalStateException>().With.Message.EqualTo("ThreadNumber '4' is not less than property 'grinder.threads': '4'"), () => datapool.NextValue());
        }
Example #3
0
        public void LogicalSizeShouldBeSameAsPhysicalSizeWhenDistibutionModeIsThreadComplete()
        {
            SetupThreadCompleteContextFor2Agents3Processes4Threads();
            SetupContextForAgentNumber0ProcessNumber0ThreadNumber0RunNumber5();
            AddTestValues(49);
            var datapool = new Datapool <TestValue>(grinderContextMock.Object, metadataMock.Object);

            Assert.That(datapool.LogicalSize, Is.EqualTo(datapool.PhysicalSize));
        }
Example #4
0
        public void LogicalSizeShouldBeSameAsThreadBucketSizeWhenDistibutionModeIsThreadUnique()
        {
            SetupThreadUniqueContextFor2Agents3Processes4Threads();
            SetupContextForAgentNumber0ProcessNumber0ThreadNumber0RunNumber5();
            AddTestValues(49);
            var datapool = new Datapool <TestValue>(grinderContextMock.Object, metadataMock.Object);

            // First process of first agent gets 49 / 2 (agentCount) (+ 1 leftover from dividion) = 25 / 3 (processCount) (+ 1 leftover from division) = 9 / 4 (threadcount) (+ 1 leftover from division) = 3
            Assert.That(datapool.LogicalSize, Is.EqualTo(3));
        }
Example #5
0
        public void NextValueShouldCircleLastBucketWhenDatapoolIsThreadUniqueAndCircularForLastAgentProcessThread()
        {
            SetupThreadUniqueContextFor2Agents3Processes4ThreadsAnd49TestValues();
            SetupContextForAgentNumber1ProcessNumber2ThreadNumber3RunNumber4();
            metadataMock.Setup(md => md.IsCircular).Returns(true);
            var datapool = new Datapool <TestValue>(grinderContextMock.Object, metadataMock.Object);

            Assert.That(datapool.NextValue(), Is.SameAs(values[47]));
            Assert.That(datapool.NextValue(), Is.SameAs(values[48]));
            Assert.That(datapool.NextValue(), Is.SameAs(values[47]));
        }
Example #6
0
        public void NextValueShouldThrowExceptionWhenDatapoolIsThreadUniqueAndNonCircularAndAllValuesInLastBucketAreUsedForLastAgentProcessThread()
        {
            SetupThreadUniqueContextFor2Agents3Processes4ThreadsAnd49TestValues();
            SetupContextForAgentNumber1ProcessNumber2ThreadNumber3RunNumber4();
            metadataMock.Setup(md => md.IsCircular).Returns(false);
            var datapool = new Datapool <TestValue>(grinderContextMock.Object, metadataMock.Object);

            datapool.NextValue();
            datapool.NextValue();
            Assert.Throws(Is.InstanceOf <IllegalStateException>().With.Message.EqualTo("Non circular thread unique datapool 'TestValue' is drained: Agent number '1', process number '2' (TestProcessYYY), thread number '3', run number '4'"), () => datapool.NextValue());
        }
Example #7
0
        public void NextValueShouldUseAllValuesInCircleWhenDatapoolIsThreadSharedAndCircular()
        {
            metadataMock.Setup(md => md.IsRandom).Returns(false);
            metadataMock.Setup(md => md.DistributionMode).Returns(DatapoolThreadDistributionMode.ThreadShared);
            metadataMock.Setup(md => md.IsCircular).Returns(true);
            var datapool = new Datapool <TestValue>(grinderContextMock.Object, metadataMock.Object);

            Assert.That(datapool.NextValue(), Is.SameAs(values[0]));
            Assert.That(datapool.NextValue(), Is.SameAs(values[1]));
            Assert.That(datapool.NextValue(), Is.SameAs(values[0]));
        }
Example #8
0
        public void NextValueShouldThrowExceptionWhenDatapoolIsThreadSharedAndNonCircularAndAllValuesAreUsed()
        {
            SetupContextForAgentNumber1ProcessNumber2ThreadNumber3RunNumber4();
            metadataMock.Setup(md => md.DistributionMode).Returns(DatapoolThreadDistributionMode.ThreadShared);
            metadataMock.Setup(md => md.IsCircular).Returns(false);
            var datapool = new Datapool <TestValue>(grinderContextMock.Object, metadataMock.Object);

            datapool.NextValue();
            datapool.NextValue();
            Assert.Throws(Is.InstanceOf <IllegalStateException>().With.Message.EqualTo("Non circular non thread unique datapool 'TestValue' is drained: Agent number '1', process number '2' (TestProcessYYY), thread number '3', run number '4'"), () => datapool.NextValue());
        }
        public void Start()
        {
            logger.Info("Start");
            datapool = DatapoolSvr;

            logger.Debug("Constructor Started");
            timer        = new Timer(TimerElapsed, null, timerDelayTime, timerPeriod);
            ramos.Recipe = omniView.GetRaMOSRecipe();
            recipeName   = ramos.Recipe.RecipeName;
            //datapool.ConnectionChange += DatapoolSvr_ConnectionChange;

            DatapoolSvr_ConnectionChange(CheckDatapoolConnectionStatus());
        }
Example #10
0
        public void CtorShouldSetGrinderContext()
        {
            var datapool = new Datapool <TestValue>(grinderContextMock.Object, metadataMock.Object);

            Assert.That(datapool.GrinderContext, Is.SameAs(grinderContextMock.Object));
        }
Example #11
0
 public void GetSubtuple2InTuple25To48SliceddBy3ShouldBe41To48()
 {
     Assert.That(Datapool <TestValue> .GetSubtupleInTupleSlicedBy(2, new Tuple <int, int>(25, 48), 3), Is.EqualTo(new Tuple <int, int>(41, 48)));
 }
Example #12
0
 public void GetSubtuple3InTuple41To48SliceddBy4ShouldBe47To48()
 {
     Assert.That(Datapool <TestValue> .GetSubtupleInTupleSlicedBy(3, new Tuple <int, int>(41, 48), 4), Is.EqualTo(new Tuple <int, int>(47, 48)));
 }
Example #13
0
 public void GetSubtuple2InTuple0To4SlicedBy3ShouldBe4To4()
 {
     Assert.That(Datapool <TestValue> .GetSubtupleInTupleSlicedBy(2, new Tuple <int, int>(0, 4), 3), Is.EqualTo(new Tuple <int, int>(4, 4)));
 }
Example #14
0
 public void GetSubtuple1InTuple0To3SliceddBy2ShouldBe2To3()
 {
     Assert.That(Datapool <TestValue> .GetSubtupleInTupleSlicedBy(1, new Tuple <int, int>(0, 3), 2), Is.EqualTo(new Tuple <int, int>(2, 3)));
 }
 public void NextValueShouldThrowExceptionWhenDatapoolIsThreadUniqueAndThreadNumberIsNotLessThanThreadCount()
 {
     SetupThreadUniqueContextFor2Agents3Processes4ThreadsAnd49TestValues();
     var datapool = new Datapool<TestValue>(grinderContextMock.Object, metadataMock.Object);
     grinderContextMock.Setup(gc => gc.ThreadNumber).Returns(4);
     Assert.Throws(Is.InstanceOf<IllegalStateException>().With.Message.EqualTo("ThreadNumber '4' is not less than property 'grinder.threads': '4'"), () => datapool.NextValue());
 }
 public void NextValueShouldThrowExceptionWhenDatapoolIsThreadSharedAndNonCircularAndAllValuesAreUsed()
 {
     SetupContextForAgentNumber1ProcessNumber2ThreadNumber3RunNumber4();
     metadataMock.Setup(md => md.DistributionMode).Returns(DatapoolThreadDistributionMode.ThreadShared);
     metadataMock.Setup(md => md.IsCircular).Returns(false);
     var datapool = new Datapool<TestValue>(grinderContextMock.Object, metadataMock.Object);
     datapool.NextValue();
     datapool.NextValue();
     Assert.Throws(Is.InstanceOf<IllegalStateException>().With.Message.EqualTo("Non circular non thread unique datapool 'TestValue' is drained: Agent number '1', process number '2' (TestProcessYYY), thread number '3', run number '4'"), () => datapool.NextValue());
 }
 public void NextValueShouldCircleLastBucketWhenDatapoolIsThreadUniqueAndCircularForLastAgentProcessThread()
 {
     SetupThreadUniqueContextFor2Agents3Processes4ThreadsAnd49TestValues();
     SetupContextForAgentNumber1ProcessNumber2ThreadNumber3RunNumber4();
     metadataMock.Setup(md => md.IsCircular).Returns(true);
     var datapool = new Datapool<TestValue>(grinderContextMock.Object, metadataMock.Object);
     Assert.That(datapool.NextValue(), Is.SameAs(values[47]));
     Assert.That(datapool.NextValue(), Is.SameAs(values[48]));
     Assert.That(datapool.NextValue(), Is.SameAs(values[47]));
 }
Example #18
0
        public void PhysicalSizeShouldBeSameAsMetatdataValueSize()
        {
            var datapool = new Datapool <TestValue>(grinderContextMock.Object, metadataMock.Object);

            Assert.That(datapool.PhysicalSize, Is.EqualTo(values.Count));
        }
        public void NextValueShouldUseAllValuesInCircleForAllThreadsWhenDatapoolThreadCompleteAndCircular()
        {
            metadataMock.Setup(md => md.IsRandom).Returns(false);
            metadataMock.Setup(md => md.DistributionMode).Returns(DatapoolThreadDistributionMode.ThreadComplete);
            metadataMock.Setup(md => md.IsCircular).Returns(true);
            grinderContextMock.Setup(c => c.GetProperty(Constants.AgentCountKey, "1")).Returns("1");
            grinderContextMock.Setup(c => c.GetProperty(Constants.ProcessCountKey, "1")).Returns("1");
            grinderContextMock.Setup(c => c.GetProperty(Constants.ThreadCountKey, "1")).Returns("2");
            grinderContextMock.Setup(gc => gc.AgentNumber).Returns(0);
            grinderContextMock.Setup(gc => gc.FirstProcessNumber).Returns(0);
            grinderContextMock.Setup(gc => gc.ProcessNumber).Returns(0);
            grinderContextMock.Setup(gc => gc.ProcessName).Returns("TestProcessYYY");
            grinderContextMock.Setup(gc => gc.RunNumber).Returns(1);
            var datapool = new Datapool<TestValue>(grinderContextMock.Object, metadataMock.Object);

            grinderContextMock.Setup(gc => gc.ThreadNumber).Returns(0);
            Assert.That(datapool.NextValue(), Is.SameAs(values[0]));
            Assert.That(datapool.NextValue(), Is.SameAs(values[1]));
            Assert.That(datapool.NextValue(), Is.SameAs(values[0]));

            grinderContextMock.Setup(gc => gc.ThreadNumber).Returns(1);
            Assert.That(datapool.NextValue(), Is.SameAs(values[0]));
            Assert.That(datapool.NextValue(), Is.SameAs(values[1]));
            Assert.That(datapool.NextValue(), Is.SameAs(values[0]));
        }
 public void NextValueShouldThrowExceptionWhenDatapoolIsThreadUniqueAndNonCircularAndAllValuesInLastBucketAreUsedForLastAgentProcessThread()
 {
     SetupThreadUniqueContextFor2Agents3Processes4ThreadsAnd49TestValues();
     SetupContextForAgentNumber1ProcessNumber2ThreadNumber3RunNumber4();
     metadataMock.Setup(md => md.IsCircular).Returns(false);
     var datapool = new Datapool<TestValue>(grinderContextMock.Object, metadataMock.Object);
     datapool.NextValue();
     datapool.NextValue();
     Assert.Throws(Is.InstanceOf<IllegalStateException>().With.Message.EqualTo("Non circular thread unique datapool 'TestValue' is drained: Agent number '1', process number '2' (TestProcessYYY), thread number '3', run number '4'"), () => datapool.NextValue());
 }
 public void PhysicalSizeShouldBeSameAsMetatdataValueSize()
 {
     var datapool = new Datapool<TestValue>(grinderContextMock.Object, metadataMock.Object);
     Assert.That(datapool.PhysicalSize, Is.EqualTo(values.Count));
 }
 public void NextValueShouldUseAllValuesInCircleWhenDatapoolIsThreadSharedAndCircular()
 {
     metadataMock.Setup(md => md.IsRandom).Returns(false);
     metadataMock.Setup(md => md.DistributionMode).Returns(DatapoolThreadDistributionMode.ThreadShared);
     metadataMock.Setup(md => md.IsCircular).Returns(true);
     var datapool = new Datapool<TestValue>(grinderContextMock.Object, metadataMock.Object);
     Assert.That(datapool.NextValue(), Is.SameAs(values[0]));
     Assert.That(datapool.NextValue(), Is.SameAs(values[1]));
     Assert.That(datapool.NextValue(), Is.SameAs(values[0]));
 }
 public void LogicalSizeShouldBeSameAsPhysicalSizeWhenDistibutionModeIsThreadComplete()
 {
     SetupThreadCompleteContextFor2Agents3Processes4Threads();
     SetupContextForAgentNumber0ProcessNumber0ThreadNumber0RunNumber5();
     AddTestValues(49);
     var datapool = new Datapool<TestValue>(grinderContextMock.Object, metadataMock.Object);
     Assert.That(datapool.LogicalSize, Is.EqualTo(datapool.PhysicalSize));
 }
 public void CtorShouldSetGrinderContext()
 {
     var datapool = new Datapool<TestValue>(grinderContextMock.Object, metadataMock.Object);
     Assert.That(datapool.GrinderContext, Is.SameAs(grinderContextMock.Object));
 }
 public void LogicalSizeShouldBeSameAsThreadBucketSizeWhenDistibutionModeIsThreadUnique()
 {
     SetupThreadUniqueContextFor2Agents3Processes4Threads();
     SetupContextForAgentNumber0ProcessNumber0ThreadNumber0RunNumber5();
     AddTestValues(49);
     var datapool = new Datapool<TestValue>(grinderContextMock.Object, metadataMock.Object);
     // First process of first agent gets 49 / 2 (agentCount) (+ 1 leftover from dividion) = 25 / 3 (processCount) (+ 1 leftover from division) = 9 / 4 (threadcount) (+ 1 leftover from division) = 3
     Assert.That(datapool.LogicalSize, Is.EqualTo(3));
 }