Package no.priv.garshol.duke.datasources

Examples of no.priv.garshol.duke.datasources.JDBCDataSource$JDBCIterator


                                attributes.getValue("lookup").toUpperCase());
      } else if (localName.equals("csv")) {
        datasource = new CSVDataSource();
        currentobj = datasource;
      } else if (localName.equals("jdbc")) {
        datasource = new JDBCDataSource();
        currentobj = datasource;
      } else if (localName.equals("jndi")) {
        datasource = new JNDIDataSource();
        currentobj = datasource;
      } else if (localName.equals("sparql")) {
View Full Code Here


    Configuration config = new ConfigurationImpl();
    ((ConfigurationImpl) config).setProperties(props);
    ((ConfigurationImpl) config).setThreshold(0.85);
    ((ConfigurationImpl) config).setMaybeThreshold(0.7);

    JDBCDataSource jdbc = new JDBCDataSource();
    jdbc.setDriverClass("klass");
    jdbc.setConnectionString("konnection");
    jdbc.setUserName("user");
    jdbc.setPassword("secret");
    jdbc.setQuery("select");
    jdbc.addColumn(new Column("id", "ID", null, null));
    jdbc.addColumn(new Column("name", "NAME", null, null));
    jdbc.addColumn(new Column("email", "EMAIL", null, null));
    ((ConfigurationImpl) config).addDataSource(0, jdbc);
   
    // --- write and reload
    File outfile = tmpdir.newFile("config.xml");           
    ConfigWriter.write(config, outfile.getAbsolutePath());
    config = ConfigLoader.load(outfile.getAbsolutePath());
   
    // --- verify loaded correctly   
    assertEquals(1, config.getDataSources().size());

    jdbc = (JDBCDataSource) config.getDataSources().iterator().next();
    assertEquals("klass", jdbc.getDriverClass());
    assertEquals("konnection", jdbc.getConnectionString());
    assertEquals("user", jdbc.getUserName());
    assertEquals("secret", jdbc.getPassword());
    assertEquals("select", jdbc.getQuery());
    assertEquals(3, jdbc.getColumns().size());
    // FIXME: check the columns (kind of hard given lack of ordering)
   
    assertTrue(config.getDataSources(1).isEmpty());
    assertTrue(config.getDataSources(2).isEmpty());
    assertEquals(config.getThreshold(), 0.85);
View Full Code Here

      writeParam(pp, "jndi-path", jndi.getJndiPath());
      writeParam(pp, "query", jndi.getQuery());
    } else if (src instanceof JDBCDataSource) {
      name = "jdbc";
      JDBCDataSource jdbc = (JDBCDataSource) src;
      pp.startElement(name, null);

      writeParam(pp, "driver-class", jdbc.getDriverClass());
      writeParam(pp, "connection-string", jdbc.getConnectionString());
      writeParam(pp, "user-name", jdbc.getUserName());
      writeParam(pp, "password", jdbc.getPassword());
      writeParam(pp, "query", jdbc.getQuery());

    } else if (src instanceof MongoDBDataSource) {
      name = "data-source";
      MongoDBDataSource mongodb = (MongoDBDataSource) src;
      String klass = mongodb.getClass().getName();
View Full Code Here

    connect();
    perform("drop table if exists testdata");
    perform("create table testdata (id int, name varchar)");

    // create data source
    source = new JDBCDataSource();
    source.setConnectionString(JDBC_URI);
    source.setDriverClass(DRIVER);
    source.setQuery("select * from testdata order by id");
  }
View Full Code Here

TOP

Related Classes of no.priv.garshol.duke.datasources.JDBCDataSource$JDBCIterator

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.