Removes warnings
Original commit: elastic/x-pack-elasticsearch@59626a3a3a
This commit is contained in:
parent
c932588c68
commit
5e6c63bc51
|
@ -33,7 +33,6 @@ import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.transport.TransportService;
|
import org.elasticsearch.transport.TransportService;
|
||||||
import org.elasticsearch.xpack.prelert.job.Detector;
|
import org.elasticsearch.xpack.prelert.job.Detector;
|
||||||
import org.elasticsearch.xpack.prelert.job.Job;
|
import org.elasticsearch.xpack.prelert.job.Job;
|
||||||
import org.elasticsearch.xpack.prelert.job.messages.Messages;
|
|
||||||
import org.elasticsearch.xpack.prelert.job.metadata.PrelertMetadata;
|
import org.elasticsearch.xpack.prelert.job.metadata.PrelertMetadata;
|
||||||
import org.elasticsearch.xpack.prelert.lists.ListDocument;
|
import org.elasticsearch.xpack.prelert.lists.ListDocument;
|
||||||
import org.elasticsearch.xpack.prelert.utils.ExceptionsHelper;
|
import org.elasticsearch.xpack.prelert.utils.ExceptionsHelper;
|
||||||
|
|
|
@ -22,12 +22,9 @@ import org.elasticsearch.index.query.QueryBuilders;
|
||||||
import org.elasticsearch.index.query.RangeQueryBuilder;
|
import org.elasticsearch.index.query.RangeQueryBuilder;
|
||||||
import org.elasticsearch.search.SearchHit;
|
import org.elasticsearch.search.SearchHit;
|
||||||
import org.elasticsearch.search.SearchHits;
|
import org.elasticsearch.search.SearchHits;
|
||||||
import org.elasticsearch.search.sort.SortBuilders;
|
|
||||||
import org.elasticsearch.xpack.prelert.job.ModelSizeStats;
|
|
||||||
import org.elasticsearch.xpack.prelert.job.ModelSnapshot;
|
import org.elasticsearch.xpack.prelert.job.ModelSnapshot;
|
||||||
import org.elasticsearch.xpack.prelert.job.ModelState;
|
import org.elasticsearch.xpack.prelert.job.ModelState;
|
||||||
import org.elasticsearch.xpack.prelert.job.results.Bucket;
|
import org.elasticsearch.xpack.prelert.job.results.Bucket;
|
||||||
import org.elasticsearch.xpack.prelert.job.results.ModelDebugOutput;
|
|
||||||
import org.elasticsearch.xpack.prelert.job.results.Result;
|
import org.elasticsearch.xpack.prelert.job.results.Result;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
|
@ -28,10 +28,8 @@ import org.elasticsearch.xpack.prelert.job.results.PerPartitionMaxProbabilities;
|
||||||
import org.elasticsearch.xpack.prelert.job.results.Result;
|
import org.elasticsearch.xpack.prelert.job.results.Result;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,8 @@
|
||||||
package org.elasticsearch.xpack.prelert.job.process.normalizer;
|
package org.elasticsearch.xpack.prelert.job.process.normalizer;
|
||||||
|
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.apache.lucene.util.IOUtils;
|
|
||||||
import org.elasticsearch.common.logging.Loggers;
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.xpack.prelert.job.process.NativeController;
|
import org.elasticsearch.xpack.prelert.job.process.NativeController;
|
||||||
import org.elasticsearch.xpack.prelert.job.process.ProcessCtrl;
|
import org.elasticsearch.xpack.prelert.job.process.ProcessCtrl;
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.elasticsearch.xpack.prelert.job.process.normalizer.output.NormalizerR
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface representing the native C++ normalizer process
|
* Interface representing the native C++ normalizer process
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.prelert.job.process.normalizer.output;
|
package org.elasticsearch.xpack.prelert.job.process.normalizer.output;
|
||||||
|
|
||||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
import org.elasticsearch.common.ParseFieldMatcher;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
|
|
|
@ -13,8 +13,8 @@ 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.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
||||||
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
||||||
import org.elasticsearch.xpack.prelert.job.Job;
|
import org.elasticsearch.xpack.prelert.job.Job;
|
||||||
import org.elasticsearch.xpack.prelert.utils.ExceptionsHelper;
|
import org.elasticsearch.xpack.prelert.utils.ExceptionsHelper;
|
||||||
|
@ -28,8 +28,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collector;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bucket Result POJO
|
* Bucket Result POJO
|
||||||
|
|
|
@ -15,7 +15,6 @@ import org.elasticsearch.rest.action.AcknowledgedRestListener;
|
||||||
import org.elasticsearch.xpack.prelert.PrelertPlugin;
|
import org.elasticsearch.xpack.prelert.PrelertPlugin;
|
||||||
import org.elasticsearch.xpack.prelert.action.DeleteListAction;
|
import org.elasticsearch.xpack.prelert.action.DeleteListAction;
|
||||||
import org.elasticsearch.xpack.prelert.action.DeleteListAction.Request;
|
import org.elasticsearch.xpack.prelert.action.DeleteListAction.Request;
|
||||||
import org.elasticsearch.xpack.prelert.action.PutListAction;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.prelert.job;
|
package org.elasticsearch.xpack.prelert.job;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.generators.CodepointSetGenerator;
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
import org.elasticsearch.common.ParseFieldMatcher;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
|
@ -17,6 +16,8 @@ import org.elasticsearch.xpack.prelert.job.transform.TransformConfig;
|
||||||
import org.elasticsearch.xpack.prelert.job.transform.TransformType;
|
import org.elasticsearch.xpack.prelert.job.transform.TransformType;
|
||||||
import org.elasticsearch.xpack.prelert.support.AbstractSerializingTestCase;
|
import org.elasticsearch.xpack.prelert.support.AbstractSerializingTestCase;
|
||||||
|
|
||||||
|
import com.carrotsearch.randomizedtesting.generators.CodepointSetGenerator;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -506,13 +507,4 @@ public class JobTests extends AbstractSerializingTestCase<Job> {
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<String> randomStringList(int min, int max) {
|
|
||||||
int size = scaledRandomIntBetween(min, max);
|
|
||||||
List<String> list = new ArrayList<>();
|
|
||||||
for (int i = 0; i < size; i++) {
|
|
||||||
list.add(randomAsciiOfLength(10));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,9 @@ public class PrelertMetadataTests extends AbstractSerializingTestCase<PrelertMet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// NORELEASE TODO: randomize scheduler status:
|
// NORELEASE TODO: randomize scheduler status:
|
||||||
// if (randomBoolean()) {
|
// if (randomBoolean()) {
|
||||||
// builder.updateSchedulerStatus(job.getId(), SchedulerStatus.STARTED);
|
// builder.updateSchedulerStatus(job.getId(), SchedulerStatus.STARTED);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public class PrelertMetadataTests extends AbstractSerializingTestCase<PrelertMet
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T extends ToXContent & Writeable> XContentBuilder toXContent(T instance, XContentType contentType) throws IOException {
|
protected XContentBuilder toXContent(PrelertMetadata instance, XContentType contentType) throws IOException {
|
||||||
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
|
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
builder.prettyPrint();
|
builder.prettyPrint();
|
||||||
|
|
|
@ -5,24 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.prelert.job.persistence;
|
package org.elasticsearch.xpack.prelert.job.persistence;
|
||||||
|
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
|
||||||
import static org.mockito.Matchers.any;
|
|
||||||
import static org.mockito.Matchers.anyBoolean;
|
|
||||||
import static org.mockito.Matchers.anyInt;
|
|
||||||
import static org.mockito.Matchers.anyString;
|
|
||||||
import static org.mockito.Matchers.argThat;
|
|
||||||
import static org.mockito.Matchers.eq;
|
|
||||||
import static org.mockito.Mockito.doAnswer;
|
|
||||||
import static org.mockito.Mockito.doThrow;
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
import static org.mockito.Mockito.reset;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
import org.elasticsearch.action.ActionFuture;
|
import org.elasticsearch.action.ActionFuture;
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
import org.elasticsearch.action.ListenableActionFuture;
|
import org.elasticsearch.action.ListenableActionFuture;
|
||||||
|
@ -64,11 +46,27 @@ import org.elasticsearch.search.sort.SortBuilder;
|
||||||
import org.elasticsearch.search.sort.SortOrder;
|
import org.elasticsearch.search.sort.SortOrder;
|
||||||
import org.elasticsearch.xpack.prelert.action.DeleteJobAction;
|
import org.elasticsearch.xpack.prelert.action.DeleteJobAction;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.ArgumentMatcher;
|
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.invocation.InvocationOnMock;
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
import org.mockito.stubbing.Answer;
|
import org.mockito.stubbing.Answer;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertArrayEquals;
|
||||||
|
import static org.mockito.Matchers.any;
|
||||||
|
import static org.mockito.Matchers.anyBoolean;
|
||||||
|
import static org.mockito.Matchers.anyInt;
|
||||||
|
import static org.mockito.Matchers.anyString;
|
||||||
|
import static org.mockito.Matchers.eq;
|
||||||
|
import static org.mockito.Mockito.doAnswer;
|
||||||
|
import static org.mockito.Mockito.doThrow;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.reset;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
public class MockClientBuilder {
|
public class MockClientBuilder {
|
||||||
@Mock
|
@Mock
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class ScheduledJobRunnerTests extends ESTestCase {
|
||||||
flushJobFuture = mock(ActionFuture.class);
|
flushJobFuture = mock(ActionFuture.class);
|
||||||
clusterService = mock(ClusterService.class);
|
clusterService = mock(ClusterService.class);
|
||||||
doAnswer(invocation -> {
|
doAnswer(invocation -> {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("rawtypes")
|
||||||
ActionListener<Object> actionListener = (ActionListener) invocation.getArguments()[2];
|
ActionListener<Object> actionListener = (ActionListener) invocation.getArguments()[2];
|
||||||
actionListener.onResponse(new UpdateSchedulerStatusAction.Response());
|
actionListener.onResponse(new UpdateSchedulerStatusAction.Response());
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -26,7 +26,6 @@ import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
public class ElasticsearchDataExtractorTests extends ESTestCase {
|
public class ElasticsearchDataExtractorTests extends ESTestCase {
|
||||||
|
|
||||||
private static final String BASE_URL = "http://localhost:9200";
|
|
||||||
private static final List<String> INDEXES = Arrays.asList("index-*");
|
private static final List<String> INDEXES = Arrays.asList("index-*");
|
||||||
private static final List<String> TYPES = Arrays.asList("dataType");
|
private static final List<String> TYPES = Arrays.asList("dataType");
|
||||||
private static final String SEARCH = "\"match_all\":{}";
|
private static final String SEARCH = "\"match_all\":{}";
|
||||||
|
|
|
@ -65,7 +65,7 @@ public abstract class AbstractSerializingTestCase<T extends ToXContent & Writeab
|
||||||
return Strings.EMPTY_ARRAY;
|
return Strings.EMPTY_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <T extends ToXContent & Writeable> XContentBuilder toXContent(T instance, XContentType contentType)
|
protected XContentBuilder toXContent(T instance, XContentType contentType)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
|
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
|
|
Loading…
Reference in New Issue