Package org.gdbms.engine.data

Examples of org.gdbms.engine.data.DataSource


   * @throws Exception
   *             DOCUMENT ME!
   */
  public static void testGetRowCount(DataSourceFactory ds, String pgds)
      throws Exception {
    DataSource d = ds.getDataSource(pgds);

    d.start();

    long myCount = d.getRowCount();
    assertTrue(myCount >= 22);

    d.stop();
  }
View Full Code Here


   * @throws Exception
   *             DOCUMENT ME!
   */
  public static void testgetFieldType(DataSourceFactory ds, String pgds)
      throws Exception {
    DataSource d = ds.getDataSource(pgds);

    d.start();

    int myFieldType = d.getDataSourceMetadata().getFieldType(0);
    assertTrue(myFieldType == Value.INT);
    myFieldType = d.getDataSourceMetadata().getFieldType(1);
    assertTrue(myFieldType == Value.INT);
    myFieldType = d.getDataSourceMetadata().getFieldType(2);
    assertTrue(myFieldType == PTTypes.GEOMETRY);

    d.stop();
  }
View Full Code Here

   * @throws Exception
   *             DOCUMENT ME!
   */
  public static void testFieldCount(DataSourceFactory ds, String pgds)
      throws Exception {
    DataSource d = ds.getDataSource(pgds);

    d.start();

    int fieldCount = d.getDataSourceMetadata().getFieldCount();
    assertTrue(fieldCount == 3);

    d.stop();
  }
View Full Code Here

    testFullExtent(ds, "pgWithGDBMS");
  }

  public static void testWrite(DataSourceFactory ds, String pgds)
      throws Exception {
    DataSource d = ds.getDataSource(pgds);

    d.beginTrans();
    long countBefore = d.getRowCount();
    d.insertFilledRow(new Value[] { ValueFactory.createValue(55),
        ValueFactory.createValue(55),
        GeometryFactory.createPoint2D(0, 0) });
    d.commitTrans();

    d.start();
    assertTrue(d.getRowCount() - 1 == countBefore);
    d.stop();
  }
View Full Code Here

    dsdm.addSpatialField("geom", FShape.MULTI);
    dsdm.addField("field", "INTEGER");
    dsdm.setPrimaryKey(new String[] { "field" });
    DBSourceCreation dbsc = new DBSourceCreation(source, dsdm);
    ds.createDataSource(dbsc);
    DataSource d = ds.getSpatialDataSource(source);
    d.start();
    d.stop();
  }
View Full Code Here

        assertTrue(d.getDataSourceMetadata().getFieldType(fc) == Value.STRING);
        d.stop();
    }
   
    public void testDriverMetadataEdition() throws Exception {
        DataSource d = ds.getDataSource("hsqldbpersona");
       
        d.beginTrans();
        int fc = d.getDataSourceMetadata().getFieldCount();
        d.addField("nuevo", "CHAR", new String[]{"LENGTH"}, new String[]{"5"});
        assertTrue(d.getDataSourceMetadata().getFieldType(fc) == Value.STRING);
        assertTrue(d.getDriverMetadata().getFieldType(fc).equals("CHAR"));
        assertTrue(d.getDriverMetadata().getFieldParam(fc, "LENGTH").equals("5"));
        d.commitTrans();
       
        d = ds.getDataSource("hsqldbpersona");
        d.start();
        assertTrue(d.getDataSourceMetadata().getFieldType(fc) == Value.STRING);
        assertTrue(d.getDriverMetadata().getFieldType(fc).equals("CHAR"));
        assertTrue(d.getDriverMetadata().getFieldParam(fc, "LENGTH").equals("5"));
        d.stop();
    }
View Full Code Here

        ddm.setPrimaryKey(new String[]{"entero"});
        DBSource dbsd = new DBSource(null, 0, "src/test/resources/testdb", "sa", "",
        "nuevo", "jdbc:hsqldb:file");
        ds.createDataSource(new DBSourceCreation(dbsd, ddm));
        ds.registerDataSource("nuevoDataSource", new DBTableSourceDefinition(dbsd));
        DataSource d = ds.getDataSource("nuevoDataSource");
        d.start();
        assertTrue(d.check(0, ValueFactory.createNullValue()) == null);
        assertTrue(d.check(0, ValueFactory.createValue("")) == null);
        assertTrue(d.check(0, ValueFactory.createValue("aa")) == null);
        assertTrue(d.check(0, ValueFactory.createValue("aaaaaa")) != null);
        assertTrue(d.check(1, ValueFactory.createNullValue()) == null);
        assertTrue(d.check(1, ValueFactory.createValue((byte) 2)) == null);
        assertTrue(d.check(2, ValueFactory.createValue(2234.3)) == null);
        assertTrue(d.check(2, ValueFactory.createValue(23432.3)) != null);
        assertTrue(d.check(2, ValueFactory.createValue(2.323)) != null);
        d.stop();
    }
View Full Code Here

/**
*
*/
public class SHPTest extends DataSourceTestCase {
    private void testOpen(String dsName) throws Exception {
        DataSource d = ds.getDataSource(dsName);

        d.start();
        d.stop();
    }
View Full Code Here

     * DOCUMENT ME!
     *
     * @throws Exception DOCUMENT ME!
     */
    private void testGetRowCount(String dsName) throws Exception {
        DataSource d = ds.getDataSource(dsName);

        d.start();

        long myCount = d.getRowCount();
        assertTrue(myCount == 22);

        d.stop();
    }
View Full Code Here

     * DOCUMENT ME!
     *
     * @throws Exception DOCUMENT ME!
     */
    private void testgetFieldType(String dsName) throws Exception {
        DataSource d = ds.getDataSource(dsName);

        d.start();

        int myFieldType = d.getDataSourceMetadata().getFieldType(0);
        assertTrue(myFieldType == Types.INTEGER);
        myFieldType = d.getDataSourceMetadata().getFieldType(1);
        assertTrue(myFieldType == Types.INTEGER);

        d.stop();
    }
View Full Code Here

TOP

Related Classes of org.gdbms.engine.data.DataSource

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.