-
Notifications
You must be signed in to change notification settings - Fork 428
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
Connection test #95
Connection test #95
Conversation
public void testNativeMSSQLDataSource() throws SQLException { | ||
SQLServerXADataSource ds = new SQLServerXADataSource(); | ||
ds.setLastUpdateCount(true); | ||
assertTrue(true == ds.getLastUpdateCount()); |
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.
assertTrue(ds.getLastUpdateCount());
will suffice the purpose.
No need to compare true == ds.getLastUpdateCount());
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.
done
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.
Reviewed.
.unwrap(Class.forName("com.microsoft.sqlserver.jdbc.ISQLServerDataSource"))); | ||
ids.setApplicationName("AppName"); | ||
} catch (UnsupportedOperationException e) { | ||
assertEquals("This operation is not supported.", e.getMessage()); |
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.
Can you add some java docs related to which Unsupported Operation you are expecting in this unit test case?
public class PoolingTest extends AbstractTest { | ||
@Test | ||
public void testPooling() throws SQLException { | ||
if (!DBConnection.isSqlAzure(DriverManager.getConnection(connectionString))) { |
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.
You can use assumeTrue(DBConnection.isSqlAzure(DriverManager.getConnection(connectionString)),"Skipping / Aborting testcase as this is not Azure Env");
No need to use if condition
. In assumeTrue(...)
if given condition results true then JUnit runner executes further lines else it will abort running test case.
This will give us indications about how many test case gets skipped.
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.
done
rs.next(); | ||
int engineEdition = rs.getInt(1); | ||
rs.close(); | ||
if (engineEdition == ENGINE_EDITION_FOR_SQL_AZURE) { |
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.
SUGGESTION: Although code is right, as per standard can you use constant on left side?
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.
done
Connection con = ds.getConnection(); | ||
|
||
//drop function | ||
String sqlDropFunction = "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo]." + functionName + "')" + "and xtype in (N'FN', N'IF', N'TF'))" |
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.
I guess this sql query for Drop Function is generic and should be reusable.
No description provided.