use of org.activityinfo.shared.command.GetTargets in project activityinfo by bedatadriven.
the class TargetTest method deleteTargetTest.
@Test
public void deleteTargetTest() {
TargetDTO target = createTarget();
CreateResult cresult = execute(new AddTarget(db.getId(), target));
int newId = cresult.getNewId();
/*
* Load Targets to verify the changes have stuck
*/
List<TargetDTO> targets = execute(new GetTargets(db.getId())).getData();
TargetDTO dto = getTargetById(targets, newId);
Assert.assertEquals("name", "Target0071", dto.getName());
/*
* Delete new target now
*/
execute(new Delete(dto));
/*
* Verify if target is deleted.
*/
targets = execute(new GetTargets()).getData();
TargetDTO deleted = getTargetById(targets, newId);
Assert.assertNull(deleted);
}
use of org.activityinfo.shared.command.GetTargets in project activityinfo by bedatadriven.
the class TargetTest method testTarget.
@Test
public void testTarget() throws CommandException {
/*
* Create a new Target
*/
TargetDTO target = createTarget();
CreateResult cresult = execute(new AddTarget(db.getId(), target));
int newId = cresult.getNewId();
/*
* Load Targets to verify the changes have stuck
*/
List<TargetDTO> targets = execute(new GetTargets(db.getId())).getData();
TargetDTO dto = getTargetById(targets, newId);
Assert.assertNotNull(dto);
Assert.assertEquals("name", "Target0071", dto.getName());
}
use of org.activityinfo.shared.command.GetTargets in project activityinfo by bedatadriven.
the class TargetTest method updateTargetNameTest.
@Test
public void updateTargetNameTest() throws Throwable {
Map<String, Object> changes1 = new HashMap<String, Object>();
changes1.put("name", "newNameOfTarget");
execute(new BatchCommand(new UpdateEntity("Target", 1, changes1)));
List<TargetDTO> targets = execute(new GetTargets(db.getId())).getData();
TargetDTO dto = getTargetById(targets, 1);
Assert.assertEquals("newNameOfTarget", dto.getName());
}
Aggregations