Merge branch 'master' into feature/sql_2

Original commit: elastic/x-pack-elasticsearch@ec3a82494e
This commit is contained in:
Nik Everett 2018-01-30 12:50:27 -05:00
commit 6631fe0376
140 changed files with 1400 additions and 857 deletions

View File

@ -1,14 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.ml;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
public interface MachineLearningClientActionPlugin {
}

View File

@ -7,6 +7,7 @@ package org.elasticsearch.xpack.core.security.authc.support.mapper;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -99,7 +100,8 @@ public class ExpressionRoleMapping implements ToXContentObject, Writeable {
/**
* The expression that determines whether the roles in this mapping should be applied to any given user.
* If the expression {@link RoleMapperExpression#match(Map) matches} a
* If the expression
* {@link RoleMapperExpression#match(org.elasticsearch.xpack.security.authc.support.mapper.expressiondsl.ExpressionModel) matches} a
* org.elasticsearch.xpack.security.authc.support.UserRoleMapper.UserData user, then the user should be assigned this mapping's
* {@link #getRoles() roles}
*/
@ -133,7 +135,7 @@ public class ExpressionRoleMapping implements ToXContentObject, Writeable {
@Override
public String toString() {
return getClass().getSimpleName() + "<" + name + " ; " + roles + " = " + expression + ">";
return getClass().getSimpleName() + "<" + name + " ; " + roles + " = " + Strings.toString(expression) + ">";
}
/**

View File

@ -8,7 +8,6 @@ package org.elasticsearch.xpack.core.security.authc.support.mapper.expressiondsl
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -45,8 +44,8 @@ public final class AllExpression implements RoleMapperExpression {
}
@Override
public boolean match(Map<String, Object> object) {
return elements.stream().allMatch(RoleMapperExpression.predicate(object));
public boolean match(ExpressionModel model) {
return elements.stream().allMatch(RoleMapperExpression.predicate(model));
}
public List<RoleMapperExpression> getElements() {

View File

@ -8,7 +8,6 @@ package org.elasticsearch.xpack.core.security.authc.support.mapper.expressiondsl
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -45,8 +44,8 @@ public final class AnyExpression implements RoleMapperExpression {
}
@Override
public boolean match(Map<String, Object> object) {
return elements.stream().anyMatch(RoleMapperExpression.predicate(object));
public boolean match(ExpressionModel model) {
return elements.stream().anyMatch(RoleMapperExpression.predicate(model));
}
public List<RoleMapperExpression> getElements() {

View File

@ -6,7 +6,6 @@
package org.elasticsearch.xpack.core.security.authc.support.mapper.expressiondsl;
import java.io.IOException;
import java.util.Map;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -44,8 +43,8 @@ public final class ExceptExpression implements RoleMapperExpression {
}
@Override
public boolean match(Map<String, Object> object) {
return !expression.match(object);
public boolean match(ExpressionModel model) {
return !expression.match(model);
}
@Override

View File

@ -0,0 +1,106 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.security.authc.support.mapper.expressiondsl;
import org.elasticsearch.common.Numbers;
import org.elasticsearch.common.collect.Tuple;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
/**
* Represents the "model" object to be evaluated within a {@link RoleMapperExpression}.
* The model is a flat object, where fields are defined by strings and value is either a
* string, boolean, or number, or a collection of the above.
*/
public class ExpressionModel {
public static final Predicate<FieldExpression.FieldValue> NULL_PREDICATE = field -> field.getValue() == null;
private Map<String, Tuple<Object, Predicate<FieldExpression.FieldValue>>> fields;
public ExpressionModel() {
this.fields = new HashMap<>();
}
/**
* Defines a field using a predicate that corresponds to the type of {@code value}
*
* @see #buildPredicate(Object)
*/
public ExpressionModel defineField(String name, Object value) {
return defineField(name, value, buildPredicate(value));
}
/**
* Defines a field using a supplied predicate.
*/
public ExpressionModel defineField(String name, Object value, Predicate<FieldExpression.FieldValue> predicate) {
this.fields.put(name, new Tuple<>(value, predicate));
return this;
}
/**
* Returns {@code true} if the named field, matches <em>any</em> of the provided values.
*/
public boolean test(String field, List<FieldExpression.FieldValue> values) {
final Tuple<Object, Predicate<FieldExpression.FieldValue>> tuple = this.fields.get(field);
final Predicate<FieldExpression.FieldValue> predicate;
if (tuple == null) {
predicate = NULL_PREDICATE;
} else {
predicate = tuple.v2();
}
return values.stream().anyMatch(predicate);
}
/**
* Constructs a {@link Predicate} that matches correctly based on the type of the provided parameter.
*/
static Predicate<FieldExpression.FieldValue> buildPredicate(Object object) {
if (object == null) {
return NULL_PREDICATE;
}
if (object instanceof Boolean) {
return field -> object.equals(field.getValue());
}
if (object instanceof Number) {
return field -> numberEquals((Number) object, field.getValue());
}
if (object instanceof String) {
return field -> field.getAutomaton() == null ? object.equals(field.getValue()) : field.getAutomaton().run((String) object);
}
if (object instanceof Collection) {
return ((Collection<?>) object).stream()
.map(element -> buildPredicate(element))
.reduce((a, b) -> a.or(b))
.orElse(fieldValue -> false);
}
throw new IllegalArgumentException("Unsupported value type " + object.getClass());
}
/**
* A comparison of {@link Number} objects that compares by floating point when either value is a {@link Float} or {@link Double}
* otherwise compares by {@link Numbers#toLongExact long}.
*/
private static boolean numberEquals(Number left, Object other) {
if (left.equals(other)) {
return true;
}
if ((other instanceof Number) == false) {
return false;
}
Number right = (Number) other;
if (left instanceof Double || left instanceof Float
|| right instanceof Double || right instanceof Float) {
return Double.compare(left.doubleValue(), right.doubleValue()) == 0;
}
return Numbers.toLongExact(left) == Numbers.toLongExact(right);
}
}

View File

@ -114,7 +114,7 @@ public final class ExpressionParser {
private RoleMapperExpression parseFieldExpression(XContentParser parser) throws IOException {
checkStartObject(parser);
final String fieldName = readFieldName(Fields.FIELD.getPreferredName(), parser);
final List<FieldExpression.FieldPredicate> values;
final List<FieldExpression.FieldValue> values;
if (parser.nextToken() == XContentParser.Token.START_ARRAY) {
values = parseArray(Fields.FIELD, parser, this::parseFieldValue);
} else {
@ -166,19 +166,19 @@ public final class ExpressionParser {
}
}
private FieldExpression.FieldPredicate parseFieldValue(XContentParser parser) throws IOException {
private FieldExpression.FieldValue parseFieldValue(XContentParser parser) throws IOException {
switch (parser.currentToken()) {
case VALUE_STRING:
return FieldExpression.FieldPredicate.create(parser.text());
return new FieldExpression.FieldValue(parser.text());
case VALUE_BOOLEAN:
return FieldExpression.FieldPredicate.create(parser.booleanValue());
return new FieldExpression.FieldValue(parser.booleanValue());
case VALUE_NUMBER:
return FieldExpression.FieldPredicate.create(parser.longValue());
return new FieldExpression.FieldValue(parser.longValue());
case VALUE_NULL:
return FieldExpression.FieldPredicate.create(null);
return new FieldExpression.FieldValue(null);
default:
throw new ElasticsearchParseException("failed to parse rules expression. expected a field value but found [{}] instead",

View File

@ -5,21 +5,19 @@
*/
package org.elasticsearch.xpack.core.security.authc.support.mapper.expressiondsl;
import org.elasticsearch.common.Numbers;
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.xpack.core.security.support.Automatons;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Predicate;
/**
* An expression that evaluates to <code>true</code> if a field (map element) matches
@ -31,9 +29,9 @@ public final class FieldExpression implements RoleMapperExpression {
public static final String NAME = "field";
private final String field;
private final List<FieldPredicate> values;
private final List<FieldValue> values;
public FieldExpression(String field, List<FieldPredicate> values) {
public FieldExpression(String field, List<FieldValue> values) {
if (field == null || field.isEmpty()) {
throw new IllegalArgumentException("null or empty field name (" + field + ")");
}
@ -45,7 +43,7 @@ public final class FieldExpression implements RoleMapperExpression {
}
public FieldExpression(StreamInput in) throws IOException {
this(in.readString(), in.readList(FieldPredicate::readFrom));
this(in.readString(), in.readList(FieldValue::readFrom));
}
@Override
@ -60,24 +58,15 @@ public final class FieldExpression implements RoleMapperExpression {
}
@Override
public boolean match(Map<String, Object> object) {
final Object fieldValue = object.get(field);
if (fieldValue instanceof Collection) {
return ((Collection) fieldValue).stream().anyMatch(this::matchValue);
} else {
return matchValue(fieldValue);
}
}
private boolean matchValue(Object fieldValue) {
return values.stream().anyMatch(predicate -> predicate.test(fieldValue));
public boolean match(ExpressionModel model) {
return model.test(field, values);
}
public String getField() {
return field;
}
public List<Predicate<Object>> getValues() {
public List<FieldValue> getValues() {
return Collections.unmodifiableList(values);
}
@ -107,7 +96,7 @@ public final class FieldExpression implements RoleMapperExpression {
values.get(0).toXContent(builder, params);
} else {
builder.startArray(this.field);
for (FieldPredicate fp : values) {
for (FieldValue fp : values) {
fp.toXContent(builder, params);
}
builder.endArray();
@ -116,60 +105,40 @@ public final class FieldExpression implements RoleMapperExpression {
return builder.endObject();
}
/**
* A special predicate for matching values in a {@link FieldExpression}. This interface
* exists to support the serialisation ({@link ToXContent}, {@link Writeable}) of <em>field</em>
* expressions.
*/
public static class FieldPredicate implements Predicate<Object>, ToXContent, Writeable {
public static class FieldValue implements ToXContent, Writeable {
private final Object value;
private final Predicate<Object> predicate;
@Nullable
private final CharacterRunAutomaton automaton;
private FieldPredicate(Object value, Predicate<Object> predicate) {
public FieldValue(Object value) {
this.value = value;
this.predicate = predicate;
this.automaton = buildAutomaton(value);
}
@Override
public boolean test(Object o) {
return this.predicate.test(o);
private static CharacterRunAutomaton buildAutomaton(Object value) {
if (value instanceof String) {
final String str = (String) value;
if (Regex.isSimpleMatchPattern(str) || isLuceneRegex(str)) {
return new CharacterRunAutomaton(Automatons.patterns(str));
}
}
return null;
}
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params)
throws IOException {
return builder.value(value);
private static boolean isLuceneRegex(String str) {
return str.length() > 1 && str.charAt(0) == '/' && str.charAt(str.length() - 1) == '/';
}
/**
* Create an appropriate predicate based on the type and value of the argument.
* The predicate is formed according to the following rules:
* <ul>
* <li>If <code>value</code> is <code>null</code>, then the predicate evaluates to
* <code>true</code> <em>if-and-only-if</em> the predicate-argument is
* <code>null</code></li>
* <li>If <code>value</code> is a {@link Boolean}, then the predicate
* evaluates to <code>true</code> <em>if-and-only-if</em> the predicate-argument is
* an {@link Boolean#equals(Object) equal} <code>Boolean</code></li>
* <li>If <code>value</code> is a {@link Number}, then the predicate
* evaluates to <code>true</code> <em>if-and-only-if</em> the predicate-argument is
* numerically equal to <code>value</code>. This class makes a best-effort to determine
* numeric equality across different implementations of <code>Number</code>, but the
* implementation can only be guaranteed for standard integral representations (
* <code>Long</code>, <code>Integer</code>, etc)</li>
* <li>If <code>value</code> is a {@link String}, then it is treated as a
* {@link org.apache.lucene.util.automaton.Automaton Lucene automaton} pattern with
* {@link Automatons#predicate(String...) corresponding predicate}.
* </li>
* </ul>
*/
public static FieldPredicate create(Object value) {
Predicate<Object> predicate = buildPredicate(value);
return new FieldPredicate(value, predicate);
public Object getValue() {
return value;
}
public static FieldPredicate readFrom(StreamInput in) throws IOException {
return create(in.readGenericValue());
public CharacterRunAutomaton getAutomaton() {
return automaton;
}
public static FieldValue readFrom(StreamInput in) throws IOException {
return new FieldValue(in.readGenericValue());
}
@Override
@ -177,41 +146,9 @@ public final class FieldExpression implements RoleMapperExpression {
out.writeGenericValue(value);
}
private static Predicate<Object> buildPredicate(Object object) {
if (object == null) {
return Objects::isNull;
}
if (object instanceof Boolean) {
return object::equals;
}
if (object instanceof Number) {
return (other) -> numberEquals((Number) object, other);
}
if (object instanceof String) {
final String str = (String) object;
if (str.isEmpty()) {
return obj -> String.valueOf(obj).isEmpty();
} else {
final Predicate<String> predicate = Automatons.predicate(str);
return obj -> predicate.test(String.valueOf(obj));
}
}
throw new IllegalArgumentException("Unsupported value type " + object.getClass());
}
private static boolean numberEquals(Number left, Object other) {
if (left.equals(other)) {
return true;
}
if ((other instanceof Number) == false) {
return false;
}
Number right = (Number) other;
if (left instanceof Double || left instanceof Float
|| right instanceof Double || right instanceof Float) {
return Double.compare(left.doubleValue(), right.doubleValue()) == 0;
}
return Numbers.toLongExact(left) == Numbers.toLongExact(right);
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
return builder.value(value);
}
}

View File

@ -5,27 +5,27 @@
*/
package org.elasticsearch.xpack.core.security.authc.support.mapper.expressiondsl;
import java.util.Map;
import java.util.function.Predicate;
import org.elasticsearch.common.io.stream.NamedWriteable;
import org.elasticsearch.common.xcontent.ToXContentObject;
import java.util.function.Predicate;
/**
* Implementations of this interface represent an expression over a simple object that resolves to
* a boolean value. The "simple object" is implemented as a (flattened) {@link Map}.
* a boolean value. The "simple object" is provided as a {@link ExpressionModel}.
*/
public interface RoleMapperExpression extends ToXContentObject, NamedWriteable {
/**
* Determines whether this expression matches against the provided object.
* @param model
*/
boolean match(Map<String, Object> object);
boolean match(ExpressionModel model);
/**
* Adapt this expression to a standard {@link Predicate}
*/
default Predicate<Map<String, Object>> asPredicate() {
default Predicate<ExpressionModel> asPredicate() {
return this::match;
}
@ -34,7 +34,7 @@ public interface RoleMapperExpression extends ToXContentObject, NamedWriteable {
* a fixed object. Its purpose is for cases where there is a {@link java.util.stream.Stream} of
* expressions, that need to be filtered against a single map.
*/
static Predicate<RoleMapperExpression> predicate(Map<String, Object> map) {
static Predicate<RoleMapperExpression> predicate(ExpressionModel map) {
return expr -> expr.match(map);
}

View File

@ -0,0 +1,44 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.xpack.core.ml.action.CloseJobAction.Request;
public class CloseJobActionRequestTests extends AbstractStreamableXContentTestCase<Request> {
@Override
protected Request createTestInstance() {
Request request = new Request(randomAlphaOfLengthBetween(1, 20));
if (randomBoolean()) {
request.setCloseTimeout(TimeValue.timeValueMillis(randomNonNegativeLong()));
}
if (randomBoolean()) {
request.setForce(randomBoolean());
}
if (randomBoolean()) {
request.setAllowNoJobs(randomBoolean());
}
return request;
}
@Override
protected boolean supportsUnknownFields() {
return false;
}
@Override
protected Request createBlankInstance() {
return new Request();
}
@Override
protected Request doParseInstance(XContentParser parser) {
return Request.parseRequest(null, parser);
}
}

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.CloseJobAction.Response;

View File

@ -3,10 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.DeleteCalendarEventAction;
import org.elasticsearch.xpack.core.ml.action.DeleteCalendarEventAction.Request;
public class DeleteCalendarEventActionRequestTests extends AbstractStreamableTestCase<DeleteCalendarEventAction.Request> {

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.DeleteDatafeedAction.Request;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.DeleteExpiredDataAction.Response;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.DeleteJobAction;

View File

@ -0,0 +1,64 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.xpack.core.ml.action.ForecastJobAction.Request;
import static org.hamcrest.Matchers.equalTo;
public class ForecastJobActionRequestTests extends AbstractStreamableXContentTestCase<Request> {
@Override
protected Request doParseInstance(XContentParser parser) {
return Request.parseRequest(null, parser);
}
@Override
protected boolean supportsUnknownFields() {
return false;
}
@Override
protected Request createTestInstance() {
Request request = new Request(randomAlphaOfLengthBetween(1, 20));
if (randomBoolean()) {
request.setDuration(TimeValue.timeValueSeconds(randomIntBetween(1, 1_000_000)).getStringRep());
}
if (randomBoolean()) {
request.setExpiresIn(TimeValue.timeValueSeconds(randomIntBetween(0, 1_000_000)).getStringRep());
}
return request;
}
@Override
protected Request createBlankInstance() {
return new Request();
}
public void testSetDuration_GivenZero() {
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new Request().setDuration("0"));
assertThat(e.getMessage(), equalTo("[duration] must be positive: [0ms]"));
}
public void testSetDuration_GivenNegative() {
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new Request().setDuration("-1s"));
assertThat(e.getMessage(), equalTo("[duration] must be positive: [-1]"));
}
public void testSetExpiresIn_GivenZero() {
Request request = new Request();
request.setExpiresIn("0");
assertThat(request.getExpiresIn(), equalTo(TimeValue.ZERO));
}
public void testSetExpiresIn_GivenNegative() {
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new Request().setExpiresIn("-1s"));
assertThat(e.getMessage(), equalTo("[expires_in] must be non-negative: [-1]"));
}
}

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.ForecastJobAction.Response;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;

View File

@ -3,10 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.GetBucketsAction;
import org.elasticsearch.xpack.core.ml.action.GetBucketsAction.Response;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.job.results.AnomalyRecord;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.common.xcontent.XContentParser;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;

View File

@ -3,10 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.GetCategoriesAction;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.job.results.CategoryDefinition;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.common.io.stream.Writeable;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.node.DiscoveryNode;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.common.io.stream.Writeable;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.Settings;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.GetFiltersAction;

View File

@ -3,10 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.GetFiltersAction;
import org.elasticsearch.xpack.core.ml.action.GetFiltersAction.Response;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.job.config.MlFilter;

View File

@ -3,11 +3,10 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.xpack.core.ml.action.GetInfluencersAction;
import org.elasticsearch.xpack.core.ml.action.GetInfluencersAction.Request;
import org.elasticsearch.xpack.core.ml.action.util.PageParams;

View File

@ -3,10 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.GetInfluencersAction;
import org.elasticsearch.xpack.core.ml.action.GetInfluencersAction.Response;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.job.results.Influencer;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.test.AbstractStreamableTestCase;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.node.DiscoveryNode;
@ -15,7 +15,7 @@ import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.job.config.Job;
import org.elasticsearch.xpack.core.ml.job.config.JobState;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.DataCounts;
import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCountsTests;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.DataCountsTests;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSizeStats;
import java.net.InetAddress;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.common.io.stream.Writeable;

View File

@ -3,10 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.GetJobsAction;
import org.elasticsearch.xpack.core.ml.action.GetJobsAction.Response;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.job.config.Job;

View File

@ -3,11 +3,10 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.xpack.core.ml.action.GetModelSnapshotsAction;
import org.elasticsearch.xpack.core.ml.action.GetModelSnapshotsAction.Request;
import org.elasticsearch.xpack.core.ml.action.util.PageParams;

View File

@ -3,14 +3,13 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.GetModelSnapshotsAction;
import org.elasticsearch.xpack.core.ml.action.GetModelSnapshotsAction.Response;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSnapshot;
import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshotTests;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSnapshotTests;
import java.util.ArrayList;
import java.util.List;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.GetOverallBucketsAction.Response;

View File

@ -3,11 +3,10 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.xpack.core.ml.action.GetRecordsAction;
import org.elasticsearch.xpack.core.ml.action.GetRecordsAction.Request;
import org.elasticsearch.xpack.core.ml.action.util.PageParams;

View File

@ -3,10 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.GetRecordsAction;
import org.elasticsearch.xpack.core.ml.action.GetRecordsAction.Response;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.job.results.AnomalyRecord;

View File

@ -3,12 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.xpack.core.ml.action.OpenJobAction;
import org.elasticsearch.xpack.core.ml.action.OpenJobAction.Request;
public class OpenJobActionRequestTests extends AbstractStreamableXContentTestCase<Request> {

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.common.Strings;

View File

@ -3,12 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.PostDataAction;
import org.elasticsearch.xpack.core.ml.job.config.DataDescription;
import org.elasticsearch.xpack.core.ml.job.config.DataDescription.DataFormat;

View File

@ -3,12 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.PostDataAction;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.DataCounts;
import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCountsTests;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.DataCountsTests;
public class PostDataActionResponseTests extends AbstractStreamableTestCase<PostDataAction.Response> {

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.FlushJobAction.Request;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.FlushJobAction.Response;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.PreviewDatafeedAction.Request;

View File

@ -3,13 +3,12 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.xpack.core.ml.action.PutCalendarAction;
import org.elasticsearch.xpack.core.ml.calendars.CalendarTests;
import org.elasticsearch.xpack.core.ml.job.config.JobTests;
import org.elasticsearch.xpack.ml.calendars.CalendarTests;
public class PutCalendarActionRequestTests extends AbstractStreamableXContentTestCase<PutCalendarAction.Request> {

View File

@ -3,11 +3,10 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.PutCalendarAction;
import org.elasticsearch.xpack.ml.calendars.CalendarTests;
import org.elasticsearch.xpack.core.ml.calendars.CalendarTests;
public class PutCalendarActionResponseTests extends AbstractStreamableTestCase<PutCalendarAction.Response> {

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.Settings;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.Settings;

View File

@ -3,11 +3,10 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.xpack.core.ml.action.PutFilterAction;
import org.elasticsearch.xpack.core.ml.action.PutFilterAction.Request;
import org.elasticsearch.xpack.core.ml.job.config.MlFilter;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.XContentHelper;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.PutJobAction.Response;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;

View File

@ -3,12 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.RevertModelSnapshotAction;
import org.elasticsearch.xpack.core.ml.action.RevertModelSnapshotAction.Response;
import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshotTests;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSnapshotTests;
public class RevertModelSnapshotActionResponseTests extends AbstractStreamableTestCase<RevertModelSnapshotAction.Response> {

View File

@ -0,0 +1,44 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.xpack.core.ml.action.StopDatafeedAction.Request;
public class StopDatafeedActionRequestTests extends AbstractStreamableXContentTestCase<Request> {
@Override
protected Request createTestInstance() {
Request request = new Request(randomAlphaOfLengthBetween(1, 20));
if (randomBoolean()) {
request.setStopTimeout(TimeValue.timeValueMillis(randomNonNegativeLong()));
}
if (randomBoolean()) {
request.setForce(randomBoolean());
}
if (randomBoolean()) {
request.setAllowNoDatafeeds(randomBoolean());
}
return request;
}
@Override
protected boolean supportsUnknownFields() {
return false;
}
@Override
protected Request createBlankInstance() {
return new Request();
}
@Override
protected Request doParseInstance(XContentParser parser) {
return Request.parseRequest(null, parser);
}
}

View File

@ -3,10 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.UpdateCalendarJobAction;
public class UpdateCalendarJobActionResquestTests extends AbstractStreamableTestCase<UpdateCalendarJobAction.Request> {

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.Settings;

View File

@ -3,10 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.UpdateJobAction;
import org.elasticsearch.xpack.core.ml.job.config.AnalysisLimits;
import org.elasticsearch.xpack.core.ml.job.config.JobUpdate;

View File

@ -3,11 +3,10 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.xpack.core.ml.action.UpdateModelSnapshotAction;
import org.elasticsearch.xpack.core.ml.action.UpdateModelSnapshotAction.Request;
public class UpdateModelSnapshotActionRequestTests

View File

@ -3,12 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.UpdateModelSnapshotAction;
import org.elasticsearch.xpack.core.ml.action.UpdateModelSnapshotAction.Response;
import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshotTests;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSnapshotTests;
public class UpdateModelSnapshotActionResponseTests
extends AbstractStreamableTestCase<UpdateModelSnapshotAction.Response> {

View File

@ -3,13 +3,12 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.test.AbstractStreamableTestCase;
import org.elasticsearch.xpack.core.ml.action.UpdateProcessAction;
import org.elasticsearch.xpack.core.ml.job.config.JobUpdate;
import org.elasticsearch.xpack.core.ml.job.config.MlFilter;
import org.elasticsearch.xpack.ml.job.config.MlFilterTests;
import org.elasticsearch.xpack.core.ml.job.config.MlFilterTests;
import org.elasticsearch.xpack.core.ml.job.config.ModelPlotConfig;
import java.util.ArrayList;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action;
package org.elasticsearch.xpack.core.ml.action;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.ToXContent;

View File

@ -3,12 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action.util;
package org.elasticsearch.xpack.core.ml.action.util;
import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractSerializingTestCase;
import org.elasticsearch.xpack.core.ml.action.util.PageParams;
import java.io.IOException;

View File

@ -3,12 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.action.util;
package org.elasticsearch.xpack.core.ml.action.util;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.test.AbstractWireSerializingTestCase;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.job.results.Influencer;
import java.io.IOException;

View File

@ -3,12 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.calendars;
package org.elasticsearch.xpack.core.ml.calendars;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractSerializingTestCase;
import org.elasticsearch.xpack.core.ml.calendars.Calendar;
import org.elasticsearch.xpack.core.ml.job.config.JobTests;
import java.io.IOException;

View File

@ -5,26 +5,16 @@
*/
package org.elasticsearch.xpack.core.ml.integration;
import org.apache.http.HttpStatus;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksAction;
import org.elasticsearch.client.Response;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.rest.ESRestTestCase;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
public class MlRestTestStateCleaner {
private final Logger logger;

View File

@ -3,12 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.job.config;
package org.elasticsearch.xpack.core.ml.job.config;
import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractSerializingTestCase;
import org.elasticsearch.xpack.core.ml.job.config.MlFilter;
import java.util.ArrayList;
import java.util.Collections;

View File

@ -3,12 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.job.config;
package org.elasticsearch.xpack.core.ml.job.config;
import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractSerializingTestCase;
import org.elasticsearch.xpack.core.ml.job.config.ModelPlotConfig;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;

View File

@ -3,12 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.job.process.autodetect.state;
package org.elasticsearch.xpack.core.ml.job.process.autodetect.state;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractSerializingTestCase;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.DataCounts;
import org.joda.time.DateTime;
import java.util.Date;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.job.process.autodetect.state;
package org.elasticsearch.xpack.core.ml.job.process.autodetect.state;
import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.common.unit.TimeValue;

View File

@ -3,15 +3,12 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.job.process.autodetect.state;
package org.elasticsearch.xpack.core.ml.job.process.autodetect.state;
import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractSerializingTestCase;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSizeStats;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSnapshot;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.Quantiles;
import java.util.Arrays;
import java.util.Date;

View File

@ -3,13 +3,12 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ml.job.process.autodetect.state;
package org.elasticsearch.xpack.core.ml.job.process.autodetect.state;
import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractSerializingTestCase;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.Quantiles;
import java.util.Date;

View File

@ -0,0 +1,98 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.security.authc.support.mapper.expressiondsl;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.security.authc.support.mapper.expressiondsl.FieldExpression.FieldValue;
import java.math.BigInteger;
import java.util.function.Predicate;
import static org.hamcrest.Matchers.is;
public class ExpressionModelPredicateTests extends ESTestCase {
public void testNullValue() throws Exception {
final Predicate<FieldValue> predicate = ExpressionModel.buildPredicate(null);
assertThat(predicate.test(new FieldValue(null)), is(true));
assertThat(predicate.test(new FieldValue("")), is(false));
assertThat(predicate.test(new FieldValue(1)), is(false));
assertThat(predicate.test(new FieldValue(true)), is(false));
}
public void testBooleanValue() throws Exception {
final boolean matchValue = randomBoolean();
final Predicate<FieldValue> predicate = ExpressionModel.buildPredicate(matchValue);
assertThat(predicate.test(new FieldValue(matchValue)), is(true));
Object value = !matchValue;
assertThat(predicate.test(new FieldValue(value)), is(false));
assertThat(predicate.test(new FieldValue(String.valueOf(matchValue))), is(false));
assertThat(predicate.test(new FieldValue("")), is(false));
assertThat(predicate.test(new FieldValue(1)), is(false));
assertThat(predicate.test(new FieldValue(null)), is(false));
}
public void testLongValue() throws Exception {
final int intValue = randomInt();
final long longValue = intValue;
final Predicate<FieldValue> predicate = ExpressionModel.buildPredicate(longValue);
assertThat(predicate.test(new FieldValue(longValue)), is(true));
assertThat(predicate.test(new FieldValue(intValue)), is(true));
assertThat(predicate.test(new FieldValue(new BigInteger(String.valueOf(longValue)))), is(true));
assertThat(predicate.test(new FieldValue(longValue - 1)), is(false));
assertThat(predicate.test(new FieldValue(intValue + 1)), is(false));
assertThat(predicate.test(new FieldValue(String.valueOf(longValue))), is(false));
assertThat(predicate.test(new FieldValue("")), is(false));
assertThat(predicate.test(new FieldValue(true)), is(false));
assertThat(predicate.test(new FieldValue(null)), is(false));
}
public void testSimpleAutomatonValue() throws Exception {
final String prefix = randomAlphaOfLength(3);
FieldValue fieldValue = new FieldValue(prefix + "*");
assertThat(ExpressionModel.buildPredicate(prefix).test(fieldValue), is(true));
assertThat(ExpressionModel.buildPredicate(prefix + randomAlphaOfLengthBetween(1, 5)).test(fieldValue), is(true));
assertThat(ExpressionModel.buildPredicate("_" + prefix).test(fieldValue), is(false));
assertThat(ExpressionModel.buildPredicate(prefix.substring(0, 1)).test(fieldValue), is(false));
assertThat(ExpressionModel.buildPredicate("").test(fieldValue), is(false));
assertThat(ExpressionModel.buildPredicate(1).test(fieldValue), is(false));
assertThat(ExpressionModel.buildPredicate(true).test(fieldValue), is(false));
assertThat(ExpressionModel.buildPredicate(null).test(fieldValue), is(false));
}
public void testEmptyStringValue() throws Exception {
final Predicate<FieldValue> predicate = ExpressionModel.buildPredicate("");
assertThat(predicate.test(new FieldValue("")), is(true));
assertThat(predicate.test(new FieldValue(randomAlphaOfLengthBetween(1, 3))), is(false));
assertThat(predicate.test(new FieldValue(1)), is(false));
assertThat(predicate.test(new FieldValue(true)), is(false));
assertThat(predicate.test(new FieldValue(null)), is(false));
}
public void testRegexAutomatonValue() throws Exception {
final String substring = randomAlphaOfLength(5);
final FieldValue fieldValue = new FieldValue("/.*" + substring + ".*/");
assertThat(ExpressionModel.buildPredicate(substring).test(fieldValue), is(true));
assertThat(ExpressionModel.buildPredicate(randomAlphaOfLengthBetween(2, 4) + substring + randomAlphaOfLengthBetween(1, 5))
.test(fieldValue), is(true));
assertThat(ExpressionModel.buildPredicate(substring.substring(1, 3)).test(fieldValue), is(false));
assertThat(ExpressionModel.buildPredicate("").test(fieldValue), is(false));
assertThat(ExpressionModel.buildPredicate(1).test(fieldValue), is(false));
assertThat(ExpressionModel.buildPredicate(true).test(fieldValue), is(false));
assertThat(ExpressionModel.buildPredicate(null).test(fieldValue), is(false));
}
}

View File

@ -17,18 +17,17 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.XPackClientPlugin;
import org.elasticsearch.xpack.core.security.authc.support.mapper.expressiondsl.FieldExpression.FieldValue;
import org.elasticsearch.xpack.core.watcher.support.xcontent.XContentSource;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Predicate;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.iterableWithSize;
import static org.hamcrest.Matchers.notNullValue;
public class ExpressionParserTests extends ESTestCase {
@ -37,9 +36,11 @@ public class ExpressionParserTests extends ESTestCase {
FieldExpression field = checkExpressionType(parse(json), FieldExpression.class);
assertThat(field.getField(), equalTo("username"));
assertThat(field.getValues(), iterableWithSize(1));
final Predicate<Object> predicate = field.getValues().get(0);
assertThat(predicate.test("bob@shield.gov"), equalTo(true));
assertThat(predicate.test("bob@example.net"), equalTo(false));
final FieldValue value = field.getValues().get(0);
assertThat(value.getValue(), equalTo("*@shield.gov"));
assertThat(value.getAutomaton(), notNullValue());
assertThat(value.getAutomaton().run("bob@shield.gov"), equalTo(true));
assertThat(value.getAutomaton().run("bob@example.net"), equalTo(false));
assertThat(json(field), equalTo(json.replaceAll("\\s", "")));
}
@ -65,9 +66,11 @@ public class ExpressionParserTests extends ESTestCase {
FieldExpression.class);
assertThat(fieldShield.getField(), equalTo("username"));
assertThat(fieldShield.getValues(), iterableWithSize(1));
final Predicate<Object> predicateShield = fieldShield.getValues().get(0);
assertThat(predicateShield.test("fury@shield.gov"), equalTo(true));
assertThat(predicateShield.test("fury@shield.net"), equalTo(false));
final FieldValue valueShield = fieldShield.getValues().get(0);
assertThat(valueShield.getValue(), equalTo("*@shield.gov"));
assertThat(valueShield.getAutomaton(), notNullValue());
assertThat(valueShield.getAutomaton().run("fury@shield.gov"), equalTo(true));
assertThat(valueShield.getAutomaton().run("fury@shield.net"), equalTo(false));
final AllExpression all = checkExpressionType(any.getElements().get(1),
AllExpression.class);
@ -77,19 +80,17 @@ public class ExpressionParserTests extends ESTestCase {
FieldExpression.class);
assertThat(fieldAvengers.getField(), equalTo("username"));
assertThat(fieldAvengers.getValues(), iterableWithSize(1));
final Predicate<Object> predicateAvengers = fieldAvengers.getValues().get(0);
assertThat(predicateAvengers.test("stark@avengers.net"), equalTo(true));
assertThat(predicateAvengers.test("romanov@avengers.org"), equalTo(true));
assertThat(predicateAvengers.test("fury@shield.gov"), equalTo(false));
final FieldValue valueAvengers = fieldAvengers.getValues().get(0);
assertThat(valueAvengers.getAutomaton().run("stark@avengers.net"), equalTo(true));
assertThat(valueAvengers.getAutomaton().run("romanov@avengers.org"), equalTo(true));
assertThat(valueAvengers.getAutomaton().run("fury@shield.gov"), equalTo(false));
final FieldExpression fieldGroupsAdmin = checkExpressionType(all.getElements().get(1),
FieldExpression.class);
assertThat(fieldGroupsAdmin.getField(), equalTo("groups"));
assertThat(fieldGroupsAdmin.getValues(), iterableWithSize(2));
assertThat(fieldGroupsAdmin.getValues().get(0).test("admin"), equalTo(true));
assertThat(fieldGroupsAdmin.getValues().get(0).test("foo"), equalTo(false));
assertThat(fieldGroupsAdmin.getValues().get(1).test("operators"), equalTo(true));
assertThat(fieldGroupsAdmin.getValues().get(1).test("foo"), equalTo(false));
assertThat(fieldGroupsAdmin.getValues().get(0).getValue(), equalTo("admin"));
assertThat(fieldGroupsAdmin.getValues().get(1).getValue(), equalTo("operators"));
final ExceptExpression except = checkExpressionType(all.getElements().get(2),
ExceptExpression.class);
@ -97,26 +98,25 @@ public class ExpressionParserTests extends ESTestCase {
FieldExpression.class);
assertThat(fieldDisavowed.getField(), equalTo("groups"));
assertThat(fieldDisavowed.getValues(), iterableWithSize(1));
assertThat(fieldDisavowed.getValues().get(0).test("disavowed"), equalTo(true));
assertThat(fieldDisavowed.getValues().get(0).test("_disavowed_"), equalTo(false));
assertThat(fieldDisavowed.getValues().get(0).getValue(), equalTo("disavowed"));
Map<String, Object> hawkeye = new HashMap<>();
hawkeye.put("username", "hawkeye@avengers.org");
hawkeye.put("groups", Arrays.asList("operators"));
ExpressionModel hawkeye = new ExpressionModel();
hawkeye.defineField("username", "hawkeye@avengers.org");
hawkeye.defineField("groups", Arrays.asList("operators"));
assertThat(expr.match(hawkeye), equalTo(true));
Map<String, Object> captain = new HashMap<>();
captain.put("username", "america@avengers.net");
ExpressionModel captain = new ExpressionModel();
captain.defineField("username", "america@avengers.net");
assertThat(expr.match(captain), equalTo(false));
Map<String, Object> warmachine = new HashMap<>();
warmachine.put("username", "warmachine@avengers.net");
warmachine.put("groups", Arrays.asList("admin", "disavowed"));
ExpressionModel warmachine = new ExpressionModel();
warmachine.defineField("username", "warmachine@avengers.net");
warmachine.defineField("groups", Arrays.asList("admin", "disavowed"));
assertThat(expr.match(warmachine), equalTo(false));
Map<String, Object> fury = new HashMap<>();
fury.put("username", "fury@shield.gov");
fury.put("groups", Arrays.asList("classified", "directors"));
ExpressionModel fury = new ExpressionModel();
fury.defineField("username", "fury@shield.gov");
fury.defineField("groups", Arrays.asList("classified", "directors"));
assertThat(expr.asPredicate().test(fury), equalTo(true));
assertThat(json(expr), equalTo(json.replaceAll("\\s", "")));

View File

@ -15,7 +15,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.core.ml.action.GetBucketsAction;
import org.elasticsearch.xpack.core.ml.job.persistence.BucketsQueryBuilder;
import org.elasticsearch.xpack.ml.job.persistence.BucketsQueryBuilder;
import org.elasticsearch.xpack.ml.job.JobManager;
import org.elasticsearch.xpack.ml.job.persistence.JobProvider;

View File

@ -22,7 +22,7 @@ import org.elasticsearch.xpack.core.ml.action.GetCalendarsAction;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.calendars.ScheduledEvent;
import org.elasticsearch.xpack.core.ml.job.config.Job;
import org.elasticsearch.xpack.core.ml.job.persistence.ScheduledEventsQueryBuilder;
import org.elasticsearch.xpack.ml.job.persistence.ScheduledEventsQueryBuilder;
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
import org.elasticsearch.xpack.ml.job.persistence.JobProvider;

View File

@ -17,7 +17,7 @@ import org.elasticsearch.xpack.core.ml.action.GetCalendarsAction;
import org.elasticsearch.xpack.core.ml.action.util.PageParams;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.calendars.Calendar;
import org.elasticsearch.xpack.core.ml.job.persistence.CalendarQueryBuilder;
import org.elasticsearch.xpack.ml.job.persistence.CalendarQueryBuilder;
import org.elasticsearch.xpack.ml.job.persistence.JobProvider;
import java.util.Collections;

View File

@ -15,7 +15,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.core.ml.action.GetInfluencersAction;
import org.elasticsearch.xpack.core.ml.job.persistence.InfluencersQueryBuilder;
import org.elasticsearch.xpack.ml.job.persistence.InfluencersQueryBuilder;
import org.elasticsearch.xpack.ml.job.JobManager;
import org.elasticsearch.xpack.ml.job.persistence.JobProvider;

View File

@ -29,7 +29,7 @@ import org.elasticsearch.xpack.core.ml.action.GetOverallBucketsAction;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.job.config.Job;
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
import org.elasticsearch.xpack.core.ml.job.persistence.BucketsQueryBuilder;
import org.elasticsearch.xpack.ml.job.persistence.BucketsQueryBuilder;
import org.elasticsearch.xpack.core.ml.job.results.Bucket;
import org.elasticsearch.xpack.core.ml.job.results.OverallBucket;
import org.elasticsearch.xpack.core.ml.job.results.Result;

View File

@ -15,7 +15,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.core.ml.action.GetRecordsAction;
import org.elasticsearch.xpack.core.ml.job.persistence.RecordsQueryBuilder;
import org.elasticsearch.xpack.ml.job.persistence.RecordsQueryBuilder;
import org.elasticsearch.xpack.ml.job.JobManager;
import org.elasticsearch.xpack.ml.job.persistence.JobProvider;

View File

@ -13,7 +13,7 @@ import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig;
import org.elasticsearch.xpack.core.ml.job.config.DataDescription;
import org.elasticsearch.xpack.core.ml.job.config.Job;
import org.elasticsearch.xpack.core.ml.job.persistence.BucketsQueryBuilder;
import org.elasticsearch.xpack.ml.job.persistence.BucketsQueryBuilder;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.DataCounts;
import org.elasticsearch.xpack.core.ml.job.results.Bucket;
import org.elasticsearch.xpack.core.ml.job.results.Result;

View File

@ -18,7 +18,11 @@ import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.xpack.core.ml.action.UpdateProcessAction;
import org.elasticsearch.xpack.ml.job.process.autodetect.UpdateParams;
import org.elasticsearch.xpack.ml.utils.VolatileCursorIterator;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN;
@ -81,17 +85,20 @@ public class UpdateJobProcessNotifier extends AbstractComponent implements Local
}
private void processNextUpdate() {
List<UpdateParams> updates = new ArrayList<>(orderedJobUpdates.size());
try {
UpdateParams updateParams = orderedJobUpdates.poll();
if (updateParams != null) {
executeRemoteJob(updateParams);
}
orderedJobUpdates.drainTo(updates);
executeProcessUpdates(new VolatileCursorIterator<>(updates));
} catch (Exception e) {
logger.error("Unable while processing next job update", e);
logger.error("Error while processing next job update", e);
}
}
void executeRemoteJob(UpdateParams update) {
void executeProcessUpdates(Iterator<UpdateParams> updatesIterator) {
if (updatesIterator.hasNext() == false) {
return;
}
UpdateParams update = updatesIterator.next();
Request request = new Request(update.getJobId(), update.getModelPlotConfig(), update.getDetectorUpdates(), update.getFilter(),
update.isUpdateScheduledEvents());
@ -104,6 +111,7 @@ public class UpdateJobProcessNotifier extends AbstractComponent implements Local
} else {
logger.error("Failed to update remote job [{}]", update.getJobId());
}
executeProcessUpdates(updatesIterator);
}
@Override
@ -116,7 +124,9 @@ public class UpdateJobProcessNotifier extends AbstractComponent implements Local
} else {
logger.error("Failed to update remote job [" + update.getJobId() + "]", e);
}
executeProcessUpdates(updatesIterator);
}
});
}
}

View File

@ -9,7 +9,6 @@ import org.elasticsearch.client.Client;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.TermsQueryBuilder;
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
import org.elasticsearch.xpack.core.ml.job.persistence.ResultsFilterBuilder;
import org.elasticsearch.xpack.core.ml.job.results.Result;
public abstract class BatchedResultsIterator<T> extends BatchedDocumentsIterator<Result<T>> {

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.ml.job.persistence;
package org.elasticsearch.xpack.ml.job.persistence;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.ml.job.persistence;
package org.elasticsearch.xpack.ml.job.persistence;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.ml.job.persistence;
package org.elasticsearch.xpack.ml.job.persistence;
import org.elasticsearch.xpack.core.ml.job.results.Influencer;

View File

@ -80,14 +80,9 @@ import org.elasticsearch.xpack.core.ml.calendars.ScheduledEvent;
import org.elasticsearch.xpack.core.ml.job.config.Job;
import org.elasticsearch.xpack.core.ml.job.config.MlFilter;
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
import org.elasticsearch.xpack.core.ml.job.persistence.BucketsQueryBuilder;
import org.elasticsearch.xpack.core.ml.job.persistence.CalendarQueryBuilder;
import org.elasticsearch.xpack.core.ml.job.persistence.ElasticsearchMappings;
import org.elasticsearch.xpack.core.ml.job.persistence.InfluencersQueryBuilder.InfluencersQuery;
import org.elasticsearch.xpack.core.ml.job.persistence.RecordsQueryBuilder;
import org.elasticsearch.xpack.core.ml.job.persistence.ResultsFilterBuilder;
import org.elasticsearch.xpack.core.ml.job.persistence.ScheduledEventsQueryBuilder;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.params.AutodetectParams;
import org.elasticsearch.xpack.ml.job.persistence.InfluencersQueryBuilder.InfluencersQuery;
import org.elasticsearch.xpack.ml.job.process.autodetect.params.AutodetectParams;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.CategorizerState;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.DataCounts;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSizeStats;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.ml.job.persistence;
package org.elasticsearch.xpack.ml.job.persistence;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
@ -13,6 +13,7 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.FieldSortBuilder;
import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.xpack.core.ml.job.persistence.ElasticsearchMappings;
import org.elasticsearch.xpack.core.ml.job.results.AnomalyRecord;
import org.elasticsearch.xpack.core.ml.job.results.Result;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.ml.job.persistence;
package org.elasticsearch.xpack.ml.job.persistence;
import org.elasticsearch.common.Strings;
import org.elasticsearch.index.query.BoolQueryBuilder;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.ml.job.persistence;
package org.elasticsearch.xpack.ml.job.persistence;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.ml.job.process.autodetect;
import org.elasticsearch.xpack.core.ml.job.config.Job;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.params.AutodetectParams;
import org.elasticsearch.xpack.ml.job.process.autodetect.params.AutodetectParams;
import java.util.concurrent.ExecutorService;

View File

@ -29,9 +29,9 @@ import org.elasticsearch.xpack.core.ml.calendars.ScheduledEvent;
import org.elasticsearch.xpack.core.ml.job.config.Job;
import org.elasticsearch.xpack.core.ml.job.config.JobState;
import org.elasticsearch.xpack.core.ml.job.config.JobTaskStatus;
import org.elasticsearch.xpack.core.ml.job.persistence.ScheduledEventsQueryBuilder;
import org.elasticsearch.xpack.ml.job.persistence.ScheduledEventsQueryBuilder;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.output.FlushAcknowledgement;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.params.AutodetectParams;
import org.elasticsearch.xpack.ml.job.process.autodetect.params.AutodetectParams;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.DataCounts;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSizeStats;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSnapshot;

View File

@ -19,7 +19,7 @@ import org.elasticsearch.xpack.ml.job.process.ProcessCtrl;
import org.elasticsearch.xpack.ml.job.process.ProcessPipes;
import org.elasticsearch.xpack.ml.job.process.autodetect.output.AutodetectResultsParser;
import org.elasticsearch.xpack.ml.job.process.autodetect.output.StateProcessor;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.params.AutodetectParams;
import org.elasticsearch.xpack.ml.job.process.autodetect.params.AutodetectParams;
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
import org.elasticsearch.xpack.ml.utils.NamedPipeHelper;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.ml.job.process.autodetect.params;
package org.elasticsearch.xpack.ml.job.process.autodetect.params;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.xpack.core.ml.calendars.ScheduledEvent;

View File

@ -22,7 +22,7 @@ import org.elasticsearch.xpack.ml.notifications.Auditor;
import java.net.InetAddress;
import java.util.Collections;
import static org.elasticsearch.xpack.ml.action.OpenJobActionTests.addJobTask;
import static org.elasticsearch.xpack.ml.action.TransportOpenJobActionTests.addJobTask;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;

View File

@ -30,6 +30,7 @@ import org.elasticsearch.xpack.core.ml.job.config.JobState;
import org.elasticsearch.xpack.core.ml.job.config.JobTaskStatus;
import org.elasticsearch.xpack.core.ml.job.config.JobTests;
import org.elasticsearch.xpack.core.persistent.PersistentTasksCustomMetaData;
import org.elasticsearch.xpack.ml.datafeed.DatafeedManagerTests;
import java.util.Collections;
import java.util.Date;
@ -37,7 +38,7 @@ import java.util.Map;
import static org.elasticsearch.xpack.core.ml.job.config.JobTests.buildJobBuilder;
import static org.elasticsearch.xpack.core.persistent.PersistentTasksCustomMetaData.INITIAL_ASSIGNMENT;
import static org.elasticsearch.xpack.ml.action.OpenJobActionTests.addJobTask;
import static org.elasticsearch.xpack.ml.action.TransportOpenJobActionTests.addJobTask;
import static org.elasticsearch.xpack.ml.datafeed.DatafeedManagerTests.createDatafeedConfig;
import static org.elasticsearch.xpack.ml.datafeed.DatafeedManagerTests.createDatafeedJob;
import static org.hamcrest.Matchers.contains;

Some files were not shown because too many files have changed in this diff Show More