Search in sources :

Example 6 with IExecutorService

use of org.jowidgets.cap.common.api.service.IExecutorService in project jo-client-platform by jo-source.

the class ExecutorAnnotationPostProcessorTest method testCreateUser.

@Test
public void testCreateUser() {
    final IExecutorService<String> service = ServiceProvider.getService(new ServiceId<IExecutorService<String>>("createUser", IExecutorService.class));
    Assert.assertNotNull(service);
    final SyncResultCallback<List<IBeanDto>> result = new SyncResultCallback<List<IBeanDto>>();
    service.execute(result, new ArrayList<IBeanKey>(), "Hans Meier", null);
    final List<IBeanDto> dtos = result.getResultSynchronious();
    Assert.assertNotNull(dtos);
    Assert.assertEquals(1, dtos.size());
    final IBeanDto dto = dtos.get(0);
    Assert.assertEquals(1, dto.getId());
    Assert.assertEquals("Hans Meier", dto.getValue("name"));
}
Also used : IBeanDto(org.jowidgets.cap.common.api.bean.IBeanDto) IBeanKey(org.jowidgets.cap.common.api.bean.IBeanKey) ArrayList(java.util.ArrayList) List(java.util.List) IExecutorService(org.jowidgets.cap.common.api.service.IExecutorService) SyncResultCallback(org.jowidgets.cap.common.tools.execution.SyncResultCallback) Test(org.junit.Test)

Example 7 with IExecutorService

use of org.jowidgets.cap.common.api.service.IExecutorService in project jo-client-platform by jo-source.

the class ExecutorAnnotationPostProcessorTest method testChangeFirstAndLastName.

@Test
public void testChangeFirstAndLastName() {
    final IExecutorService<String[]> service = ServiceProvider.getService(new ServiceId<IExecutorService<String[]>>("changeFirstAndLastName", IExecutorService.class));
    Assert.assertNotNull(service);
    final SyncResultCallback<List<IBeanDto>> result = new SyncResultCallback<List<IBeanDto>>();
    service.execute(result, Collections.singletonList(new BeanKey(0, 0)), new String[] { "Hans", "Hansen" }, null);
    final List<IBeanDto> dtos = result.getResultSynchronious();
    Assert.assertNotNull(dtos);
    Assert.assertEquals(1, dtos.size());
    final IBeanDto dto = dtos.get(0);
    Assert.assertEquals(0, dto.getId());
    Assert.assertEquals("Hans Hansen", dto.getValue("name"));
}
Also used : BeanKey(org.jowidgets.cap.common.tools.bean.BeanKey) IBeanKey(org.jowidgets.cap.common.api.bean.IBeanKey) IBeanDto(org.jowidgets.cap.common.api.bean.IBeanDto) ArrayList(java.util.ArrayList) List(java.util.List) IExecutorService(org.jowidgets.cap.common.api.service.IExecutorService) SyncResultCallback(org.jowidgets.cap.common.tools.execution.SyncResultCallback) Test(org.junit.Test)

Example 8 with IExecutorService

use of org.jowidgets.cap.common.api.service.IExecutorService in project jo-client-platform by jo-source.

the class ExecutorAnnotationPostProcessorTest method testChangeNameList.

@Test
public void testChangeNameList() {
    final IExecutorService<String> service = ServiceProvider.getService(new ServiceId<IExecutorService<String>>("changeNameList", IExecutorService.class));
    Assert.assertNotNull(service);
    final SyncResultCallback<List<IBeanDto>> result = new SyncResultCallback<List<IBeanDto>>();
    service.execute(result, Collections.singletonList(new BeanKey(0, 0)), "Hans", null);
    final List<IBeanDto> dtos = result.getResultSynchronious();
    Assert.assertNotNull(dtos);
    Assert.assertEquals(1, dtos.size());
    final IBeanDto dto = dtos.get(0);
    Assert.assertEquals(0, dto.getId());
    Assert.assertEquals("Hans", dto.getValue("name"));
}
Also used : BeanKey(org.jowidgets.cap.common.tools.bean.BeanKey) IBeanKey(org.jowidgets.cap.common.api.bean.IBeanKey) IBeanDto(org.jowidgets.cap.common.api.bean.IBeanDto) ArrayList(java.util.ArrayList) List(java.util.List) IExecutorService(org.jowidgets.cap.common.api.service.IExecutorService) SyncResultCallback(org.jowidgets.cap.common.tools.execution.SyncResultCallback) Test(org.junit.Test)

Aggregations

IExecutorService (org.jowidgets.cap.common.api.service.IExecutorService)8 ArrayList (java.util.ArrayList)5 List (java.util.List)5 IBeanDto (org.jowidgets.cap.common.api.bean.IBeanDto)5 IBeanKey (org.jowidgets.cap.common.api.bean.IBeanKey)5 SyncResultCallback (org.jowidgets.cap.common.tools.execution.SyncResultCallback)5 Test (org.junit.Test)5 BeanKey (org.jowidgets.cap.common.tools.bean.BeanKey)4 Method (java.lang.reflect.Method)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 IAction (org.jowidgets.api.command.IAction)1 IBean (org.jowidgets.cap.common.api.bean.IBean)1 IAdapterFactoryProvider (org.jowidgets.cap.service.api.adapter.IAdapterFactoryProvider)1 ISyncExecutorService (org.jowidgets.cap.service.api.adapter.ISyncExecutorService)1 Executor (org.jowidgets.cap.service.api.annotation.Executor)1 ExecutorBean (org.jowidgets.cap.service.api.annotation.ExecutorBean)1 IBeanExecutor (org.jowidgets.cap.service.api.executor.IBeanExecutor)1 IBeanListExecutor (org.jowidgets.cap.service.api.executor.IBeanListExecutor)1 DefaultCapServiceToolkit (org.jowidgets.cap.service.impl.DefaultCapServiceToolkit)1