Search in sources :

Example 6 with TableFieldBeanData

use of org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData in project scout.rt by eclipse.

the class SelectInputBindTest method testBatchUpdateFromTableFieldBeanDataInBean.

/**
 * {@link TableFieldBeanData} is from type {@link ITableBeanHolder} (introduced with Luna). TableData for batch update
 * is in a bean (ContainerBean).
 */
@Test
public void testBatchUpdateFromTableFieldBeanDataInBean() throws Exception {
    SqlServiceMock sql = createSqlServiceMock();
    TableFieldBeanData tableData = createTableFieldBeanData(false);
    ContainerBean bean = new ContainerBean();
    bean.setTableFieldBeanData(tableData);
    sql.update("UDPATE my_table SET a=:{tableFieldBeanData.active}, s=:{tableFieldBeanData.state} where n=:{tableFieldBeanData.name} ", bean);
    assertExpectedProtocol(sql);
}
Also used : ContainerBean(org.eclipse.scout.rt.server.jdbc.fixture.ContainerBean) SqlServiceMock(org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock) TableFieldBeanData(org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData) Test(org.junit.Test)

Example 7 with TableFieldBeanData

use of org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData in project scout.rt by eclipse.

the class SelectInputBindTest method testBatchUpdateFromTableBeanHolderFilterInBean.

/**
 * {@link TableFieldBeanData} in combination with {@link TableBeanHolderFilter} (introduced with Luna). TableData for
 * batch update is in a bean (ContainerBean).
 */
@Test
public void testBatchUpdateFromTableBeanHolderFilterInBean() throws Exception {
    SqlServiceMock sql = createSqlServiceMock();
    TableFieldBeanData tableData = createTableFieldBeanData(true);
    TableBeanHolderFilter filter = new TableBeanHolderFilter(tableData, ITableBeanRowHolder.STATUS_UPDATED);
    ContainerBean bean = new ContainerBean();
    bean.setTableBeanHolderFilter(filter);
    sql.update("UDPATE my_table SET a=:{TableBeanHolderFilter.active}, s=:{TableBeanHolderFilter.state} where n=:{TableBeanHolderFilter.name} ", bean);
    assertExpectedProtocol(sql);
}
Also used : TableBeanHolderFilter(org.eclipse.scout.rt.platform.holders.TableBeanHolderFilter) ContainerBean(org.eclipse.scout.rt.server.jdbc.fixture.ContainerBean) SqlServiceMock(org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock) TableFieldBeanData(org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData) Test(org.junit.Test)

Example 8 with TableFieldBeanData

use of org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData in project scout.rt by eclipse.

the class SelectInputBindTest method testBatchUpdateFromTableFieldBeanDataInNVPair.

/**
 * {@link TableFieldBeanData} is from type {@link ITableBeanHolder} (introduced with Luna). TableData for batch update
 * is in NVPair bind.
 */
@Test
public void testBatchUpdateFromTableFieldBeanDataInNVPair() throws Exception {
    SqlServiceMock sql = createSqlServiceMock();
    TableFieldBeanData tableData = createTableFieldBeanData(false);
    sql.update("UDPATE my_table SET a=:{table.active}, s=:{table.state} where n=:{table.name} ", new NVPair("table", tableData));
    assertExpectedProtocol(sql);
}
Also used : SqlServiceMock(org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock) NVPair(org.eclipse.scout.rt.platform.holders.NVPair) TableFieldBeanData(org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData) Test(org.junit.Test)

Example 9 with TableFieldBeanData

use of org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData in project scout.rt by eclipse.

the class SelectInputBindTest method testBatchUpdateFromTableBeanHolderFilterInNVPair.

/**
 * {@link TableFieldBeanData} in combination with {@link TableBeanHolderFilter} (introduced with Luna). TableData for
 * batch update is in NVPair bind.
 */
@Test
public void testBatchUpdateFromTableBeanHolderFilterInNVPair() throws Exception {
    SqlServiceMock sql = createSqlServiceMock();
    TableFieldBeanData tableData = createTableFieldBeanData(true);
    TableBeanHolderFilter filter = new TableBeanHolderFilter(tableData, ITableBeanRowHolder.STATUS_UPDATED);
    sql.update("UDPATE my_table SET a=:{filter.active}, s=:{filter.state} where n=:{filter.name} ", new NVPair("filter", filter));
    assertExpectedProtocol(sql);
}
Also used : TableBeanHolderFilter(org.eclipse.scout.rt.platform.holders.TableBeanHolderFilter) SqlServiceMock(org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock) NVPair(org.eclipse.scout.rt.platform.holders.NVPair) TableFieldBeanData(org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData) Test(org.junit.Test)

Example 10 with TableFieldBeanData

use of org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData in project scout.rt by eclipse.

the class SelectInputBindTest method testBatchUpdateFromTableFieldBeanDataInMap.

/**
 * {@link TableFieldBeanData} is from type {@link ITableBeanHolder} (introduced with Luna). TableData for batch update
 * is in Map bind.
 */
@Test
public void testBatchUpdateFromTableFieldBeanDataInMap() throws Exception {
    SqlServiceMock sql = createSqlServiceMock();
    TableFieldBeanData tableData = createTableFieldBeanData(false);
    Map<String, ?> map = Collections.singletonMap("table", tableData);
    sql.update("UDPATE my_table SET a=:{table.active}, s=:{table.state} where n=:{table.name} ", map);
    assertExpectedProtocol(sql);
}
Also used : SqlServiceMock(org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock) TableFieldBeanData(org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData) Test(org.junit.Test)

Aggregations

TableFieldBeanData (org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData)13 SqlServiceMock (org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock)12 Test (org.junit.Test)12 TableBeanHolderFilter (org.eclipse.scout.rt.platform.holders.TableBeanHolderFilter)4 NVPair (org.eclipse.scout.rt.platform.holders.NVPair)3 ContainerBean (org.eclipse.scout.rt.server.jdbc.fixture.ContainerBean)3