use of com.microsoft.sqlserver.jdbc.ISQLServerDataSource in project mssql-jdbc by Microsoft.
the class NativeMSSQLDataSourceTest method testInterfaceWrapping.
@Test
public void testInterfaceWrapping() throws ClassNotFoundException, SQLException {
SQLServerDataSource ds = new SQLServerDataSource();
assertEquals(true, ds.isWrapperFor(Class.forName("com.microsoft.sqlserver.jdbc.ISQLServerDataSource")));
assertEquals(true, ds.isWrapperFor(Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDataSource")));
assertEquals(true, ds.isWrapperFor(Class.forName("javax.sql.CommonDataSource")));
ISQLServerDataSource ids = (ISQLServerDataSource) (ds.unwrap(Class.forName("com.microsoft.sqlserver.jdbc.ISQLServerDataSource")));
ids.setApplicationName("AppName");
SQLServerConnectionPoolDataSource poolDS = new SQLServerConnectionPoolDataSource();
assertEquals(true, poolDS.isWrapperFor(Class.forName("com.microsoft.sqlserver.jdbc.ISQLServerDataSource")));
assertEquals(true, poolDS.isWrapperFor(Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDataSource")));
assertEquals(true, poolDS.isWrapperFor(Class.forName("com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource")));
assertEquals(true, poolDS.isWrapperFor(Class.forName("javax.sql.CommonDataSource")));
ISQLServerDataSource ids2 = (ISQLServerDataSource) (poolDS.unwrap(Class.forName("com.microsoft.sqlserver.jdbc.ISQLServerDataSource")));
ids2.setApplicationName("AppName");
SQLServerXADataSource xaDS = new SQLServerXADataSource();
assertEquals(true, xaDS.isWrapperFor(Class.forName("com.microsoft.sqlserver.jdbc.ISQLServerDataSource")));
assertEquals(true, xaDS.isWrapperFor(Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDataSource")));
assertEquals(true, xaDS.isWrapperFor(Class.forName("com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource")));
assertEquals(true, xaDS.isWrapperFor(Class.forName("com.microsoft.sqlserver.jdbc.SQLServerXADataSource")));
assertEquals(true, xaDS.isWrapperFor(Class.forName("javax.sql.CommonDataSource")));
ISQLServerDataSource ids3 = (ISQLServerDataSource) (xaDS.unwrap(Class.forName("com.microsoft.sqlserver.jdbc.ISQLServerDataSource")));
ids3.setApplicationName("AppName");
}
Aggregations