-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added another test file for Statement test #174
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #174 +/- ##
===========================================
+ Coverage 29.7% 30.95% +1.24%
- Complexity 1248 1331 +83
===========================================
Files 97 97
Lines 23305 23305
Branches 3871 3871
===========================================
+ Hits 6923 7214 +291
+ Misses 15028 14714 -314
- Partials 1354 1377 +23
Continue to review full report at Codecov.
|
@@ -0,0 +1,2700 @@ | |||
package com.microsoft.sqlserver.jdbc.unit.statement; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add MIT License to top:
/*
- Microsoft JDBC Driver for SQL Server
- Copyright(c) Microsoft Corporation All rights reserved.
- This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information.
*/
private static final int MIN_TABLE_ROWS = 100; | ||
private static final String TEST_STRING = "Hello." + " This is a test string." | ||
+ " It is particularly long so that we will get a multipacket TDS response back from the server." + " Does it work?" | ||
+ " I have no idea." + " If I did, then I would not be needing this test, now would I?" + " So how about it then?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modify TEST_STRING
*/ | ||
@Test | ||
public void testQueryTimeout() throws Exception { | ||
// VSTS 433183 - fxUnitStatement: TCAttentionHandling\testQueryTimeout fails on VM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line
@Test | ||
public void testQueryTimeout() throws Exception { | ||
// VSTS 433183 - fxUnitStatement: TCAttentionHandling\testQueryTimeout fails on VM | ||
// BVTs use a fixed seed (set in build.xml) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this too
*/ | ||
@Test | ||
public void testCancelLongResponse() throws Exception { | ||
// assumeTrue("JDBC42".equals(Utils.getConfiguredProperty("JDBC_Version")), "Aborting test case as JDBC version is not compatible. "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove un-used code
stmt.executeUpdate("Insert into " + tableName + " values(0, 'hello')"); | ||
stmt.executeUpdate("Insert into " + tableName + " values(0, 'yo')"); | ||
String query = "create procedure " + procName + " @col1Value int, @col2Value varchar(512) OUTPUT AS BEGIN SELECT * from " + tableName | ||
+ " where col1=@col1Value SET @col2Value='wassup' END"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid strings like wassup
Connection conn = DriverManager.getConnection(connectionString); | ||
Statement stmt = conn.createStatement(); | ||
try { | ||
stmt.executeUpdate("drop table if exists " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid using yo
Connection conn = DriverManager.getConnection(connectionString); | ||
Statement stmt = conn.createStatement(); | ||
try { | ||
stmt.executeUpdate("drop table if exists " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid using wassup
stmt.executeUpdate("Insert into " + tableName + " values(0, 'hello')"); | ||
stmt.executeUpdate("Insert into " + tableName + " values(0, 'yo')"); | ||
String query = "create procedure " + procName + " @col1Value int, @col2Value varchar(512) OUTPUT AS BEGIN SELECT * from " + tableName | ||
+ " where col1=@col1Value SET @col2Value='wassup' END"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not use strings 'yo' and 'wassap'. may need to retest to make sure nothing broke once strings are modified
ResultSet rs = cstmt.executeQuery(); | ||
rs.next(); | ||
assertEquals(rs.getString(2), "hello", "Wrong value"); | ||
assertEquals(cstmt.getString(2), "wassup", "Wrong value"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid using string wassup
added last test class for statement unit test.