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.
assertTrue(ds.getLastUpdateCount()); will suffice the purpose.
No need to compare true == ds.getLastUpdateCount());
| .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.
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.
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.
| rs.next(); | ||
| int engineEdition = rs.getInt(1); | ||
| rs.close(); | ||
| if (engineEdition == ENGINE_EDITION_FOR_SQL_AZURE) { |
There was a problem hiding this comment.
SUGGESTION: Although code is right, as per standard can you use constant on left side?
| 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.
I guess this sql query for Drop Function is generic and should be reusable.
No description provided.