Beispiel #1
0
        public void TestJdbc3()
        {
            // arrange
            mockDataFrameReaderProxy.Setup(m => m.Jdbc(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string[]>(), It.IsAny<Dictionary<string, string>>()));
            var dataFrameReader = new DataFrameReader(mockDataFrameReaderProxy.Object, sparkContext);

            // Act
            const string url = "url";
            const string table = "table_name";
            var predicates = new[] { "predicate1", "predicate2" };
            var connectionProperties = new Dictionary<string, string>()
            {
                {"prop1", "value1"},
                {"prop2", "value2"}
            };

            dataFrameReader.Jdbc(url, table, predicates, connectionProperties);

            // Assert
            mockDataFrameReaderProxy.Verify(m => m.Jdbc(url, table, predicates, connectionProperties), Times.Once);
        }
Beispiel #2
0
        public void TestJdbc2()
        {
            // arrange
            mockDataFrameReaderProxy.Setup(m => m.Jdbc(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), 
                It.IsAny<string>(), It.IsAny<int>(), It.IsAny<Dictionary<string, string>>()));
            var dataFrameReader = new DataFrameReader(mockDataFrameReaderProxy.Object, sparkContext);

            // Act
            const string url = "url";
            const string table = "table_name";
            const string columnName = "col1";
            const string lowerBound = "a";
            const string upperBound = "z";
            const int numPartitions = 5;
            var connectionProperties = new Dictionary<string, string>()
            {
                {"prop1", "value1"},
                {"prop2", "value2"}
            };

            dataFrameReader.Jdbc(url, table, columnName, lowerBound, upperBound, numPartitions, connectionProperties);

            // Assert
            mockDataFrameReaderProxy.Verify(m => m.Jdbc(url, table, columnName, lowerBound, upperBound, numPartitions, connectionProperties), 
                Times.Once);
        }