Search in sources :

Example 16 with NVPair

use of org.eclipse.scout.rt.platform.holders.NVPair 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 17 with NVPair

use of org.eclipse.scout.rt.platform.holders.NVPair in project scout.rt by eclipse.

the class SelectInputBindTest method testBatchUpdateFromArray2.

/**
 * This test is similar to {@link #testBatchUpdateFromArray()}. It ensure that
 * {@link #assertExpectedProtocol2(SqlServiceMock)} does not care about the order of the elements in the roles array
 * (because in a set you can not ensure the order of the entries in the set)
 */
@Test
public void testBatchUpdateFromArray2() throws Exception {
    SqlServiceMock sql = createSqlServiceMock();
    Long person = 9L;
    Long[] roles = new Long[] { 6L, 5L };
    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);
}
Also used : SqlServiceMock(org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock) NVPair(org.eclipse.scout.rt.platform.holders.NVPair) Test(org.junit.Test)

Example 18 with NVPair

use of org.eclipse.scout.rt.platform.holders.NVPair 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);
}
Also used : SqlServiceMock(org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock) ITableBeanHolder(org.eclipse.scout.rt.platform.holders.ITableBeanHolder) ITableBeanRowHolder(org.eclipse.scout.rt.platform.holders.ITableBeanRowHolder) Holder(org.eclipse.scout.rt.platform.holders.Holder) NVPair(org.eclipse.scout.rt.platform.holders.NVPair) List(java.util.List) Test(org.junit.Test)

Example 19 with NVPair

use of org.eclipse.scout.rt.platform.holders.NVPair 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);
}
Also used : SqlServiceMock(org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock) NVPair(org.eclipse.scout.rt.platform.holders.NVPair) Test(org.junit.Test)

Example 20 with NVPair

use of org.eclipse.scout.rt.platform.holders.NVPair in project scout.rt by eclipse.

the class SelectIntoArrayTest method testSelectIntoTableFieldBeanDataInNVPair.

/**
 * {@link TableFieldBeanData} is from type {@link ITableBeanHolder} (introduced with Luna). TableData is in NVPair
 * bind.
 */
@Test
public void testSelectIntoTableFieldBeanDataInNVPair() throws Exception {
    SqlServiceMock sql = createSqlServiceMock(DATA);
    // 
    TableFieldBeanData tableData = new TableFieldBeanData();
    sql.selectInto("SELECT A,B,C FROM T WHERE D=0 INTO :{table.active},:{table.state},:{table.name}", new NVPair("table", tableData));
    assertContainsData(tableData);
}
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)

Aggregations

NVPair (org.eclipse.scout.rt.platform.holders.NVPair)25 Test (org.junit.Test)19 SqlServiceMock (org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock)12 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)5 ITableBeanHolder (org.eclipse.scout.rt.platform.holders.ITableBeanHolder)4 List (java.util.List)3 BeanArrayHolder (org.eclipse.scout.rt.platform.holders.BeanArrayHolder)3 IntegerHolder (org.eclipse.scout.rt.platform.holders.IntegerHolder)3 AbstractSqlService (org.eclipse.scout.rt.server.jdbc.AbstractSqlService)3 TableFieldBeanData (org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData)3 VerboseMock (org.eclipse.scout.rt.server.jdbc.fixture.VerboseMock)3 Method (java.lang.reflect.Method)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 Holder (org.eclipse.scout.rt.platform.holders.Holder)2 IBeanArrayHolder (org.eclipse.scout.rt.platform.holders.IBeanArrayHolder)2 IHolder (org.eclipse.scout.rt.platform.holders.IHolder)2 LongHolder (org.eclipse.scout.rt.platform.holders.LongHolder)2 TableBeanHolderFilter (org.eclipse.scout.rt.platform.holders.TableBeanHolderFilter)2 FastPropertyDescriptor (org.eclipse.scout.rt.platform.reflect.FastPropertyDescriptor)2