use of com.splunk.JobCollection in project camel by apache.
the class ConsumerStreamingTest method testSearch.
@Test
public void testSearch() throws Exception {
MockEndpoint searchMock = getMockEndpoint("mock:search-result");
searchMock.expectedMessageCount(3);
JobCollection jobCollection = mock(JobCollection.class);
Job jobMock = mock(Job.class);
when(service.getJobs()).thenReturn(jobCollection);
when(jobCollection.create(anyString(), any(JobArgs.class))).thenReturn(jobMock);
when(jobMock.isDone()).thenReturn(Boolean.TRUE);
InputStream stream = ConsumerTest.class.getResourceAsStream("/resultsreader_test_data.json");
when(jobMock.getResults(any(JobResultsArgs.class))).thenReturn(stream);
assertMockEndpointsSatisfied();
SplunkEvent recieved = searchMock.getReceivedExchanges().get(0).getIn().getBody(SplunkEvent.class);
assertNotNull(recieved);
Map<String, String> data = recieved.getEventData();
assertEquals("indexertpool", data.get("name"));
stream.close();
}
use of com.splunk.JobCollection in project camel by apache.
the class ConsumerTest method testSearch.
@Test
public void testSearch() throws Exception {
MockEndpoint searchMock = getMockEndpoint("mock:search-result");
searchMock.expectedMessageCount(3);
searchMock.expectedPropertyReceived(Exchange.BATCH_SIZE, 3);
JobCollection jobCollection = mock(JobCollection.class);
Job jobMock = mock(Job.class);
when(service.getJobs()).thenReturn(jobCollection);
when(jobCollection.create(anyString(), any(JobArgs.class))).thenReturn(jobMock);
when(jobMock.isDone()).thenReturn(Boolean.TRUE);
InputStream stream = ConsumerTest.class.getResourceAsStream("/resultsreader_test_data.json");
when(jobMock.getResults(any(JobResultsArgs.class))).thenReturn(stream);
assertMockEndpointsSatisfied();
SplunkEvent recieved = searchMock.getReceivedExchanges().get(0).getIn().getBody(SplunkEvent.class);
assertNotNull(recieved);
Map<String, String> data = recieved.getEventData();
assertEquals("indexertpool", data.get("name"));
assertEquals(true, searchMock.getReceivedExchanges().get(2).getProperty(Exchange.BATCH_COMPLETE, Boolean.class));
stream.close();
}
Aggregations