Package com.springsource.insight.plugin.jdbc.helpers

Examples of com.springsource.insight.plugin.jdbc.helpers.AbstractStatement


        super();
    }

    @Test
    public void testGetMetadataRunsSqlQuery() throws SQLException {
        final AbstractStatement metaDataStmt = new Jdk16Statement();
        final AtomicInteger callsCount = new AtomicInteger(0);
        final DatabaseMetaData metaData = new Jdk16DatabaseMetaData() {
            @Override
            public String getURL() throws SQLException {
                callsCount.incrementAndGet();
                return "jdbc:test:call=" + metaDataStmt.execute("SHOW META DATA");
            }
        };
        Connection metaDataConn = new Jdk16Connection() {
            @Override
            public DatabaseMetaData getMetaData() throws SQLException {
                return metaData;
            }
        };
        metaDataStmt.setConnection(metaDataConn);

        AbstractStatement orgStmt = new Jdk16Statement();
        orgStmt.setConnection(metaDataConn);

        final String sql = "select * from appointment where owner = 'Agim' and dateTime = '2009-06-01'";
        assertTrue("Failed to executed dummy SQL", orgStmt.execute(sql));
        assertEquals("Mismatched meta data calls count", 1, callsCount.intValue());
        assertJdbcOperation(sql);
    }
View Full Code Here

TOP

Related Classes of com.springsource.insight.plugin.jdbc.helpers.AbstractStatement

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.