use of org.activityinfo.shared.command.GetSchema in project activityinfo by bedatadriven.
the class CommandRequestTest method equalCommandsShouldBeMerged.
@Test
public void equalCommandsShouldBeMerged() {
assumeThat(new GetSchema(), is(equalTo(new GetSchema())));
CommandRequest firstCommand = new CommandRequest(new GetSchema(), new NullCallback());
List<CommandRequest> pending = Collections.singletonList(firstCommand);
CommandRequest secondRequest = new CommandRequest(new GetSchema(), new NullCallback());
boolean merged = secondRequest.mergeSuccessfulInto(pending);
assertThat("merged", merged, is(true));
assertThat(firstCommand.getCallbacks(), hasItem(first(secondRequest.getCallbacks())));
}
use of org.activityinfo.shared.command.GetSchema in project activityinfo by bedatadriven.
the class DbListPresenterTest method loaderPopulatesStore.
@Test
public void loaderPopulatesStore() {
ignoreView();
expectDispatch(new GetSchema(), schema);
replay(dispatcher);
createPresenter();
ListStore<UserDatabaseDTO> store = presenter.getStore();
assertThat("store.getCount()", store.getCount(), is(equalTo(3)));
verify(dispatcher);
}
use of org.activityinfo.shared.command.GetSchema in project activityinfo by bedatadriven.
the class SiteAdminTreeLoaderTest method load.
@Test
public void load() {
DispatcherStub dispatcher = new DispatcherStub();
dispatcher.setResult(new GetSchema(), DTOs.PEAR.SCHEMA);
dispatcher.setResult(new GetAdminEntities(1), DTOs.PROVINCES);
SiteAdminTreeLoader loader = new SiteAdminTreeLoader(dispatcher, new AdminGroupingModel(1));
new TreeStore<ModelData>(loader);
loader.load();
}
use of org.activityinfo.shared.command.GetSchema in project activityinfo by bedatadriven.
the class CreateDatabaseTest method createWithSpecificCountry.
@Test
@OnDataSet("/dbunit/multicountry.db.xml")
public void createWithSpecificCountry() throws CommandException {
UserDatabaseDTO db = new UserDatabaseDTO();
db.setName("Warchild Haiti");
db.setFullName("Warchild Haiti");
setUser(1);
CreateEntity cmd = new CreateEntity(db);
cmd.getProperties().put("countryId", 2);
CreateResult cr = execute(cmd);
SchemaDTO schema = execute(new GetSchema());
UserDatabaseDTO newdb = schema.getDatabaseById(cr.getNewId());
assertNotNull(newdb);
assertThat(newdb.getCountry(), is(notNullValue()));
assertThat(newdb.getCountry().getName(), is(equalTo("Haiti")));
}
use of org.activityinfo.shared.command.GetSchema in project activityinfo by bedatadriven.
the class DeleteTest method testDeleteAttribute.
@Test
public void testDeleteAttribute() throws CommandException {
SchemaDTO schema = execute(new GetSchema());
execute(new Delete(schema.getActivityById(1).getAttributeById(1)));
schema = execute(new GetSchema());
Assert.assertNull(schema.getActivityById(1).getAttributeById(1));
}
Aggregations