Search in sources :

Example 1 with MockEventBus

use of org.activityinfo.ui.client.MockEventBus in project activityinfo by bedatadriven.

the class SchemaCacheTest method testSchemaCache.

@Test
public void testSchemaCache() {
    CacheManager proxyMgr = new CacheManager(new MockEventBus());
    new SchemaCache(proxyMgr);
    SchemaDTO schema = DTOs.pear();
    proxyMgr.notifyListenersOfSuccess(new GetSchema(), schema);
    CacheResult<SchemaDTO> proxyResult = proxyMgr.execute(new GetSchema());
    Assert.assertTrue("could execute locally", proxyResult.isCouldExecute());
    Assert.assertEquals("PEAR", proxyResult.getResult().getDatabaseById(1).getName());
}
Also used : MockEventBus(org.activityinfo.ui.client.MockEventBus) SchemaDTO(org.activityinfo.legacy.shared.model.SchemaDTO) GetSchema(org.activityinfo.legacy.shared.command.GetSchema) Test(org.junit.Test)

Example 2 with MockEventBus

use of org.activityinfo.ui.client.MockEventBus in project activityinfo by bedatadriven.

the class OutOfSyncMonitorTest method setUp.

@Before
public void setUp() {
    eventBus = new MockEventBus();
    notifier = createNiceMock(OutOfSyncMonitor.View.class);
    replay(notifier);
}
Also used : MockEventBus(org.activityinfo.ui.client.MockEventBus) Before(org.junit.Before)

Example 3 with MockEventBus

use of org.activityinfo.ui.client.MockEventBus in project activityinfo by bedatadriven.

the class AdminEntityCacheTest method testRootLevelCache.

@Test
public void testRootLevelCache() {
    CacheManager proxyMgr = new CacheManager(new MockEventBus());
    new AdminEntityCache(proxyMgr);
    proxyMgr.notifyListenersOfSuccess(new GetAdminEntities(1), DTOs.getProvinces());
    CacheResult<ListResult<AdminEntityDTO>> proxyResult = proxyMgr.execute(new GetAdminEntities(1));
    Assert.assertTrue(proxyResult.isCouldExecute());
    Assert.assertEquals(2, proxyResult.getResult().getData().size());
}
Also used : ListResult(org.activityinfo.legacy.shared.command.result.ListResult) MockEventBus(org.activityinfo.ui.client.MockEventBus) GetAdminEntities(org.activityinfo.legacy.shared.command.GetAdminEntities) Test(org.junit.Test)

Aggregations

MockEventBus (org.activityinfo.ui.client.MockEventBus)3 Test (org.junit.Test)2 GetAdminEntities (org.activityinfo.legacy.shared.command.GetAdminEntities)1 GetSchema (org.activityinfo.legacy.shared.command.GetSchema)1 ListResult (org.activityinfo.legacy.shared.command.result.ListResult)1 SchemaDTO (org.activityinfo.legacy.shared.model.SchemaDTO)1 Before (org.junit.Before)1