use of org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock 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);
}
use of org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock in project scout.rt by eclipse.
the class SelectInputBindTest method testEmptyBatchUpdateFromSetInValueField.
/**
* Direct batch update from a array in {@link AbstractValueFieldData}.
*/
@Test
public void testEmptyBatchUpdateFromSetInValueField() throws Exception {
SqlServiceMock sql = createSqlServiceMock();
FormDataWithSet formData = new FormDataWithSet();
formData.getPersonNr().setValue(9L);
formData.getValue().setValue("lorem");
formData.getRoles().setValue(Collections.<Long>emptySet());
sql.update("UDPATE this_table SET v = :value where r = :{roles} and p = :personNr", formData);
assertEquals("", sql.getProtocol().toString());
}
use of org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock in project scout.rt by eclipse.
the class SelectInputBindTest method testBatchUpdateFromListInHolder.
/**
* Batch update from a list in an holder.
*/
@Test
public void testBatchUpdateFromListInHolder() throws Exception {
SqlServiceMock sql = createSqlServiceMock();
Long person = 9L;
List<Long> roles = Arrays.asList(5L, 6L);
Holder<List> holder = new Holder<List>(List.class, roles);
sql.update("UDPATE this_table SET v = :value where r = :{roles} and p = :personNr", new NVPair("personNr", person), new NVPair("roles", holder), new NVPair("value", "lorem"));
assertExpectedProtocol2(sql);
}
use of org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock in project scout.rt by eclipse.
the class SelectInputBindTest method testBatchUpdateFromTableBeanHolderFilterInMap.
/**
* {@link TableFieldBeanData} in combination with {@link TableBeanHolderFilter} (introduced with Luna). TableData for
* batch update is in Map bind.
*/
@Test
public void testBatchUpdateFromTableBeanHolderFilterInMap() throws Exception {
SqlServiceMock sql = createSqlServiceMock();
TableFieldBeanData tableData = createTableFieldBeanData(true);
TableBeanHolderFilter filter = new TableBeanHolderFilter(tableData, ITableBeanRowHolder.STATUS_UPDATED);
Map<String, ?> map = Collections.singletonMap("filter", filter);
sql.update("UDPATE my_table SET a=:{filter.active}, s=:{filter.state} where n=:{filter.name} ", map);
assertExpectedProtocol(sql);
}
use of org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock in project scout.rt by eclipse.
the class SelectInputBindTest method testBatchUpdateFromList.
/**
* Batch update from a list.
*/
@Test
public void testBatchUpdateFromList() throws Exception {
SqlServiceMock sql = createSqlServiceMock();
Long person = 9L;
List<Long> roles = Arrays.asList(5L, 6L);
sql.update("UDPATE this_table SET v = :value where r = :{roles} and p = :personNr", new NVPair("personNr", person), new NVPair("roles", roles), new NVPair("value", "lorem"));
assertExpectedProtocol2(sql);
}
Aggregations