use of org.knowm.dropwizard.sundial.tasks.StartJobTask in project dropwizard-sundial by knowm.
the class StartJobTaskTest method shouldGiveErrorMessageIfNoJobNameSpecified.
@Test
public void shouldGiveErrorMessageIfNoJobNameSpecified() throws Exception {
StartJobTask task = new StartJobTask();
ImmutableMultimap<String, String> map = ImmutableMultimap.of();
OutputStream stream = new ByteArrayOutputStream();
PrintWriter out = new PrintWriter(stream);
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("JOB_NAME");
task.execute(map, out);
}
use of org.knowm.dropwizard.sundial.tasks.StartJobTask in project dropwizard-sundial by knowm.
the class StartJobTaskTest method shouldStartNamedTask.
@Test
public void shouldStartNamedTask() throws Exception {
StartJobTask task = new StartJobTask();
ImmutableMultimap<String, String> map = ImmutableMultimap.of("JOB_NAME", "test");
OutputStream stream = new ByteArrayOutputStream();
PrintWriter out = new PrintWriter(stream);
PowerMock.mockStatic(SundialJobScheduler.class);
SundialJobScheduler.startJob("test", Collections.singletonMap("JOB_NAME", (Object) "test"));
EasyMock.expectLastCall();
PowerMock.replay(SundialJobScheduler.class);
task.execute(map, out);
PowerMock.verify(SundialJobScheduler.class);
}
use of org.knowm.dropwizard.sundial.tasks.StartJobTask in project dropwizard-sundial by knowm.
the class StartJobTaskTest method shouldPassParameters.
@Test
public void shouldPassParameters() throws Exception {
StartJobTask task = new StartJobTask();
ImmutableMultimap<String, String> map = ImmutableMultimap.of("JOB_NAME", "test", "Param1", "1", "Param2", "2");
OutputStream stream = new ByteArrayOutputStream();
PrintWriter out = new PrintWriter(stream);
PowerMock.mockStatic(SundialJobScheduler.class);
SundialJobScheduler.startJob("test", ImmutableMap.of("JOB_NAME", (Object) "test", "Param1", (Object) "1", "Param2", (Object) "2"));
EasyMock.expectLastCall();
PowerMock.replay(SundialJobScheduler.class);
task.execute(map, out);
PowerMock.verify(SundialJobScheduler.class);
}
Aggregations