Hi,
Yes sure I can.
Is maven, I have following ( elastic related ) dependecies:
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>rest</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.test</groupId>
<artifactId>framework</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>x-pack-transport</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>lang-mustache-client</artifactId>
</dependency>
and in parent
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.test</groupId>
<artifactId>framework</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
I m really missing alle the x-pack client stuff, to execure the alerting queries. This is the class i was using and was working with 5.4.0 x-pack jar.
public abstract class AbstractWatcherTest extends ESSingleNodeTestCase {
...
void executeWatcher(String watcherId) {
WatcherClient watcherClient = new WatcherClient(client());
PutWatchRequestBuilder putWatchRequestBuilder = watcherClient.preparePutWatch(watcherId);
putWatchRequestBuilder.setSource(this.watcherBytesReference.get(watcherId)).setActive(false);
PutWatchResponse putWatchResponse = putWatchRequestBuilder.get();
assertNotNull(putWatchResponse.getId());
ExecuteWatchRequest executeWatchRequest = new ExecuteWatchRequest(watcherId);
ExecuteWatchResponse executeWatchResponse = watcherClient.executeWatch(executeWatchRequest).actionGet();
assertNotNull(executeWatchResponse.getRecordId());
flushAllIndexes();
}