Examples of SQLContainer


Examples of com.vaadin.data.util.sqlcontainer.SQLContainer

                .createMock(FreeformQueryDelegate.class);
        EasyMock.expect(
                delegate.storeRow(EasyMock.isA(Connection.class),
                        EasyMock.isA(RowItem.class))).andThrow(
                new UnsupportedOperationException());
        SQLContainer container = EasyMock.createNiceMock(SQLContainer.class);
        EasyMock.replay(delegate, container);
        query.setDelegate(delegate);

        query.beginTransaction();
        RowItem row = new RowItem(container, new RowId(new Object[] { 1 }),
View Full Code Here

Examples of com.vaadin.data.util.sqlcontainer.SQLContainer

        FreeformQueryDelegate delegate = EasyMock
                .createMock(FreeformQueryDelegate.class);
        EasyMock.expect(
                delegate.removeRow(EasyMock.isA(Connection.class),
                        EasyMock.isA(RowItem.class))).andReturn(true);
        SQLContainer container = EasyMock.createNiceMock(SQLContainer.class);
        EasyMock.replay(delegate, container);
        query.setDelegate(delegate);

        query.beginTransaction();
        RowItem row = new RowItem(container, new RowId(new Object[] { 1 }),
View Full Code Here

Examples of com.vaadin.data.util.sqlcontainer.SQLContainer

                .createMock(FreeformQueryDelegate.class);
        EasyMock.expect(
                delegate.removeRow(EasyMock.isA(Connection.class),
                        EasyMock.isA(RowItem.class))).andThrow(
                new UnsupportedOperationException());
        SQLContainer container = EasyMock.createNiceMock(SQLContainer.class);
        EasyMock.replay(delegate, container);
        query.setDelegate(delegate);

        query.beginTransaction();
        RowItem row = new RowItem(container, new RowId(new Object[] { 1 }),
View Full Code Here

Examples of com.vaadin.data.util.sqlcontainer.SQLContainer

            return;
        }
        SQLGenerator sg = SQLTestsConstants.sqlGen;
        TableQuery query = new TableQuery("people", connectionPool,
                SQLTestsConstants.sqlGen);
        SQLContainer container = new SQLContainer(query);

        StatementHelper sh = sg.generateDeleteQuery(
                "people",
                query.getPrimaryKeyColumns(),
                null,
                (RowItem) container.getItem(container.getItemIds().iterator()
                        .next()));
        Assert.assertEquals("DELETE FROM people WHERE \"ID\" = ?",
                sh.getQueryString());
    }
View Full Code Here

Examples of com.vaadin.data.util.sqlcontainer.SQLContainer

                || SQLTestsConstants.sqlGen instanceof OracleGenerator) {
            return;
        }
        SQLGenerator sg = new DefaultSQLGenerator();
        TableQuery query = new TableQuery("people", connectionPool);
        SQLContainer container = new SQLContainer(query);

        RowItem ri = (RowItem) container.getItem(container.getItemIds()
                .iterator().next());
        ri.getItemProperty("NAME").setValue("Viljami");

        StatementHelper sh = sg.generateUpdateQuery("people", ri);
        Assert.assertTrue("UPDATE people SET \"NAME\" = ?, \"AGE\" = ? WHERE \"ID\" = ?"
View Full Code Here

Examples of com.vaadin.data.util.sqlcontainer.SQLContainer

                || SQLTestsConstants.sqlGen instanceof OracleGenerator) {
            return;
        }
        SQLGenerator sg = new DefaultSQLGenerator();
        TableQuery query = new TableQuery("people", connectionPool);
        SQLContainer container = new SQLContainer(query);

        RowItem ri = (RowItem) container.getItem(container.addItem());
        ri.getItemProperty("NAME").setValue("Viljami");

        StatementHelper sh = sg.generateInsertQuery("people", ri);

        Assert.assertTrue("INSERT INTO people (\"NAME\", \"AGE\") VALUES (?, ?)"
View Full Code Here

Examples of com.vaadin.data.util.sqlcontainer.SQLContainer

            createTestTable(connectionPool);
            insertTestData(connectionPool);

            TableQuery q = new TableQuery("mytable", connectionPool);
            q.setVersionColumn("version");
            SQLContainer myContainer = new SQLContainer(q);

            table.setContainerDataSource(myContainer);

        } catch (SQLException e) {
            e.printStackTrace();
View Full Code Here

Examples of com.vaadin.data.util.sqlcontainer.SQLContainer

    @Test
    public void removeRowThroughContainer_legalRowItem_shouldSucceed()
            throws SQLException {
        TableQuery tQuery = new TableQuery("people", connectionPool,
                SQLTestsConstants.sqlGen);
        SQLContainer container = new SQLContainer(tQuery);
        container.setAutoCommit(false);
        Assert.assertTrue(container.removeItem(container.getItemIds()
                .iterator().next()));

        Assert.assertEquals(4, tQuery.getCount());
        Assert.assertEquals(3, container.size());
        container.commit();

        Assert.assertEquals(3, tQuery.getCount());
        Assert.assertEquals(3, container.size());
    }
View Full Code Here

Examples of com.vaadin.data.util.sqlcontainer.SQLContainer

    public void removeRowThroughContainer_nonexistingRowId_shouldFail()
            throws SQLException {
        TableQuery tQuery = new TableQuery("people", connectionPool,
                SQLTestsConstants.sqlGen);

        SQLContainer container = new SQLContainer(tQuery);
        container.setAutoCommit(true);
        Assert.assertFalse(container.removeItem("foo"));
    }
View Full Code Here

Examples of com.vaadin.data.util.sqlcontainer.SQLContainer

    public void insertRowThroughContainer_shouldSucceed() throws SQLException {
        TableQuery tQuery = new TableQuery("people", connectionPool,
                SQLTestsConstants.sqlGen);
        tQuery.setVersionColumn("ID");

        SQLContainer container = new SQLContainer(tQuery);
        container.setAutoCommit(false);

        Object item = container.addItem();
        Assert.assertNotNull(item);

        Assert.assertEquals(4, tQuery.getCount());
        Assert.assertEquals(5, container.size());
        container.commit();

        Assert.assertEquals(5, tQuery.getCount());
        Assert.assertEquals(5, container.size());
    }
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.