Beispiel #1
0
        /// <exception cref="System.Exception"/>
        public virtual void TestTextSplitter()
        {
            TextSplitter       splitter = new TextSplitter();
            ResultSet          result   = Org.Mockito.Mockito.Mock <ResultSet>();
            IList <InputSplit> splits   = splitter.Split(configuration, result, "column");

            AssertSplits(new string[] { "column IS NULL column IS NULL" }, splits);
            Org.Mockito.Mockito.When(result.GetString(1)).ThenReturn("result1");
            Org.Mockito.Mockito.When(result.GetString(2)).ThenReturn("result2");
            splits = splitter.Split(configuration, result, "column1");
            AssertSplits(new string[] { "column1 >= 'result1' column1 < 'result1.'", "column1 >= 'result1' column1 <= 'result2'" }, splits);
        }
Beispiel #2
0
        /// <exception cref="Java.Sql.SQLException"/>
        public virtual void TestAlphabetSplit()
        {
            // This should give us 25 splits, one per letter.
            TextSplitter   splitter = new TextSplitter();
            IList <string> splits   = splitter.Split(25, "A", "Z", string.Empty);

            string[] expected = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J"
                                               , "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
            AssertArrayEquals(expected, Sharpen.Collections.ToArray(splits, new string[0]));
        }
Beispiel #3
0
        /// <exception cref="Java.Sql.SQLException"/>
        public virtual void TestCommonPrefix()
        {
            // Splits between 'Hand' and 'Hardy'
            TextSplitter   splitter = new TextSplitter();
            IList <string> splits   = splitter.Split(5, "nd", "rdy", "Ha");

            // Don't check for exact values in the middle, because the splitter generates some
            // ugly Unicode-isms. But do check that we get multiple splits and that it starts
            // and ends on the correct points.
            NUnit.Framework.Assert.AreEqual("Hand", splits[0]);
            NUnit.Framework.Assert.AreEqual("Hardy", splits[splits.Count - 1]);
            NUnit.Framework.Assert.AreEqual(6, splits.Count);
        }