Move ObjectPath and XContentUtils to libs/x-content (#34803)
These are generally useful utility classes that do not need to live in the Watcher code
This commit is contained in:
parent
6b08d5fc89
commit
e2af849f70
|
@ -1,48 +1,61 @@
|
||||||
/*
|
/*
|
||||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* or more contributor license agreements. Licensed under the Elastic License;
|
* license agreements. See the NOTICE file distributed with
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.core.watcher.support.xcontent;
|
|
||||||
|
|
||||||
import org.elasticsearch.common.Strings;
|
package org.elasticsearch.common.xcontent;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ObjectPath {
|
/**
|
||||||
|
* Helper class to navigate nested objects using dot notation
|
||||||
|
*/
|
||||||
|
public final class ObjectPath {
|
||||||
|
|
||||||
|
private static final String[] EMPTY_ARRAY = new String[0];
|
||||||
|
|
||||||
private ObjectPath() {
|
private ObjectPath() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the value within a given object at the specified path, or
|
||||||
|
* {@code null} if the path does not exist
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public static <T> T eval(String path, Object object) {
|
public static <T> T eval(String path, Object object) {
|
||||||
return (T) evalContext(path, object);
|
return (T) evalContext(path, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object evalContext(String path, Object ctx) {
|
private static Object evalContext(String path, Object ctx) {
|
||||||
final String[] parts;
|
final String[] parts;
|
||||||
if (path == null || path.isEmpty()) parts = Strings.EMPTY_ARRAY;
|
if (path == null || path.isEmpty()) parts = EMPTY_ARRAY;
|
||||||
else parts = path.split("\\.");
|
else parts = path.split("\\.");
|
||||||
StringBuilder resolved = new StringBuilder();
|
|
||||||
for (String part : parts) {
|
for (String part : parts) {
|
||||||
if (ctx == null) {
|
if (ctx == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (ctx instanceof Map) {
|
if (ctx instanceof Map) {
|
||||||
ctx = ((Map) ctx).get(part);
|
ctx = ((Map) ctx).get(part);
|
||||||
if (resolved.length() != 0) {
|
|
||||||
resolved.append(".");
|
|
||||||
}
|
|
||||||
resolved.append(part);
|
|
||||||
} else if (ctx instanceof List) {
|
} else if (ctx instanceof List) {
|
||||||
try {
|
try {
|
||||||
int index = Integer.parseInt(part);
|
int index = Integer.parseInt(part);
|
||||||
ctx = ((List) ctx).get(index);
|
ctx = ((List) ctx).get(index);
|
||||||
if (resolved.length() != 0) {
|
|
||||||
resolved.append(".");
|
|
||||||
}
|
|
||||||
resolved.append(part);
|
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -50,10 +63,6 @@ public class ObjectPath {
|
||||||
try {
|
try {
|
||||||
int index = Integer.parseInt(part);
|
int index = Integer.parseInt(part);
|
||||||
ctx = Array.get(ctx, index);
|
ctx = Array.get(ctx, index);
|
||||||
if (resolved.length() != 0) {
|
|
||||||
resolved.append(".");
|
|
||||||
}
|
|
||||||
resolved.append(part);
|
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
|
@ -1,20 +1,34 @@
|
||||||
/*
|
/*
|
||||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* or more contributor license agreements. Licensed under the Elastic License;
|
* license agreements. See the NOTICE file distributed with
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.core.watcher.common.xcontent;
|
|
||||||
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
package org.elasticsearch.common.xcontent;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class XContentUtils {
|
public final class XContentUtils {
|
||||||
|
|
||||||
private XContentUtils() {
|
private XContentUtils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO open this up in core
|
/**
|
||||||
|
* Convert a {@link XContentParser.Token} to a value
|
||||||
|
*/
|
||||||
public static Object readValue(XContentParser parser, XContentParser.Token token) throws IOException {
|
public static Object readValue(XContentParser parser, XContentParser.Token token) throws IOException {
|
||||||
if (token == XContentParser.Token.VALUE_NULL) {
|
if (token == XContentParser.Token.VALUE_NULL) {
|
||||||
return null;
|
return null;
|
|
@ -1,12 +1,25 @@
|
||||||
/*
|
/*
|
||||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* or more contributor license agreements. Licensed under the Elastic License;
|
* license agreements. See the NOTICE file distributed with
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.watcher.support.xcontent;
|
|
||||||
|
package org.elasticsearch.common.xcontent;
|
||||||
|
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -18,23 +31,23 @@ import static java.util.Collections.singletonMap;
|
||||||
import static org.hamcrest.CoreMatchers.nullValue;
|
import static org.hamcrest.CoreMatchers.nullValue;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
|
||||||
public class MapPathTests extends ESTestCase {
|
public class ObjectPathTests extends ESTestCase {
|
||||||
public void testEval() throws Exception {
|
public void testEval() {
|
||||||
Map<String, Object> map = singletonMap("key", "value");
|
Map<String, Object> map = singletonMap("key", "value");
|
||||||
|
|
||||||
assertThat(ObjectPath.eval("key", map), is((Object) "value"));
|
assertThat(ObjectPath.eval("key", map), is((Object) "value"));
|
||||||
assertThat(ObjectPath.eval("key1", map), nullValue());
|
assertThat(ObjectPath.eval("key1", map), nullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEvalList() throws Exception {
|
public void testEvalList() {
|
||||||
List list = Arrays.asList(1, 2, 3, 4);
|
List<Integer> list = Arrays.asList(1, 2, 3, 4);
|
||||||
Map<String, Object> map = singletonMap("key", list);
|
Map<String, Object> map = singletonMap("key", list);
|
||||||
|
|
||||||
int index = randomInt(3);
|
int index = randomInt(3);
|
||||||
assertThat(ObjectPath.eval("key." + index, map), is(list.get(index)));
|
assertThat(ObjectPath.eval("key." + index, map), is(list.get(index)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEvalArray() throws Exception {
|
public void testEvalArray() {
|
||||||
int[] array = new int[] { 1, 2, 3, 4 };
|
int[] array = new int[] { 1, 2, 3, 4 };
|
||||||
Map<String, Object> map = singletonMap("key", array);
|
Map<String, Object> map = singletonMap("key", array);
|
||||||
|
|
||||||
|
@ -42,13 +55,13 @@ public class MapPathTests extends ESTestCase {
|
||||||
assertThat(((Number) ObjectPath.eval("key." + index, map)).intValue(), is(array[index]));
|
assertThat(((Number) ObjectPath.eval("key." + index, map)).intValue(), is(array[index]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEvalMap() throws Exception {
|
public void testEvalMap() {
|
||||||
Map<String, Object> map = singletonMap("a", singletonMap("b", "val"));
|
Map<String, Object> map = singletonMap("a", singletonMap("b", "val"));
|
||||||
|
|
||||||
assertThat(ObjectPath.eval("a.b", map), is((Object) "val"));
|
assertThat(ObjectPath.eval("a.b", map), is((Object) "val"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEvalMixed() throws Exception {
|
public void testEvalMixed() {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
Map<String, Object> mapA = new HashMap<>();
|
Map<String, Object> mapA = new HashMap<>();
|
|
@ -12,11 +12,12 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
|
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
|
||||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||||
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.common.xcontent.ToXContent;
|
import org.elasticsearch.common.xcontent.ToXContent;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.xpack.core.watcher.common.xcontent.XContentUtils;
|
import org.elasticsearch.common.xcontent.XContentUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.xpack.core.watcher.condition.ExecutableCondition;
|
import org.elasticsearch.xpack.core.watcher.condition.ExecutableCondition;
|
||||||
import org.elasticsearch.xpack.core.watcher.execution.WatchExecutionContext;
|
import org.elasticsearch.xpack.core.watcher.execution.WatchExecutionContext;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.WatcherDateTimeUtils;
|
import org.elasticsearch.xpack.core.watcher.support.WatcherDateTimeUtils;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.xpack.watcher.support.Variables;
|
import org.elasticsearch.xpack.watcher.support.Variables;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.DateTimeZone;
|
import org.joda.time.DateTimeZone;
|
||||||
|
|
|
@ -8,8 +8,8 @@ package org.elasticsearch.xpack.watcher.condition;
|
||||||
import org.elasticsearch.ElasticsearchParseException;
|
import org.elasticsearch.ElasticsearchParseException;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.core.watcher.common.xcontent.XContentUtils;
|
import org.elasticsearch.common.xcontent.XContentUtils;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Clock;
|
import java.time.Clock;
|
||||||
|
|
|
@ -8,8 +8,8 @@ package org.elasticsearch.xpack.watcher.condition;
|
||||||
import org.elasticsearch.ElasticsearchParseException;
|
import org.elasticsearch.ElasticsearchParseException;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.core.watcher.common.xcontent.XContentUtils;
|
import org.elasticsearch.common.xcontent.XContentUtils;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Clock;
|
import java.time.Clock;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.elasticsearch.ElasticsearchParseException;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine;
|
import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.elasticsearch.xpack.core.XPackFeatureSet;
|
||||||
import org.elasticsearch.xpack.core.watcher.WatcherFeatureSetUsage;
|
import org.elasticsearch.xpack.core.watcher.WatcherFeatureSetUsage;
|
||||||
import org.elasticsearch.xpack.core.watcher.WatcherMetaData;
|
import org.elasticsearch.xpack.core.watcher.WatcherMetaData;
|
||||||
import org.elasticsearch.xpack.core.watcher.common.stats.Counters;
|
import org.elasticsearch.xpack.core.watcher.common.stats.Counters;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.XContentSource;
|
import org.elasticsearch.xpack.core.watcher.support.xcontent.XContentSource;
|
||||||
import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsAction;
|
import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsAction;
|
||||||
import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsResponse;
|
import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsResponse;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.elasticsearch.search.sort.SortBuilders;
|
||||||
import org.elasticsearch.search.sort.SortOrder;
|
import org.elasticsearch.search.sort.SortOrder;
|
||||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||||
import org.elasticsearch.xpack.core.watcher.history.HistoryStoreField;
|
import org.elasticsearch.xpack.core.watcher.history.HistoryStoreField;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase;
|
import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.elasticsearch.xpack.core.watcher.actions.Action;
|
||||||
import org.elasticsearch.xpack.core.watcher.client.WatchSourceBuilder;
|
import org.elasticsearch.xpack.core.watcher.client.WatchSourceBuilder;
|
||||||
import org.elasticsearch.xpack.core.watcher.execution.ActionExecutionMode;
|
import org.elasticsearch.xpack.core.watcher.execution.ActionExecutionMode;
|
||||||
import org.elasticsearch.xpack.core.watcher.execution.ExecutionState;
|
import org.elasticsearch.xpack.core.watcher.execution.ExecutionState;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchRequestBuilder;
|
import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchRequestBuilder;
|
||||||
import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchResponse;
|
import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchResponse;
|
||||||
import org.elasticsearch.xpack.core.watcher.watch.Watch;
|
import org.elasticsearch.xpack.core.watcher.watch.Watch;
|
||||||
|
|
|
@ -53,7 +53,7 @@ import org.elasticsearch.xpack.core.watcher.execution.Wid;
|
||||||
import org.elasticsearch.xpack.core.watcher.history.WatchRecord;
|
import org.elasticsearch.xpack.core.watcher.history.WatchRecord;
|
||||||
import org.elasticsearch.xpack.core.watcher.input.ExecutableInput;
|
import org.elasticsearch.xpack.core.watcher.input.ExecutableInput;
|
||||||
import org.elasticsearch.xpack.core.watcher.input.Input;
|
import org.elasticsearch.xpack.core.watcher.input.Input;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.xpack.core.watcher.transform.ExecutableTransform;
|
import org.elasticsearch.xpack.core.watcher.transform.ExecutableTransform;
|
||||||
import org.elasticsearch.xpack.core.watcher.transform.Transform;
|
import org.elasticsearch.xpack.core.watcher.transform.Transform;
|
||||||
import org.elasticsearch.xpack.core.watcher.trigger.TriggerEvent;
|
import org.elasticsearch.xpack.core.watcher.trigger.TriggerEvent;
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.elasticsearch.test.http.MockResponse;
|
||||||
import org.elasticsearch.test.http.MockWebServer;
|
import org.elasticsearch.test.http.MockWebServer;
|
||||||
import org.elasticsearch.xpack.core.watcher.execution.ExecutionState;
|
import org.elasticsearch.xpack.core.watcher.execution.ExecutionState;
|
||||||
import org.elasticsearch.xpack.core.watcher.history.HistoryStoreField;
|
import org.elasticsearch.xpack.core.watcher.history.HistoryStoreField;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.xpack.watcher.common.http.HttpMethod;
|
import org.elasticsearch.xpack.watcher.common.http.HttpMethod;
|
||||||
import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate;
|
import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate;
|
||||||
import org.elasticsearch.xpack.watcher.condition.InternalAlwaysCondition;
|
import org.elasticsearch.xpack.watcher.condition.InternalAlwaysCondition;
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.xpack.core.watcher.execution.WatchExecutionContext;
|
import org.elasticsearch.xpack.core.watcher.execution.WatchExecutionContext;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.WatcherParams;
|
import org.elasticsearch.xpack.core.watcher.support.xcontent.WatcherParams;
|
||||||
import org.elasticsearch.xpack.core.watcher.watch.Payload;
|
import org.elasticsearch.xpack.core.watcher.watch.Payload;
|
||||||
import org.elasticsearch.xpack.watcher.common.http.HttpClient;
|
import org.elasticsearch.xpack.watcher.common.http.HttpClient;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.elasticsearch.common.collect.MapBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
|
@ -8,7 +8,7 @@ package org.elasticsearch.xpack.watcher.support;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.xpack.core.watcher.execution.WatchExecutionContext;
|
import org.elasticsearch.xpack.core.watcher.execution.WatchExecutionContext;
|
||||||
import org.elasticsearch.xpack.core.watcher.execution.Wid;
|
import org.elasticsearch.xpack.core.watcher.execution.Wid;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.xpack.core.watcher.trigger.TriggerEvent;
|
import org.elasticsearch.xpack.core.watcher.trigger.TriggerEvent;
|
||||||
import org.elasticsearch.xpack.core.watcher.watch.Payload;
|
import org.elasticsearch.xpack.core.watcher.watch.Payload;
|
||||||
import org.elasticsearch.xpack.watcher.test.WatcherTestUtils;
|
import org.elasticsearch.xpack.watcher.test.WatcherTestUtils;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.protocol.xpack.watcher.PutWatchResponse;
|
import org.elasticsearch.protocol.xpack.watcher.PutWatchResponse;
|
||||||
import org.elasticsearch.xpack.core.watcher.client.WatcherClient;
|
import org.elasticsearch.xpack.core.watcher.client.WatcherClient;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.XContentSource;
|
import org.elasticsearch.xpack.core.watcher.support.xcontent.XContentSource;
|
||||||
import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchResponse;
|
import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchResponse;
|
||||||
import org.elasticsearch.xpack.watcher.condition.ScriptCondition;
|
import org.elasticsearch.xpack.watcher.condition.ScriptCondition;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.elasticsearch.action.search.SearchResponse;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.xpack.core.watcher.execution.ActionExecutionMode;
|
import org.elasticsearch.xpack.core.watcher.execution.ActionExecutionMode;
|
||||||
import org.elasticsearch.xpack.core.watcher.history.HistoryStoreField;
|
import org.elasticsearch.xpack.core.watcher.history.HistoryStoreField;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchResponse;
|
import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchResponse;
|
||||||
import org.elasticsearch.xpack.core.watcher.trigger.TriggerEvent;
|
import org.elasticsearch.xpack.core.watcher.trigger.TriggerEvent;
|
||||||
import org.elasticsearch.xpack.watcher.actions.logging.LoggingAction;
|
import org.elasticsearch.xpack.watcher.actions.logging.LoggingAction;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.elasticsearch.protocol.xpack.watcher.PutWatchResponse;
|
||||||
import org.elasticsearch.test.http.MockResponse;
|
import org.elasticsearch.test.http.MockResponse;
|
||||||
import org.elasticsearch.test.http.MockWebServer;
|
import org.elasticsearch.test.http.MockWebServer;
|
||||||
import org.elasticsearch.xpack.core.watcher.history.HistoryStoreField;
|
import org.elasticsearch.xpack.core.watcher.history.HistoryStoreField;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse;
|
import org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse;
|
||||||
import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchResponse;
|
import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchResponse;
|
||||||
import org.elasticsearch.xpack.core.watcher.transport.actions.get.GetWatchResponse;
|
import org.elasticsearch.xpack.core.watcher.transport.actions.get.GetWatchResponse;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.elasticsearch.test.StreamsUtils;
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.upgrades.AbstractFullClusterRestartTestCase;
|
import org.elasticsearch.upgrades.AbstractFullClusterRestartTestCase;
|
||||||
import org.elasticsearch.xpack.core.watcher.client.WatchSourceBuilder;
|
import org.elasticsearch.xpack.core.watcher.client.WatchSourceBuilder;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.elasticsearch.xpack.security.support.SecurityIndexManager;
|
import org.elasticsearch.xpack.security.support.SecurityIndexManager;
|
||||||
import org.elasticsearch.xpack.test.rest.XPackRestTestHelper;
|
import org.elasticsearch.xpack.test.rest.XPackRestTestHelper;
|
||||||
import org.elasticsearch.xpack.watcher.actions.logging.LoggingAction;
|
import org.elasticsearch.xpack.watcher.actions.logging.LoggingAction;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||||
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||||
import org.elasticsearch.rest.RestStatus;
|
import org.elasticsearch.rest.RestStatus;
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.elasticsearch.common.Booleans;
|
||||||
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||||
import org.elasticsearch.rest.RestStatus;
|
import org.elasticsearch.rest.RestStatus;
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
|
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||||
import org.hamcrest.Matcher;
|
import org.hamcrest.Matcher;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
Loading…
Reference in New Issue