use of org.motechproject.tasks.contract.ActionEventRequest in project motech by motech.
the class ActionEventRequestBuilderTest method shouldTestSubjectAvailability.
@Test
public void shouldTestSubjectAvailability() {
TestActionEventRequestBuilder requestBuilder = new TestActionEventRequestBuilder();
ActionEventRequest requestWithSubject = requestBuilder.setSubject(SUBJECT).createActionEventRequest();
assertThat(requestWithSubject.hasSubject(), is(true));
ActionEventRequest requestWithoutSubject = requestBuilder.setNullSubject().createActionEventRequest();
assertThat(requestWithoutSubject.hasSubject(), is(false));
ActionEventRequest requestWithEmptySubject = requestBuilder.setEmptySubject().createActionEventRequest();
assertThat(requestWithEmptySubject.hasSubject(), is(false));
}
use of org.motechproject.tasks.contract.ActionEventRequest in project motech by motech.
the class ActionEventRequestBuilderTest method shouldTestServiceAvailability.
@Test
public void shouldTestServiceAvailability() {
TestActionEventRequestBuilder requestBuilder = new TestActionEventRequestBuilder();
ActionEventRequest fullyFormedRequest = requestBuilder.setServiceInterface(SERVICE_INTERFACE).setServiceMethod(SERVICE_METHOD).createActionEventRequest();
assertThat(fullyFormedRequest.hasService(), is(true));
ActionEventRequest requestWithoutServiceInterface = requestBuilder.setNullServiceInterface().setServiceMethod(SERVICE_METHOD).createActionEventRequest();
assertThat(requestWithoutServiceInterface.hasService(), is(false));
ActionEventRequest requestWithEmptyServiceInterface = requestBuilder.setEmptyServiceInterface().setServiceMethod(SERVICE_METHOD).createActionEventRequest();
assertThat(requestWithEmptyServiceInterface.hasService(), is(false));
ActionEventRequest requestWithoutServiceMethod = requestBuilder.setServiceInterface(SERVICE_INTERFACE).setNullServiceMethod().createActionEventRequest();
assertThat(requestWithoutServiceMethod.hasService(), is(false));
ActionEventRequest requestWithEmptyServiceMethod = requestBuilder.setServiceInterface(SERVICE_INTERFACE).setEmptyServiceMethod().createActionEventRequest();
assertThat(requestWithEmptyServiceMethod.hasService(), is(false));
}
use of org.motechproject.tasks.contract.ActionEventRequest in project motech by motech.
the class ActionEventDeserializerParametrizedTest method shouldDeserializeJson.
@Test
public void shouldDeserializeJson() {
ChannelRequest channelRequest = (ChannelRequest) reader.readFromString(channelAsString, type, typeAdapters);
List<ActionEventRequest> actionTaskEvents = channelRequest.getActionTaskEvents();
assertEquals(expected, actionTaskEvents);
}
use of org.motechproject.tasks.contract.ActionEventRequest in project motech by motech.
the class ActionEventDeserializerParametrizedTest method getPillReminderEvents.
private static List<ActionEventRequest> getPillReminderEvents() {
SortedSet<ActionParameterRequest> parameters = new TreeSet<>();
parameters.add(new ActionParameterRequestBuilder().setKey("DosageID").setDisplayName("pillreminder.dossageID").setOrder(0).createActionParameterRequest());
parameters.add(new ActionParameterRequestBuilder().setKey("ExternalID").setDisplayName("pillreminder.externalID").setOrder(1).createActionParameterRequest());
parameters.add(new ActionParameterRequestBuilder().setKey("times-reminders-sent").setDisplayName("pillreminder.times.sent").setOrder(2).setType("INTEGER").createActionParameterRequest());
parameters.add(new ActionParameterRequestBuilder().setKey("times-reminders-to-be-sent").setDisplayName("pillreminder.total.times.sent").setOrder(3).setType("INTEGER").createActionParameterRequest());
parameters.add(new ActionParameterRequestBuilder().setKey("retry-interval").setDisplayName("pillreminder.retry.interval").setOrder(4).setType("INTEGER").createActionParameterRequest());
ActionEventRequest event = new TestActionEventRequestBuilder().setDisplayName("pillreminder.event.subject.scheduler").setSubject("org.motechproject.server.pillreminder.scheduler-reminder").setDescription("description").setServiceInterface(null).setServiceMethod(null).setActionParameters(parameters).createActionEventRequest();
List<ActionEventRequest> events = new ArrayList<>();
events.add(event);
return events;
}
use of org.motechproject.tasks.contract.ActionEventRequest in project motech by motech.
the class ActionEventDeserializerParametrizedTest method getMessageCampaignEvents.
private static List<ActionEventRequest> getMessageCampaignEvents() {
SortedSet<ActionParameterRequest> parameters1 = new TreeSet<>();
parameters1.add(new ActionParameterRequestBuilder().setKey("CampaignName").setDisplayName("msgCampaign.campaign.name").setOrder(0).createActionParameterRequest());
parameters1.add(new ActionParameterRequestBuilder().setKey("ExternalID").setDisplayName("msgCampaign.externalID").setOrder(1).createActionParameterRequest());
parameters1.add(new ActionParameterRequestBuilder().setKey("MessageKey").setDisplayName("msgCampaign.message.key").setOrder(2).createActionParameterRequest());
ActionEventRequest event1 = new TestActionEventRequestBuilder().setDisplayName("msgCampaign.send.message").setSubject("org.motechproject.messagecampaign.fired-campaign-message").setDescription("description").setServiceInterface(null).setServiceMethod(null).setActionParameters(parameters1).createActionEventRequest();
SortedSet<ActionParameterRequest> parameters2 = new TreeSet<>();
parameters2.add(new ActionParameterRequestBuilder().setKey("ExternalID").setDisplayName("msgCampaign.externalID").setOrder(0).createActionParameterRequest());
parameters2.add(new ActionParameterRequestBuilder().setKey("CampaignName").setDisplayName("msgCampaign.campaign.name").setOrder(1).createActionParameterRequest());
ActionEventRequest event2 = new TestActionEventRequestBuilder().setDisplayName("msgCampaign.campaign.completed").setSubject("org.motechproject.messagecampaign.campaign-completed").setDescription("description").setServiceInterface("org.motechproject.messagecampaign.service.MessageCampaignService").setServiceMethod("campaignCompleted").setActionParameters(parameters2).createActionEventRequest();
return asList(event1, event2);
}
Aggregations