use of org.motechproject.tasks.domain.mds.task.TaskDataProvider in project motech by motech.
the class DataProviderManagerTest method shouldRemoveProviderFromHandler.
@Test
public void shouldRemoveProviderFromHandler() throws IOException {
DataProviderManager mgr = new DataProviderManager(taskTriggerHandler, taskDataProviderService);
TaskDataProvider provider = new TaskDataProvider();
provider.setId(TASK_DATA_PROVIDER_ID);
when(dataProvider.getName()).thenReturn(TASK_DATA_PROVIDER_NAME);
when(taskDataProviderService.getProvider(TASK_DATA_PROVIDER_NAME)).thenReturn(provider);
mgr.unbind(dataProvider, null);
verify(taskTriggerHandler).removeDataProvider(TASK_DATA_PROVIDER_NAME);
}
use of org.motechproject.tasks.domain.mds.task.TaskDataProvider in project motech by motech.
the class DataProviderManagerTest method shouldNotRemoveProviderFromHandler.
@Test
public void shouldNotRemoveProviderFromHandler() throws IOException {
DataProviderManager mgr = new DataProviderManager(taskDataProviderService);
TaskDataProvider provider = new TaskDataProvider();
provider.setId(TASK_DATA_PROVIDER_ID);
when(taskDataProviderService.getProvider(TASK_DATA_PROVIDER_NAME)).thenReturn(provider);
mgr.unbind(dataProvider, null);
verify(taskTriggerHandler, never()).removeDataProvider(TASK_DATA_PROVIDER_NAME);
}
use of org.motechproject.tasks.domain.mds.task.TaskDataProvider in project motech by motech.
the class DataProviderManagerTest method shouldRegisterProvider.
@Test
public void shouldRegisterProvider() throws IOException {
DataProviderManager mgr = new DataProviderManager(taskDataProviderService);
TaskDataProvider provider = new TaskDataProvider();
provider.setId(TASK_DATA_PROVIDER_ID);
String json = String.format("{ name: '%s', objects: []", TASK_DATA_PROVIDER_NAME);
when(dataProvider.toJSON()).thenReturn(json);
mgr.bind(dataProvider, null);
verify(taskDataProviderService).registerProvider(json);
verify(taskTriggerHandler, never()).addDataProvider(dataProvider);
}
Aggregations