use of org.activityinfo.legacy.shared.command.Delete in project activityinfo by bedatadriven.
the class DeleteTest method testDeleteIndicator.
@Test
public void testDeleteIndicator() throws CommandException {
int activityId = 1;
int indicatorId = 1;
execute(new Delete("Indicator", indicatorId));
ActivityFormDTO form = execute(new GetActivityForm(activityId));
assertNull(form.getIndicatorById(indicatorId));
PagingResult<SiteDTO> sites = execute(GetSites.byId(1));
assertNull(sites.getData().get(0).getIndicatorValue(1));
}
use of org.activityinfo.legacy.shared.command.Delete in project activityinfo by bedatadriven.
the class DeleteTest method testDeleteLocationType.
@Test
public void testDeleteLocationType() throws CommandException {
int locationTypeId = 4;
SchemaDTO schema = execute(new GetSchema());
// assert location type exists
assertNotNull(schema.getLocationTypeById(locationTypeId));
execute(new Delete("LocationType", locationTypeId));
schema = execute(new GetSchema());
// assert "delete" flag is set
assertTrue(schema.getLocationTypeById(locationTypeId).isDeleted());
}
use of org.activityinfo.legacy.shared.command.Delete in project activityinfo by bedatadriven.
the class DeleteTest method testDeleteActivity.
@Test
public void testDeleteActivity() throws CommandException {
ActivityFormDTO form = execute(new GetActivityForm(1));
execute(new Delete(form));
execute(new Delete("Activity", 4));
SchemaDTO schema = execute(new GetSchema());
assertNull("delete by entity reference", schema.getActivityById(1));
assertNull("delete by id", schema.getActivityById(4));
}
use of org.activityinfo.legacy.shared.command.Delete in project activityinfo by bedatadriven.
the class DeleteTest method testDeleteSite.
@Test
public void testDeleteSite() throws CommandException {
PagingResult<SiteDTO> sites = execute(GetSites.byId(3));
execute(new Delete(sites.getData().get(0)));
sites = execute(GetSites.byId(3));
Assert.assertEquals(0, sites.getData().size());
sites = execute(new GetSites());
assertNull(getById(sites.getData(), 3));
}
use of org.activityinfo.legacy.shared.command.Delete in project activityinfo by bedatadriven.
the class DeleteTest method testDeleteAttribute.
@Test
public void testDeleteAttribute() throws CommandException {
ActivityFormDTO form = execute(new GetActivityForm(1));
execute(new Delete(form.getAttributeById(1)));
form = execute(new GetActivityForm(1));
assertNull(form.getAttributeById(1));
}
Aggregations