Added another test file for Statement test#174
Merged
ahmad-ibra merged 4 commits intomicrosoft:devfrom Mar 8, 2017
Merged
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.
|
ahmad-ibra
suggested changes
Mar 8, 2017
| @@ -0,0 +1,2700 @@ | |||
| package com.microsoft.sqlserver.jdbc.unit.statement; | |||
There was a problem hiding this comment.
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?" |
| */ | ||
| @Test | ||
| public void testQueryTimeout() throws Exception { | ||
| // VSTS 433183 - fxUnitStatement: TCAttentionHandling\testQueryTimeout fails on VM |
| @Test | ||
| public void testQueryTimeout() throws Exception { | ||
| // VSTS 433183 - fxUnitStatement: TCAttentionHandling\testQueryTimeout fails on VM | ||
| // BVTs use a fixed seed (set in build.xml) |
| */ | ||
| @Test | ||
| public void testCancelLongResponse() throws Exception { | ||
| // assumeTrue("JDBC42".equals(Utils.getConfiguredProperty("JDBC_Version")), "Aborting test case as JDBC version is not compatible. "); |
| 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"; |
| Connection conn = DriverManager.getConnection(connectionString); | ||
| Statement stmt = conn.createStatement(); | ||
| try { | ||
| stmt.executeUpdate("drop table if exists " |
| Connection conn = DriverManager.getConnection(connectionString); | ||
| Statement stmt = conn.createStatement(); | ||
| try { | ||
| stmt.executeUpdate("drop table if exists " |
| 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.
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"); |
ahmad-ibra
approved these changes
Mar 8, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
added last test class for statement unit test.