Exemple #1
0
        public async System.Threading.Tasks.Task TestParallelAsync()
        {
            var breaker = _cluster.GrainFactory.GetGrain <ITestHelper>(this.GetType().Namespace);

            StaticTestHelper.Reset();
            StaticTestHelper.TempFailTest("Initial fail of the test");
            var conf = new TopologyConfiguration();

            conf.TimeCharacteristic = CoreOSP.TimePolicy.None;
            var mgr = new TopologyManager(conf);
            var ds  = mgr.AddSource(typeof(TestSource), 1);
            var wds = ds.WindowAggregate(typeof(TestEventBasedAggregationM));

            var terminationds = mgr.AddSource(typeof(TestSource1), 1);

            wds.AddInput(terminationds);

            var        sink = wds.Sink(typeof(TestSink), 1);
            JobManager jmgr = new JobManager();
            await jmgr.StartJob(mgr, _cluster.Client);

            Thread.Sleep(10000);
            var result = StaticTestHelper.GetStatus();

            Assert.False(result.Item1, result.Item2);
        }
Exemple #2
0
 public override void Consume(string input)
 {
     if (index == 0)
     {
         if (!"Test1".Equals(input))
         {
             StaticTestHelper.FailTest("Wrong input received, expected Test1 | got: " + input);
         }
         else
         {
             StaticTestHelper.PassTest("Correct value received");
         }
         index++;
     }
     else
     {
         StaticTestHelper.TempFailTest("Temp fail for index 2 ");
         if (!"Test2".Equals(input))
         {
             StaticTestHelper.FailTest("Wrong input received, expected Test2 | got: " + input);
         }
         else
         {
             StaticTestHelper.PassTest("Correct value received");
         }
     }
 }
Exemple #3
0
        public override void Consume(TypeB input)
        {
            if (index == 0)
            {
                if (!input.Field2.Equals("0"))
                {
                    StaticTestHelper.FailTest("Wrong input received, expected: 0 |actual: " + input.Field2);
                }
                else
                {
                    StaticTestHelper.PassTest("Expected input received, expected: 0 | actual: " + input.Field2);
                }

                index++;
            }
            else
            {
                StaticTestHelper.TempFailTest("Temp fail test for index 1");

                if (!input.Field2.Equals("1"))
                {
                    StaticTestHelper.FailTest("Wrong input received, expected: 1 |actual: " + input.Field2);
                }
                else
                {
                    StaticTestHelper.PassTest("Expected input received, expected: 1 | actual: " + input.Field2);
                }
            }
        }
Exemple #4
0
        public override void Consume(string input)
        {
            if (!success)
            {
                StaticTestHelper.TempFailTest("Not yet received from both inputs");
            }

            if (input == "Test1")
            {
                gotTest1 = true;
            }
            else if (input == "Test2")
            {
                gotTest2 = true;
            }
            else
            {
                StaticTestHelper.FailTest("Unexpected input: " + input);
            }

            if (gotTest2 && gotTest1)
            {
                success = true;
            }
            if (success)
            {
                StaticTestHelper.PassTest("Received from both inputs already");
            }
        }
Exemple #5
0
 public override void ProcessWatermark(Watermark wm, Metadata metadata)
 {
     wmCount++;
     if (wmCount != 2)
     {
         StaticTestHelper.TempFailTest("Wmcount !=2 actual: " + wmCount);
     }
     else
     {
         StaticTestHelper.PassTest("Wmcount == 2");
     }
 }
        public async System.Threading.Tasks.Task TestWatermark()
        {
            StaticTestHelper.Reset();
            StaticTestHelper.TempFailTest("Init test fail");
            var        conf = new TopologyConfiguration();
            var        mgr  = new TopologyManager(conf);
            var        ds   = mgr.AddSource(typeof(TestSource), 1);
            var        sink = ds.Sink(typeof(TestSink), 1);
            JobManager jmgr = new JobManager();
            await jmgr.StartJob(mgr, _cluster.Client);

            Thread.Sleep(7000);
            var result = StaticTestHelper.GetStatus();

            Assert.False(result.Item1, result.Item2);
        }
Exemple #7
0
        public override void Consume(int input)
        {
            if (input == 4 || input == 5 || input == 100 || input == 8 || input == 10)
            {
                StaticTestHelper.PassTest("Correct input received: " + input);
                count++;
            }
            else
            {
                StaticTestHelper.FailTest("Completely incorrect value received: " + input);
            }

            if (count != 5)
            {
                StaticTestHelper.TempFailTest("Count is not 5, actual: " + count);
            }
        }
Exemple #8
0
        public async System.Threading.Tasks.Task TestSourceFilterSinkRunAsync()
        {
            StaticTestHelper.Reset();
            StaticTestHelper.TempFailTest("Initial fail of test");
            var conf = new TopologyConfiguration();
            var mgr  = new TopologyManager(conf);
            var ds   = mgr.AddSource(typeof(TestSource1));

            ds.Filter(typeof(TestFilter)).Sink(typeof(TestSink1));

            JobManager jmgr = new JobManager();
            await jmgr.StartJob(mgr, _cluster.Client);

            Thread.Sleep(1000);
            var result = StaticTestHelper.GetStatus();

            Assert.False(result.Item1, result.Item2);
        }
Exemple #9
0
        public async System.Threading.Tasks.Task TestParallelFail1Async()
        {
            var breaker = _cluster.GrainFactory.GetGrain <ITestHelper>(this.GetType().Namespace);

            StaticTestHelper.Reset();
            StaticTestHelper.TempFailTest("Init test fail");
            var conf = new TopologyConfiguration();
            var mgr  = new TopologyManager(conf);
            var ds   = mgr.AddSource(typeof(TestSource1), 2);

            ds.Sink(typeof(TestSink1), 2);
            JobManager jmgr = new JobManager();
            await jmgr.StartJob(mgr, _cluster.Client);

            Thread.Sleep(1000);
            var result = StaticTestHelper.GetStatus();

            Assert.True(result.Item1, result.Item2);
        }
Exemple #10
0
        public override void ProcessWatermark(Watermark wm, Metadata metadata)
        {
            if (wmCount == 0)
            {
                if (wm.TimeStamp != new DateTime(2019, 10, 10, 10, 10, 9))
                {
                    error = true;
                }
            }
            else if (wmCount == 1)
            {
                if (wm.TimeStamp != new DateTime(2019, 10, 10, 10, 10, 10, 100))
                {
                    error = true;
                }
            }
            else if (wmCount == 2)
            {
                if (wm.TimeStamp != new DateTime(2019, 10, 10, 10, 10, 11, 500))
                {
                    error = true;
                }
            }

            wmCount++;
            if (wmCount != 3)
            {
                StaticTestHelper.TempFailTest("Wmcount != 3, actual: " + wmCount);
            }
            else
            {
                if (!error)
                {
                    StaticTestHelper.PassTest("WmCount == 3");
                }
            }
        }