Package org.jitterbit.integration.database.driver

Examples of org.jitterbit.integration.database.driver.JdbcDriverDescriptor


        testBeginEndQuoteConfigurationImpl(BeginEndQuote.fromStrings("", ""));
    }

    private void testBeginEndQuoteConfigurationImpl(BeginEndQuote quotes) {
        try {
            JdbcDriverDescriptor pgsql = new JdbcDriverDescriptor("PostgreSQL", "postgresql", "org.postgresql.Driver",
                            BeginEndQuote.POSTGRES);
            Xml xml = new Xml();
            xml.addDriver(pgsql, quotes);
            JdbcDriversConfig config = JdbcDriversConfig.fromXml(xml.toXml());
            List<JdbcDriverDescriptor> drivers = config.getRegisteredDrivers();
            assertEquals(1, drivers.size());
            JdbcDriverDescriptor driver = drivers.get(0);
            assertEquals(pgsql.getName(), driver.getName());
            assertEquals(pgsql.getSubprotocol(), driver.getSubprotocol());
            assertEquals(pgsql.getClass(), driver.getClass());
            assertEquals(quotes, driver.getBeginEndQuotes());
        } catch (Exception e) {
            fail(e.getMessage());
        }
    }
View Full Code Here


    }

    @Test
    public void ensureMultipleDriversWork() {
        try {
            JdbcDriverDescriptor pgsql = new JdbcDriverDescriptor("PostgreSQL", "postgresql", "org.postgresql.Driver",
                            BeginEndQuote.POSTGRES);
            JdbcDriverDescriptor mysql = new JdbcDriverDescriptor("MySQL", "mysql", "com.mysql.jdbc.Driver",
                            BeginEndQuote.BLANK);
            BeginEndQuote pgsqlQuotes = BeginEndQuote.fromStrings("|", "|");
            Xml xml = new Xml();
            xml.addDriver(pgsql, pgsqlQuotes);
            xml.addDriver(mysql, null);
            JdbcDriversConfig config = JdbcDriversConfig.fromXml(xml.toXml());
            Map<String, JdbcDriverDescriptor> expectedDrivers = Maps.newHashMap();
            expectedDrivers.put(pgsql.getName(), pgsql);
            expectedDrivers.put(mysql.getName(), mysql);
            Map<String, JdbcDriverDescriptor> configuredDrivers = Maps.newHashMap();
            for (JdbcDriverDescriptor d : config.getRegisteredDrivers()) {
                configuredDrivers.put(d.getName(), d);
            }
            for (Map.Entry<String, JdbcDriverDescriptor> e : expectedDrivers.entrySet()) {
                JdbcDriverDescriptor driver = configuredDrivers.get(e.getKey());
                assertNotNull(driver);
                JdbcDriverDescriptor expectedDriver = e.getValue();
                assertEquals(expectedDriver.getName(), driver.getName());
                assertEquals(expectedDriver.getSubprotocol(), driver.getSubprotocol());
                assertEquals(expectedDriver.getClass(), driver.getClass());
                if (expectedDriver == pgsql) {
                    assertEquals(pgsqlQuotes, driver.getBeginEndQuotes());
                } else if (expectedDriver == mysql) {
                    assertNull(driver.getBeginEndQuotes());
                }
View Full Code Here

            System.out.println(d + " -- begin/end quotes: " + d.getBeginEndQuotes());
        }
    }
   
    public static void lookupDriver() throws ServerConfigurationException {
        JdbcDriverDescriptor driver = JdbcDriversConfig.getConfig().getDriverDescriptor("PostgreSQL");
        System.out.println(driver);
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.database.driver.JdbcDriverDescriptor

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.