Search in sources :

Example 16 with FilterSet

use of org.motechproject.tasks.domain.mds.task.FilterSet in project motech by motech.

the class TaskBuilderTest method shouldReturnBuiltTaskObject.

@Test
public void shouldReturnBuiltTaskObject() throws Exception {
    TaskBuilder builder = new TaskBuilder();
    Task task = builder.withName(TASK_NAME).withDescription(TASK_DESCRIPTION).isEnabled(isEnabled).withTrigger(new TaskTriggerInformation()).addAction(new TaskActionInformation()).withTaskConfig(new TaskConfig()).addFilterSet(new FilterSet()).addDataSource(new DataSource()).build();
    assertNotNull(task);
    assertEquals(TASK_NAME, task.getName());
    assertEquals(TASK_DESCRIPTION, task.getDescription());
    assertEquals(isEnabled, task.isEnabled());
    assertNotNull(task.getTrigger());
    assertNotNull(task.getActions());
    assertFalse(task.getActions().isEmpty());
    assertNotNull(task.getTaskConfig());
    assertFalse(task.getTaskConfig().getDataSources().isEmpty());
    assertFalse(task.getTaskConfig().getFilters().isEmpty());
}
Also used : TaskBuilder(org.motechproject.tasks.domain.mds.task.builder.TaskBuilder) TaskTriggerInformation(org.motechproject.tasks.domain.mds.task.TaskTriggerInformation) Task(org.motechproject.tasks.domain.mds.task.Task) FilterSet(org.motechproject.tasks.domain.mds.task.FilterSet) TaskActionInformation(org.motechproject.tasks.domain.mds.task.TaskActionInformation) TaskConfig(org.motechproject.tasks.domain.mds.task.TaskConfig) DataSource(org.motechproject.tasks.domain.mds.task.DataSource) Test(org.junit.Test)

Aggregations

FilterSet (org.motechproject.tasks.domain.mds.task.FilterSet)16 Test (org.junit.Test)11 DataSource (org.motechproject.tasks.domain.mds.task.DataSource)11 ArrayList (java.util.ArrayList)9 TaskConfig (org.motechproject.tasks.domain.mds.task.TaskConfig)9 Filter (org.motechproject.tasks.domain.mds.task.Filter)7 Matchers.anyString (org.mockito.Matchers.anyString)5 Task (org.motechproject.tasks.domain.mds.task.Task)5 TaskTriggerInformation (org.motechproject.tasks.domain.mds.task.TaskTriggerInformation)4 TaskHandlerException (org.motechproject.tasks.exception.TaskHandlerException)4 MotechEvent (org.motechproject.event.MotechEvent)3 EventParameter (org.motechproject.tasks.domain.mds.channel.EventParameter)3 TriggerEvent (org.motechproject.tasks.domain.mds.channel.TriggerEvent)3 Lookup (org.motechproject.tasks.domain.mds.task.Lookup)3 TaskConfigStep (org.motechproject.tasks.domain.mds.task.TaskConfigStep)3 TaskBuilder (org.motechproject.tasks.domain.mds.task.builder.TaskBuilder)3 HashMap (java.util.HashMap)2 Random (java.util.Random)2 DataProvider (org.motechproject.commons.api.DataProvider)2 TaskActionInformation (org.motechproject.tasks.domain.mds.task.TaskActionInformation)2