Search in sources :

Example 6 with TargetDTO

use of org.activityinfo.legacy.shared.model.TargetDTO in project activityinfo by bedatadriven.

the class TargetTest method updateTarget.

@Test
public void updateTarget() throws Throwable {
    LocalDate fromDate = new LocalDate(2015, 3, 3);
    LocalDate toDate = new LocalDate(2015, 3, 4);
    Map<String, Object> changes = new HashMap<String, Object>();
    changes.put("name", "newNameOfTarget");
    changes.put("fromDate", fromDate);
    changes.put("toDate", toDate);
    execute(new BatchCommand(new UpdateEntity("Target", 1, changes)));
    List<TargetDTO> targets = execute(new GetTargets(db.getId())).getData();
    TargetDTO dto = getTargetById(targets, 1);
    assertThat(dto.getName(), equalTo("newNameOfTarget"));
    assertThat(dto.getFromDate(), equalTo(fromDate));
    assertThat(dto.getToDate(), equalTo(toDate));
}
Also used : HashMap(java.util.HashMap) TargetDTO(org.activityinfo.legacy.shared.model.TargetDTO) LocalDate(com.bedatadriven.rebar.time.calendar.LocalDate) Test(org.junit.Test)

Example 7 with TargetDTO

use of org.activityinfo.legacy.shared.model.TargetDTO in project activityinfo by bedatadriven.

the class TargetTest method createTarget.

private TargetDTO createTarget() {
    Date date1 = new Date();
    Date date2 = new Date();
    TargetDTO target = new TargetDTO();
    target.setName("Target0071");
    target.setFromDate(date1);
    target.setToDate(date2);
    return target;
}
Also used : TargetDTO(org.activityinfo.legacy.shared.model.TargetDTO) Date(java.util.Date) LocalDate(com.bedatadriven.rebar.time.calendar.LocalDate)

Example 8 with TargetDTO

use of org.activityinfo.legacy.shared.model.TargetDTO in project activityinfo by bedatadriven.

the class CommandValidatorTest method nameTooLong.

@Test
public void nameTooLong() {
    TargetDTO target = new TargetDTO();
    target.setName(Strings.repeat("xoxoxo", 2000));
    AddTarget command = new AddTarget();
    command.setTarget(target);
    assertThat(validator.validate(command), hasItems(forProperty("target.name")));
}
Also used : AddTarget(org.activityinfo.legacy.shared.command.AddTarget) TargetDTO(org.activityinfo.legacy.shared.model.TargetDTO) Test(org.junit.Test)

Example 9 with TargetDTO

use of org.activityinfo.legacy.shared.model.TargetDTO in project activityinfo by bedatadriven.

the class CommandValidatorTest method missingDates.

@Test
public void missingDates() {
    TargetDTO target = new TargetDTO();
    AddTarget command = new AddTarget();
    command.setTarget(target);
    assertThat(validator.validate(command), hasItems(forProperty("target.name"), forProperty("target.fromDate"), forProperty("target.toDate")));
}
Also used : AddTarget(org.activityinfo.legacy.shared.command.AddTarget) TargetDTO(org.activityinfo.legacy.shared.model.TargetDTO) Test(org.junit.Test)

Aggregations

TargetDTO (org.activityinfo.legacy.shared.model.TargetDTO)9 Test (org.junit.Test)5 AddTarget (org.activityinfo.legacy.shared.command.AddTarget)4 CreateResult (org.activityinfo.legacy.shared.command.result.CreateResult)4 LocalDate (com.bedatadriven.rebar.time.calendar.LocalDate)2 Date (java.util.Date)2 ListStore (com.extjs.gxt.ui.client.store.ListStore)1 BorderLayout (com.extjs.gxt.ui.client.widget.layout.BorderLayout)1 BorderLayoutData (com.extjs.gxt.ui.client.widget.layout.BorderLayoutData)1 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1 HashMap (java.util.HashMap)1 PartnerDTO (org.activityinfo.legacy.shared.model.PartnerDTO)1 ProjectDTO (org.activityinfo.legacy.shared.model.ProjectDTO)1 FormDialogCallback (org.activityinfo.ui.client.page.common.dialog.FormDialogCallback)1 FormDialogTether (org.activityinfo.ui.client.page.common.dialog.FormDialogTether)1