Пример #1
0
        /// <exception cref="Java.Sql.SQLException"/>
        public virtual void TestSingletonSplit()
        {
            IList <long> splits = new IntegerSplitter().Split(1, 5, 5);

            long[] expected = new long[] { 5, 5 };
            AssertLongArrayEquals(expected, ToLongArray(splits));
        }
Пример #2
0
        /// <exception cref="Java.Sql.SQLException"/>
        public virtual void TestOddSplits()
        {
            IList <long> splits = new IntegerSplitter().Split(10, 0, 95);

            long[] expected = new long[] { 0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 95 };
            AssertLongArrayEquals(expected, ToLongArray(splits));
        }
Пример #3
0
        /// <exception cref="Java.Sql.SQLException"/>
        public virtual void TestEvenSplits()
        {
            IList <long> splits = new IntegerSplitter().Split(10, 0, 100);

            long[] expected = new long[] { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
            AssertLongArrayEquals(expected, ToLongArray(splits));
        }
Пример #4
0
        /// <exception cref="Java.Sql.SQLException"/>
        public virtual void TestTooManySplits()
        {
            IList <long> splits = new IntegerSplitter().Split(5, 3, 5);

            long[] expected = new long[] { 3, 4, 5 };
            AssertLongArrayEquals(expected, ToLongArray(splits));
        }
Пример #5
0
        /// <exception cref="Java.Sql.SQLException"/>
        public virtual void TestSingletonSplit2()
        {
            // Same test, but overly-high numSplits
            IList <long> splits = new IntegerSplitter().Split(5, 5, 5);

            long[] expected = new long[] { 5, 5 };
            AssertLongArrayEquals(expected, ToLongArray(splits));
        }
Пример #6
0
        /// <exception cref="System.Exception"/>
        public virtual void TestIntegerSplitter()
        {
            IntegerSplitter    splitter = new IntegerSplitter();
            ResultSet          result   = Org.Mockito.Mockito.Mock <ResultSet>();
            IList <InputSplit> splits   = splitter.Split(configuration, result, "column");

            AssertSplits(new string[] { ".*column IS NULL" }, splits);
            Org.Mockito.Mockito.When(result.GetString(1)).ThenReturn("result1");
            Org.Mockito.Mockito.When(result.GetString(2)).ThenReturn("result2");
            Org.Mockito.Mockito.When(result.GetLong(1)).ThenReturn(8L);
            Org.Mockito.Mockito.When(result.GetLong(2)).ThenReturn(19L);
            splits = splitter.Split(configuration, result, "column1");
            AssertSplits(new string[] { "column1 >= 8 column1 < 13", "column1 >= 13 column1 < 18"
                                        , "column1 >= 18 column1 <= 19" }, splits);
        }