Package no.priv.garshol.duke.datasources

Examples of no.priv.garshol.duke.datasources.JNDIDataSource


        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")) {
        datasource = new SparqlDataSource();
        currentobj = datasource;
      } else if (localName.equals("ntriples")) {
View Full Code Here


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

    JNDIDataSource jndi = new JNDIDataSource();
    jndi.setJndiPath("path");
    jndi.setQuery("select");
    jndi.addColumn(new Column("id", "ID", null, null));
    jndi.addColumn(new Column("name", "NAME", null, null));
    jndi.addColumn(new Column("email", "EMAIL", null, null));
    ((ConfigurationImpl) config).addDataSource(0, jndi);
   
    // --- 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());

    jndi = (JNDIDataSource) config.getDataSources().iterator().next();
    assertEquals("select", jndi.getQuery());
    assertEquals(3, jndi.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

  private static void writeDataSource(XMLPrettyPrinter pp, DataSource src) {
    String name = null;
    if (src instanceof JNDIDataSource) {
      name = "jndi";
      JNDIDataSource jndi = (JNDIDataSource) src;
      pp.startElement(name, null);

      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);
View Full Code Here

TOP

Related Classes of no.priv.garshol.duke.datasources.JNDIDataSource

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.