Package javax.sql

Examples of javax.sql.RowSetInternal


        provider.setDataSourceLock(SyncProvider.DATASOURCE_NO_LOCK);
    }

    public void testGetConnection() throws Exception {
        RowSetInternal rowset = (RowSetInternal) noInitialCrset;
        assertNull(rowset.getConnection());

        noInitialCrset.setUsername("test");
        noInitialCrset.setPassword("pwd");

        assertNull(noInitialCrset.getUrl());
        assertNull(noInitialCrset.getDataSourceName());
        assertNull(rowset.getConnection());

        noInitialCrset.setUrl(DERBY_URL);
        assertNull(noInitialCrset.getDataSourceName());
        assertNull(rowset.getConnection());

        noInitialCrset.setUsername(null);
        noInitialCrset.setPassword(null);
        noInitialCrset.setUrl(DERBY_URL);
        assertNull(noInitialCrset.getDataSourceName());
        assertNull(rowset.getConnection());

        // test acceptChange
        crset = newNoInitialInstance();
        rs = st.executeQuery("select * from USER_INFO");

        crset.populate(rs);

        rowset = (RowSetInternal) crset;

        assertNull(crset.getUsername());
        assertNull(crset.getPassword());
        assertNull(crset.getUrl());
        assertNull(crset.getDataSourceName());
        assertNull(rowset.getConnection());

        crset.setUrl(DERBY_URL);
        assertNull(crset.getUsername());
        assertNull(crset.getPassword());
        assertEquals(DERBY_URL, crset.getUrl());
        assertNull(rowset.getConnection());

        crset.absolute(3);
        crset.updateString(2, "update2");
        assertEquals(DERBY_URL, crset.getUrl());
        crset.acceptChanges();
        assertNull(rowset.getConnection());

        crset.acceptChanges(conn);

        assertNotNull(rowset.getConnection());
        assertSame(conn, rowset.getConnection());

        crset.acceptChanges();
        assertSame(conn, rowset.getConnection());

        Connection connection = DriverManager.getConnection(DERBY_URL);
        crset.acceptChanges(connection);
        assertSame(connection, rowset.getConnection());

    }
View Full Code Here


        provider.setDataSourceLock(SyncProvider.DATASOURCE_NO_LOCK);
    }

    public void testGetConnection() throws Exception {
        RowSetInternal rowset = (RowSetInternal) noInitialCrset;
        assertNull(rowset.getConnection());

        noInitialCrset.setUsername("test");
        noInitialCrset.setPassword("pwd");

        assertNull(noInitialCrset.getUrl());
        assertNull(noInitialCrset.getDataSourceName());
        assertNull(rowset.getConnection());

        noInitialCrset.setUrl(DERBY_URL);
        assertNull(noInitialCrset.getDataSourceName());
        assertNull(rowset.getConnection());

        noInitialCrset.setUsername(null);
        noInitialCrset.setPassword(null);
        noInitialCrset.setUrl(DERBY_URL);
        assertNull(noInitialCrset.getDataSourceName());
        assertNull(rowset.getConnection());

        // test acceptChange
        crset = newNoInitialInstance();
        rs = st.executeQuery("select * from USER_INFO");

        crset.populate(rs);

        rowset = (RowSetInternal) crset;

        assertNull(crset.getUsername());
        assertNull(crset.getPassword());
        assertNull(crset.getUrl());
        assertNull(crset.getDataSourceName());
        assertNull(rowset.getConnection());

        crset.setUrl(DERBY_URL);
        assertNull(crset.getUsername());
        assertNull(crset.getPassword());
        assertEquals(DERBY_URL, crset.getUrl());
        assertNull(rowset.getConnection());

        crset.absolute(3);
        crset.updateString(2, "update2");
        assertEquals(DERBY_URL, crset.getUrl());
        crset.acceptChanges();
        assertNull(rowset.getConnection());

        crset.acceptChanges(conn);

        assertNotNull(rowset.getConnection());
        assertSame(conn, rowset.getConnection());

        crset.acceptChanges();
        assertSame(conn, rowset.getConnection());

        Connection connection = DriverManager.getConnection(DERBY_URL);
        crset.acceptChanges(connection);
        assertSame(connection, rowset.getConnection());

    }
View Full Code Here

TOP

Related Classes of javax.sql.RowSetInternal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.