Package org.gdbms.engine.data

Examples of org.gdbms.engine.data.DataSource.beginTrans()


    }

    public void testValuesDuringEditionDirectTransaction() throws Exception {
    DataSource d = ds.getDataSource("hsqldbpersonatransactional");

    d.beginTrans();
    d.setFieldValue(0, 2, ValueFactory.createValue("10"));
    assertTrue(((BooleanValue)d.getFieldValue(0, 2).equals(ValueFactory.createValue(10))).getValue());
    assertTrue(((BooleanValue)d.getFieldValue(0, 1).equals(ValueFactory.createValue("fernando"))).getValue());
    d.setFieldValue(0, 1, ValueFactory.createValue("nombre"));
    assertTrue(((BooleanValue)d.getFieldValue(0, 1).equals(ValueFactory.createValue("nombre"))).getValue());
View Full Code Here


    assertFalse(d.isModified());
    d.setFieldName(1, "asd");
    assertTrue(d.isModified());
    d.rollBackTrans();

    d.beginTrans();
    assertFalse(d.isModified());
    d.setFieldValue(0, 0, ValueFactory.createNullValue());
    assertTrue(d.isModified());
    d.rollBackTrans();
View Full Code Here

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

    d.beginTrans();
    d.insertEmptyRow();
        d.setFieldValue(3, 0, ValueFactory.createValue(5));
    d.commitTrans();

    d = ds.getDataSource(dsName);
View Full Code Here

public class MetadataTest extends DataSourceTestCase {

    private void testAddField(String dsName, String type) throws Exception {
        DataSource d = ds.getDataSource(dsName);

        d.beginTrans();
        Metadata m = d.getDataSourceMetadata();
        int fc = m.getFieldCount();
        d.addField("extra", type);
        m = d.getDataSourceMetadata();
        assertTrue(fc + 1 == m.getFieldCount());
View Full Code Here

    }

    private void testDeleteField(String dsName) throws Exception {
        DataSource d = ds.getDataSource(dsName);

        d.beginTrans();
        Metadata m = d.getDataSourceMetadata();
        String fieldName = m.getFieldName(2);
        int fc = m.getFieldCount();
        d.removeField(1);
        assertTrue(fc - 1 == m.getFieldCount());
View Full Code Here

    }

    private void testModifyField(String dsName) throws Exception {
        DataSource d = ds.getDataSource(dsName);

        d.beginTrans();
        d.getDataSourceMetadata();
        d.setFieldName(1, "nuevo");
        assertTrue(d.getDataSourceMetadata().getFieldName(1).equals("nuevo"));
        d.rollBackTrans();
    }
View Full Code Here

    private void testMetadataEditionListenerTest(String dsName, String type)
            throws Exception {
        DataSource d = ds.getDataSource(dsName);

        d.beginTrans();
        EditionListenerCounter elc = new EditionListenerCounter();
        d.addMetadataEditionListener(elc);
        d.removeField(1);
        d.addField("nuevo", type);
        d.setFieldName(1, "jjjj");
View Full Code Here

    }

    private void testEditionWithFieldAdded(String dsName, String type) throws Exception {
        DataSource d = ds.getDataSource(dsName,
                DataSourceFactory.UNDOABLE);
        d.beginTrans();
        d.addField("extra", type);
        int fi = d.getFieldIndexByName("extra");
        new UndoRedoTests()
                .testAlphanumericEditionUndoRedo((AlphanumericDataSource) d);
        d.setFieldValue(0, fi, ValueFactory.createValue(true));
View Full Code Here

    }

    private void testEditionWithFieldRemoved(String dsName) throws Exception {
        DataSource d = ds.getDataSource(dsName,
                DataSourceFactory.UNDOABLE);
        d.beginTrans();
        d.removeField(1);
        assertTrue(((BooleanValue) d.getFieldValue(0, 1).equals(
                ValueFactory.createValue("gonzalez"))).getValue());
        new UndoRedoTests()
                .testAlphanumericEditionUndoRedo((AlphanumericDataSource) d);
View Full Code Here

    }

    public void testRemovePK() throws Exception {
        DataSource d = ds.getDataSource("hsqldbpersona",
                DataSourceFactory.UNDOABLE);
        d.beginTrans();
        try {
            d.removeField(0);
            assertTrue(false);
        } catch (DriverException e) {
            assertTrue(true);
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.