Skip to content
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

Merged
merged 4 commits into from
Mar 8, 2017

Conversation

AfsanehR-zz
Copy link
Contributor

added last test class for statement unit test.

@codecov-io
Copy link

codecov-io commented Mar 7, 2017

Codecov Report

Merging #174 into dev will increase coverage by 1.24%.
The diff coverage is n/a.

@@             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
Flag Coverage Δ Complexity Δ
#JDBC41 30.82% <ø> (+1.21%) 1323 <ø> (+78)
#JDBC42 30.91% <ø> (+1.33%) 1329 <ø> (+85)
Impacted Files Coverage Δ Complexity Δ
...om/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java 45.89% <0%> (+0.07%) 184% <0%> (+2%)
.../microsoft/sqlserver/jdbc/SQLServerConnection.java 39.26% <0%> (+0.48%) 193% <0%> (+3%)
.../microsoft/sqlserver/jdbc/SQLServerDataSource.java 43.32% <0%> (+0.59%) 54% <0%> (+1%)
...n/java/com/microsoft/sqlserver/jdbc/DataTypes.java 68.68% <0%> (+0.67%) 1% <0%> (+1%)
...c/main/java/com/microsoft/sqlserver/jdbc/Util.java 38.95% <0%> (+0.71%) 51% <0%> (+1%)
...oft/sqlserver/jdbc/SQLServerCallableStatement.java 13.42% <0%> (+0.83%) 39% <0%> (+4%)
...in/java/com/microsoft/sqlserver/jdbc/IOBuffer.java 33.14% <0%> (+1.03%) 0% <0%> (ø)
...rc/main/java/com/microsoft/sqlserver/jdbc/dtv.java 31.79% <0%> (+1.08%) 0% <0%> (ø)
...m/microsoft/sqlserver/jdbc/SQLServerResultSet.java 19.03% <0%> (+1.1%) 140% <0%> (+13%)
...rc/main/java/com/microsoft/sqlserver/jdbc/DDC.java 24.1% <0%> (+1.11%) 36% <0%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 369e5e0...acc3c34. Read the comment docs.

@ahmad-ibra ahmad-ibra self-assigned this Mar 7, 2017
@@ -0,0 +1,2700 @@
package com.microsoft.sqlserver.jdbc.unit.statement;

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?"

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

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)

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. ");

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";

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 "

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 "

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";

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");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid using string wassup

@ahmad-ibra ahmad-ibra merged commit 85a5b68 into microsoft:dev Mar 8, 2017
@AfsanehR-zz AfsanehR-zz deleted the statementTest branch March 31, 2017 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants