use of org.eclipse.scout.rt.server.jdbc.fixture.FormDataWithSet 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.FormDataWithSet in project scout.rt by eclipse.
the class SelectIntoArrayTest method testEmptySelectIntoFormDataWithSet.
@Test
public void testEmptySelectIntoFormDataWithSet() throws Exception {
SqlServiceMock sql = createSqlServiceMock(new Object[][] {});
//
FormDataWithSet formData = new FormDataWithSet();
formData.getPersonNr().setValue(42L);
sql.selectInto("SELECT ROLE_NR FROM USER_ROLE WHERE USER_NR = :personNr INTO :{roles}", formData);
Set<Long> r = formData.getRoles().getValue();
assertNotNull(r);
assertEquals(0, r.size());
}
use of org.eclipse.scout.rt.server.jdbc.fixture.FormDataWithSet 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.FormDataWithSet in project scout.rt by eclipse.
the class SelectIntoArrayTest method testSelectIntoFormDataWithSet.
@Test
public void testSelectIntoFormDataWithSet() throws Exception {
SqlServiceMock sql = createSqlServiceMock(ROLES_DATA);
//
FormDataWithSet formData = new FormDataWithSet();
formData.getPersonNr().setValue(42L);
sql.selectInto("SELECT ROLE_NR FROM USER_ROLE WHERE USER_NR = :personNr INTO :{roles}", formData);
Set<Long> r = formData.getRoles().getValue();
assertNotNull(r);
assertEquals(3, r.size());
assertTrue("role contains 3", r.contains(3L));
assertTrue("role contains 5", r.contains(5L));
assertTrue("role contains 7", r.contains(7L));
}
Aggregations