use of org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock in project scout.rt by eclipse.
the class SelectInputBindTest method createSqlServiceMock.
private static SqlServiceMock createSqlServiceMock() {
SqlServiceMock sql = new SqlServiceMock();
sql.clearProtocol();
return sql;
}
use of org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock in project scout.rt by eclipse.
the class SelectInputBindTest method testBatchUpdateFromSet.
/**
* Direct batch update from a set.
*/
@Test
public void testBatchUpdateFromSet() throws Exception {
SqlServiceMock sql = createSqlServiceMock();
Long person = 9L;
Set<Long> roles = new HashSet<Long>();
roles.add(5L);
roles.add(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);
}
use of org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock in project scout.rt by eclipse.
the class SelectInputBindTest method testBatchUpdateFromTableFieldBeanData.
/**
* {@link TableFieldBeanData} is from type {@link ITableBeanHolder} (introduced with Luna). Direct batch update.
*/
@Test
public void testBatchUpdateFromTableFieldBeanData() throws Exception {
SqlServiceMock sql = createSqlServiceMock();
TableFieldBeanData tableData = createTableFieldBeanData(false);
sql.update("UDPATE my_table SET a=:{active}, s=:{state} where n=:{name} ", tableData);
assertExpectedProtocol(sql);
}
use of org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock in project scout.rt by eclipse.
the class SelectInputBindTest method testBatchUpdateFromSetInValueField.
/**
* Direct batch update from a array in {@link AbstractValueFieldData}.
*/
@Test
public void testBatchUpdateFromSetInValueField() throws Exception {
SqlServiceMock sql = createSqlServiceMock();
Set<Long> roles = new HashSet<Long>();
roles.add(5L);
roles.add(6L);
FormDataWithSet formData = new FormDataWithSet();
formData.getPersonNr().setValue(9L);
formData.getValue().setValue("lorem");
formData.getRoles().setValue(roles);
sql.update("UDPATE this_table SET v = :value where r = :{roles} and p = :personNr", formData);
assertExpectedProtocol2(sql);
}
use of org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock in project scout.rt by eclipse.
the class SelectInputBindTest method testBatchUpdateFromTableBeanHolderFilter.
/**
* {@link TableFieldBeanData} in combination with {@link TableBeanHolderFilter} (introduced with Luna). Direct batch
* update.
*/
@Test
public void testBatchUpdateFromTableBeanHolderFilter() throws Exception {
SqlServiceMock sql = createSqlServiceMock();
TableFieldBeanData tableData = createTableFieldBeanData(true);
TableBeanHolderFilter filter = new TableBeanHolderFilter(tableData, ITableBeanRowHolder.STATUS_UPDATED);
sql.update("UDPATE my_table SET a=:{active}, s=:{state} where n=:{name} ", filter);
assertExpectedProtocol(sql);
}
Aggregations