コード例 #1
0
        public virtual void TestDefaultCollect()
        {
            //mock creation
            Task.TaskReporter mockTaskReporter = Org.Mockito.Mockito.Mock <Task.TaskReporter>(
                );
            IFile.Writer <string, int> mockWriter = Org.Mockito.Mockito.Mock <IFile.Writer>();
            Configuration conf = new Configuration();

            coc = new Task.CombineOutputCollector <string, int>(outCounter, mockTaskReporter,
                                                                conf);
            coc.SetWriter(mockWriter);
            Org.Mockito.Mockito.Verify(mockTaskReporter, Org.Mockito.Mockito.Never()).Progress
                ();
            for (int i = 0; i < Task.DefaultCombineRecordsBeforeProgress; i++)
            {
                coc.Collect("dummy", i);
            }
            Org.Mockito.Mockito.Verify(mockTaskReporter, Org.Mockito.Mockito.Times(1)).Progress
                ();
            for (int i_1 = 0; i_1 < Task.DefaultCombineRecordsBeforeProgress; i_1++)
            {
                coc.Collect("dummy", i_1);
            }
            Org.Mockito.Mockito.Verify(mockTaskReporter, Org.Mockito.Mockito.Times(2)).Progress
                ();
        }
コード例 #2
0
        public virtual void TestCustomCollect()
        {
            //mock creation
            Task.TaskReporter mockTaskReporter = Org.Mockito.Mockito.Mock <Task.TaskReporter>(
                );
            IFile.Writer <string, int> mockWriter = Org.Mockito.Mockito.Mock <IFile.Writer>();
            Configuration conf = new Configuration();

            conf.Set(MRJobConfig.CombineRecordsBeforeProgress, "2");
            coc = new Task.CombineOutputCollector <string, int>(outCounter, mockTaskReporter,
                                                                conf);
            coc.SetWriter(mockWriter);
            Org.Mockito.Mockito.Verify(mockTaskReporter, Org.Mockito.Mockito.Never()).Progress
                ();
            coc.Collect("dummy", 1);
            Org.Mockito.Mockito.Verify(mockTaskReporter, Org.Mockito.Mockito.Never()).Progress
                ();
            coc.Collect("dummy", 2);
            Org.Mockito.Mockito.Verify(mockTaskReporter, Org.Mockito.Mockito.Times(1)).Progress
                ();
        }