Skip to content

Commit

Permalink
Revert "Address TODOs in tests (#873)"
Browse files Browse the repository at this point in the history
This reverts commit c3cb562.
  • Loading branch information
ulvii authored Nov 30, 2018
1 parent b638471 commit 60e879a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package com.microsoft.sqlserver.jdbc.bulkCopy;

import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
Expand All @@ -22,7 +21,6 @@

import com.microsoft.sqlserver.jdbc.ComparisonUtil;
import com.microsoft.sqlserver.jdbc.TestResource;
import com.microsoft.sqlserver.jdbc.TestUtils;
import com.microsoft.sqlserver.testframework.DBConnection;
import com.microsoft.sqlserver.testframework.DBResultSet;
import com.microsoft.sqlserver.testframework.DBStatement;
Expand Down Expand Up @@ -387,10 +385,10 @@ private void validateValuesRepetitiveCM(DBConnection con, DBTable sourceTable,
int totalColumns = sourceMeta.getColumnCount();

// verify data from sourceType and resultSet
int numRows = 0;
while (srcResultSet.next() && dstResultSet.next()) {
numRows++;
for (int i = 1; i <= totalColumns; i++) {
// TODO: check row and column count in both the tables

Object srcValue, dstValue;
srcValue = srcResultSet.getObject(i);
dstValue = dstResultSet.getObject(i);
Expand All @@ -405,11 +403,6 @@ private void validateValuesRepetitiveCM(DBConnection con, DBTable sourceTable,
}
}
}

// verify number of rows and columns
assertTrue(((ResultSet) dstResultSet.product()).getMetaData().getColumnCount() == totalColumns + 1);
assertTrue(sourceTable.getTotalRows() == numRows);
assertTrue(destinationTable.getTotalRows() == numRows);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
package com.microsoft.sqlserver.jdbc.bulkCopy;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.sql.Connection;
Expand Down Expand Up @@ -281,25 +280,17 @@ static void validateValues(DBConnection con, DBTable sourceTable, DBTable destin
int totalColumns = destMeta.getColumnCount();

// verify data from sourceType and resultSet
int numRows = 0;
while (srcResultSet.next() && dstResultSet.next()) {
numRows++;
for (int i = 1; i <= totalColumns; i++) {
// TODO: check row and column count in both the tables

Object srcValue, dstValue;
srcValue = srcResultSet.getObject(i);
dstValue = dstResultSet.getObject(i);

ComparisonUtil.compareExpectedAndActual(destMeta.getColumnType(i), srcValue, dstValue);
}
}

// verify number of rows and columns
assertTrue(((ResultSet) srcResultSet.product()).getMetaData().getColumnCount() == totalColumns);

if (numRows > 0) {
assertTrue(sourceTable.getTotalRows() == numRows);
assertTrue(destinationTable.getTotalRows() == numRows);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ public void testGetColumnPrivileges() throws SQLException {
}

/**
* Testing {@link SQLServerDatabaseMetaData#getFunctions(String, String, String)} with sending wrong catalog.
* TODO: Check JDBC Specs: Can we have any tables/functions without category?
*
* Testing {@link SQLServerDatabaseMetaData#getFunctions(String, String, String)} with sending wrong category.
*
* @throws SQLException
*/
Expand All @@ -427,7 +429,9 @@ public void testGetFunctionsWithWrongParams() throws SQLException {
try (Connection conn = DriverManager.getConnection(connectionString)) {
conn.getMetaData().getFunctions("", null, "xp_%");
assertTrue(false, TestResource.getResource("R_noSchemaShouldFail"));
} catch (Exception ae) {}
} catch (Exception ae) {

}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ public void bulkCopyTestVarbinary8000() throws SQLException {
*
* @throws SQLException
*/
@Test
@Test // TODO: check bitnull
public void bulkCopyTestBitNull() throws SQLException {
try (Connection con = DriverManager.getConnection(connectionString); Statement stmt = con.createStatement()) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,8 @@ public void testDateTime() throws SQLException {
*
* @throws SQLException
* @throws SQLTimeoutException
* https://msdn.microsoft.com/en-ca/library/dd303302.aspx?f=255&MSPPError=-2147217396
* Data types cannot be NULL when inside a sql_variant
*/
@Test
@Test // TODO We need to check this later. Right now sending null with TVP is not supported
public void testNull() throws SQLException {
tvp = new SQLServerDataTable();
tvp.addColumnMetadata("c1", microsoft.sql.Types.SQL_VARIANT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,16 @@ public static void populateProperties() {
currentJVM = IBM_JVM;
}

// TODO: Need to check this.
if (p.getProperty("java.vendor").startsWith("SAP")) {
currentJVM = SAP_JVM;
}
}

/**
* Test FIPS in Oracle Env.
* After stabilizing parameterized test case TODO: Enable FIPS can be done in two ways.
* <LI>JVM Level - Done.
* <LI>Program Level - Not Done. We need to test both on different environments.
*
* @since 6.1.2
*/
Expand All @@ -88,7 +91,7 @@ public void testFIPSOnOracle() throws Exception {
}

/**
* Test FIPS in IBM Env. If JVM is not IBM test will not fail. It will simply skipped.
* It will test FIPS on IBM Env. If JVM is not IBM test will not fail. It will simply skipped.
*
* @since 6.1.2
*/
Expand Down

0 comments on commit 60e879a

Please sign in to comment.