Package org.geotools.data.jdbc.datasource

Examples of org.geotools.data.jdbc.datasource.UnWrapper.unwrap()


        super.connect();
        fixture = new GeometryFixture();
        this.connection = setup.getDataSource().getConnection();
       
        UnWrapper unwrapper = DataSourceFinder.getUnWrapper(this.connection);
        OracleConnection oraConn = (OracleConnection) unwrapper.unwrap(this.connection);
        converter = new GeometryConverter(oraConn);
    }

    // called from teardown
    protected void disconnect() throws Exception {
View Full Code Here


      
       Connection conn = ds.getConnection();
       UnWrapper uw = DataSourceFinder.getUnWrapper(conn);
       assertNotNull(uw);
       assertTrue(uw.canUnwrap(conn));
       Connection unwrapped = uw.unwrap(conn);
       assertNotNull(unwrapped);
       assertTrue(unwrapped instanceof org.h2.jdbc.JdbcConnection);
      
       Statement st = conn.createStatement();
       uw = DataSourceFinder.getUnWrapper(st);
View Full Code Here

      
       Statement st = conn.createStatement();
       uw = DataSourceFinder.getUnWrapper(st);
       assertNotNull(uw);
       assertTrue(uw.canUnwrap(st));
       Statement uwst = uw.unwrap(st);
       assertNotNull(uwst);
       assertTrue(uwst instanceof org.h2.jdbc.JdbcStatement);
       st.close();
      
       PreparedStatement ps = conn.prepareStatement("select curtime()");
View Full Code Here

      
       PreparedStatement ps = conn.prepareStatement("select curtime()");
       uw = DataSourceFinder.getUnWrapper(ps);
       assertNotNull(uw);
       assertTrue(uw.canUnwrap(ps));
       PreparedStatement uwps = (PreparedStatement) uw.unwrap(ps);
       assertNotNull(uwps);
       assertTrue(uwps instanceof org.h2.jdbc.JdbcPreparedStatement);
       ps.close();
      
          
View Full Code Here

       
        UnWrapper unwrapper = new GenericUnWrapper();
       
        assertFalse( unwrapper.canUnwrap( wrapper ) );
        try {
            assertNull( unwrapper.unwrap( wrapper ));
            fail("Cannot unwrap yet");
        }
        catch (Exception expected){
        }
        GenericUnWrapper.CONNECTION_METHODS.put(WrapperConnection.class,
View Full Code Here

        }
        GenericUnWrapper.CONNECTION_METHODS.put(WrapperConnection.class,
                WrapperConnection.class.getMethod("getUnderlyingConnection", null));
       
        assertTrue( unwrapper.canUnwrap( wrapper ) );
        assertSame( connection, unwrapper.unwrap( wrapper ) );
    }

    @Test
    public void testSPIRegistration() throws Exception {
        Connection connection = new TestConnection();
View Full Code Here

                 WrapperConnection.class.getMethod("getUnderlyingConnection", null));
        
         uw = DataSourceFinder.getUnWrapper( wrapper );
         assertNotNull("registed and canUnwrap",uw);
         if( uw instanceof GenericUnWrapper ){
             assertSame( "Generic unwrapper is working", connection, uw.unwrap( wrapper ));
         }
    }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.