use of org.activityinfo.shared.command.GetAdminEntities in project activityinfo by bedatadriven.
the class AdminEntityProxy method load.
@Override
protected void load(Object loadConfig, final AsyncCallback<ListResult<AdminEntityDTO>> callback) {
GetAdminEntities query = new GetAdminEntities(levelId);
query.setParentId(parentId);
dispatcher.execute(query, new AsyncCallback<AdminEntityResult>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(AdminEntityResult result) {
callback.onSuccess(result);
}
});
}
use of org.activityinfo.shared.command.GetAdminEntities 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());
}
use of org.activityinfo.shared.command.GetAdminEntities in project activityinfo by bedatadriven.
the class AdminFieldSetPresenterTest method setupDispatcher.
@Before
public void setupDispatcher() {
dispatcher.setResult(new GetAdminEntities(PROVINCE.getId()), PROVINCES);
dispatcher.setResult(new GetAdminEntities(TERRITOIRE.getId(), NORD_KIVU.getId()), NORD_KIVU_TERRITOIRES);
dispatcher.setResult(new GetAdminEntities(TERRITOIRE.getId(), SUD_KIVU.getId()), SUD_KIVU_TERRITOIRES);
}
use of org.activityinfo.shared.command.GetAdminEntities in project activityinfo by bedatadriven.
the class GetAdminEntitiesHandlerTest method testChildQuery.
@Test
public void testChildQuery() throws Exception {
GetAdminEntities cmd = new GetAdminEntities(2, 2);
AdminEntityResult result = execute(cmd);
assertThat(result.getData().size(), equalTo(3));
AdminEntityDTO kalehe = result.getData().get(0);
assertThat(kalehe.getName(), equalTo("Kalehe"));
assertThat(kalehe.getBounds(), is(not(nullValue())));
assertThat(kalehe.getBounds().getMinLon(), equalTo(-44d));
assertThat(kalehe.getBounds().getMinLat(), equalTo(-22d));
assertThat(kalehe.getBounds().getMaxLon(), equalTo(33.5d));
assertThat(kalehe.getBounds().getMaxLat(), equalTo(40d));
}
use of org.activityinfo.shared.command.GetAdminEntities in project activityinfo by bedatadriven.
the class GetAdminEntitiesHandlerTest method testSiteQuery.
@Test
public void testSiteQuery() throws Exception {
GetAdminEntities cmd = new GetAdminEntities();
cmd.setLevelId(1);
cmd.setFilter(Filter.filter().onActivity(2));
AdminEntityResult result = execute(cmd);
assertThat(result.getData().size(), equalTo(2));
}
Aggregations