Search in sources :

Example 16 with SplunkEvent

use of org.apache.camel.component.splunk.event.SplunkEvent in project camel by apache.

the class NormalSearchTest method testSearch.

@Test
public void testSearch() throws Exception {
    MockEndpoint searchMock = getMockEndpoint("mock:search-result");
    searchMock.expectedMessageCount(1);
    getMockEndpoint("mock:submit-result").expectedMessageCount(1);
    assertMockEndpointsSatisfied(20, TimeUnit.SECONDS);
    SplunkEvent recieved = searchMock.getReceivedExchanges().get(0).getIn().getBody(SplunkEvent.class);
    assertNotNull(recieved);
    Map<String, String> data = recieved.getEventData();
    assertEquals("value1", data.get("key1"));
    assertEquals("value2", data.get("key2"));
    assertEquals("value3", data.get("key3"));
}
Also used : SplunkEvent(org.apache.camel.component.splunk.event.SplunkEvent) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 17 with SplunkEvent

use of org.apache.camel.component.splunk.event.SplunkEvent in project camel by apache.

the class SavedSearchTest method testSavedSearch.

// before run there should be created a saved search 'junit' in splunk
@Test
public void testSavedSearch() throws Exception {
    MockEndpoint searchMock = getMockEndpoint("mock:search-saved");
    searchMock.expectedMessageCount(1);
    assertMockEndpointsSatisfied(20, TimeUnit.SECONDS);
    SplunkEvent recieved = searchMock.getReceivedExchanges().get(0).getIn().getBody(SplunkEvent.class);
    assertNotNull(recieved);
    Map<String, String> data = recieved.getEventData();
    assertEquals("value1", data.get("key1"));
    assertEquals("value2", data.get("key2"));
    assertEquals("value3", data.get("key3"));
}
Also used : SplunkEvent(org.apache.camel.component.splunk.event.SplunkEvent) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 18 with SplunkEvent

use of org.apache.camel.component.splunk.event.SplunkEvent in project camel by apache.

the class SplunkProducerTest method testSubmitWriter.

@Test
public void testSubmitWriter() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:submitresult");
    mock.expectedMinimumMessageCount(1);
    SplunkEvent splunkEvent = new SplunkEvent();
    splunkEvent.addPair("key1", "value1");
    splunkEvent.addPair("key2", "value2");
    splunkEvent.addPair("key3", "value1");
    template.sendBody("direct:submit", splunkEvent);
    assertMockEndpointsSatisfied();
}
Also used : SplunkEvent(org.apache.camel.component.splunk.event.SplunkEvent) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 19 with SplunkEvent

use of org.apache.camel.component.splunk.event.SplunkEvent in project camel by apache.

the class SplunkProducerTest method testStreamWriter.

@Test
public void testStreamWriter() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:stream-result");
    mock.expectedMinimumMessageCount(1);
    SplunkEvent splunkEvent = new SplunkEvent();
    splunkEvent.addPair("key11", "value1");
    splunkEvent.addPair("key22", "value2");
    splunkEvent.addPair("key33", "value3");
    template.sendBody("direct:stream", splunkEvent);
    assertMockEndpointsSatisfied();
}
Also used : SplunkEvent(org.apache.camel.component.splunk.event.SplunkEvent) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 20 with SplunkEvent

use of org.apache.camel.component.splunk.event.SplunkEvent in project camel by apache.

the class SplunkProducerTest method testTcpWriter.

@Test
public void testTcpWriter() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:tcpresult");
    mock.expectedMinimumMessageCount(1);
    SplunkEvent splunkEvent = new SplunkEvent();
    splunkEvent.addPair("key1", "value1");
    splunkEvent.addPair("key2", "value2");
    splunkEvent.addPair("key3", "value3");
    template.sendBody("direct:tcp", splunkEvent);
    assertMockEndpointsSatisfied();
}
Also used : SplunkEvent(org.apache.camel.component.splunk.event.SplunkEvent) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Aggregations

SplunkEvent (org.apache.camel.component.splunk.event.SplunkEvent)21 Test (org.junit.Test)13 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)11 JobArgs (com.splunk.JobArgs)4 Job (com.splunk.Job)3 JobResultsArgs (com.splunk.JobResultsArgs)3 InputStream (java.io.InputStream)3 Calendar (java.util.Calendar)3 Producer (org.apache.camel.Producer)3 JobCollection (com.splunk.JobCollection)2 Exchange (org.apache.camel.Exchange)2 Message (org.apache.camel.Message)2 Matchers.anyString (org.mockito.Matchers.anyString)2 ResultsReader (com.splunk.ResultsReader)1 ResultsReaderJson (com.splunk.ResultsReaderJson)1 SavedSearch (com.splunk.SavedSearch)1 SavedSearchCollection (com.splunk.SavedSearchCollection)1 SavedSearchDispatchArgs (com.splunk.SavedSearchDispatchArgs)1 Service (com.splunk.Service)1 ServiceArgs (com.splunk.ServiceArgs)1