Search in sources :

Example 1 with BeanDtosDeletionUpdate

use of org.jowidgets.cap.common.tools.bean.BeanDtosDeletionUpdate in project jo-client-platform by jo-source.

the class BeanTableModelImplTest method testBeanDeletionUpdate.

@Test
public void testBeanDeletionUpdate() {
    tableModel.getSortModel().setCurrentSorting(Arrays.asList(new ISort() {

        @Override
        public SortOrder getSortOrder() {
            return SortOrder.ASC;
        }

        @Override
        public String getPropertyName() {
            return "key";
        }
    }));
    tableModel.load();
    triggerPageLoading();
    final IUpdatableResultCallback<IBeanDtosUpdate, List<IBeanDto>> updatableCallback = assertUpdatableResultCallback(resultCallback);
    updatableCallback.finished(new ArrayList<IBeanDto>());
    updatableCallback.update(new BeanDtosInsertionUpdate(Arrays.asList((IBeanDto) bean1, (IBeanDto) bean2)));
    updatableCallback.update(new BeanDtosDeletionUpdate(Arrays.asList(bean1.getId())));
    final int size = tableModel.getSize();
    assertTrue("Only 1 beans should be loaded, but was " + size, size == 1);
    assertTrue("bean2 should be left", tableModel.getBean(0).getValue("value").equals(bean2.getValue("value")));
}
Also used : IBeanDto(org.jowidgets.cap.common.api.bean.IBeanDto) BeanDtosDeletionUpdate(org.jowidgets.cap.common.tools.bean.BeanDtosDeletionUpdate) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) ISort(org.jowidgets.cap.common.api.sort.ISort) IBeanDtosUpdate(org.jowidgets.cap.common.api.bean.IBeanDtosUpdate) BeanDtosInsertionUpdate(org.jowidgets.cap.common.tools.bean.BeanDtosInsertionUpdate) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 IBeanDto (org.jowidgets.cap.common.api.bean.IBeanDto)1 IBeanDtosUpdate (org.jowidgets.cap.common.api.bean.IBeanDtosUpdate)1 ISort (org.jowidgets.cap.common.api.sort.ISort)1 BeanDtosDeletionUpdate (org.jowidgets.cap.common.tools.bean.BeanDtosDeletionUpdate)1 BeanDtosInsertionUpdate (org.jowidgets.cap.common.tools.bean.BeanDtosInsertionUpdate)1 Test (org.junit.Test)1