diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/MlPlugin.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/MlPlugin.java index ef6cd4ef7bc..58e69bfab13 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/MlPlugin.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/MlPlugin.java @@ -65,8 +65,8 @@ import org.elasticsearch.xpack.ml.action.UpdateDatafeedStatusAction; import org.elasticsearch.xpack.ml.action.ValidateDetectorAction; import org.elasticsearch.xpack.ml.action.ValidateTransformAction; import org.elasticsearch.xpack.ml.action.ValidateTransformsAction; -import org.elasticsearch.xpack.ml.job.manager.AutodetectProcessManager; -import org.elasticsearch.xpack.ml.job.manager.JobManager; +import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcessManager; +import org.elasticsearch.xpack.ml.job.JobManager; import org.elasticsearch.xpack.ml.job.metadata.MlInitializationService; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; import org.elasticsearch.xpack.ml.job.persistence.JobDataCountsPersister; @@ -83,7 +83,7 @@ import org.elasticsearch.xpack.ml.job.process.normalizer.MultiplyingNormalizerPr import org.elasticsearch.xpack.ml.job.process.normalizer.NativeNormalizerProcessFactory; import org.elasticsearch.xpack.ml.job.process.normalizer.NormalizerFactory; import org.elasticsearch.xpack.ml.job.process.normalizer.NormalizerProcessFactory; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; import org.elasticsearch.xpack.ml.job.usage.UsageReporter; import org.elasticsearch.xpack.ml.rest.job.RestCloseJobAction; import org.elasticsearch.xpack.ml.rest.job.RestDeleteJobAction; @@ -149,8 +149,8 @@ public class MlPlugin extends Plugin implements ActionPlugin { Arrays.asList(USE_NATIVE_PROCESS_OPTION, ProcessCtrl.DONT_PERSIST_MODEL_STATE_SETTING, ProcessCtrl.MAX_ANOMALY_RECORDS_SETTING, - StatusReporter.ACCEPTABLE_PERCENTAGE_DATE_PARSE_ERRORS_SETTING, - StatusReporter.ACCEPTABLE_PERCENTAGE_OUT_OF_ORDER_ERRORS_SETTING, + DataCountsReporter.ACCEPTABLE_PERCENTAGE_DATE_PARSE_ERRORS_SETTING, + DataCountsReporter.ACCEPTABLE_PERCENTAGE_OUT_OF_ORDER_ERRORS_SETTING, UsageReporter.UPDATE_INTERVAL_SETTING, AutodetectProcessManager.MAX_RUNNING_JOBS_PER_NODE)); } diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/CloseJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/CloseJobAction.java index c947552dd39..c66cf1716cf 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/CloseJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/CloseJobAction.java @@ -33,8 +33,8 @@ import org.elasticsearch.rest.RestStatus; import org.elasticsearch.tasks.TaskInfo; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; import org.elasticsearch.xpack.ml.job.metadata.Allocation; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteJobAction.java index b6da14ec03d..0295aef315a 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteJobAction.java @@ -28,8 +28,8 @@ import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.TaskId; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.manager.JobManager; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.JobManager; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteListAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteListAction.java index 28547c46a06..2abe972b917 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteListAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteListAction.java @@ -31,10 +31,10 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteModelSnapshotAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteModelSnapshotAction.java index ffe6e204d8d..7b2ba18267c 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteModelSnapshotAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteModelSnapshotAction.java @@ -25,13 +25,13 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.manager.JobManager; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.JobManager; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.job.persistence.JobDataDeleter; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/FlushJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/FlushJobAction.java index b07eaf5257c..06877f0ef3e 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/FlushJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/FlushJobAction.java @@ -27,9 +27,9 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.ml.MlPlugin; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.manager.AutodetectProcessManager; -import org.elasticsearch.xpack.ml.job.manager.JobManager; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcessManager; +import org.elasticsearch.xpack.ml.job.JobManager; import org.elasticsearch.xpack.ml.job.process.autodetect.params.InterimResultsParams; import org.elasticsearch.xpack.ml.job.process.autodetect.params.TimeRange; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetBucketsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetBucketsAction.java index 5ddce331d2e..eff99847f7a 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetBucketsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetBucketsAction.java @@ -28,12 +28,12 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.persistence.BucketsQueryBuilder; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.job.results.Bucket; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetCategoriesAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetCategoriesAction.java index f1d53027df6..999add8aff4 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetCategoriesAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetCategoriesAction.java @@ -27,11 +27,11 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.job.results.CategoryDefinition; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetDatafeedsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetDatafeedsAction.java index c53aefa814c..ba1321b3645 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetDatafeedsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetDatafeedsAction.java @@ -29,7 +29,7 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.datafeed.Datafeed; import org.elasticsearch.xpack.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetDatafeedsStatsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetDatafeedsStatsAction.java index db7f9873c53..4e6dac832c7 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetDatafeedsStatsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetDatafeedsStatsAction.java @@ -31,7 +31,7 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.datafeed.Datafeed; import org.elasticsearch.xpack.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.ml.datafeed.DatafeedStatus; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetInfluencersAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetInfluencersAction.java index 10c0bfa8b07..57b61e7367b 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetInfluencersAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetInfluencersAction.java @@ -28,12 +28,12 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.persistence.InfluencersQueryBuilder; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.job.results.Influencer; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetJobsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetJobsAction.java index e7ba7d00fac..ec13d4c6576 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetJobsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetJobsAction.java @@ -28,9 +28,9 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.manager.JobManager; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.JobManager; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetJobsStatsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetJobsStatsAction.java index c58b54a6efd..d8b0ca21b79 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetJobsStatsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetJobsStatsAction.java @@ -30,15 +30,15 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.manager.AutodetectProcessManager; -import org.elasticsearch.xpack.ml.job.manager.JobManager; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcessManager; +import org.elasticsearch.xpack.ml.job.JobManager; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetListAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetListAction.java index cc079f1c5fb..c239d092b82 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetListAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetListAction.java @@ -41,9 +41,9 @@ import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; -import org.elasticsearch.xpack.ml.job.results.PageParams; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.action.util.QueryPage; +import org.elasticsearch.xpack.ml.action.util.PageParams; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import java.io.IOException; import java.util.ArrayList; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetModelSnapshotsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetModelSnapshotsAction.java index 81b79371141..e9c63164d62 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetModelSnapshotsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetModelSnapshotsAction.java @@ -29,15 +29,14 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.QueryPage; +import org.elasticsearch.xpack.ml.action.util.PageParams; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; -import java.util.Locale; import java.util.Objects; public class GetModelSnapshotsAction diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetRecordsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetRecordsAction.java index 179f9adf592..e8447251a0d 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetRecordsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/GetRecordsAction.java @@ -28,13 +28,13 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.job.persistence.RecordsQueryBuilder; import org.elasticsearch.xpack.ml.job.results.AnomalyRecord; import org.elasticsearch.xpack.ml.job.results.Influencer; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/InternalOpenJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/InternalOpenJobAction.java index 9e4d0e0e9f5..ca814ccd9fe 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/InternalOpenJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/InternalOpenJobAction.java @@ -20,8 +20,8 @@ import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.TaskId; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.manager.AutodetectProcessManager; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcessManager; public class InternalOpenJobAction extends Action { diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java index 576998d4c57..955fddefe13 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java @@ -26,8 +26,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.tasks.LoggingTaskListener; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import org.elasticsearch.xpack.ml.utils.JobStatusObserver; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/PostDataAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/PostDataAction.java index 8a797990f74..de4e1be1dfc 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/PostDataAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/PostDataAction.java @@ -26,10 +26,10 @@ import org.elasticsearch.rest.RestStatus; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.ml.MlPlugin; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.manager.AutodetectProcessManager; -import org.elasticsearch.xpack.ml.job.manager.JobManager; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcessManager; +import org.elasticsearch.xpack.ml.job.JobManager; import org.elasticsearch.xpack.ml.job.process.autodetect.params.DataLoadParams; import org.elasticsearch.xpack.ml.job.process.autodetect.params.TimeRange; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/PutJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/PutJobAction.java index b249dd65dbf..67c9d095cc9 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/PutJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/PutJobAction.java @@ -30,8 +30,8 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.manager.JobManager; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.JobManager; import java.io.IOException; import java.util.Objects; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/PutListAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/PutListAction.java index bf08ba5b389..c8060e56046 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/PutListAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/PutListAction.java @@ -33,7 +33,7 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/RevertModelSnapshotAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/RevertModelSnapshotAction.java index 1b8aa979b9e..b06d97ebb85 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/RevertModelSnapshotAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/RevertModelSnapshotAction.java @@ -9,7 +9,6 @@ import org.elasticsearch.ResourceNotFoundException; import org.elasticsearch.action.Action; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.master.AcknowledgedRequest; import org.elasticsearch.action.support.master.AcknowledgedResponse; @@ -36,23 +35,22 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.manager.JobManager; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.JobManager; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.job.metadata.Allocation; import org.elasticsearch.xpack.ml.job.persistence.JobDataCountsPersister; import org.elasticsearch.xpack.ml.job.persistence.JobDataDeleter; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; import java.util.Date; import java.util.List; import java.util.Objects; -import java.util.function.BooleanSupplier; import java.util.function.Consumer; public class RevertModelSnapshotAction diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/TransportJobTaskAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/TransportJobTaskAction.java index e282485f210..7524c18445a 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/TransportJobTaskAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/TransportJobTaskAction.java @@ -23,10 +23,10 @@ import org.elasticsearch.rest.RestStatus; import org.elasticsearch.tasks.Task; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.manager.AutodetectProcessManager; -import org.elasticsearch.xpack.ml.job.manager.JobManager; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcessManager; +import org.elasticsearch.xpack.ml.job.JobManager; import org.elasticsearch.xpack.ml.job.metadata.Allocation; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/UpdateDatafeedStatusAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/UpdateDatafeedStatusAction.java index 607ee932b47..2ad4d8a0212 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/UpdateDatafeedStatusAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/UpdateDatafeedStatusAction.java @@ -27,7 +27,7 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.ml.datafeed.DatafeedStatus; -import org.elasticsearch.xpack.ml.job.manager.JobManager; +import org.elasticsearch.xpack.ml.job.JobManager; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/UpdateJobStatusAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/UpdateJobStatusAction.java index b759e9cf8d2..0b432a3c996 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/UpdateJobStatusAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/UpdateJobStatusAction.java @@ -25,9 +25,9 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.manager.JobManager; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.job.JobManager; import org.elasticsearch.xpack.ml.job.metadata.Allocation; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/UpdateModelSnapshotAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/UpdateModelSnapshotAction.java index 5ab23d69429..97d04874e42 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/UpdateModelSnapshotAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/UpdateModelSnapshotAction.java @@ -30,9 +30,9 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.manager.JobManager; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.JobManager; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/ValidateDetectorAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/ValidateDetectorAction.java index c4f1f8d65e7..1683a619018 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/ValidateDetectorAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/ValidateDetectorAction.java @@ -25,7 +25,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.Detector; +import org.elasticsearch.xpack.ml.job.config.Detector; import java.io.IOException; import java.util.Objects; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/ValidateTransformAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/ValidateTransformAction.java index 24f99e90fe9..ca5d9286498 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/ValidateTransformAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/ValidateTransformAction.java @@ -25,8 +25,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.verification.TransformConfigVerifier; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.verification.TransformConfigVerifier; import java.io.IOException; import java.util.Objects; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/ValidateTransformsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/ValidateTransformsAction.java index 28c95d1f4b2..cad7caace70 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/ValidateTransformsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/ValidateTransformsAction.java @@ -26,8 +26,8 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.verification.TransformConfigsVerifier; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.verification.TransformConfigsVerifier; import java.io.IOException; import java.util.List; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/PageParams.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/util/PageParams.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/PageParams.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/util/PageParams.java index 435ac51daaf..102d8e8ad3c 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/PageParams.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/util/PageParams.java @@ -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.results; +package org.elasticsearch.xpack.ml.action.util; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/QueryPage.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/util/QueryPage.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/QueryPage.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/util/QueryPage.java index 42cb804e1ae..3a18aea828a 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/QueryPage.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/util/QueryPage.java @@ -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.persistence; +package org.elasticsearch.xpack.ml.action.util; import org.elasticsearch.ResourceNotFoundException; import org.elasticsearch.action.support.ToXContentToBytes; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedConfig.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedConfig.java index bef872a2f12..6f707bd2cad 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedConfig.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedConfig.java @@ -19,7 +19,7 @@ import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryParseContext; import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import org.elasticsearch.xpack.ml.utils.MlStrings; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJob.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJob.java index 29a8ec36dc6..42fad786a23 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJob.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJob.java @@ -13,9 +13,9 @@ import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.index.mapper.DateFieldMapper; import org.elasticsearch.xpack.ml.action.FlushJobAction; import org.elasticsearch.xpack.ml.action.PostDataAction; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.audit.Auditor; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.notifications.Auditor; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.datafeed.extractor.DataExtractor; import org.elasticsearch.xpack.ml.datafeed.extractor.DataExtractorFactory; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobRunner.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobRunner.java index cb4f44e7e30..935d18a79f7 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobRunner.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobRunner.java @@ -19,17 +19,17 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.InternalStartDatafeedAction; import org.elasticsearch.xpack.ml.action.UpdateDatafeedStatusAction; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.audit.Auditor; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.notifications.Auditor; import org.elasticsearch.xpack.ml.job.config.DefaultFrequency; import org.elasticsearch.xpack.ml.job.metadata.Allocation; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; import org.elasticsearch.xpack.ml.job.persistence.BucketsQueryBuilder; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.job.results.Bucket; import org.elasticsearch.xpack.ml.datafeed.extractor.DataExtractorFactory; import org.elasticsearch.xpack.ml.datafeed.extractor.scroll.ScrollDataExtractorFactory; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobValidator.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobValidator.java index ee524d5bf9c..93fc633ffa9 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobValidator.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobValidator.java @@ -5,8 +5,8 @@ */ package org.elasticsearch.xpack.ml.datafeed; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.messages.Messages; public final class DatafeedJobValidator { diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/ProblemTracker.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/ProblemTracker.java index 8bb01212af0..178cbae1fc3 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/ProblemTracker.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/ProblemTracker.java @@ -5,7 +5,7 @@ */ package org.elasticsearch.xpack.ml.datafeed; -import org.elasticsearch.xpack.ml.job.audit.Auditor; +import org.elasticsearch.xpack.ml.notifications.Auditor; import org.elasticsearch.xpack.ml.job.messages.Messages; import java.util.Objects; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ExtractedFields.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ExtractedFields.java index 6b4a9038dd3..abded996211 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ExtractedFields.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ExtractedFields.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.datafeed.extractor.scroll; import org.elasticsearch.search.SearchHit; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.datafeed.DatafeedConfig; import java.util.ArrayList; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorFactory.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorFactory.java index 522253c3dc1..b50e30846bc 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorFactory.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorFactory.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.datafeed.extractor.scroll; import org.elasticsearch.client.Client; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.ml.datafeed.extractor.DataExtractor; import org.elasticsearch.xpack.ml.datafeed.extractor.DataExtractorFactory; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/manager/JobManager.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/JobManager.java similarity index 97% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/manager/JobManager.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/JobManager.java index 7cd7d52e845..be8b34bf833 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/manager/JobManager.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/JobManager.java @@ -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.manager; +package org.elasticsearch.xpack.ml.job; import org.elasticsearch.ResourceAlreadyExistsException; import org.elasticsearch.ResourceNotFoundException; @@ -23,18 +23,18 @@ import org.elasticsearch.xpack.ml.action.PutJobAction; import org.elasticsearch.xpack.ml.action.RevertModelSnapshotAction; import org.elasticsearch.xpack.ml.action.UpdateJobStatusAction; import org.elasticsearch.xpack.ml.action.UpdateDatafeedStatusAction; -import org.elasticsearch.xpack.ml.job.IgnoreDowntime; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.audit.Auditor; +import org.elasticsearch.xpack.ml.job.config.IgnoreDowntime; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.notifications.Auditor; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.job.metadata.Allocation; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; import org.elasticsearch.xpack.ml.job.persistence.AnomalyDetectorsIndex; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; import org.elasticsearch.xpack.ml.job.persistence.JobResultsPersister; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.job.results.AnomalyRecord; import org.elasticsearch.xpack.ml.datafeed.DatafeedStatus; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/AnalysisConfig.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/AnalysisConfig.java similarity index 99% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/AnalysisConfig.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/AnalysisConfig.java index 025b6351e99..9495ce5866c 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/AnalysisConfig.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/AnalysisConfig.java @@ -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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.action.support.ToXContentToBytes; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/AnalysisLimits.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/AnalysisLimits.java similarity index 99% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/AnalysisLimits.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/AnalysisLimits.java index ae0d1b1be68..a8645a29a86 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/AnalysisLimits.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/AnalysisLimits.java @@ -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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.Nullable; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/condition/Condition.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Condition.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/condition/Condition.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Condition.java index fa737ba4b0c..ae53f20f8bc 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/condition/Condition.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Condition.java @@ -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.condition; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/Connective.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Connective.java similarity index 96% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/Connective.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Connective.java index 94ada179a77..01705c4334e 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/Connective.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Connective.java @@ -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.detectionrules; +package org.elasticsearch.xpack.ml.job.config; import java.io.IOException; import java.util.Locale; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/DataDescription.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/DataDescription.java similarity index 99% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/DataDescription.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/DataDescription.java index a93954f59c6..5569b6d052e 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/DataDescription.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/DataDescription.java @@ -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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/DefaultDetectorDescription.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/DefaultDetectorDescription.java index a4e6733be94..6fafd89b20f 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/DefaultDetectorDescription.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/DefaultDetectorDescription.java @@ -6,7 +6,6 @@ package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.Strings; -import org.elasticsearch.xpack.ml.job.Detector; import org.elasticsearch.xpack.ml.utils.MlStrings; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/DetectionRule.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/DetectionRule.java similarity index 99% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/DetectionRule.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/DetectionRule.java index 746f8a18c2a..2895bd8da22 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/DetectionRule.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/DetectionRule.java @@ -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.detectionrules; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/Detector.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Detector.java similarity index 99% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/Detector.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Detector.java index da1306d2c1f..b01f2b983e6 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/Detector.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Detector.java @@ -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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.action.support.ToXContentToBytes; @@ -15,9 +15,6 @@ import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.ObjectParser; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.ml.job.config.DefaultDetectorDescription; -import org.elasticsearch.xpack.ml.job.detectionrules.DetectionRule; -import org.elasticsearch.xpack.ml.job.detectionrules.RuleCondition; import org.elasticsearch.xpack.ml.job.messages.Messages; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/IgnoreDowntime.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/IgnoreDowntime.java similarity index 97% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/IgnoreDowntime.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/IgnoreDowntime.java index 28e14427de8..7b88d9866e0 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/IgnoreDowntime.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/IgnoreDowntime.java @@ -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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/Job.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Job.java similarity index 99% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/Job.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Job.java index df263a6bfb6..40dec49f8a7 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/Job.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Job.java @@ -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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.cluster.AbstractDiffable; import org.elasticsearch.common.ParseField; @@ -18,9 +18,9 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser.Token; import org.elasticsearch.xpack.ml.job.messages.Messages; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; -import org.elasticsearch.xpack.ml.job.transform.verification.TransformConfigsVerifier; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.config.transform.verification.TransformConfigsVerifier; import org.elasticsearch.xpack.ml.utils.MlStrings; import org.elasticsearch.xpack.ml.utils.time.TimeUtils; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/JobStatus.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/JobStatus.java similarity index 97% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/JobStatus.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/JobStatus.java index 97b0a27231d..4240f7631b2 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/JobStatus.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/JobStatus.java @@ -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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/lists/ListDocument.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/ListDocument.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/lists/ListDocument.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/ListDocument.java index 8f4c7afda71..480df79d60e 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/lists/ListDocument.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/ListDocument.java @@ -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.lists; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/ModelDebugConfig.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/ModelDebugConfig.java similarity index 99% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/ModelDebugConfig.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/ModelDebugConfig.java index c5dfbca157c..03b9b7189bd 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/ModelDebugConfig.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/ModelDebugConfig.java @@ -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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/condition/Operator.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Operator.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/condition/Operator.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Operator.java index 463f7da6287..cb7a9e2a6f3 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/condition/Operator.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/Operator.java @@ -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.condition; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.io.stream.StreamInput; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/RuleAction.java similarity index 91% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleAction.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/RuleAction.java index 32977810884..f70625d7b30 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/RuleAction.java @@ -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.detectionrules; +package org.elasticsearch.xpack.ml.job.config; import java.util.Locale; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleCondition.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/RuleCondition.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleCondition.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/RuleCondition.java index a28764bc091..ec501004769 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleCondition.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/RuleCondition.java @@ -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.detectionrules; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.action.support.ToXContentToBytes; @@ -15,8 +15,6 @@ import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; import org.elasticsearch.xpack.ml.job.messages.Messages; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleConditionType.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/RuleConditionType.java similarity index 96% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleConditionType.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/RuleConditionType.java index cb7ff26fefe..ed305daf623 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleConditionType.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/RuleConditionType.java @@ -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.detectionrules; +package org.elasticsearch.xpack.ml.job.config; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/IntRange.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/IntRange.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/IntRange.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/IntRange.java index a9dcbcfef50..b1798493d3e 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/IntRange.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/IntRange.java @@ -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.transform; +package org.elasticsearch.xpack.ml.job.config.transform; import java.util.Objects; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/TransformConfig.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/TransformConfig.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/TransformConfig.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/TransformConfig.java index a6180b9a2dc..4123c86bf8f 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/TransformConfig.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/TransformConfig.java @@ -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.transform; +package org.elasticsearch.xpack.ml.job.config.transform; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; @@ -12,7 +12,7 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.xpack.ml.job.condition.Condition; +import org.elasticsearch.xpack.ml.job.config.Condition; import java.io.IOException; import java.util.Collections; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/TransformConfigs.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/TransformConfigs.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/TransformConfigs.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/TransformConfigs.java index e3094c11be3..f0588bc565b 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/TransformConfigs.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/TransformConfigs.java @@ -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.transform; +package org.elasticsearch.xpack.ml.job.config.transform; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/TransformType.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/TransformType.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/TransformType.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/TransformType.java index 712290f6ed4..21cfaec05cb 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/TransformType.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/TransformType.java @@ -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.transform; +package org.elasticsearch.xpack.ml.job.config.transform; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Writeable; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/ArgumentVerifier.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/ArgumentVerifier.java similarity index 75% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/ArgumentVerifier.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/ArgumentVerifier.java index e4804b65566..31bb0e9909e 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/ArgumentVerifier.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/ArgumentVerifier.java @@ -3,11 +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.transform.verification; +package org.elasticsearch.xpack.ml.job.config.transform.verification; import org.elasticsearch.ElasticsearchParseException; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; @FunctionalInterface public interface ArgumentVerifier { diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/RegexExtractVerifier.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/RegexExtractVerifier.java similarity index 88% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/RegexExtractVerifier.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/RegexExtractVerifier.java index cabfa9263d9..86948beee80 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/RegexExtractVerifier.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/RegexExtractVerifier.java @@ -3,11 +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.transform.verification; +package org.elasticsearch.xpack.ml.job.config.transform.verification; import org.elasticsearch.xpack.ml.job.messages.Messages; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; import java.util.List; import java.util.regex.Pattern; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/RegexPatternVerifier.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/RegexPatternVerifier.java similarity index 86% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/RegexPatternVerifier.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/RegexPatternVerifier.java index 5527a00af24..23f0033d4f0 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/RegexPatternVerifier.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/RegexPatternVerifier.java @@ -3,11 +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.transform.verification; +package org.elasticsearch.xpack.ml.job.config.transform.verification; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.xpack.ml.job.messages.Messages; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/TransformConfigVerifier.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/TransformConfigVerifier.java similarity index 95% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/TransformConfigVerifier.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/TransformConfigVerifier.java index 40a91bd5695..726aa9f382e 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/TransformConfigVerifier.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/TransformConfigVerifier.java @@ -3,13 +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.job.transform.verification; +package org.elasticsearch.xpack.ml.job.config.transform.verification; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.xpack.ml.job.messages.Messages; -import org.elasticsearch.xpack.ml.job.transform.IntRange; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.config.transform.IntRange; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; import java.util.List; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/TransformConfigsVerifier.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/TransformConfigsVerifier.java similarity index 96% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/TransformConfigsVerifier.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/TransformConfigsVerifier.java index bf9c3ae8b68..b1c3fc54f42 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/transform/verification/TransformConfigsVerifier.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/config/transform/verification/TransformConfigsVerifier.java @@ -3,12 +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.transform.verification; +package org.elasticsearch.xpack.ml.job.config.transform.verification; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.xpack.ml.job.messages.Messages; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; import java.util.HashSet; import java.util.List; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/data/DataProcessor.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/data/DataProcessor.java deleted file mode 100644 index 2dd33146294..00000000000 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/data/DataProcessor.java +++ /dev/null @@ -1,56 +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.ml.job.data; - -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.process.autodetect.params.DataLoadParams; -import org.elasticsearch.xpack.ml.job.process.autodetect.params.InterimResultsParams; - -import java.io.InputStream; -import java.util.function.Consumer; - -public interface DataProcessor { - - /** - * Passes data to the native process. - * This is a blocking call that won't return until all the data has been - * written to the process. - * - * An ElasticsearchStatusException will be thrown is any of these error conditions occur: - *
    - *
  1. If a configured field is missing from the CSV header
  2. - *
  3. If JSON data is malformed and we cannot recover parsing
  4. - *
  5. If a high proportion of the records the timestamp field that cannot be parsed
  6. - *
  7. If a high proportion of the records chronologically out of order
  8. - *
- * - * @param jobId the jobId - * @param input Data input stream - * @param params Data processing parameters - * @return Count of records, fields, bytes, etc written - */ - DataCounts processData(String jobId, InputStream input, DataLoadParams params); - - /** - * Flush the running job, ensuring that the native process has had the - * opportunity to process all data previously sent to it with none left - * sitting in buffers. - * - * @param jobId The job to flush - * @param interimResultsParams Parameters about whether interim results calculation - * should occur and for which period of time - */ - void flushJob(String jobId, InterimResultsParams interimResultsParams); - - void openJob(String jobId, boolean ignoreDowntime, Consumer handler); - - /** - * Stop the running job and mark it as finished.
- * @param jobId The job to stop - * - */ - void closeJob(String jobId); -} diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/metadata/Allocation.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/metadata/Allocation.java index c8edfc889e2..ea3c735ce4e 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/metadata/Allocation.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/metadata/Allocation.java @@ -13,8 +13,8 @@ import org.elasticsearch.common.xcontent.ObjectParser; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; import java.io.IOException; import java.util.Objects; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/metadata/MlMetadata.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/metadata/MlMetadata.java index cfbee655ef7..d079829a5bf 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/metadata/MlMetadata.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/metadata/MlMetadata.java @@ -23,8 +23,8 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.datafeed.DatafeedJobValidator; import org.elasticsearch.xpack.ml.datafeed.Datafeed; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/ElasticsearchMappings.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/ElasticsearchMappings.java index 5e794560ea5..577645e21f3 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/ElasticsearchMappings.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/ElasticsearchMappings.java @@ -6,15 +6,15 @@ package org.elasticsearch.xpack.ml.job.persistence; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.xpack.ml.job.CategorizerState; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.ModelState; -import org.elasticsearch.xpack.ml.job.audit.AuditActivity; -import org.elasticsearch.xpack.ml.job.audit.AuditMessage; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.CategorizerState; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelState; +import org.elasticsearch.xpack.ml.notifications.AuditActivity; +import org.elasticsearch.xpack.ml.notifications.AuditMessage; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.job.results.AnomalyCause; import org.elasticsearch.xpack.ml.job.results.AnomalyRecord; import org.elasticsearch.xpack.ml.job.results.Bucket; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobDataCountsPersister.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobDataCountsPersister.java index 5fdedc72e05..7f772afadb0 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobDataCountsPersister.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobDataCountsPersister.java @@ -14,7 +14,7 @@ import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.xpack.ml.job.DataCounts; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobDataDeleter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobDataDeleter.java index 646ba023a55..721c16f2e85 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobDataDeleter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobDataDeleter.java @@ -22,8 +22,8 @@ import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.RangeQueryBuilder; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHits; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.ModelState; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelState; import org.elasticsearch.xpack.ml.job.results.Bucket; import org.elasticsearch.xpack.ml.job.results.Result; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobProvider.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobProvider.java index de3a2406352..e52ec6202a3 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobProvider.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobProvider.java @@ -48,18 +48,19 @@ import org.elasticsearch.search.sort.SortBuilder; import org.elasticsearch.search.sort.SortBuilders; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.xpack.ml.action.DeleteJobAction; -import org.elasticsearch.xpack.ml.job.CategorizerState; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.ModelState; -import org.elasticsearch.xpack.ml.job.audit.AuditActivity; -import org.elasticsearch.xpack.ml.job.audit.AuditMessage; -import org.elasticsearch.xpack.ml.job.audit.Auditor; +import org.elasticsearch.xpack.ml.action.util.QueryPage; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.CategorizerState; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelState; +import org.elasticsearch.xpack.ml.notifications.AuditActivity; +import org.elasticsearch.xpack.ml.notifications.AuditMessage; +import org.elasticsearch.xpack.ml.notifications.Auditor; import org.elasticsearch.xpack.ml.job.persistence.BucketsQueryBuilder.BucketsQuery; import org.elasticsearch.xpack.ml.job.persistence.InfluencersQueryBuilder.InfluencersQuery; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.job.results.AnomalyRecord; import org.elasticsearch.xpack.ml.job.results.Bucket; import org.elasticsearch.xpack.ml.job.results.CategoryDefinition; @@ -68,7 +69,7 @@ import org.elasticsearch.xpack.ml.job.results.ModelDebugOutput; import org.elasticsearch.xpack.ml.job.results.PerPartitionMaxProbabilities; import org.elasticsearch.xpack.ml.job.results.Result; import org.elasticsearch.xpack.ml.job.usage.Usage; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsPersister.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsPersister.java index 759a506fcf7..87f59cd2d3c 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsPersister.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsPersister.java @@ -17,9 +17,9 @@ import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.job.results.AnomalyRecord; import org.elasticsearch.xpack.ml.job.results.Bucket; import org.elasticsearch.xpack.ml.job.results.BucketInfluencer; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/status/CountingInputStream.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/CountingInputStream.java similarity index 70% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/status/CountingInputStream.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/CountingInputStream.java index bcb8d736dc7..559347d1fa3 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/status/CountingInputStream.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/CountingInputStream.java @@ -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.status; +package org.elasticsearch.xpack.ml.job.process; import java.io.FilterInputStream; import java.io.IOException; @@ -12,22 +12,22 @@ import java.io.InputStream; /** * Simple wrapper around an inputstream instance that counts * all the bytes passing through it reporting that number to - * the {@link StatusReporter} + * the {@link DataCountsReporter} *

* Overrides the read methods counting the number of bytes read. */ public class CountingInputStream extends FilterInputStream { - private StatusReporter statusReporter; + private DataCountsReporter dataCountsReporter; /** * @param in * input stream - * @param statusReporter + * @param dataCountsReporter * Write number of records, bytes etc. */ - public CountingInputStream(InputStream in, StatusReporter statusReporter) { + public CountingInputStream(InputStream in, DataCountsReporter dataCountsReporter) { super(in); - this.statusReporter = statusReporter; + this.dataCountsReporter = dataCountsReporter; } /** @@ -36,7 +36,7 @@ public class CountingInputStream extends FilterInputStream { @Override public int read() throws IOException { int read = in.read(); - statusReporter.reportBytesRead(read < 0 ? 0 : 1); + dataCountsReporter.reportBytesRead(read < 0 ? 0 : 1); return read; } @@ -45,7 +45,7 @@ public class CountingInputStream extends FilterInputStream { public int read(byte[] b) throws IOException { int read = in.read(b); - statusReporter.reportBytesRead(read < 0 ? 0 : read); + dataCountsReporter.reportBytesRead(read < 0 ? 0 : read); return read; } @@ -54,7 +54,7 @@ public class CountingInputStream extends FilterInputStream { public int read(byte[] b, int off, int len) throws IOException { int read = in.read(b, off, len); - statusReporter.reportBytesRead(read < 0 ? 0 : read); + dataCountsReporter.reportBytesRead(read < 0 ? 0 : read); return read; } } diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/status/StatusReporter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/DataCountsReporter.java similarity index 96% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/status/StatusReporter.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/DataCountsReporter.java index 68fdf440751..3a4ebbe1edb 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/status/StatusReporter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/DataCountsReporter.java @@ -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.status; +package org.elasticsearch.xpack.ml.job.process; import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.action.ActionListener; @@ -13,7 +13,7 @@ import org.elasticsearch.common.settings.Setting.Property; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.xpack.ml.job.DataCounts; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; import org.elasticsearch.xpack.ml.job.persistence.JobDataCountsPersister; import org.elasticsearch.xpack.ml.job.usage.UsageReporter; @@ -42,7 +42,7 @@ import java.util.function.Function; * {@linkplain JobDataCountsPersister}, {@link #close()} must be called to * cancel the datafeed task. */ -public class StatusReporter extends AbstractComponent implements Closeable { +public class DataCountsReporter extends AbstractComponent implements Closeable { /** * The max percentage of date parse errors allowed before * an exception is thrown. @@ -80,8 +80,8 @@ public class StatusReporter extends AbstractComponent implements Closeable { private volatile boolean persistDataCountsOnNextRecord; private final ThreadPool.Cancellable persistDataCountsDatafeedAction; - public StatusReporter(ThreadPool threadPool, Settings settings, String jobId, DataCounts counts, UsageReporter usageReporter, - JobDataCountsPersister dataCountsPersister) { + public DataCountsReporter(ThreadPool threadPool, Settings settings, String jobId, DataCounts counts, UsageReporter usageReporter, + JobDataCountsPersister dataCountsPersister) { super(settings); diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/NativeController.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/NativeController.java index cf4b06f5e62..b241b9799cc 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/NativeController.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/NativeController.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.ml.job.process; import org.apache.logging.log4j.Logger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.env.Environment; -import org.elasticsearch.xpack.ml.job.logging.CppLogMessageHandler; +import org.elasticsearch.xpack.ml.job.process.logging.CppLogMessageHandler; import org.elasticsearch.xpack.ml.utils.NamedPipeHelper; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/ProcessCtrl.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/ProcessCtrl.java index 58b78f5ffba..be6a279085f 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/ProcessCtrl.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/ProcessCtrl.java @@ -13,10 +13,10 @@ import org.elasticsearch.common.settings.Setting.Property; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.xpack.ml.MlPlugin; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.IgnoreDowntime; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.IgnoreDowntime; +import org.elasticsearch.xpack.ml.job.config.Job; import java.io.BufferedWriter; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectBuilder.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectBuilder.java index 395a53db0a9..afbf55ee33a 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectBuilder.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectBuilder.java @@ -8,17 +8,17 @@ package org.elasticsearch.xpack.ml.job.process.autodetect; import org.apache.logging.log4j.Logger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; -import org.elasticsearch.xpack.ml.job.AnalysisLimits; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelDebugConfig; +import org.elasticsearch.xpack.ml.job.config.AnalysisLimits; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.ModelDebugConfig; import org.elasticsearch.xpack.ml.job.process.NativeController; import org.elasticsearch.xpack.ml.job.process.ProcessCtrl; import org.elasticsearch.xpack.ml.job.process.ProcessPipes; import org.elasticsearch.xpack.ml.job.process.autodetect.writer.AnalysisLimitsWriter; import org.elasticsearch.xpack.ml.job.process.autodetect.writer.FieldConfigWriter; import org.elasticsearch.xpack.ml.job.process.autodetect.writer.ModelDebugConfigWriter; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import java.io.IOException; import java.io.OutputStreamWriter; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectCommunicator.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectCommunicator.java index ece599ea19c..c943a995db9 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectCommunicator.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectCommunicator.java @@ -10,11 +10,12 @@ import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.job.process.autodetect.output.AutoDetectResultProcessor; import org.elasticsearch.xpack.ml.job.process.autodetect.output.StateProcessor; @@ -22,9 +23,8 @@ import org.elasticsearch.xpack.ml.job.process.autodetect.params.DataLoadParams; import org.elasticsearch.xpack.ml.job.process.autodetect.params.InterimResultsParams; import org.elasticsearch.xpack.ml.job.process.autodetect.writer.DataToProcessWriter; import org.elasticsearch.xpack.ml.job.process.autodetect.writer.DataToProcessWriterFactory; -import org.elasticsearch.xpack.ml.job.status.CountingInputStream; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.process.CountingInputStream; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.Closeable; @@ -45,7 +45,7 @@ public class AutodetectCommunicator implements Closeable { private static final int DEFAULT_TRY_TIMEOUT_SECS = 30; private final Job job; - private final StatusReporter statusReporter; + private final DataCountsReporter dataCountsReporter; private final AutodetectProcess autodetectProcess; private final AutoDetectResultProcessor autoDetectResultProcessor; private final Consumer handler; @@ -53,11 +53,11 @@ public class AutodetectCommunicator implements Closeable { final AtomicReference inUse = new AtomicReference<>(); public AutodetectCommunicator(ExecutorService autoDetectExecutor, Job job, AutodetectProcess process, - StatusReporter statusReporter, AutoDetectResultProcessor autoDetectResultProcessor, + DataCountsReporter dataCountsReporter, AutoDetectResultProcessor autoDetectResultProcessor, StateProcessor stateProcessor, Consumer handler) { this.job = job; this.autodetectProcess = process; - this.statusReporter = statusReporter; + this.dataCountsReporter = dataCountsReporter; this.autoDetectResultProcessor = autoDetectResultProcessor; this.handler = handler; @@ -77,7 +77,7 @@ public class AutodetectCommunicator implements Closeable { private DataToProcessWriter createProcessWriter(Optional dataDescription) { return DataToProcessWriterFactory.create(true, autodetectProcess, dataDescription.orElse(job.getDataDescription()), - job.getAnalysisConfig(), new TransformConfigs(job.getTransforms()) , statusReporter, LOGGER); + job.getAnalysisConfig(), new TransformConfigs(job.getTransforms()) , dataCountsReporter, LOGGER); } public DataCounts writeToJob(InputStream inputStream, DataLoadParams params) throws IOException { @@ -85,7 +85,7 @@ public class AutodetectCommunicator implements Closeable { if (params.isResettingBuckets()) { autodetectProcess.writeResetBucketsControlMessage(params); } - CountingInputStream countingStream = new CountingInputStream(inputStream, statusReporter); + CountingInputStream countingStream = new CountingInputStream(inputStream, dataCountsReporter); DataToProcessWriter autoDetectWriter = createProcessWriter(params.getDataDescription()); DataCounts results = autoDetectWriter.write(countingStream); @@ -97,7 +97,7 @@ public class AutodetectCommunicator implements Closeable { @Override public void close() throws IOException { checkAndRun(() -> Messages.getMessage(Messages.JOB_DATA_CONCURRENT_USE_CLOSE, job.getId()), () -> { - statusReporter.close(); + dataCountsReporter.close(); autodetectProcess.close(); autoDetectResultProcessor.awaitCompletion(); handler.accept(null); @@ -158,7 +158,7 @@ public class AutodetectCommunicator implements Closeable { } public Optional getDataCounts() { - return Optional.ofNullable(statusReporter.runningTotalStats()); + return Optional.ofNullable(dataCountsReporter.runningTotalStats()); } private T checkAndRun(Supplier errorMessage, Callback callback, boolean wait) throws IOException { diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessFactory.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessFactory.java index 81bd948817a..755cb95009e 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessFactory.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessFactory.java @@ -5,10 +5,10 @@ */ package org.elasticsearch.xpack.ml.job.process.autodetect; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import java.util.Set; import java.util.concurrent.ExecutorService; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/manager/AutodetectProcessManager.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java similarity index 87% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/manager/AutodetectProcessManager.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java index 3f39fd09fae..003a10ca4cd 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/manager/AutodetectProcessManager.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java @@ -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.manager; +package org.elasticsearch.xpack.ml.job.process.autodetect; import org.apache.lucene.util.IOUtils; import org.elasticsearch.ElasticsearchStatusException; @@ -16,34 +16,31 @@ import org.elasticsearch.rest.RestStatus; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.UpdateJobStatusAction; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.data.DataProcessor; +import org.elasticsearch.xpack.ml.job.JobManager; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import org.elasticsearch.xpack.ml.job.metadata.Allocation; import org.elasticsearch.xpack.ml.job.persistence.JobDataCountsPersister; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; import org.elasticsearch.xpack.ml.job.persistence.JobRenormalizedResultsPersister; import org.elasticsearch.xpack.ml.job.persistence.JobResultsPersister; import org.elasticsearch.xpack.ml.job.persistence.UsagePersister; -import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectCommunicator; -import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; -import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcessFactory; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; import org.elasticsearch.xpack.ml.job.process.autodetect.output.AutoDetectResultProcessor; import org.elasticsearch.xpack.ml.job.process.autodetect.output.AutodetectResultsParser; import org.elasticsearch.xpack.ml.job.process.autodetect.output.StateProcessor; import org.elasticsearch.xpack.ml.job.process.autodetect.params.DataLoadParams; import org.elasticsearch.xpack.ml.job.process.autodetect.params.InterimResultsParams; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.job.process.normalizer.NormalizerFactory; import org.elasticsearch.xpack.ml.job.process.normalizer.Renormalizer; import org.elasticsearch.xpack.ml.job.process.normalizer.ScoresUpdater; import org.elasticsearch.xpack.ml.job.process.normalizer.ShortCircuitingRenormalizer; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.job.usage.UsageReporter; -import org.elasticsearch.xpack.ml.lists.ListDocument; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import java.io.IOException; @@ -61,7 +58,7 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; -public class AutodetectProcessManager extends AbstractComponent implements DataProcessor { +public class AutodetectProcessManager extends AbstractComponent { // TODO (norelease) default needs to be reconsidered // Cannot be dynamic because the thread pool that is sized to match cannot be resized @@ -110,7 +107,24 @@ public class AutodetectProcessManager extends AbstractComponent implements DataP this.autoDetectCommunicatorByJob = new ConcurrentHashMap<>(); } - @Override + /** + * Passes data to the native process. + * This is a blocking call that won't return until all the data has been + * written to the process. + * + * An ElasticsearchStatusException will be thrown is any of these error conditions occur: + *

    + *
  1. If a configured field is missing from the CSV header
  2. + *
  3. If JSON data is malformed and we cannot recover parsing
  4. + *
  5. If a high proportion of the records the timestamp field that cannot be parsed
  6. + *
  7. If a high proportion of the records chronologically out of order
  8. + *
+ * + * @param jobId the jobId + * @param input Data input stream + * @param params Data processing parameters + * @return Count of records, fields, bytes, etc written + */ public DataCounts processData(String jobId, InputStream input, DataLoadParams params) { Allocation allocation = jobManager.getJobAllocation(jobId); if (allocation.getStatus() != JobStatus.OPENED) { @@ -137,7 +151,15 @@ public class AutodetectProcessManager extends AbstractComponent implements DataP } } - @Override + /** + * Flush the running job, ensuring that the native process has had the + * opportunity to process all data previously sent to it with none left + * sitting in buffers. + * + * @param jobId The job to flush + * @param params Parameters about whether interim results calculation + * should occur and for which period of time + */ public void flushJob(String jobId, InterimResultsParams params) { logger.debug("Flushing job {}", jobId); AutodetectCommunicator communicator = autoDetectCommunicatorByJob.get(jobId); @@ -166,7 +188,6 @@ public class AutodetectProcessManager extends AbstractComponent implements DataP // TODO check for errors from autodetect } - @Override public void openJob(String jobId, boolean ignoreDowntime, Consumer handler) { gatherRequiredInformation(jobId, (modelSnapshot, quantiles, lists) -> { autoDetectCommunicatorByJob.computeIfAbsent(jobId, id -> { @@ -215,7 +236,7 @@ public class AutodetectProcessManager extends AbstractComponent implements DataP ExecutorService executorService = threadPool.executor(MlPlugin.AUTODETECT_PROCESS_THREAD_POOL_NAME); UsageReporter usageReporter = new UsageReporter(settings, job.getId(), usagePersister); - try (StatusReporter statusReporter = new StatusReporter(threadPool, settings, job.getId(), fetchDataCounts(jobId), + try (DataCountsReporter dataCountsReporter = new DataCountsReporter(threadPool, settings, job.getId(), fetchDataCounts(jobId), usageReporter, jobDataCountsPersister)) { ScoresUpdater scoresUpdator = new ScoresUpdater(job, jobProvider, jobRenormalizedResultsPersister, normalizerFactory); Renormalizer renormalizer = new ShortCircuitingRenormalizer(jobId, scoresUpdator, @@ -226,7 +247,7 @@ public class AutodetectProcessManager extends AbstractComponent implements DataP try { process = autodetectProcessFactory.createAutodetectProcess(job, modelSnapshot, quantiles, lists, ignoreDowntime, executorService); - return new AutodetectCommunicator(executorService, job, process, statusReporter, processor, stateProcessor, handler); + return new AutodetectCommunicator(executorService, job, process, dataCountsReporter, processor, stateProcessor, handler); } catch (Exception e) { try { IOUtils.close(process); @@ -260,7 +281,11 @@ public class AutodetectProcessManager extends AbstractComponent implements DataP return holder.get(); } - @Override + /** + * Stop the running job and mark it as finished.
+ * @param jobId The job to stop + * + */ public void closeJob(String jobId) { logger.debug("Closing job {}", jobId); AutodetectCommunicator communicator = autoDetectCommunicatorByJob.remove(jobId); diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/NativeAutodetectProcess.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/NativeAutodetectProcess.java index b2e798e4ba2..64a51b5d309 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/NativeAutodetectProcess.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/NativeAutodetectProcess.java @@ -9,7 +9,7 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; -import org.elasticsearch.xpack.ml.job.logging.CppLogMessageHandler; +import org.elasticsearch.xpack.ml.job.process.logging.CppLogMessageHandler; import org.elasticsearch.xpack.ml.job.process.autodetect.params.DataLoadParams; import org.elasticsearch.xpack.ml.job.process.autodetect.params.InterimResultsParams; import org.elasticsearch.xpack.ml.job.process.autodetect.writer.ControlMsgToProcessWriter; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/NativeAutodetectProcessFactory.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/NativeAutodetectProcessFactory.java index ac917f2de6e..7151800a950 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/NativeAutodetectProcessFactory.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/NativeAutodetectProcessFactory.java @@ -11,14 +11,14 @@ import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; import org.elasticsearch.env.Environment; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; import org.elasticsearch.xpack.ml.job.process.NativeController; import org.elasticsearch.xpack.ml.job.process.ProcessCtrl; import org.elasticsearch.xpack.ml.job.process.ProcessPipes; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import org.elasticsearch.xpack.ml.utils.NamedPipeHelper; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutoDetectResultProcessor.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutoDetectResultProcessor.java index 38c616abb69..e888e963f3c 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutoDetectResultProcessor.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutoDetectResultProcessor.java @@ -8,11 +8,11 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.output; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.job.persistence.JobResultsPersister; import org.elasticsearch.xpack.ml.job.process.normalizer.Renormalizer; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.job.results.AnomalyRecord; import org.elasticsearch.xpack.ml.job.results.AutodetectResult; import org.elasticsearch.xpack.ml.job.results.Bucket; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/params/DataLoadParams.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/params/DataLoadParams.java index e2fc9f07f2f..5e2d9c6f464 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/params/DataLoadParams.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/params/DataLoadParams.java @@ -5,7 +5,7 @@ */ package org.elasticsearch.xpack.ml.job.process.autodetect.params; -import org.elasticsearch.xpack.ml.job.DataDescription; +import org.elasticsearch.xpack.ml.job.config.DataDescription; import java.util.Objects; import java.util.Optional; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/CategorizerState.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/CategorizerState.java similarity index 92% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/CategorizerState.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/CategorizerState.java index 6d9380209ee..7b6430ab880 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/CategorizerState.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/CategorizerState.java @@ -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; +package org.elasticsearch.xpack.ml.job.process.autodetect.state; /** diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/DataCounts.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/DataCounts.java similarity index 99% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/DataCounts.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/DataCounts.java index 68273e6dbcc..a5efce9a06a 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/DataCounts.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/DataCounts.java @@ -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; +package org.elasticsearch.xpack.ml.job.process.autodetect.state; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; @@ -14,6 +14,7 @@ import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser.Token; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.utils.time.TimeUtils; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/ModelSizeStats.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelSizeStats.java similarity index 99% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/ModelSizeStats.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelSizeStats.java index f2a5f98c10e..104245e3897 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/ModelSizeStats.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelSizeStats.java @@ -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; +package org.elasticsearch.xpack.ml.job.process.autodetect.state; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; @@ -14,6 +14,7 @@ import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser.Token; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.results.Result; import org.elasticsearch.xpack.ml.utils.time.TimeUtils; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/ModelSnapshot.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelSnapshot.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/ModelSnapshot.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelSnapshot.java index 7a41e476d39..707b4329627 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/ModelSnapshot.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelSnapshot.java @@ -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; +package org.elasticsearch.xpack.ml.job.process.autodetect.state; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; @@ -14,7 +14,7 @@ import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser.Token; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.utils.time.TimeUtils; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/ModelState.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelState.java similarity index 93% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/ModelState.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelState.java index 7de0bf3adca..576693cf79a 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/ModelState.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelState.java @@ -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; +package org.elasticsearch.xpack.ml.job.process.autodetect.state; import org.elasticsearch.common.ParseField; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/quantiles/Quantiles.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/Quantiles.java similarity index 97% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/quantiles/Quantiles.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/Quantiles.java index 52822463703..ae3b9cf2efe 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/quantiles/Quantiles.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/Quantiles.java @@ -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.quantiles; +package org.elasticsearch.xpack.ml.job.process.autodetect.state; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; @@ -13,7 +13,7 @@ import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import java.io.IOException; import java.util.Date; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AbstractDataToProcessWriter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AbstractDataToProcessWriter.java index 11c4ccac073..fd31c41cd87 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AbstractDataToProcessWriter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AbstractDataToProcessWriter.java @@ -6,13 +6,12 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import org.apache.logging.log4j.Logger; -import org.elasticsearch.tasks.TaskCancelledException; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataDescription; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.DataDescription; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; import org.elasticsearch.xpack.ml.transforms.DependencySorter; import org.elasticsearch.xpack.ml.transforms.Transform; import org.elasticsearch.xpack.ml.transforms.Transform.TransformIndex; @@ -37,7 +36,6 @@ import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.function.Supplier; public abstract class AbstractDataToProcessWriter implements DataToProcessWriter { @@ -49,7 +47,7 @@ public abstract class AbstractDataToProcessWriter implements DataToProcessWriter protected final AutodetectProcess autodetectProcess; protected final DataDescription dataDescription; protected final AnalysisConfig analysisConfig; - protected final StatusReporter statusReporter; + protected final DataCountsReporter dataCountsReporter; protected final Logger logger; protected final TransformConfigs transformConfigs; @@ -69,19 +67,19 @@ public abstract class AbstractDataToProcessWriter implements DataToProcessWriter protected AbstractDataToProcessWriter(boolean includeControlField, AutodetectProcess autodetectProcess, - DataDescription dataDescription, AnalysisConfig analysisConfig, - TransformConfigs transformConfigs, StatusReporter statusReporter, Logger logger) { + DataDescription dataDescription, AnalysisConfig analysisConfig, + TransformConfigs transformConfigs, DataCountsReporter dataCountsReporter, Logger logger) { this.includeControlField = includeControlField; this.autodetectProcess = Objects.requireNonNull(autodetectProcess); this.dataDescription = Objects.requireNonNull(dataDescription); this.analysisConfig = Objects.requireNonNull(analysisConfig); - this.statusReporter = Objects.requireNonNull(statusReporter); + this.dataCountsReporter = Objects.requireNonNull(dataCountsReporter); this.logger = Objects.requireNonNull(logger); this.transformConfigs = Objects.requireNonNull(transformConfigs); postDateTransforms = new ArrayList<>(); dateInputTransforms = new ArrayList<>(); - Date date = statusReporter.getLatestRecordTime(); + Date date = dataCountsReporter.getLatestRecordTime(); latestEpochMsThisUpload = 0; latestEpochMs = 0; if (date != null) { @@ -112,7 +110,7 @@ public abstract class AbstractDataToProcessWriter implements DataToProcessWriter Map outFieldIndexes = outputFieldIndexes(); inputOutputMap = createInputOutputMap(inFieldIndexes); - statusReporter.setAnalysedFieldsPerRecord(analysisConfig.analysisFields().size()); + dataCountsReporter.setAnalysedFieldsPerRecord(analysisConfig.analysisFields().size()); Map scratchAreaIndexes = scratchAreaIndexes(inputFields, outputFields(), dataDescription.getTimeField()); @@ -232,7 +230,7 @@ public abstract class AbstractDataToProcessWriter implements DataToProcessWriter try { dateTransform.transform(readWriteArea); } catch (TransformException e) { - statusReporter.reportDateParseError(numberOfFieldsRead); + dataCountsReporter.reportDateParseError(numberOfFieldsRead); logger.error(e.getMessage()); return false; } @@ -242,12 +240,12 @@ public abstract class AbstractDataToProcessWriter implements DataToProcessWriter // Records have epoch seconds timestamp so compare for out of order in seconds if (epochMs / MS_IN_SECOND < latestEpochMs / MS_IN_SECOND - analysisConfig.getLatency()) { // out of order - statusReporter.reportOutOfOrderRecord(inFieldIndexes.size()); + dataCountsReporter.reportOutOfOrderRecord(inFieldIndexes.size()); if (epochMs > latestEpochMsThisUpload) { // record this timestamp even if the record won't be processed latestEpochMsThisUpload = epochMs; - statusReporter.reportLatestTimeIncrementalStats(latestEpochMsThisUpload); + dataCountsReporter.reportLatestTimeIncrementalStats(latestEpochMsThisUpload); } return false; } @@ -261,7 +259,7 @@ public abstract class AbstractDataToProcessWriter implements DataToProcessWriter latestEpochMsThisUpload = latestEpochMs; autodetectProcess.writeRecord(output); - statusReporter.reportRecordWritten(numberOfFieldsRead, latestEpochMs); + dataCountsReporter.reportRecordWritten(numberOfFieldsRead, latestEpochMs); return true; } diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AnalysisLimitsWriter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AnalysisLimitsWriter.java index a52f71a59e4..023f35cf708 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AnalysisLimitsWriter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AnalysisLimitsWriter.java @@ -9,7 +9,7 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Objects; -import org.elasticsearch.xpack.ml.job.AnalysisLimits; +import org.elasticsearch.xpack.ml.job.config.AnalysisLimits; import static org.elasticsearch.xpack.ml.job.process.autodetect.writer.WriterConstants.EQUALS; import static org.elasticsearch.xpack.ml.job.process.autodetect.writer.WriterConstants.NEW_LINE; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/CsvDataToProcessWriter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/CsvDataToProcessWriter.java index 3377ad31144..ed66795ee98 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/CsvDataToProcessWriter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/CsvDataToProcessWriter.java @@ -6,12 +6,12 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.DataDescription; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.DataDescription; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; import org.supercsv.io.CsvListReader; import org.supercsv.prefs.CsvPreference; @@ -50,9 +50,9 @@ class CsvDataToProcessWriter extends AbstractDataToProcessWriter { private static final int MAX_LINES_PER_RECORD = 10000; public CsvDataToProcessWriter(boolean includeControlField, AutodetectProcess autodetectProcess, - DataDescription dataDescription, AnalysisConfig analysisConfig, - TransformConfigs transforms, StatusReporter statusReporter, Logger logger) { - super(includeControlField, autodetectProcess, dataDescription, analysisConfig, transforms, statusReporter, logger); + DataDescription dataDescription, AnalysisConfig analysisConfig, + TransformConfigs transforms, DataCountsReporter dataCountsReporter, Logger logger) { + super(includeControlField, autodetectProcess, dataDescription, analysisConfig, transforms, dataCountsReporter, logger); } /** @@ -69,13 +69,13 @@ class CsvDataToProcessWriter extends AbstractDataToProcessWriter { new String(new char[]{DataDescription.LINE_ENDING})) .maxLinesPerRow(MAX_LINES_PER_RECORD).build(); - statusReporter.startNewIncrementalCount(); + dataCountsReporter.startNewIncrementalCount(); try (CsvListReader csvReader = new CsvListReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8), csvPref)) { String[] header = csvReader.getHeader(true); if (header == null) { // null if EoF - return statusReporter.incrementalStats(); + return dataCountsReporter.incrementalStats(); } long inputFieldCount = Math.max(header.length - 1, 0); // time field doesn't count @@ -102,7 +102,7 @@ class CsvDataToProcessWriter extends AbstractDataToProcessWriter { for (InputOutputMap inOut : inputOutputMap) { if (inOut.inputIndex >= line.size()) { - statusReporter.reportMissingField(); + dataCountsReporter.reportMissingField(); continue; } @@ -121,10 +121,10 @@ class CsvDataToProcessWriter extends AbstractDataToProcessWriter { } // This function can throw - statusReporter.finishReporting(); + dataCountsReporter.finishReporting(); } - return statusReporter.incrementalStats(); + return dataCountsReporter.incrementalStats(); } private static void fillRecordFromLine(List line, String[] record) { diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataToProcessWriter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataToProcessWriter.java index 18503d23c3b..a09be8e1015 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataToProcessWriter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataToProcessWriter.java @@ -5,7 +5,7 @@ */ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; -import org.elasticsearch.xpack.ml.job.DataCounts; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; import java.io.IOException; import java.io.InputStream; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataToProcessWriterFactory.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataToProcessWriterFactory.java index 808dd67277e..8c5deffd59a 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataToProcessWriterFactory.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataToProcessWriterFactory.java @@ -6,11 +6,11 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataDescription; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; /** * Factory for creating the suitable writer depending on @@ -32,17 +32,17 @@ public final class DataToProcessWriterFactory { */ public static DataToProcessWriter create(boolean includeControlField, AutodetectProcess autodetectProcess, DataDescription dataDescription, AnalysisConfig analysisConfig, - TransformConfigs transforms, StatusReporter statusReporter, Logger logger) { + TransformConfigs transforms, DataCountsReporter dataCountsReporter, Logger logger) { switch (dataDescription.getFormat()) { case JSON: return new JsonDataToProcessWriter(includeControlField, autodetectProcess, dataDescription, analysisConfig, - transforms, statusReporter, logger); + transforms, dataCountsReporter, logger); case DELIMITED: return new CsvDataToProcessWriter(includeControlField, autodetectProcess, dataDescription, analysisConfig, - transforms, statusReporter, logger); + transforms, dataCountsReporter, logger); case SINGLE_LINE: return new SingleLineDataToProcessWriter(includeControlField, autodetectProcess, dataDescription, analysisConfig, - transforms, statusReporter, logger); + transforms, dataCountsReporter, logger); default: throw new IllegalArgumentException(); } diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/FieldConfigWriter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/FieldConfigWriter.java index f7c24f97d89..6fc771ec5c3 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/FieldConfigWriter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/FieldConfigWriter.java @@ -18,11 +18,11 @@ import org.apache.logging.log4j.Logger; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.Detector; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.Detector; import org.elasticsearch.xpack.ml.job.config.DefaultDetectorDescription; -import org.elasticsearch.xpack.ml.job.detectionrules.DetectionRule; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.job.config.DetectionRule; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import org.elasticsearch.xpack.ml.utils.MlStrings; public class FieldConfigWriter { diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/JsonDataToProcessWriter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/JsonDataToProcessWriter.java index 0aab10bdacb..e2043c80055 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/JsonDataToProcessWriter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/JsonDataToProcessWriter.java @@ -8,12 +8,12 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParser; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.DataDescription; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.DataDescription; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; import java.io.IOException; import java.io.InputStream; @@ -32,9 +32,9 @@ import java.util.Map; class JsonDataToProcessWriter extends AbstractDataToProcessWriter { public JsonDataToProcessWriter(boolean includeControlField, AutodetectProcess autodetectProcess, DataDescription dataDescription, - AnalysisConfig analysisConfig, TransformConfigs transforms, StatusReporter statusReporter, + AnalysisConfig analysisConfig, TransformConfigs transforms, DataCountsReporter dataCountsReporter, Logger logger) { - super(includeControlField, autodetectProcess, dataDescription, analysisConfig, transforms, statusReporter, logger); + super(includeControlField, autodetectProcess, dataDescription, analysisConfig, transforms, dataCountsReporter, logger); } /** @@ -46,16 +46,16 @@ class JsonDataToProcessWriter extends AbstractDataToProcessWriter { */ @Override public DataCounts write(InputStream inputStream) throws IOException { - statusReporter.startNewIncrementalCount(); + dataCountsReporter.startNewIncrementalCount(); try (JsonParser parser = new JsonFactory().createParser(inputStream)) { writeJson(parser); // this line can throw and will be propagated - statusReporter.finishReporting(); + dataCountsReporter.finishReporting(); } - return statusReporter.incrementalStats(); + return dataCountsReporter.incrementalStats(); } private void writeJson(JsonParser parser) throws IOException { @@ -79,7 +79,7 @@ class JsonDataToProcessWriter extends AbstractDataToProcessWriter { long missing = missingFieldCount(gotFields); if (missing > 0) { - statusReporter.reportMissingFields(missing); + dataCountsReporter.reportMissingFields(missing); } for (InputOutputMap inOut : inputOutputMap) { diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/ModelDebugConfigWriter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/ModelDebugConfigWriter.java index fd01cca8a95..929e1f97dea 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/ModelDebugConfigWriter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/ModelDebugConfigWriter.java @@ -5,7 +5,7 @@ */ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; -import org.elasticsearch.xpack.ml.job.ModelDebugConfig; +import org.elasticsearch.xpack.ml.job.config.ModelDebugConfig; import java.io.IOException; import java.io.Writer; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/SingleLineDataToProcessWriter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/SingleLineDataToProcessWriter.java index ccafae1e435..ded5d3a2b6f 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/SingleLineDataToProcessWriter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/SingleLineDataToProcessWriter.java @@ -6,12 +6,12 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.DataDescription; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.DataDescription; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; import java.io.BufferedReader; import java.io.IOException; @@ -36,14 +36,14 @@ public class SingleLineDataToProcessWriter extends AbstractDataToProcessWriter { private static final String RAW = "raw"; protected SingleLineDataToProcessWriter(boolean includeControlField, AutodetectProcess autodetectProcess, - DataDescription dataDescription, AnalysisConfig analysisConfig, - TransformConfigs transformConfigs, StatusReporter statusReporter, Logger logger) { - super(includeControlField, autodetectProcess, dataDescription, analysisConfig, transformConfigs, statusReporter, logger); + DataDescription dataDescription, AnalysisConfig analysisConfig, + TransformConfigs transformConfigs, DataCountsReporter dataCountsReporter, Logger logger) { + super(includeControlField, autodetectProcess, dataDescription, analysisConfig, transformConfigs, dataCountsReporter, logger); } @Override public DataCounts write(InputStream inputStream) throws IOException { - statusReporter.startNewIncrementalCount(); + dataCountsReporter.startNewIncrementalCount(); try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { String[] header = {RAW}; @@ -57,10 +57,10 @@ public class SingleLineDataToProcessWriter extends AbstractDataToProcessWriter { Arrays.fill(record, ""); applyTransformsAndWrite(new String[]{line}, record, 1); } - statusReporter.finishReporting(); + dataCountsReporter.finishReporting(); } - return statusReporter.incrementalStats(); + return dataCountsReporter.incrementalStats(); } @Override diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/logging/CppLogMessage.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/logging/CppLogMessage.java similarity index 99% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/logging/CppLogMessage.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/logging/CppLogMessage.java index 6aae0eddf48..af99df06ea3 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/logging/CppLogMessage.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/logging/CppLogMessage.java @@ -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.logging; +package org.elasticsearch.xpack.ml.job.process.logging; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/logging/CppLogMessageHandler.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/logging/CppLogMessageHandler.java similarity index 99% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/logging/CppLogMessageHandler.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/logging/CppLogMessageHandler.java index 01678e7b03e..ef78ce53d09 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/logging/CppLogMessageHandler.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/logging/CppLogMessageHandler.java @@ -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.logging; +package org.elasticsearch.xpack.ml.job.process.logging; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/NativeNormalizerProcess.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/NativeNormalizerProcess.java index 486198ee54d..254d1a6cc51 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/NativeNormalizerProcess.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/NativeNormalizerProcess.java @@ -10,7 +10,7 @@ import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; -import org.elasticsearch.xpack.ml.job.logging.CppLogMessageHandler; +import org.elasticsearch.xpack.ml.job.process.logging.CppLogMessageHandler; import org.elasticsearch.xpack.ml.job.process.autodetect.writer.LengthEncodedWriter; import org.elasticsearch.xpack.ml.job.process.normalizer.output.NormalizerResultHandler; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/Renormalizer.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/Renormalizer.java index 5a1aeff0055..56dd5d7be67 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/Renormalizer.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/Renormalizer.java @@ -5,7 +5,7 @@ */ package org.elasticsearch.xpack.ml.job.process.normalizer; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; public interface Renormalizer { /** diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/ScoresUpdater.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/ScoresUpdater.java index 29f4d8d862e..9edac99a73f 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/ScoresUpdater.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/ScoresUpdater.java @@ -7,8 +7,8 @@ package org.elasticsearch.xpack.ml.job.process.normalizer; import org.apache.logging.log4j.Logger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.persistence.BatchedDocumentsIterator; import org.elasticsearch.xpack.ml.job.persistence.BatchedResultsIterator; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/ShortCircuitingRenormalizer.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/ShortCircuitingRenormalizer.java index d80df18061b..979bf00003d 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/ShortCircuitingRenormalizer.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/ShortCircuitingRenormalizer.java @@ -7,7 +7,7 @@ package org.elasticsearch.xpack.ml.job.process.normalizer; import org.apache.logging.log4j.Logger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import java.util.Deque; import java.util.Objects; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/noop/NoOpRenormalizer.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/noop/NoOpRenormalizer.java index 4a4682676ac..bfbf6d60dd8 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/noop/NoOpRenormalizer.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/process/normalizer/noop/NoOpRenormalizer.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.job.process.normalizer.noop; import org.elasticsearch.xpack.ml.job.process.normalizer.Renormalizer; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; /** * A {@link Renormalizer} implementation that does absolutely nothing diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/AnomalyRecord.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/AnomalyRecord.java index d570dbfbb09..936dbe4e6f9 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/AnomalyRecord.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/AnomalyRecord.java @@ -14,7 +14,7 @@ import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser.Token; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import org.elasticsearch.xpack.ml.utils.time.TimeUtils; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/AutodetectResult.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/AutodetectResult.java index 9d850723725..6c2f9dc06a7 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/AutodetectResult.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/AutodetectResult.java @@ -13,10 +13,10 @@ import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.job.process.autodetect.output.FlushAcknowledgement; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import java.io.IOException; import java.util.List; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/Bucket.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/Bucket.java index 57c34ff641d..221d17e96c5 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/Bucket.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/Bucket.java @@ -14,7 +14,7 @@ import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser.Token; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import org.elasticsearch.xpack.ml.utils.time.TimeUtils; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/BucketInfluencer.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/BucketInfluencer.java index c6f7b777d39..1a196389224 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/BucketInfluencer.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/BucketInfluencer.java @@ -14,7 +14,7 @@ import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser.Token; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import org.elasticsearch.xpack.ml.utils.time.TimeUtils; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/CategoryDefinition.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/CategoryDefinition.java index 9beb1dbb28f..55b9644a3d7 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/CategoryDefinition.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/CategoryDefinition.java @@ -12,7 +12,7 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import java.io.IOException; import java.util.ArrayList; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/Influencer.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/Influencer.java index d5c3f0f20dd..9c27f0335c1 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/Influencer.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/Influencer.java @@ -14,7 +14,7 @@ import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser.Token; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import org.elasticsearch.xpack.ml.utils.time.TimeUtils; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/ModelDebugOutput.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/ModelDebugOutput.java index 8212867e22d..7280c742df8 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/ModelDebugOutput.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/ModelDebugOutput.java @@ -14,7 +14,7 @@ import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser.Token; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.utils.time.TimeUtils; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/PerPartitionMaxProbabilities.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/PerPartitionMaxProbabilities.java index 1db44e48148..bcdb0d285fb 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/PerPartitionMaxProbabilities.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/PerPartitionMaxProbabilities.java @@ -14,7 +14,7 @@ import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ObjectParser; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.utils.time.TimeUtils; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/ReservedFieldNames.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/ReservedFieldNames.java index fd573e350d6..1e2f64d4eb5 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/ReservedFieldNames.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/results/ReservedFieldNames.java @@ -5,12 +5,12 @@ */ package org.elasticsearch.xpack.ml.job.results; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.job.persistence.ElasticsearchMappings; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.job.usage.Usage; import java.util.Arrays; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/usage/UsageReporter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/usage/UsageReporter.java index d63ea8b5ac7..936063114f0 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/usage/UsageReporter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/usage/UsageReporter.java @@ -12,12 +12,14 @@ import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting.Property; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.xpack.ml.job.persistence.UsagePersister; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; + import java.util.Locale; /** * Reports the number of bytes, fields and records read. * Persistence is done via {@linkplain UsagePersister} - * The main difference betweeen this and the {@linkplain org.elasticsearch.xpack.ml.job.status.StatusReporter} + * The main difference betweeen this and the {@linkplain DataCountsReporter} * is that this writes hourly reports i.e. how much data was read in an hour */ public class UsageReporter extends AbstractComponent { diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/audit/AuditActivity.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/notifications/AuditActivity.java similarity index 99% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/audit/AuditActivity.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/notifications/AuditActivity.java index 139d9f5077d..159dcc909fb 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/audit/AuditActivity.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/notifications/AuditActivity.java @@ -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.audit; +package org.elasticsearch.xpack.ml.notifications; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/audit/AuditMessage.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/notifications/AuditMessage.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/audit/AuditMessage.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/notifications/AuditMessage.java index 207a0d41c25..4c11fcca771 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/audit/AuditMessage.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/notifications/AuditMessage.java @@ -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.audit; +package org.elasticsearch.xpack.ml.notifications; import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; @@ -15,7 +15,7 @@ import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser.Token; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.utils.time.TimeUtils; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/audit/Auditor.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/notifications/Auditor.java similarity index 98% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/audit/Auditor.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/notifications/Auditor.java index 69c4067affb..ebb39232b2f 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/audit/Auditor.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/notifications/Auditor.java @@ -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.audit; +package org.elasticsearch.xpack.ml.notifications; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/audit/Level.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/notifications/Level.java similarity index 96% rename from elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/audit/Level.java rename to elasticsearch/src/main/java/org/elasticsearch/xpack/ml/notifications/Level.java index 9ca3c973136..629326c8e9a 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/job/audit/Level.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/notifications/Level.java @@ -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.audit; +package org.elasticsearch.xpack.ml.notifications; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java index aa912a5d413..cb2bd72ec55 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java @@ -14,7 +14,7 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.CloseJobAction; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java index 97dbade05f4..d988316ab37 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java @@ -13,7 +13,7 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.AcknowledgedRestListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.DeleteJobAction; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java index 94e161649b3..af5575ff05b 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java @@ -14,7 +14,7 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.FlushJobAction; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java index 1f7aca5af36..fcba341e3c4 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java @@ -14,7 +14,7 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.GetJobsStatsAction; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java index 1ab2f46a458..f98722ba855 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java @@ -14,7 +14,7 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.GetJobsAction; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java index 4802959f689..22e5061d763 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java @@ -15,7 +15,7 @@ import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.OpenJobAction; import org.elasticsearch.xpack.ml.action.PostDataAction; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java index b70d119a647..8265fb943a6 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java @@ -13,7 +13,7 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.PostDataAction; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java index 76d9b9ea907..c0c7a0efb0c 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java @@ -14,7 +14,7 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.PutJobAction; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/list/RestGetListAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/list/RestGetListAction.java index bc3e3683579..9695d90eede 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/list/RestGetListAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/list/RestGetListAction.java @@ -14,8 +14,8 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.GetListAction; -import org.elasticsearch.xpack.ml.job.results.PageParams; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.action.util.PageParams; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java index 2845383a335..a1029b3222d 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java @@ -13,8 +13,8 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.AcknowledgedRestListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.DeleteModelSnapshotAction; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java index 82ab527d70d..9e106dd5425 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java @@ -15,8 +15,8 @@ import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.GetModelSnapshotsAction; import org.elasticsearch.xpack.ml.action.GetModelSnapshotsAction.Request; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.action.util.PageParams; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java index 783cf322cae..2febb5094de 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java @@ -14,7 +14,7 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.RevertModelSnapshotAction; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java index b7258590b91..4fab6255e67 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java @@ -14,8 +14,8 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.UpdateModelSnapshotAction; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java index 50bc19930db..7a9957437e0 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java @@ -14,9 +14,9 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.GetBucketsAction; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.results.Bucket; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java index 04a870f48d6..0c1a92ee38a 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java @@ -17,8 +17,8 @@ import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.GetCategoriesAction; import org.elasticsearch.xpack.ml.action.GetCategoriesAction.Request; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.action.util.PageParams; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java index 37cce24e201..de3607b05f4 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java @@ -14,9 +14,9 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.GetInfluencersAction; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.results.Influencer; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java index e99b26d8f46..baa5dfb1707 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java @@ -14,9 +14,9 @@ import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.GetRecordsAction; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.results.AnomalyRecord; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import java.io.IOException; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/DependencySorter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/DependencySorter.java index 183f9cc4d01..8e26a12baac 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/DependencySorter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/DependencySorter.java @@ -10,7 +10,7 @@ import java.util.LinkedList; import java.util.List; import java.util.ListIterator; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; /** * Transform inputs and outputs can be chained together this class provides @@ -33,7 +33,7 @@ public final class DependencySorter { *

* Note if there is a circular dependency in the list of transforms this * will cause a stack overflow. Check with - * {@linkplain org.elasticsearch.xpack.ml.job.transform.verification.TransformConfigsVerifier#checkForCircularDependencies(List)} + * {@linkplain org.elasticsearch.xpack.ml.job.config.transform.verification.TransformConfigsVerifier#checkForCircularDependencies(List)} * first. * * @return List of transforms ordered by dependencies @@ -49,7 +49,7 @@ public final class DependencySorter { *

* Note if there is a circular dependency in the list of transforms this * will cause a stack overflow. Check with - * {@linkplain org.elasticsearch.xpack.ml.job.transform.verification.TransformConfigsVerifier#checkForCircularDependencies(List)} + * {@linkplain org.elasticsearch.xpack.ml.job.config.transform.verification.TransformConfigsVerifier#checkForCircularDependencies(List)} * first. * * @return List of transforms ordered by dependencies @@ -102,7 +102,7 @@ public final class DependencySorter { *

* Note if there is a circular dependency in the list of transforms this * will cause a stack overflow. Check with - * {@linkplain org.elasticsearch.xpack.ml.job.transform.verification.TransformConfigsVerifier#checkForCircularDependencies(List)} + * {@linkplain org.elasticsearch.xpack.ml.job.config.transform.verification.TransformConfigsVerifier#checkForCircularDependencies(List)} * first. * * @return List of transforms ordered by dependencies diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilter.java index 1eb59803096..ec22f69e0d4 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilter.java @@ -9,7 +9,7 @@ import java.util.List; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.ml.job.condition.Condition; +import org.elasticsearch.xpack.ml.job.config.Condition; /** diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterNumeric.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterNumeric.java index 14b3b716138..bb65c4f3b76 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterNumeric.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterNumeric.java @@ -9,8 +9,8 @@ import java.util.List; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; +import org.elasticsearch.xpack.ml.job.config.Condition; +import org.elasticsearch.xpack.ml.job.config.Operator; /** diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterRegex.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterRegex.java index e0903087d55..594b3fdce3f 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterRegex.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterRegex.java @@ -11,7 +11,7 @@ import java.util.regex.Pattern; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.ml.job.condition.Condition; +import org.elasticsearch.xpack.ml.job.config.Condition; /** * Matches a field against a regex diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/TransformFactory.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/TransformFactory.java index 922e6fde095..7f851788357 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/TransformFactory.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/transforms/TransformFactory.java @@ -11,8 +11,8 @@ import java.util.Map; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; import org.elasticsearch.xpack.ml.transforms.Transform.TransformIndex; /** diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/utils/JobStatusObserver.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/utils/JobStatusObserver.java index 46c7457c271..764f5d6e925 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/utils/JobStatusObserver.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/utils/JobStatusObserver.java @@ -12,7 +12,7 @@ import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.xpack.ml.job.JobStatus; +import org.elasticsearch.xpack.ml.job.config.JobStatus; import org.elasticsearch.xpack.ml.job.metadata.Allocation; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/CreateListActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/CreateListActionRequestTests.java index 4fe2a4d0909..b2803476ec7 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/CreateListActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/CreateListActionRequestTests.java @@ -7,7 +7,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.ml.action.PutListAction.Request; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase; import java.util.ArrayList; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/DatafeedJobsIT.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/DatafeedJobsIT.java index 5540ab7e073..fcd4ec687c4 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/DatafeedJobsIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/DatafeedJobsIT.java @@ -20,12 +20,12 @@ import org.elasticsearch.plugins.Plugin; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.xpack.ml.MlPlugin; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; import org.elasticsearch.xpack.ml.job.persistence.AnomalyDetectorsIndex; import org.elasticsearch.xpack.ml.datafeed.Datafeed; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetBucketActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetBucketActionRequestTests.java index e73ae564014..723dd56e3ff 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetBucketActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetBucketActionRequestTests.java @@ -7,7 +7,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.ml.action.GetBucketsAction.Request; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase; public class GetBucketActionRequestTests extends AbstractStreamableXContentTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetBucketActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetBucketActionResponseTests.java index bdf0c1b9bd8..7d884522373 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetBucketActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetBucketActionResponseTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetBucketsAction.Response; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.job.results.AnomalyRecord; import org.elasticsearch.xpack.ml.job.results.Bucket; import org.elasticsearch.xpack.ml.job.results.BucketInfluencer; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetCategoriesRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetCategoriesRequestTests.java index 7f2d1e27d71..ce7c870b3c3 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetCategoriesRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetCategoriesRequestTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase; public class GetCategoriesRequestTests extends AbstractStreamableXContentTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetCategoriesResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetCategoriesResponseTests.java index 3bf49112b60..c3fa85ce8b0 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetCategoriesResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetCategoriesResponseTests.java @@ -5,7 +5,7 @@ */ package org.elasticsearch.xpack.ml.action; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.job.results.CategoryDefinition; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedStatsActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedStatsActionRequestTests.java index 4539665d768..bb1b612bcbf 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedStatsActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedStatsActionRequestTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetDatafeedsStatsAction.Request; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; public class GetDatafeedStatsActionRequestTests extends AbstractStreamableTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedStatsActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedStatsActionResponseTests.java index 7711f45c086..bfda5a520a4 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedStatsActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedStatsActionResponseTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetDatafeedsStatsAction.Response; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.datafeed.Datafeed; import org.elasticsearch.xpack.ml.datafeed.DatafeedStatus; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedsActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedsActionRequestTests.java index 273ed437ec0..add0a9e9115 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedsActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedsActionRequestTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetDatafeedsAction.Request; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; public class GetDatafeedsActionRequestTests extends AbstractStreamableTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedsActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedsActionResponseTests.java index 73e1f9ab02b..401f5f39bbb 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedsActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetDatafeedsActionResponseTests.java @@ -11,7 +11,7 @@ import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.xpack.ml.action.GetDatafeedsAction.Response; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.datafeed.Datafeed; import org.elasticsearch.xpack.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.ml.datafeed.DatafeedConfigTests; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetInfluencersActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetInfluencersActionRequestTests.java index f1f5db3f12c..22dd4476fb7 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetInfluencersActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetInfluencersActionRequestTests.java @@ -7,7 +7,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.ml.action.GetInfluencersAction.Request; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase; public class GetInfluencersActionRequestTests extends AbstractStreamableXContentTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetInfluencersActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetInfluencersActionResponseTests.java index f247d13abd7..352bee43bd6 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetInfluencersActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetInfluencersActionResponseTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetInfluencersAction.Response; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.job.results.Influencer; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobStatsActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobStatsActionRequestTests.java index aef1ae04c86..19fdc305606 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobStatsActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobStatsActionRequestTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetJobsStatsAction.Request; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; public class GetJobStatsActionRequestTests extends AbstractStreamableTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobStatsActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobStatsActionResponseTests.java index 01ea1825f69..8066119452f 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobStatsActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobStatsActionResponseTests.java @@ -6,12 +6,11 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetJobsStatsAction.Response; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; -import org.elasticsearch.xpack.ml.datafeed.DatafeedStatus; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; import org.joda.time.DateTime; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobsActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobsActionRequestTests.java index d2640921f35..ef8b87e3cec 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobsActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobsActionRequestTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetJobsAction.Request; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; public class GetJobsActionRequestTests extends AbstractStreamableTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobsActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobsActionResponseTests.java index 8526c237f97..20c7b359e04 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobsActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetJobsActionResponseTests.java @@ -6,16 +6,16 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetJobsAction.Response; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.AnalysisLimits; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.IgnoreDowntime; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelDebugConfig; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.AnalysisLimits; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.IgnoreDowntime; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.ModelDebugConfig; +import org.elasticsearch.xpack.ml.action.util.QueryPage; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; import java.util.ArrayList; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetListActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetListActionRequestTests.java index 1d1621edd4b..4f872a81092 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetListActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetListActionRequestTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetListAction.Request; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; public class GetListActionRequestTests extends AbstractStreamableTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetListActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetListActionResponseTests.java index a83d0aff7e8..4bce01f0dda 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetListActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetListActionResponseTests.java @@ -6,8 +6,8 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetListAction.Response; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.action.util.QueryPage; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; import java.util.Collections; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetModelSnapshotsActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetModelSnapshotsActionRequestTests.java index ce422777a0e..c78b7af4c1a 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetModelSnapshotsActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetModelSnapshotsActionRequestTests.java @@ -7,7 +7,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.ml.action.GetModelSnapshotsAction.Request; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase; public class GetModelSnapshotsActionRequestTests extends AbstractStreamableXContentTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetModelSnapshotsActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetModelSnapshotsActionResponseTests.java index 147c56497e2..9aeec617eeb 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetModelSnapshotsActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetModelSnapshotsActionResponseTests.java @@ -6,8 +6,8 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetModelSnapshotsAction.Response; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; import java.util.ArrayList; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetRecordsActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetRecordsActionRequestTests.java index 5d3931947da..3f2cfbb3ead 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetRecordsActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetRecordsActionRequestTests.java @@ -7,7 +7,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.ml.action.GetRecordsAction.Request; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.action.util.PageParams; import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase; public class GetRecordsActionRequestTests extends AbstractStreamableXContentTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetRecordsActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetRecordsActionResponseTests.java index 25a6eeed9a0..97046d1063e 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetRecordsActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/GetRecordsActionResponseTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.GetRecordsAction.Response; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.job.results.AnomalyRecord; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PostDataActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PostDataActionResponseTests.java index 6c5e29863c7..6596c6eee0c 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PostDataActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PostDataActionResponseTests.java @@ -5,7 +5,7 @@ */ package org.elasticsearch.xpack.ml.action; -import org.elasticsearch.xpack.ml.job.DataCounts; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; import org.joda.time.DateTime; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PutJobActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PutJobActionRequestTests.java index da9fb311a21..051017b2983 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PutJobActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PutJobActionRequestTests.java @@ -7,11 +7,11 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.ml.action.PutJobAction.Request; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase; -import static org.elasticsearch.xpack.ml.job.JobTests.buildJobBuilder; -import static org.elasticsearch.xpack.ml.job.JobTests.randomValidJobId; +import static org.elasticsearch.xpack.ml.job.config.JobTests.buildJobBuilder; +import static org.elasticsearch.xpack.ml.job.config.JobTests.randomValidJobId; public class PutJobActionRequestTests extends AbstractStreamableXContentTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PutJobActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PutJobActionResponseTests.java index 5d8a0a25a24..c1b0d9b8db8 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PutJobActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PutJobActionResponseTests.java @@ -6,12 +6,12 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.PutJobAction.Response; -import org.elasticsearch.xpack.ml.job.IgnoreDowntime; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.IgnoreDowntime; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; -import static org.elasticsearch.xpack.ml.job.JobTests.buildJobBuilder; -import static org.elasticsearch.xpack.ml.job.JobTests.randomValidJobId; +import static org.elasticsearch.xpack.ml.job.config.JobTests.buildJobBuilder; +import static org.elasticsearch.xpack.ml.job.config.JobTests.randomValidJobId; public class PutJobActionResponseTests extends AbstractStreamableTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PutModelSnapshotDescriptionActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PutModelSnapshotDescriptionActionResponseTests.java index c1e999a7b81..883568bce1f 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PutModelSnapshotDescriptionActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/PutModelSnapshotDescriptionActionResponseTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.UpdateModelSnapshotAction.Response; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; public class PutModelSnapshotDescriptionActionResponseTests extends AbstractStreamableTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/RevertModelSnapshotActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/RevertModelSnapshotActionResponseTests.java index 4bb937e32ae..4da4214de3f 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/RevertModelSnapshotActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/RevertModelSnapshotActionResponseTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.RevertModelSnapshotAction.Response; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; public class RevertModelSnapshotActionResponseTests extends AbstractStreamableTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/StopDatafeedActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/StopDatafeedActionRequestTests.java index a2ae6ccdee0..cd1bc5d7abf 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/StopDatafeedActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/StopDatafeedActionRequestTests.java @@ -9,7 +9,7 @@ import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.ResourceNotFoundException; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.xpack.ml.action.StopDatafeedAction.Request; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; import org.elasticsearch.xpack.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.ml.datafeed.DatafeedStatus; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/UpdateJobStatusRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/UpdateJobStatusRequestTests.java index 74494009544..c799f9959d6 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/UpdateJobStatusRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/UpdateJobStatusRequestTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.xpack.ml.action.UpdateJobStatusAction.Request; -import org.elasticsearch.xpack.ml.job.JobStatus; +import org.elasticsearch.xpack.ml.job.config.JobStatus; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; public class UpdateJobStatusRequestTests extends AbstractStreamableTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/ValidateDetectorActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/ValidateDetectorActionRequestTests.java index 8fbb4a03150..95ad22d5698 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/ValidateDetectorActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/ValidateDetectorActionRequestTests.java @@ -7,7 +7,7 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.ml.action.ValidateDetectorAction.Request; -import org.elasticsearch.xpack.ml.job.Detector; +import org.elasticsearch.xpack.ml.job.config.Detector; import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase; public class ValidateDetectorActionRequestTests extends AbstractStreamableXContentTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/ValidateTransformActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/ValidateTransformActionRequestTests.java index 17f279016b9..2e19251d735 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/ValidateTransformActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/ValidateTransformActionRequestTests.java @@ -7,8 +7,8 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.ml.action.ValidateTransformAction.Request; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase; public class ValidateTransformActionRequestTests extends AbstractStreamableXContentTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/ValidateTransformsActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/ValidateTransformsActionRequestTests.java index 0ab6f833993..ed5dbf747cb 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/ValidateTransformsActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/ValidateTransformsActionRequestTests.java @@ -7,8 +7,8 @@ package org.elasticsearch.xpack.ml.action; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.ml.action.ValidateTransformsAction.Request; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase; import java.util.ArrayList; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/results/PageParamsTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/util/PageParamsTests.java similarity index 97% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/results/PageParamsTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/util/PageParamsTests.java index b187d8d8dcb..15181393946 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/results/PageParamsTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/util/PageParamsTests.java @@ -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.results; +package org.elasticsearch.xpack.ml.action.util; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/QueryPageTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/util/QueryPageTests.java similarity index 96% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/QueryPageTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/util/QueryPageTests.java index 84410e1b367..19102c3fa99 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/QueryPageTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/util/QueryPageTests.java @@ -3,12 +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.job.persistence; +package org.elasticsearch.xpack.ml.action.util; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.xpack.ml.job.results.Influencer; import org.elasticsearch.xpack.ml.support.AbstractWireSerializingTestCase; + import java.util.ArrayList; import java.util.Date; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobRunnerTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobRunnerTests.java index 2db74b0016b..c5658f0fb4d 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobRunnerTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobRunnerTests.java @@ -23,13 +23,13 @@ import org.elasticsearch.xpack.ml.action.FlushJobAction; import org.elasticsearch.xpack.ml.action.InternalStartDatafeedAction; import org.elasticsearch.xpack.ml.action.PostDataAction; import org.elasticsearch.xpack.ml.action.UpdateDatafeedStatusAction; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.audit.Auditor; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.notifications.Auditor; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; import org.elasticsearch.xpack.ml.datafeed.extractor.DataExtractor; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobTests.java index a1e7e0d0387..cc7e26299be 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobTests.java @@ -10,9 +10,9 @@ import org.elasticsearch.client.Client; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.ml.action.FlushJobAction; import org.elasticsearch.xpack.ml.action.PostDataAction; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.audit.Auditor; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.notifications.Auditor; import org.elasticsearch.xpack.ml.datafeed.extractor.DataExtractor; import org.elasticsearch.xpack.ml.datafeed.extractor.DataExtractorFactory; import org.junit.Before; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobValidatorTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobValidatorTests.java index 716269bbfc6..9526808b700 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobValidatorTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobValidatorTests.java @@ -8,9 +8,9 @@ package org.elasticsearch.xpack.ml.datafeed; import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.messages.Messages; import java.io.IOException; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/ProblemTrackerTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/ProblemTrackerTests.java index ae78b29b770..c91c259b1fa 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/ProblemTrackerTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/datafeed/ProblemTrackerTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.datafeed; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.audit.Auditor; +import org.elasticsearch.xpack.ml.notifications.Auditor; import org.junit.Before; import org.mockito.Mockito; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/integration/AutodetectResultProcessorIT.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/integration/AutodetectResultProcessorIT.java index ecea5f8be4f..c361daa3891 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/integration/AutodetectResultProcessorIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/integration/AutodetectResultProcessorIT.java @@ -11,23 +11,23 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.test.ESSingleNodeTestCase; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.job.persistence.BucketsQueryBuilder; import org.elasticsearch.xpack.ml.job.persistence.InfluencersQueryBuilder; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; import org.elasticsearch.xpack.ml.job.persistence.JobResultsPersister; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.job.persistence.RecordsQueryBuilder; import org.elasticsearch.xpack.ml.job.process.autodetect.output.AutoDetectResultProcessor; import org.elasticsearch.xpack.ml.job.process.autodetect.output.AutodetectResultsParser; import org.elasticsearch.xpack.ml.job.process.autodetect.output.FlushAcknowledgement; import org.elasticsearch.xpack.ml.job.process.normalizer.Renormalizer; import org.elasticsearch.xpack.ml.job.process.normalizer.noop.NoOpRenormalizer; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.job.results.AnomalyRecord; import org.elasticsearch.xpack.ml.job.results.AnomalyRecordTests; import org.elasticsearch.xpack.ml.job.results.Bucket; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java index 3d804495d0f..d9d1a261cf0 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java @@ -5,8 +5,6 @@ */ package org.elasticsearch.xpack.ml.integration; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterModule; import org.elasticsearch.cluster.ClusterState; @@ -14,19 +12,18 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.rest.RestStatus; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.GetJobsStatsAction; import org.elasticsearch.xpack.ml.action.OpenJobAction; import org.elasticsearch.xpack.ml.action.PutJobAction; import org.elasticsearch.xpack.ml.action.DatafeedJobsIT; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.manager.AutodetectProcessManager; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcessManager; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; import org.junit.After; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/manager/JobManagerTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/JobManagerTests.java similarity index 97% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/manager/JobManagerTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/JobManagerTests.java index a454975b0cc..25e6bdb6ae0 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/manager/JobManagerTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/JobManagerTests.java @@ -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.manager; +package org.elasticsearch.xpack.ml.job; import org.elasticsearch.ResourceAlreadyExistsException; import org.elasticsearch.ResourceNotFoundException; @@ -21,13 +21,13 @@ import org.elasticsearch.env.Environment; import org.elasticsearch.index.Index; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.ml.action.PutJobAction; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.audit.Auditor; +import org.elasticsearch.xpack.ml.action.util.QueryPage; +import org.elasticsearch.xpack.ml.notifications.Auditor; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.metadata.MlMetadata; import org.elasticsearch.xpack.ml.job.persistence.AnomalyDetectorsIndex; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; import org.elasticsearch.xpack.ml.job.persistence.JobResultsPersister; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; import org.junit.Before; import java.util.Arrays; @@ -35,7 +35,7 @@ import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; -import static org.elasticsearch.xpack.ml.job.JobTests.buildJobBuilder; +import static org.elasticsearch.xpack.ml.job.config.JobTests.buildJobBuilder; import static org.hamcrest.Matchers.equalTo; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/AnalysisConfigTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/AnalysisConfigTests.java similarity index 99% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/AnalysisConfigTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/AnalysisConfigTests.java index 4b62553f1e6..d31572368ba 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/AnalysisConfigTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/AnalysisConfigTests.java @@ -3,14 +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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.detectionrules.Connective; -import org.elasticsearch.xpack.ml.job.detectionrules.DetectionRule; -import org.elasticsearch.xpack.ml.job.detectionrules.RuleCondition; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/AnalysisLimitsTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/AnalysisLimitsTests.java similarity index 98% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/AnalysisLimitsTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/AnalysisLimitsTests.java index 66f20747c75..7fe07f8c0bc 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/AnalysisLimitsTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/AnalysisLimitsTests.java @@ -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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.XContentParser; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/condition/ConditionTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/ConditionTests.java similarity index 98% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/condition/ConditionTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/ConditionTests.java index c81e9609008..b0a9031980f 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/condition/ConditionTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/ConditionTests.java @@ -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.condition; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.io.stream.Writeable.Reader; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/ConnectiveTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/ConnectiveTests.java similarity index 97% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/ConnectiveTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/ConnectiveTests.java index 4b2e0854f6d..183ae417c5c 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/ConnectiveTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/ConnectiveTests.java @@ -3,17 +3,17 @@ * 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.detectionrules; - -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.equalTo; - -import java.io.IOException; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.test.ESTestCase; +import java.io.IOException; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.equalTo; + public class ConnectiveTests extends ESTestCase { public void testForString() { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/DataDescriptionTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DataDescriptionTests.java similarity index 94% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/DataDescriptionTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DataDescriptionTests.java index 68a627201b3..e47a86c7219 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/DataDescriptionTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DataDescriptionTests.java @@ -3,15 +3,15 @@ * 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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.ml.job.DataDescription.DataFormat; +import org.elasticsearch.common.xcontent.json.JsonXContent; +import org.elasticsearch.xpack.ml.job.config.DataDescription.DataFormat; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; @@ -173,7 +173,7 @@ public class DataDescriptionTests extends AbstractSerializingTestCase DataDescription.PARSER.apply(parser, null)); assertThat(ex.getMessage(), containsString("[data_description] failed to parse field [format]")); @@ -181,12 +181,12 @@ public class DataDescriptionTests extends AbstractSerializingTestCase DataDescription.PARSER.apply(parser, null)); assertThat(ex.getMessage(), containsString("[data_description] failed to parse field [field_delimiter]")); @@ -199,7 +199,7 @@ public class DataDescriptionTests extends AbstractSerializingTestCase DataDescription.PARSER.apply(parser, null)); assertThat(ex.getMessage(), containsString("[data_description] failed to parse field [quote_character]")); diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/DataFormatTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DataFormatTests.java similarity index 96% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/DataFormatTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DataFormatTests.java index adbcd7a4b65..d76d12c29b3 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/DataFormatTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DataFormatTests.java @@ -3,14 +3,14 @@ * 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; +package org.elasticsearch.xpack.ml.job.config; import java.io.IOException; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.DataDescription.DataFormat; +import org.elasticsearch.xpack.ml.job.config.DataDescription.DataFormat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DefaultDetectorDescriptionTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DefaultDetectorDescriptionTests.java index e292f3d381e..6e60ab63c1c 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DefaultDetectorDescriptionTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DefaultDetectorDescriptionTests.java @@ -6,7 +6,6 @@ package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.Detector; public class DefaultDetectorDescriptionTests extends ESTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/DetectionRuleTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DetectionRuleTests.java similarity index 96% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/DetectionRuleTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DetectionRuleTests.java index 77715c8ffb5..87529db613e 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/DetectionRuleTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DetectionRuleTests.java @@ -3,12 +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.job.detectionrules; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; import java.util.ArrayList; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/DetectorTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DetectorTests.java similarity index 98% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/DetectorTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DetectorTests.java index eb8042e1d99..ad5be037555 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/DetectorTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/DetectorTests.java @@ -3,17 +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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; -import org.elasticsearch.xpack.ml.job.detectionrules.Connective; -import org.elasticsearch.xpack.ml.job.detectionrules.DetectionRule; -import org.elasticsearch.xpack.ml.job.detectionrules.RuleCondition; -import org.elasticsearch.xpack.ml.job.detectionrules.RuleConditionType; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; import org.junit.Assert; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/IgnoreDowntimeTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/IgnoreDowntimeTests.java similarity index 97% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/IgnoreDowntimeTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/IgnoreDowntimeTests.java index 08d12914202..25f41c8361d 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/IgnoreDowntimeTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/IgnoreDowntimeTests.java @@ -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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.test.ESTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/JobStatusTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/JobStatusTests.java similarity index 97% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/JobStatusTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/JobStatusTests.java index 6734be3bd1c..279a4ad94a1 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/JobStatusTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/JobStatusTests.java @@ -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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.test.ESTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/JobTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/JobTests.java similarity index 98% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/JobTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/JobTests.java index d0a878a2d84..b0cad1701b6 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/JobTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/JobTests.java @@ -3,17 +3,15 @@ * 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; +package org.elasticsearch.xpack.ml.job.config; import com.carrotsearch.randomizedtesting.generators.CodepointSetGenerator; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; import org.elasticsearch.xpack.ml.job.messages.Messages; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; import java.util.ArrayList; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/lists/ListDocumentTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/ListDocumentTests.java similarity index 97% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/lists/ListDocumentTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/ListDocumentTests.java index da5ca088533..2df88249457 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/lists/ListDocumentTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/ListDocumentTests.java @@ -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.lists; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/ModelDebugConfigTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/ModelDebugConfigTests.java similarity index 96% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/ModelDebugConfigTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/ModelDebugConfigTests.java index d654daa4c3f..f7ac2707173 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/ModelDebugConfigTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/ModelDebugConfigTests.java @@ -3,12 +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; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.ModelDebugConfig.DebugDestination; +import org.elasticsearch.xpack.ml.job.config.ModelDebugConfig.DebugDestination; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/condition/OperatorTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/OperatorTests.java similarity index 99% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/condition/OperatorTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/OperatorTests.java index ada21c28fb4..6e45e21e0ea 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/condition/OperatorTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/OperatorTests.java @@ -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.condition; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleActionTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/RuleActionTests.java similarity index 92% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleActionTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/RuleActionTests.java index 42fc5e3d041..748ff8b6ea3 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleActionTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/RuleActionTests.java @@ -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.detectionrules; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.test.ESTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleConditionTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/RuleConditionTests.java similarity index 98% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleConditionTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/RuleConditionTests.java index f7477fb904d..c57d182a682 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleConditionTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/RuleConditionTests.java @@ -3,12 +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.job.detectionrules; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleConditionTypeTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/RuleConditionTypeTests.java similarity index 98% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleConditionTypeTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/RuleConditionTypeTests.java index 397d8facfc9..665c2b8963c 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/detectionrules/RuleConditionTypeTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/RuleConditionTypeTests.java @@ -3,14 +3,14 @@ * 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.detectionrules; - -import java.io.IOException; +package org.elasticsearch.xpack.ml.job.config; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.test.ESTestCase; +import java.io.IOException; + import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/transform/TransformConfigTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/transform/TransformConfigTests.java similarity index 97% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/transform/TransformConfigTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/transform/TransformConfigTests.java index d208693905e..01b675c935f 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/transform/TransformConfigTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/transform/TransformConfigTests.java @@ -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.transform; +package org.elasticsearch.xpack.ml.job.config.transform; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.bytes.BytesArray; @@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; +import org.elasticsearch.xpack.ml.job.config.Condition; +import org.elasticsearch.xpack.ml.job.config.Operator; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; import java.util.Arrays; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/transform/TransformConfigsTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/transform/TransformConfigsTests.java similarity index 94% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/transform/TransformConfigsTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/transform/TransformConfigsTests.java index b2a73be39a6..fc2103b7301 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/transform/TransformConfigsTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/transform/TransformConfigsTests.java @@ -3,12 +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.transform; +package org.elasticsearch.xpack.ml.job.config.transform; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; +import org.elasticsearch.xpack.ml.job.config.Condition; +import org.elasticsearch.xpack.ml.job.config.Operator; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; import java.util.ArrayList; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/transform/TransformSerialisationTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/transform/TransformSerialisationTests.java similarity index 98% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/transform/TransformSerialisationTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/transform/TransformSerialisationTests.java index 0cc48de9e20..988efbb2c73 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/transform/TransformSerialisationTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/transform/TransformSerialisationTests.java @@ -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.transform; +package org.elasticsearch.xpack.ml.job.config.transform; import com.fasterxml.jackson.core.JsonProcessingException; import org.elasticsearch.common.xcontent.NamedXContentRegistry; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/transform/TransformTypeTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/transform/TransformTypeTests.java similarity index 97% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/transform/TransformTypeTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/transform/TransformTypeTests.java index 7f4af6efb4c..d6d271c4e24 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/transform/TransformTypeTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/config/transform/TransformTypeTests.java @@ -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.transform; +package org.elasticsearch.xpack.ml.job.config.transform; import org.elasticsearch.test.ESTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/metadata/AllocationTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/metadata/AllocationTests.java index cd83b250532..dee799b269a 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/metadata/AllocationTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/metadata/AllocationTests.java @@ -7,7 +7,7 @@ package org.elasticsearch.xpack.ml.job.metadata; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.ml.job.JobStatus; +import org.elasticsearch.xpack.ml.job.config.JobStatus; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; public class AllocationTests extends AbstractSerializingTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/metadata/MlMetadataTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/metadata/MlMetadataTests.java index 0d3a819471b..9128cb2e03a 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/metadata/MlMetadataTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/metadata/MlMetadataTests.java @@ -15,10 +15,10 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.JobTests; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.job.config.JobTests; import org.elasticsearch.xpack.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.ml.datafeed.DatafeedConfigTests; import org.elasticsearch.xpack.ml.datafeed.DatafeedStatus; @@ -26,7 +26,7 @@ import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; import java.io.IOException; -import static org.elasticsearch.xpack.ml.job.JobTests.buildJobBuilder; +import static org.elasticsearch.xpack.ml.job.config.JobTests.buildJobBuilder; import static org.elasticsearch.xpack.ml.datafeed.DatafeedJobRunnerTests.createDatafeedJob; import static org.elasticsearch.xpack.ml.datafeed.DatafeedJobRunnerTests.createDatafeedConfig; import static org.hamcrest.Matchers.equalTo; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/ElasticsearchMappingsTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/ElasticsearchMappingsTests.java index 470ae17b43e..81f50050e54 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/ElasticsearchMappingsTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/ElasticsearchMappingsTests.java @@ -7,21 +7,21 @@ package org.elasticsearch.xpack.ml.job.persistence; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.CategorizerState; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.ModelState; -import org.elasticsearch.xpack.ml.job.audit.AuditActivity; -import org.elasticsearch.xpack.ml.job.audit.AuditMessage; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.CategorizerState; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelState; +import org.elasticsearch.xpack.ml.notifications.AuditActivity; +import org.elasticsearch.xpack.ml.notifications.AuditMessage; import org.elasticsearch.xpack.ml.job.metadata.Allocation; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.job.results.CategoryDefinition; import org.elasticsearch.xpack.ml.job.results.ReservedFieldNames; import org.elasticsearch.xpack.ml.job.results.Result; import org.elasticsearch.xpack.ml.job.usage.Usage; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParseException; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobDataDeleterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobDataDeleterTests.java index 5795abc8b25..2b5e3771f7f 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobDataDeleterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobDataDeleterTests.java @@ -13,8 +13,8 @@ import org.elasticsearch.client.Client; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHits; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.ModelState; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelState; import org.mockito.Mockito; import java.util.ArrayList; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobProviderTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobProviderTests.java index 63d152ba07b..99573bd0f9d 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobProviderTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobProviderTests.java @@ -23,16 +23,17 @@ import org.elasticsearch.search.SearchHitField; import org.elasticsearch.search.SearchHits; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.ml.action.DeleteJobAction; -import org.elasticsearch.xpack.ml.job.AnalysisLimits; -import org.elasticsearch.xpack.ml.job.CategorizerState; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.ModelState; -import org.elasticsearch.xpack.ml.job.audit.AuditActivity; -import org.elasticsearch.xpack.ml.job.audit.AuditMessage; +import org.elasticsearch.xpack.ml.action.util.QueryPage; +import org.elasticsearch.xpack.ml.job.config.AnalysisLimits; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.CategorizerState; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelState; +import org.elasticsearch.xpack.ml.notifications.AuditActivity; +import org.elasticsearch.xpack.ml.notifications.AuditMessage; import org.elasticsearch.xpack.ml.job.persistence.InfluencersQueryBuilder.InfluencersQuery; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.job.results.AnomalyRecord; import org.elasticsearch.xpack.ml.job.results.Bucket; import org.elasticsearch.xpack.ml.job.results.CategoryDefinition; @@ -55,7 +56,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; -import static org.elasticsearch.xpack.ml.job.JobTests.buildJobBuilder; +import static org.elasticsearch.xpack.ml.job.config.JobTests.buildJobBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; import static org.mockito.Matchers.any; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/status/CountingInputStreamTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/CountingInputStreamTests.java similarity index 82% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/status/CountingInputStreamTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/CountingInputStreamTests.java index 658f176dab5..49b6550b563 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/status/CountingInputStreamTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/CountingInputStreamTests.java @@ -3,35 +3,35 @@ * 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.status; +package org.elasticsearch.xpack.ml.job.process; + +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.xpack.ml.job.persistence.UsagePersister; +import org.elasticsearch.xpack.ml.job.usage.UsageReporter; +import org.junit.Assert; +import org.mockito.Mockito; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.persistence.UsagePersister; -import org.junit.Assert; -import org.mockito.Mockito; -import org.elasticsearch.xpack.ml.job.usage.UsageReporter; - public class CountingInputStreamTests extends ESTestCase { public void testRead_OneByteAtATime() throws IOException { UsageReporter usageReporter = new UsageReporter(Settings.EMPTY, "foo", Mockito.mock(UsagePersister.class)); - DummyStatusReporter statusReporter = new DummyStatusReporter(usageReporter); + DummyDataCountsReporter dataCountsReporter = new DummyDataCountsReporter(usageReporter); final String TEXT = "123"; InputStream source = new ByteArrayInputStream(TEXT.getBytes(StandardCharsets.UTF_8)); - try (CountingInputStream counting = new CountingInputStream(source, statusReporter)) { + try (CountingInputStream counting = new CountingInputStream(source, dataCountsReporter)) { while (counting.read() >= 0) {} Assert.assertEquals(TEXT.length(), usageReporter.getBytesReadSinceLastReport()); - Assert.assertEquals(usageReporter.getBytesReadSinceLastReport(), statusReporter.getBytesRead()); + Assert.assertEquals(usageReporter.getBytesReadSinceLastReport(), dataCountsReporter.getBytesRead()); } } @@ -39,15 +39,15 @@ public class CountingInputStreamTests extends ESTestCase { final String TEXT = "To the man who only has a hammer, everything he encounters begins to look like a nail."; UsageReporter usageReporter = new UsageReporter(Settings.EMPTY, "foo", Mockito.mock(UsagePersister.class)); - DummyStatusReporter statusReporter = new DummyStatusReporter(usageReporter); + DummyDataCountsReporter dataCountsReporter = new DummyDataCountsReporter(usageReporter); InputStream source = new ByteArrayInputStream(TEXT.getBytes(StandardCharsets.UTF_8)); - try (CountingInputStream counting = new CountingInputStream(source, statusReporter)) { + try (CountingInputStream counting = new CountingInputStream(source, dataCountsReporter)) { byte buf[] = new byte[256]; while (counting.read(buf) >= 0) {} Assert.assertEquals(TEXT.length(), usageReporter.getBytesReadSinceLastReport()); - Assert.assertEquals(usageReporter.getBytesReadSinceLastReport(), statusReporter.getBytesRead()); + Assert.assertEquals(usageReporter.getBytesReadSinceLastReport(), dataCountsReporter.getBytesRead()); } } @@ -55,15 +55,15 @@ public class CountingInputStreamTests extends ESTestCase { final String TEXT = "To the man who only has a hammer, everything he encounters begins to look like a nail."; UsageReporter usageReporter = new UsageReporter(Settings.EMPTY, "foo", Mockito.mock(UsagePersister.class)); - DummyStatusReporter statusReporter = new DummyStatusReporter(usageReporter); + DummyDataCountsReporter dataCountsReporter = new DummyDataCountsReporter(usageReporter); InputStream source = new ByteArrayInputStream(TEXT.getBytes(StandardCharsets.UTF_8)); - try (CountingInputStream counting = new CountingInputStream(source, statusReporter)) { + try (CountingInputStream counting = new CountingInputStream(source, dataCountsReporter)) { byte buf[] = new byte[8]; while (counting.read(buf, 0, 8) >= 0) {} Assert.assertEquals(TEXT.length(), usageReporter.getBytesReadSinceLastReport()); - Assert.assertEquals(usageReporter.getBytesReadSinceLastReport(), statusReporter.getBytesRead()); + Assert.assertEquals(usageReporter.getBytesReadSinceLastReport(), dataCountsReporter.getBytesRead()); } } diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/DataCountsReporterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/DataCountsReporterTests.java new file mode 100644 index 00000000000..ecb649d9cef --- /dev/null +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/DataCountsReporterTests.java @@ -0,0 +1,309 @@ +/* + * 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.ml.job.process; + +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.env.Environment; +import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.threadpool.ThreadPool; +import org.elasticsearch.xpack.ml.job.persistence.JobDataCountsPersister; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.usage.UsageReporter; +import org.junit.Before; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; + +import java.io.IOException; +import java.util.Date; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class DataCountsReporterTests extends ESTestCase { + private static final String JOB_ID = "SR"; + private static final int MAX_PERCENT_DATE_PARSE_ERRORS = 40; + private static final int MAX_PERCENT_OUT_OF_ORDER_ERRORS = 30; + + private UsageReporter usageReporter; + private JobDataCountsPersister jobDataCountsPersister; + private ThreadPool threadPool; + private Settings settings; + + @Before + public void setUpMocks() { + settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) + .put(DataCountsReporter.ACCEPTABLE_PERCENTAGE_DATE_PARSE_ERRORS_SETTING.getKey(), MAX_PERCENT_DATE_PARSE_ERRORS) + .put(DataCountsReporter.ACCEPTABLE_PERCENTAGE_OUT_OF_ORDER_ERRORS_SETTING.getKey(), MAX_PERCENT_OUT_OF_ORDER_ERRORS) + .build(); + usageReporter = Mockito.mock(UsageReporter.class); + jobDataCountsPersister = Mockito.mock(JobDataCountsPersister.class); + threadPool = Mockito.mock(ThreadPool.class); + + when(threadPool.scheduleWithFixedDelay(any(Runnable.class), any(), any())).thenReturn(new ThreadPool.Cancellable() { + @Override + public void cancel() { + } + + @Override + public boolean isCancelled() { + return false; + } + }); + } + + public void testSettingAcceptablePercentages() throws IOException { + try (DataCountsReporter dataCountsReporter = new DataCountsReporter(threadPool, settings, JOB_ID, new DataCounts(JOB_ID), + usageReporter, jobDataCountsPersister)) { + assertEquals(dataCountsReporter.getAcceptablePercentDateParseErrors(), MAX_PERCENT_DATE_PARSE_ERRORS); + assertEquals(dataCountsReporter.getAcceptablePercentOutOfOrderErrors(), MAX_PERCENT_OUT_OF_ORDER_ERRORS); + } + } + + public void testSimpleConstructor() throws Exception { + try (DataCountsReporter dataCountsReporter = new DataCountsReporter(threadPool, settings, JOB_ID, new DataCounts(JOB_ID), + usageReporter, jobDataCountsPersister)) { + DataCounts stats = dataCountsReporter.incrementalStats(); + assertNotNull(stats); + assertAllCountFieldsEqualZero(stats); + } + } + + public void testComplexConstructor() throws Exception { + DataCounts counts = new DataCounts("foo", 1L, 1L, 2L, 0L, 3L, 4L, 5L, new Date(), new Date()); + + try (DataCountsReporter dataCountsReporter = + new DataCountsReporter(threadPool, settings, JOB_ID, counts, usageReporter, jobDataCountsPersister)) { + DataCounts stats = dataCountsReporter.incrementalStats(); + assertNotNull(stats); + assertAllCountFieldsEqualZero(stats); + + assertEquals(1, dataCountsReporter.getProcessedRecordCount()); + assertEquals(2, dataCountsReporter.getBytesRead()); + assertEquals(3, dataCountsReporter.getDateParseErrorsCount()); + assertEquals(4, dataCountsReporter.getMissingFieldErrorCount()); + assertEquals(5, dataCountsReporter.getOutOfOrderRecordCount()); + assertNull(stats.getEarliestRecordTimeStamp()); + } + } + + public void testResetIncrementalCounts() throws Exception { + try (DataCountsReporter dataCountsReporter = new DataCountsReporter(threadPool, settings, JOB_ID, new DataCounts(JOB_ID), + usageReporter, jobDataCountsPersister)) { + DataCounts stats = dataCountsReporter.incrementalStats(); + assertNotNull(stats); + assertAllCountFieldsEqualZero(stats); + + dataCountsReporter.setAnalysedFieldsPerRecord(3); + + dataCountsReporter.reportRecordWritten(5, 1000); + dataCountsReporter.reportRecordWritten(5, 1000); + assertEquals(2, dataCountsReporter.incrementalStats().getInputRecordCount()); + assertEquals(10, dataCountsReporter.incrementalStats().getInputFieldCount()); + assertEquals(2, dataCountsReporter.incrementalStats().getProcessedRecordCount()); + assertEquals(6, dataCountsReporter.incrementalStats().getProcessedFieldCount()); + assertEquals(1000, dataCountsReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); + + assertEquals(dataCountsReporter.incrementalStats(), dataCountsReporter.runningTotalStats()); + + dataCountsReporter.startNewIncrementalCount(); + stats = dataCountsReporter.incrementalStats(); + assertNotNull(stats); + assertAllCountFieldsEqualZero(stats); + } + } + + public void testReportLatestTimeIncrementalStats() throws IOException { + try (DataCountsReporter dataCountsReporter = new DataCountsReporter(threadPool, settings, JOB_ID, new DataCounts(JOB_ID), + usageReporter, jobDataCountsPersister)) { + dataCountsReporter.startNewIncrementalCount(); + dataCountsReporter.reportLatestTimeIncrementalStats(5001L); + assertEquals(5001L, dataCountsReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); + } + } + + public void testReportRecordsWritten() { + try (DataCountsReporter dataCountsReporter = new DataCountsReporter(threadPool, settings, JOB_ID, new DataCounts(JOB_ID), + usageReporter, jobDataCountsPersister)) { + dataCountsReporter.setAnalysedFieldsPerRecord(3); + + dataCountsReporter.reportRecordWritten(5, 2000); + assertEquals(1, dataCountsReporter.incrementalStats().getInputRecordCount()); + assertEquals(5, dataCountsReporter.incrementalStats().getInputFieldCount()); + assertEquals(1, dataCountsReporter.incrementalStats().getProcessedRecordCount()); + assertEquals(3, dataCountsReporter.incrementalStats().getProcessedFieldCount()); + assertEquals(2000, dataCountsReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); + + dataCountsReporter.reportRecordWritten(5, 3000); + dataCountsReporter.reportMissingField(); + assertEquals(2, dataCountsReporter.incrementalStats().getInputRecordCount()); + assertEquals(10, dataCountsReporter.incrementalStats().getInputFieldCount()); + assertEquals(2, dataCountsReporter.incrementalStats().getProcessedRecordCount()); + assertEquals(5, dataCountsReporter.incrementalStats().getProcessedFieldCount()); + assertEquals(3000, dataCountsReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); + + assertEquals(dataCountsReporter.incrementalStats(), dataCountsReporter.runningTotalStats()); + + verify(jobDataCountsPersister, never()).persistDataCounts(anyString(), any(DataCounts.class), any()); + } + } + + public void testReportRecordsWritten_Given100Records() { + try (DummyDataCountsReporter dataCountsReporter = new DummyDataCountsReporter(usageReporter)) { + dataCountsReporter.setAnalysedFieldsPerRecord(3); + + for (int i = 1; i <= 101; i++) { + dataCountsReporter.reportRecordWritten(5, i); + } + + assertEquals(101, dataCountsReporter.incrementalStats().getInputRecordCount()); + assertEquals(505, dataCountsReporter.incrementalStats().getInputFieldCount()); + assertEquals(101, dataCountsReporter.incrementalStats().getProcessedRecordCount()); + assertEquals(303, dataCountsReporter.incrementalStats().getProcessedFieldCount()); + assertEquals(101, dataCountsReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); + + assertEquals(1, dataCountsReporter.getLogStatusCallCount()); + } + } + + public void testReportRecordsWritten_Given1000Records() { + try (DummyDataCountsReporter dataCountsReporter = new DummyDataCountsReporter(usageReporter)) { + + dataCountsReporter.setAnalysedFieldsPerRecord(3); + + for (int i = 1; i <= 1001; i++) { + dataCountsReporter.reportRecordWritten(5, i); + } + + assertEquals(1001, dataCountsReporter.incrementalStats().getInputRecordCount()); + assertEquals(5005, dataCountsReporter.incrementalStats().getInputFieldCount()); + assertEquals(1001, dataCountsReporter.incrementalStats().getProcessedRecordCount()); + assertEquals(3003, dataCountsReporter.incrementalStats().getProcessedFieldCount()); + assertEquals(1001, dataCountsReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); + + assertEquals(10, dataCountsReporter.getLogStatusCallCount()); + } + + } + + public void testReportRecordsWritten_Given2000Records() { + try (DummyDataCountsReporter dataCountsReporter = new DummyDataCountsReporter(usageReporter)) { + dataCountsReporter.setAnalysedFieldsPerRecord(3); + + for (int i = 1; i <= 2001; i++) { + dataCountsReporter.reportRecordWritten(5, i); + } + + assertEquals(2001, dataCountsReporter.incrementalStats().getInputRecordCount()); + assertEquals(10005, dataCountsReporter.incrementalStats().getInputFieldCount()); + assertEquals(2001, dataCountsReporter.incrementalStats().getProcessedRecordCount()); + assertEquals(6003, dataCountsReporter.incrementalStats().getProcessedFieldCount()); + assertEquals(2001, dataCountsReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); + + assertEquals(11, dataCountsReporter.getLogStatusCallCount()); + } + } + + public void testReportRecordsWritten_Given20000Records() { + try (DummyDataCountsReporter dataCountsReporter = new DummyDataCountsReporter(usageReporter)) { + dataCountsReporter.setAnalysedFieldsPerRecord(3); + + for (int i = 1; i <= 20001; i++) { + dataCountsReporter.reportRecordWritten(5, i); + } + + assertEquals(20001, dataCountsReporter.incrementalStats().getInputRecordCount()); + assertEquals(100005, dataCountsReporter.incrementalStats().getInputFieldCount()); + assertEquals(20001, dataCountsReporter.incrementalStats().getProcessedRecordCount()); + assertEquals(60003, dataCountsReporter.incrementalStats().getProcessedFieldCount()); + assertEquals(20001, dataCountsReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); + + assertEquals(29, dataCountsReporter.getLogStatusCallCount()); + } + } + + public void testReportRecordsWritten_Given30000Records() { + try (DummyDataCountsReporter dataCountsReporter = new DummyDataCountsReporter(usageReporter)) { + dataCountsReporter.setAnalysedFieldsPerRecord(3); + + for (int i = 1; i <= 30001; i++) { + dataCountsReporter.reportRecordWritten(5, i); + } + + assertEquals(30001, dataCountsReporter.incrementalStats().getInputRecordCount()); + assertEquals(150005, dataCountsReporter.incrementalStats().getInputFieldCount()); + assertEquals(30001, dataCountsReporter.incrementalStats().getProcessedRecordCount()); + assertEquals(90003, dataCountsReporter.incrementalStats().getProcessedFieldCount()); + assertEquals(30001, dataCountsReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); + + assertEquals(30, dataCountsReporter.getLogStatusCallCount()); + } + } + + public void testFinishReporting() { + try (DataCountsReporter dataCountsReporter = new DataCountsReporter(threadPool, settings, JOB_ID, new DataCounts(JOB_ID), + usageReporter, jobDataCountsPersister)) { + + dataCountsReporter.setAnalysedFieldsPerRecord(3); + + DataCounts dc = new DataCounts(JOB_ID, 2L, 5L, 0L, 10L, 0L, 1L, 0L, new Date(2000), new Date(3000)); + dataCountsReporter.reportRecordWritten(5, 2000); + dataCountsReporter.reportRecordWritten(5, 3000); + dataCountsReporter.reportMissingField(); + dataCountsReporter.finishReporting(); + + Mockito.verify(usageReporter, Mockito.times(1)).reportUsage(); + Mockito.verify(jobDataCountsPersister, Mockito.times(1)).persistDataCounts(eq("SR"), eq(dc), any()); + assertEquals(dc, dataCountsReporter.incrementalStats()); + } + } + + public void testPersistenceTimeOut() { + + ThreadPool mockThreadPool = Mockito.mock(ThreadPool.class); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Runnable.class); + + when(mockThreadPool.scheduleWithFixedDelay(argumentCaptor.capture(), any(), any())).thenReturn(new ThreadPool.Cancellable() { + @Override + public void cancel() { + + } + + @Override + public boolean isCancelled() { + return false; + } + }); + + try (DataCountsReporter dataCountsReporter = new DataCountsReporter(mockThreadPool, settings, JOB_ID, new DataCounts(JOB_ID), + usageReporter, jobDataCountsPersister)) { + + dataCountsReporter.setAnalysedFieldsPerRecord(3); + + dataCountsReporter.reportRecordWritten(5, 2000); + dataCountsReporter.reportRecordWritten(5, 3000); + + Mockito.verify(jobDataCountsPersister, Mockito.times(0)).persistDataCounts(eq("SR"), any(), any()); + argumentCaptor.getValue().run(); + dataCountsReporter.reportRecordWritten(5, 4000); + Mockito.verify(jobDataCountsPersister, Mockito.times(1)).persistDataCounts(eq("SR"), any(), any()); + } + } + + private void assertAllCountFieldsEqualZero(DataCounts stats) throws Exception { + assertEquals(0L, stats.getProcessedRecordCount()); + assertEquals(0L, stats.getProcessedFieldCount()); + assertEquals(0L, stats.getInputBytes()); + assertEquals(0L, stats.getInputFieldCount()); + assertEquals(0L, stats.getInputRecordCount()); + assertEquals(0L, stats.getInvalidDateCount()); + assertEquals(0L, stats.getMissingFieldCount()); + assertEquals(0L, stats.getOutOfOrderTimeStampCount()); + } +} diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/status/DummyStatusReporter.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/DummyDataCountsReporter.java similarity index 80% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/status/DummyStatusReporter.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/DummyDataCountsReporter.java index e80fd8cc155..5f2b8bd3feb 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/status/DummyStatusReporter.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/DummyDataCountsReporter.java @@ -3,31 +3,31 @@ * 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.status; +package org.elasticsearch.xpack.ml.job.process; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.xpack.ml.job.DataCounts; import org.elasticsearch.xpack.ml.job.persistence.JobDataCountsPersister; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; import org.elasticsearch.xpack.ml.job.usage.UsageReporter; import static org.mockito.Mockito.mock; /** - * Dummy StatusReporter for testing + * Dummy DataCountsReporter for testing */ -class DummyStatusReporter extends StatusReporter { +class DummyDataCountsReporter extends DataCountsReporter { int logStatusCallCount = 0; - public DummyStatusReporter(UsageReporter usageReporter) { + public DummyDataCountsReporter(UsageReporter usageReporter) { super(mock(ThreadPool.class), Settings.EMPTY, "DummyJobId", new DataCounts("DummyJobId"), usageReporter, mock(JobDataCountsPersister.class)); } /** * It's difficult to use mocking to get the number of calls to {@link #logStatus(long)} - * and Mockito.spy() doesn't work due to the lambdas used in {@link StatusReporter}. + * and Mockito.spy() doesn't work due to the lambdas used in {@link DataCountsReporter}. * Override the method here an count the calls */ @Override diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/ProcessCtrlTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/ProcessCtrlTests.java index 3e61c8c12b0..6cd54c824be 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/ProcessCtrlTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/ProcessCtrlTests.java @@ -9,17 +9,17 @@ import org.apache.logging.log4j.Logger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.IgnoreDowntime; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.IgnoreDowntime; +import org.elasticsearch.xpack.ml.job.config.Job; import org.mockito.Mockito; import java.io.IOException; import java.util.Collections; import java.util.List; -import static org.elasticsearch.xpack.ml.job.JobTests.buildJobBuilder; +import static org.elasticsearch.xpack.ml.job.config.JobTests.buildJobBuilder; public class ProcessCtrlTests extends ESTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectCommunicatorTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectCommunicatorTests.java index 90bd5b7f786..8eef415a795 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectCommunicatorTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectCommunicatorTests.java @@ -8,16 +8,16 @@ package org.elasticsearch.xpack.ml.job.process.autodetect; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; import org.elasticsearch.xpack.ml.job.process.autodetect.output.AutoDetectResultProcessor; import org.elasticsearch.xpack.ml.job.process.autodetect.output.StateProcessor; import org.elasticsearch.xpack.ml.job.process.autodetect.params.DataLoadParams; import org.elasticsearch.xpack.ml.job.process.autodetect.params.InterimResultsParams; import org.elasticsearch.xpack.ml.job.process.autodetect.params.TimeRange; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; import org.mockito.Mockito; import java.io.ByteArrayInputStream; @@ -131,9 +131,9 @@ public class AutodetectCommunicatorTests extends ESTestCase { ((Runnable) invocation.getArguments()[0]).run(); return null; }).when(executorService).execute(any(Runnable.class)); - StatusReporter statusReporter = mock(StatusReporter.class); + DataCountsReporter dataCountsReporter = mock(DataCountsReporter.class); StateProcessor stateProcessor = mock(StateProcessor.class); - return new AutodetectCommunicator(executorService, createJobDetails(), autodetectProcess, statusReporter, + return new AutodetectCommunicator(executorService, createJobDetails(), autodetectProcess, dataCountsReporter, autoDetectResultProcessor, stateProcessor, e -> {}); } diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/manager/AutodetectProcessManagerTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java similarity index 95% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/manager/AutodetectProcessManagerTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java index 730968877e8..ce06f102f4d 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/manager/AutodetectProcessManagerTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java @@ -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.manager; +package org.elasticsearch.xpack.ml.job.process.autodetect; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchStatusException; @@ -14,30 +14,27 @@ import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.UpdateJobStatusAction; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.Job; -import org.elasticsearch.xpack.ml.job.JobStatus; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.data.DataProcessor; +import org.elasticsearch.xpack.ml.job.JobManager; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.Job; +import org.elasticsearch.xpack.ml.job.config.JobStatus; +import org.elasticsearch.xpack.ml.job.config.ListDocument; import org.elasticsearch.xpack.ml.job.metadata.Allocation; import org.elasticsearch.xpack.ml.job.persistence.JobDataCountsPersister; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; import org.elasticsearch.xpack.ml.job.persistence.JobRenormalizedResultsPersister; import org.elasticsearch.xpack.ml.job.persistence.JobResultsPersister; -import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectCommunicator; -import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; -import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcessFactory; import org.elasticsearch.xpack.ml.job.process.autodetect.output.AutodetectResultsParser; import org.elasticsearch.xpack.ml.job.process.autodetect.params.DataLoadParams; import org.elasticsearch.xpack.ml.job.process.autodetect.params.InterimResultsParams; import org.elasticsearch.xpack.ml.job.process.autodetect.params.TimeRange; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.job.process.normalizer.NormalizerFactory; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.job.results.AutodetectResult; -import org.elasticsearch.xpack.ml.lists.ListDocument; import org.junit.Before; import org.mockito.Mockito; @@ -49,8 +46,8 @@ import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.Iterator; -import java.util.Set; import java.util.Optional; +import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.function.Consumer; import java.util.stream.Stream; @@ -70,7 +67,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; /** - * Calling the {@link DataProcessor#processData(String, InputStream, DataLoadParams)} + * Calling the {@link AutodetectProcessManager#processData(String, InputStream, DataLoadParams)} * method causes an AutodetectCommunicator to be created on demand. Most of these tests have to * do that before they can assert other things */ diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutoDetectResultProcessorTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutoDetectResultProcessorTests.java index fa9860375a6..65da6d0f573 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutoDetectResultProcessorTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutoDetectResultProcessorTests.java @@ -6,11 +6,11 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.output; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.job.persistence.JobResultsPersister; import org.elasticsearch.xpack.ml.job.process.normalizer.Renormalizer; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.job.results.AnomalyRecord; import org.elasticsearch.xpack.ml.job.results.AutodetectResult; import org.elasticsearch.xpack.ml.job.results.Bucket; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutodetectResultsParserTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutodetectResultsParserTests.java index 3e9aa8bbef2..bcf1042f1bb 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutodetectResultsParserTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutodetectResultsParserTests.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.output; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.job.results.AutodetectResult; import org.elasticsearch.xpack.ml.job.results.Bucket; import org.elasticsearch.xpack.ml.job.results.BucketInfluencer; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/DataCountsTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/DataCountsTests.java similarity index 97% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/DataCountsTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/DataCountsTests.java index 91944b54ecb..df0e44089b1 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/DataCountsTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/DataCountsTests.java @@ -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.job; +package org.elasticsearch.xpack.ml.job.process.autodetect.state; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; import org.joda.time.DateTime; @@ -126,7 +125,7 @@ public class DataCountsTests extends AbstractSerializingTestCase { DataCounts counts = new DataCounts(randomAsciiOfLength(12)); counts.setEarliestRecordTimeStamp(new Date(100L)); - ESTestCase.expectThrows(IllegalStateException.class, () -> counts.setEarliestRecordTimeStamp(new Date(200L))); + expectThrows(IllegalStateException.class, () -> counts.setEarliestRecordTimeStamp(new Date(200L))); assertEquals(new Date(100L), counts.getEarliestRecordTimeStamp()); } diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/MemoryStatusTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/MemoryStatusTests.java similarity index 95% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/MemoryStatusTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/MemoryStatusTests.java index 8530f6ca48d..98e773e99c7 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/MemoryStatusTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/MemoryStatusTests.java @@ -3,17 +3,17 @@ * 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; - -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.equalTo; - -import java.io.IOException; +package org.elasticsearch.xpack.ml.job.process.autodetect.state; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.ModelSizeStats.MemoryStatus; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats.MemoryStatus; + +import java.io.IOException; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.equalTo; public class MemoryStatusTests extends ESTestCase { @@ -92,5 +92,4 @@ public class MemoryStatusTests extends ESTestCase { }); assertThat(ex.getMessage(), containsString("Unknown MemoryStatus [" + statusName + "]")); } - } diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/ModelSizeStatsTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelSizeStatsTests.java similarity index 95% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/ModelSizeStatsTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelSizeStatsTests.java index ab776e49cc6..319b6352f8a 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/ModelSizeStatsTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelSizeStatsTests.java @@ -3,11 +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; +package org.elasticsearch.xpack.ml.job.process.autodetect.state; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.ml.job.ModelSizeStats.MemoryStatus; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats.MemoryStatus; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; import java.util.Date; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/ModelSnapshotTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelSnapshotTests.java similarity index 98% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/ModelSnapshotTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelSnapshotTests.java index ab6f5e57845..78097572995 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/ModelSnapshotTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/ModelSnapshotTests.java @@ -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; +package org.elasticsearch.xpack.ml.job.process.autodetect.state; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.ml.job.ModelSizeStats.MemoryStatus; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats.MemoryStatus; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; import org.elasticsearch.xpack.ml.utils.time.TimeUtils; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/quantiles/QuantilesTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/QuantilesTests.java similarity index 97% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/quantiles/QuantilesTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/QuantilesTests.java index b7468860f1d..bb9956a849b 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/quantiles/QuantilesTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/state/QuantilesTests.java @@ -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.quantiles; +package org.elasticsearch.xpack.ml.job.process.autodetect.state; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AbstractDataToProcessWriterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AbstractDataToProcessWriterTests.java index c6d54d2ff89..3363aa18acc 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AbstractDataToProcessWriterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AbstractDataToProcessWriterTests.java @@ -7,17 +7,17 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import org.apache.logging.log4j.Logger; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.Condition; +import org.elasticsearch.xpack.ml.job.config.Operator; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; import org.elasticsearch.xpack.ml.job.process.autodetect.writer.AbstractDataToProcessWriter.InputOutputMap; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; import org.elasticsearch.xpack.ml.transforms.Concat; import org.elasticsearch.xpack.ml.transforms.HighestRegisteredDomain; import org.elasticsearch.xpack.ml.transforms.RegexSplit; @@ -50,13 +50,13 @@ import static org.mockito.Mockito.verify; */ public class AbstractDataToProcessWriterTests extends ESTestCase { private AutodetectProcess autodetectProcess; - private StatusReporter statusReporter; + private DataCountsReporter dataCountsReporter; private Logger jobLogger; @Before public void setUpMocks() { autodetectProcess = Mockito.mock(AutodetectProcess.class); - statusReporter = Mockito.mock(StatusReporter.class); + dataCountsReporter = Mockito.mock(DataCountsReporter.class); jobLogger = Mockito.mock(Logger.class); } @@ -76,7 +76,7 @@ public class AbstractDataToProcessWriterTests extends ESTestCase { TransformConfigs transforms = new TransformConfigs(Arrays.asList(tc)); AbstractDataToProcessWriter writer = - new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, transforms, statusReporter, jobLogger); + new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, transforms, dataCountsReporter, jobLogger); writer.writeHeader(); @@ -135,7 +135,7 @@ public class AbstractDataToProcessWriterTests extends ESTestCase { TransformConfigs transforms = new TransformConfigs(Arrays.asList(tc)); AbstractDataToProcessWriter writer = - new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, transforms, statusReporter, jobLogger); + new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, transforms, dataCountsReporter, jobLogger); writer.writeHeader(); @@ -206,7 +206,7 @@ public class AbstractDataToProcessWriterTests extends ESTestCase { TransformConfigs transforms = new TransformConfigs(Arrays.asList(tc)); AbstractDataToProcessWriter writer = - new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, transforms, statusReporter, jobLogger); + new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, transforms, dataCountsReporter, jobLogger); writer.writeHeader(); @@ -278,7 +278,7 @@ public class AbstractDataToProcessWriterTests extends ESTestCase { TransformConfigs transforms = new TransformConfigs(Arrays.asList(concatTc, hrdTc)); AbstractDataToProcessWriter writer = - new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, transforms, statusReporter, jobLogger); + new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, transforms, dataCountsReporter, jobLogger); writer.writeHeader(); @@ -330,7 +330,7 @@ public class AbstractDataToProcessWriterTests extends ESTestCase { TransformConfigs transforms = new TransformConfigs(Arrays.asList(excludeConfig)); AbstractDataToProcessWriter writer = - new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, transforms, statusReporter, jobLogger); + new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, transforms, dataCountsReporter, jobLogger); writer.writeHeader(); @@ -345,10 +345,10 @@ public class AbstractDataToProcessWriterTests extends ESTestCase { assertFalse(writer.applyTransformsAndWrite(input, output, 3)); verify(autodetectProcess, never()).writeRecord(output); - verify(statusReporter, never()).reportRecordWritten(anyLong(), anyLong()); + verify(dataCountsReporter, never()).reportRecordWritten(anyLong(), anyLong()); // reset the call counts etc. - Mockito.reset(statusReporter); + Mockito.reset(dataCountsReporter); // this is ok input = new String[] { "2", "metricB", "0" }; @@ -356,7 +356,7 @@ public class AbstractDataToProcessWriterTests extends ESTestCase { assertTrue(writer.applyTransformsAndWrite(input, output, 3)); verify(autodetectProcess, times(1)).writeRecord(expectedOutput); - verify(statusReporter, times(1)).reportRecordWritten(3, 2000); + verify(dataCountsReporter, times(1)).reportRecordWritten(3, 2000); } public void testBuildTransforms_DateTransformsAreSorted() throws IOException { @@ -383,7 +383,7 @@ public class AbstractDataToProcessWriterTests extends ESTestCase { TransformConfigs transforms = new TransformConfigs(Arrays.asList(upperTc, concatTc, splitTc)); AbstractDataToProcessWriter writer = - new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, transforms, statusReporter, jobLogger); + new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, transforms, dataCountsReporter, jobLogger); writer.writeHeader(); diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AnalysisLimitsWriterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AnalysisLimitsWriterTests.java index 0952e25dc06..494ee63b32d 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AnalysisLimitsWriterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/AnalysisLimitsWriterTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.AnalysisLimits; +import org.elasticsearch.xpack.ml.job.config.AnalysisLimits; import org.junit.After; import org.junit.Before; import org.mockito.Mockito; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/CsvDataToProcessWriterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/CsvDataToProcessWriterTests.java index 241cf2fc635..ccf5683a437 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/CsvDataToProcessWriterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/CsvDataToProcessWriterTests.java @@ -7,16 +7,16 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import org.apache.logging.log4j.Logger; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.DataDescription.DataFormat; -import org.elasticsearch.xpack.ml.job.Detector; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.DataDescription.DataFormat; +import org.elasticsearch.xpack.ml.job.config.Detector; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; import org.junit.Before; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; @@ -46,7 +46,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { private List transforms; private DataDescription.Builder dataDescription; private AnalysisConfig analysisConfig; - private StatusReporter statusReporter; + private DataCountsReporter dataCountsReporter; private Logger jobLogger; private List writtenRecords; @@ -54,7 +54,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { @Before public void setUpMocks() throws IOException { autodetectProcess = Mockito.mock(AutodetectProcess.class); - statusReporter = Mockito.mock(StatusReporter.class); + dataCountsReporter = Mockito.mock(DataCountsReporter.class); jobLogger = Mockito.mock(Logger.class); writtenRecords = new ArrayList<>(); @@ -89,7 +89,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { CsvDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -98,7 +98,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[] { "2", "2.0", "" }); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenTransformAndEmptyField() @@ -121,7 +121,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { CsvDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -130,7 +130,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[] { "2", "", "" }); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenTimeFormatIsEpochAndTimestampsAreOutOfOrder() @@ -144,7 +144,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { CsvDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -152,9 +152,9 @@ public class CsvDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[] { "3", "3.0", "" }); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter, times(2)).reportOutOfOrderRecord(2); - verify(statusReporter, never()).reportLatestTimeIncrementalStats(anyLong()); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter, times(2)).reportOutOfOrderRecord(2); + verify(dataCountsReporter, never()).reportLatestTimeIncrementalStats(anyLong()); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenTimeFormatIsEpochAndAllRecordsAreOutOfOrder() @@ -165,21 +165,21 @@ public class CsvDataToProcessWriterTests extends ESTestCase { input.append("2,bar,2.0\n"); InputStream inputStream = createInputStream(input.toString()); - when(statusReporter.getLatestRecordTime()).thenReturn(new Date(5000L)); + when(dataCountsReporter.getLatestRecordTime()).thenReturn(new Date(5000L)); CsvDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field expectedRecords.add(new String[] { "time", "value", "." }); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter, times(2)).reportOutOfOrderRecord(2); - verify(statusReporter, times(2)).reportLatestTimeIncrementalStats(anyLong()); - verify(statusReporter, never()).reportRecordWritten(anyLong(), anyLong()); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter, times(2)).reportOutOfOrderRecord(2); + verify(dataCountsReporter, times(2)).reportLatestTimeIncrementalStats(anyLong()); + verify(dataCountsReporter, never()).reportRecordWritten(anyLong(), anyLong()); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenTimeFormatIsEpochAndSomeTimestampsWithinLatencySomeOutOfOrder() @@ -200,7 +200,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { CsvDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -211,9 +211,9 @@ public class CsvDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[] { "4", "4.0", "" }); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter, times(1)).reportOutOfOrderRecord(2); - verify(statusReporter, never()).reportLatestTimeIncrementalStats(anyLong()); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter, times(1)).reportOutOfOrderRecord(2); + verify(dataCountsReporter, never()).reportLatestTimeIncrementalStats(anyLong()); + verify(dataCountsReporter).finishReporting(); } public void testWrite_NullByte() @@ -234,7 +234,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { CsvDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -245,13 +245,13 @@ public class CsvDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[] { "4", "4.0", "" }); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter, times(1)).reportMissingField(); - verify(statusReporter, times(1)).reportRecordWritten(2, 1000); - verify(statusReporter, times(1)).reportRecordWritten(2, 2000); - verify(statusReporter, times(1)).reportRecordWritten(2, 3000); - verify(statusReporter, times(1)).reportRecordWritten(2, 4000); - verify(statusReporter, times(1)).reportDateParseError(2); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter, times(1)).reportMissingField(); + verify(dataCountsReporter, times(1)).reportRecordWritten(2, 1000); + verify(dataCountsReporter, times(1)).reportRecordWritten(2, 2000); + verify(dataCountsReporter, times(1)).reportRecordWritten(2, 3000); + verify(dataCountsReporter, times(1)).reportRecordWritten(2, 4000); + verify(dataCountsReporter, times(1)).reportDateParseError(2); + verify(dataCountsReporter).finishReporting(); } public void testWrite_EmptyInput() throws IOException { @@ -259,7 +259,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { builder.setLatency(0L); analysisConfig = builder.build(); - when(statusReporter.incrementalStats()).thenReturn(new DataCounts("foo")); + when(dataCountsReporter.incrementalStats()).thenReturn(new DataCounts("foo")); InputStream inputStream = createInputStream(""); CsvDataToProcessWriter writer = createWriter(); @@ -294,7 +294,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { InputStream inputStream = createInputStream(input.toString()); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -303,7 +303,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[] { "2", "6.0", "" }); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenChainedTransforms_SortsByDependencies() @@ -333,7 +333,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { CsvDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -342,7 +342,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[] { "2", "WWW.BAR.COM", "2.0", "" }); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenMisplacedQuoteMakesRecordExtendOverTooManyLines() @@ -372,7 +372,7 @@ public class CsvDataToProcessWriterTests extends ESTestCase { private CsvDataToProcessWriter createWriter() { return new CsvDataToProcessWriter(true, autodetectProcess, dataDescription.build(), analysisConfig, - new TransformConfigs(transforms),statusReporter, jobLogger); + new TransformConfigs(transforms), dataCountsReporter, jobLogger); } private void assertWrittenRecordsEqualTo(List expectedRecords) { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/CsvParserTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/CsvParserTests.java index 466460ebbc6..9747550855a 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/CsvParserTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/CsvParserTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.DataDescription; +import org.elasticsearch.xpack.ml.job.config.DataDescription; import org.supercsv.io.CsvListReader; import org.supercsv.prefs.CsvPreference; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataToProcessWriterFactoryTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataToProcessWriterFactoryTests.java index 0fbba65c35b..cb7f61c3209 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataToProcessWriterFactoryTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataToProcessWriterFactoryTests.java @@ -7,12 +7,12 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import org.apache.logging.log4j.Logger; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.DataDescription.DataFormat; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.DataDescription.DataFormat; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; import static org.mockito.Mockito.mock; @@ -40,6 +40,6 @@ public class DataToProcessWriterFactoryTests extends ESTestCase { private static DataToProcessWriter createWriter(DataDescription dataDescription) { return DataToProcessWriterFactory.create(true, mock(AutodetectProcess.class), dataDescription, - mock(AnalysisConfig.class), mock(TransformConfigs.class), mock(StatusReporter.class), mock(Logger.class)); + mock(AnalysisConfig.class), mock(TransformConfigs.class), mock(DataCountsReporter.class), mock(Logger.class)); } } diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataWithTransformsToProcessWriterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataWithTransformsToProcessWriterTests.java index 610e9c48208..1a463ae4c4c 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataWithTransformsToProcessWriterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/DataWithTransformsToProcessWriterTests.java @@ -7,15 +7,15 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import org.apache.logging.log4j.Logger; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.DataDescription.DataFormat; -import org.elasticsearch.xpack.ml.job.Detector; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.DataDescription.DataFormat; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; import org.junit.Before; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; @@ -35,7 +35,7 @@ import static org.mockito.Mockito.verify; public class DataWithTransformsToProcessWriterTests extends ESTestCase { private AutodetectProcess autodetectProcess; - private StatusReporter statusReporter; + private DataCountsReporter dataCountsReporter; private Logger logger; private List writtenRecords; @@ -43,7 +43,7 @@ public class DataWithTransformsToProcessWriterTests extends ESTestCase { @Before public void setUpMocks() throws IOException { autodetectProcess = Mockito.mock(AutodetectProcess.class); - statusReporter = Mockito.mock(StatusReporter.class); + dataCountsReporter = Mockito.mock(DataCountsReporter.class); logger = Mockito.mock(Logger.class); writtenRecords = new ArrayList<>(); @@ -79,7 +79,7 @@ public class DataWithTransformsToProcessWriterTests extends ESTestCase { assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter).finishReporting(); } public void testJsonWriteWithConcat() throws IOException { @@ -102,7 +102,7 @@ public class DataWithTransformsToProcessWriterTests extends ESTestCase { assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter).finishReporting(); } @@ -126,9 +126,9 @@ public class DataWithTransformsToProcessWriterTests extends ESTestCase { TransformConfigs tcs = new TransformConfigs(Arrays.asList(tc)); if (doCsv) { - return new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, tcs, statusReporter, logger); + return new CsvDataToProcessWriter(true, autodetectProcess, dd.build(), ac, tcs, dataCountsReporter, logger); } else { - return new JsonDataToProcessWriter(true, autodetectProcess, dd.build(), ac, tcs, statusReporter, logger); + return new JsonDataToProcessWriter(true, autodetectProcess, dd.build(), ac, tcs, dataCountsReporter, logger); } } diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/FieldConfigWriterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/FieldConfigWriterTests.java index 28d6707c4f0..8177f3eaf02 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/FieldConfigWriterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/FieldConfigWriterTests.java @@ -25,21 +25,21 @@ import org.apache.logging.log4j.Logger; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.detectionrules.Connective; +import org.elasticsearch.xpack.ml.job.config.Connective; import org.ini4j.Config; import org.ini4j.Ini; import org.ini4j.Profile.Section; import org.junit.Before; import org.mockito.ArgumentCaptor; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; -import org.elasticsearch.xpack.ml.job.detectionrules.DetectionRule; -import org.elasticsearch.xpack.ml.job.detectionrules.RuleCondition; -import org.elasticsearch.xpack.ml.job.detectionrules.RuleConditionType; -import org.elasticsearch.xpack.ml.lists.ListDocument; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.Condition; +import org.elasticsearch.xpack.ml.job.config.Operator; +import org.elasticsearch.xpack.ml.job.config.DetectionRule; +import org.elasticsearch.xpack.ml.job.config.RuleCondition; +import org.elasticsearch.xpack.ml.job.config.RuleConditionType; +import org.elasticsearch.xpack.ml.job.config.ListDocument; public class FieldConfigWriterTests extends ESTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/JsonDataToProcessWriterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/JsonDataToProcessWriterTests.java index 7911a90436a..6c4eb1f2e4e 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/JsonDataToProcessWriterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/JsonDataToProcessWriterTests.java @@ -8,15 +8,15 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import org.apache.logging.log4j.Logger; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.DataDescription.DataFormat; -import org.elasticsearch.xpack.ml.job.Detector; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.DataDescription.DataFormat; +import org.elasticsearch.xpack.ml.job.config.Detector; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; import org.junit.Before; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; @@ -40,7 +40,7 @@ import static org.mockito.Mockito.verify; public class JsonDataToProcessWriterTests extends ESTestCase { private AutodetectProcess autodetectProcess; - private StatusReporter statusReporter; + private DataCountsReporter dataCountsReporter; private Logger logger; private List transforms; @@ -52,7 +52,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { @Before public void setUpMocks() throws IOException { autodetectProcess = Mockito.mock(AutodetectProcess.class); - statusReporter = Mockito.mock(StatusReporter.class); + dataCountsReporter = Mockito.mock(DataCountsReporter.class); logger = Mockito.mock(Logger.class); writtenRecords = new ArrayList<>(); @@ -84,7 +84,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { JsonDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -93,7 +93,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[]{"2", "2.0", ""}); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenTimeFormatIsEpochAndTimestampsAreOutOfOrder() @@ -106,7 +106,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { JsonDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -114,9 +114,9 @@ public class JsonDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[]{"3", "3.0", ""}); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter, times(2)).reportOutOfOrderRecord(2); - verify(statusReporter, never()).reportLatestTimeIncrementalStats(anyLong()); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter, times(2)).reportOutOfOrderRecord(2); + verify(dataCountsReporter, never()).reportLatestTimeIncrementalStats(anyLong()); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenTimeFormatIsEpochAndSomeTimestampsWithinLatencySomeOutOfOrder() @@ -145,9 +145,9 @@ public class JsonDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[]{"4", "4.0", ""}); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter, times(1)).reportOutOfOrderRecord(2); - verify(statusReporter, never()).reportLatestTimeIncrementalStats(anyLong()); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter, times(1)).reportOutOfOrderRecord(2); + verify(dataCountsReporter, never()).reportLatestTimeIncrementalStats(anyLong()); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenMalformedJsonWithoutNestedLevels() @@ -164,7 +164,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { JsonDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -174,8 +174,8 @@ public class JsonDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[]{"3", "3.0", ""}); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).reportMissingFields(1); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter).reportMissingFields(1); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenMalformedJsonWithNestedLevels() @@ -193,7 +193,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { JsonDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -203,7 +203,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[]{"3", "3.0", ""}); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenMalformedJsonThatNeverRecovers() @@ -235,7 +235,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { JsonDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -244,7 +244,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[]{"2", "2.0", ""}); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenJsonWithMissingFields() @@ -264,7 +264,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { JsonDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -275,13 +275,13 @@ public class JsonDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[]{"4", "3.0", ""}); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter, times(1)).reportMissingFields(1L); - verify(statusReporter, times(1)).reportRecordWritten(2, 1000); - verify(statusReporter, times(1)).reportRecordWritten(1, 2000); - verify(statusReporter, times(1)).reportRecordWritten(1, 3000); - verify(statusReporter, times(1)).reportRecordWritten(1, 4000); - verify(statusReporter, times(1)).reportDateParseError(0); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter, times(1)).reportMissingFields(1L); + verify(dataCountsReporter, times(1)).reportRecordWritten(2, 1000); + verify(dataCountsReporter, times(1)).reportRecordWritten(1, 2000); + verify(dataCountsReporter, times(1)).reportRecordWritten(1, 3000); + verify(dataCountsReporter, times(1)).reportRecordWritten(1, 4000); + verify(dataCountsReporter, times(1)).reportDateParseError(0); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenDateTimeFieldIsOutputOfTransform() throws Exception { @@ -306,7 +306,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { InputStream inputStream = createInputStream(input.toString()); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -315,7 +315,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[]{"2", "6.0", ""}); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter).finishReporting(); } public void testWrite_GivenChainedTransforms_SortsByDependencies() throws Exception { @@ -343,7 +343,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { JsonDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -352,7 +352,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[]{"2", "WWW.BAR.COM", "2.0", ""}); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); + verify(dataCountsReporter).finishReporting(); } @@ -362,7 +362,7 @@ public class JsonDataToProcessWriterTests extends ESTestCase { private JsonDataToProcessWriter createWriter() { return new JsonDataToProcessWriter(true, autodetectProcess, dataDescription.build(), analysisConfig, - new TransformConfigs(transforms), statusReporter, logger); + new TransformConfigs(transforms), dataCountsReporter, logger); } private void assertWrittenRecordsEqualTo(List expectedRecords) { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/ModelDebugConfigWriterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/ModelDebugConfigWriterTests.java index c8ad716ed25..3d3504b02e1 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/ModelDebugConfigWriterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/ModelDebugConfigWriterTests.java @@ -15,8 +15,8 @@ import org.elasticsearch.test.ESTestCase; import org.junit.After; import org.junit.Before; import org.mockito.Mockito; -import org.elasticsearch.xpack.ml.job.ModelDebugConfig; -import org.elasticsearch.xpack.ml.job.ModelDebugConfig.DebugDestination; +import org.elasticsearch.xpack.ml.job.config.ModelDebugConfig; +import org.elasticsearch.xpack.ml.job.config.ModelDebugConfig.DebugDestination; public class ModelDebugConfigWriterTests extends ESTestCase { private OutputStreamWriter writer; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/SimpleJsonRecordReaderTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/SimpleJsonRecordReaderTests.java index 99143328160..ecb80f408af 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/SimpleJsonRecordReaderTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/SimpleJsonRecordReaderTests.java @@ -11,8 +11,8 @@ import com.fasterxml.jackson.core.JsonParser; import org.apache.logging.log4j.Logger; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.status.CountingInputStream; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; +import org.elasticsearch.xpack.ml.job.process.CountingInputStream; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -212,7 +212,7 @@ public class SimpleJsonRecordReaderTests extends ESTestCase { private JsonParser createParser(String input) throws JsonParseException, IOException { ByteArrayInputStream inputStream = new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8)); - InputStream inputStream2 = new CountingInputStream(inputStream, mock(StatusReporter.class)); + InputStream inputStream2 = new CountingInputStream(inputStream, mock(DataCountsReporter.class)); return new JsonFactory().createParser(inputStream2); } diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/SingleLineDataToProcessWriterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/SingleLineDataToProcessWriterTests.java index b23133caba4..2f3d441f150 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/SingleLineDataToProcessWriterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/writer/SingleLineDataToProcessWriterTests.java @@ -7,14 +7,14 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.writer; import org.apache.logging.log4j.Logger; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.DataDescription; -import org.elasticsearch.xpack.ml.job.DataDescription.DataFormat; -import org.elasticsearch.xpack.ml.job.Detector; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.DataDescription; +import org.elasticsearch.xpack.ml.job.config.DataDescription.DataFormat; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.process.DataCountsReporter; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; -import org.elasticsearch.xpack.ml.job.status.StatusReporter; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformConfigs; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfigs; import org.junit.Before; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; @@ -39,14 +39,14 @@ public class SingleLineDataToProcessWriterTests extends ESTestCase { private DataDescription.Builder dataDescription; private AnalysisConfig analysisConfig; private List transformConfigs; - private StatusReporter statusReporter; + private DataCountsReporter dataCountsReporter; private List writtenRecords; @Before public void setUpMocks() throws IOException { autodetectProcess = Mockito.mock(AutodetectProcess.class); - statusReporter = Mockito.mock(StatusReporter.class); + dataCountsReporter = Mockito.mock(DataCountsReporter.class); writtenRecords = new ArrayList<>(); doAnswer(new Answer() { @@ -85,13 +85,13 @@ public class SingleLineDataToProcessWriterTests extends ESTestCase { SingleLineDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).getLatestRecordTime(); - verify(statusReporter, times(1)).startNewIncrementalCount(); - verify(statusReporter, times(1)).setAnalysedFieldsPerRecord(1); - verify(statusReporter, times(1)).reportRecordWritten(1, 1430301600000L); - verify(statusReporter, times(1)).reportRecordWritten(1, 1430305200000L); - verify(statusReporter, times(1)).reportRecordWritten(1, 1430308800000L); - verify(statusReporter, times(1)).incrementalStats(); + verify(dataCountsReporter, times(1)).getLatestRecordTime(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).setAnalysedFieldsPerRecord(1); + verify(dataCountsReporter, times(1)).reportRecordWritten(1, 1430301600000L); + verify(dataCountsReporter, times(1)).reportRecordWritten(1, 1430305200000L); + verify(dataCountsReporter, times(1)).reportRecordWritten(1, 1430308800000L); + verify(dataCountsReporter, times(1)).incrementalStats(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -101,8 +101,8 @@ public class SingleLineDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[]{"1430308800", "This is message 3", ""}); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); - verifyNoMoreInteractions(statusReporter); + verify(dataCountsReporter).finishReporting(); + verifyNoMoreInteractions(dataCountsReporter); } public void testWrite_GivenDataContainsInvalidRecords() throws Exception { @@ -122,13 +122,13 @@ public class SingleLineDataToProcessWriterTests extends ESTestCase { SingleLineDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).getLatestRecordTime(); - verify(statusReporter, times(1)).startNewIncrementalCount(); - verify(statusReporter, times(1)).setAnalysedFieldsPerRecord(1); - verify(statusReporter, times(1)).reportRecordWritten(1, 1430301600000L); - verify(statusReporter, times(1)).reportRecordWritten(1, 1430308800000L); - verify(statusReporter, times(3)).reportDateParseError(1); - verify(statusReporter, times(1)).incrementalStats(); + verify(dataCountsReporter, times(1)).getLatestRecordTime(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).setAnalysedFieldsPerRecord(1); + verify(dataCountsReporter, times(1)).reportRecordWritten(1, 1430301600000L); + verify(dataCountsReporter, times(1)).reportRecordWritten(1, 1430308800000L); + verify(dataCountsReporter, times(3)).reportDateParseError(1); + verify(dataCountsReporter, times(1)).incrementalStats(); List expectedRecords = new ArrayList<>(); // The final field is the control field @@ -137,8 +137,8 @@ public class SingleLineDataToProcessWriterTests extends ESTestCase { expectedRecords.add(new String[]{"1430308800", "This is message 3", ""}); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).finishReporting(); - verifyNoMoreInteractions(statusReporter); + verify(dataCountsReporter).finishReporting(); + verifyNoMoreInteractions(dataCountsReporter); } public void testWrite_GivenNoTransforms() throws Exception { @@ -148,19 +148,19 @@ public class SingleLineDataToProcessWriterTests extends ESTestCase { SingleLineDataToProcessWriter writer = createWriter(); writer.writeHeader(); writer.write(inputStream); - verify(statusReporter, times(1)).startNewIncrementalCount(); - verify(statusReporter, times(1)).setAnalysedFieldsPerRecord(1); - verify(statusReporter, times(1)).reportDateParseError(1); - verify(statusReporter, times(1)).incrementalStats(); + verify(dataCountsReporter, times(1)).startNewIncrementalCount(); + verify(dataCountsReporter, times(1)).setAnalysedFieldsPerRecord(1); + verify(dataCountsReporter, times(1)).reportDateParseError(1); + verify(dataCountsReporter, times(1)).incrementalStats(); List expectedRecords = new ArrayList<>(); // The final field is the control field expectedRecords.add(new String[]{"time", "message", "."}); assertWrittenRecordsEqualTo(expectedRecords); - verify(statusReporter).getLatestRecordTime(); - verify(statusReporter).finishReporting(); - verifyNoMoreInteractions(statusReporter); + verify(dataCountsReporter).getLatestRecordTime(); + verify(dataCountsReporter).finishReporting(); + verifyNoMoreInteractions(dataCountsReporter); } private static InputStream createInputStream(String input) { @@ -169,7 +169,7 @@ public class SingleLineDataToProcessWriterTests extends ESTestCase { private SingleLineDataToProcessWriter createWriter() { return new SingleLineDataToProcessWriter(true, autodetectProcess, dataDescription.build(), - analysisConfig, new TransformConfigs(transformConfigs), statusReporter, Mockito.mock(Logger.class)); + analysisConfig, new TransformConfigs(transformConfigs), dataCountsReporter, Mockito.mock(Logger.class)); } private void assertWrittenRecordsEqualTo(List expectedRecords) { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/logging/CppLogMessageHandlerTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/logging/CppLogMessageHandlerTests.java similarity index 98% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/logging/CppLogMessageHandlerTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/logging/CppLogMessageHandlerTests.java index 29ce19674f1..37d889a14d2 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/logging/CppLogMessageHandlerTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/logging/CppLogMessageHandlerTests.java @@ -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.logging; +package org.elasticsearch.xpack.ml.job.process.logging; import org.elasticsearch.test.ESTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/logging/CppLogMessageTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/logging/CppLogMessageTests.java similarity index 96% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/logging/CppLogMessageTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/logging/CppLogMessageTests.java index f435c62c83e..ab43630697e 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/logging/CppLogMessageTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/logging/CppLogMessageTests.java @@ -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.logging; +package org.elasticsearch.xpack.ml.job.process.logging; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/normalizer/ScoresUpdaterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/normalizer/ScoresUpdaterTests.java index 76c4e2c0577..56a58c1efc0 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/normalizer/ScoresUpdaterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/normalizer/ScoresUpdaterTests.java @@ -14,9 +14,9 @@ import java.util.Deque; import java.util.List; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.AnalysisConfig; -import org.elasticsearch.xpack.ml.job.Detector; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.AnalysisConfig; +import org.elasticsearch.xpack.ml.job.config.Detector; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.persistence.BatchedDocumentsIterator; import org.elasticsearch.xpack.ml.job.persistence.BatchedResultsIterator; import org.elasticsearch.xpack.ml.job.persistence.JobProvider; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/normalizer/ShortCircuitingRenormalizerTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/normalizer/ShortCircuitingRenormalizerTests.java index 6f2706084f8..81849486587 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/normalizer/ShortCircuitingRenormalizerTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/process/normalizer/ShortCircuitingRenormalizerTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.ml.job.process.normalizer; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.mockito.ArgumentCaptor; import java.util.Date; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/results/AutodetectResultTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/results/AutodetectResultTests.java index b73ca74446a..5bbe59a2f14 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/results/AutodetectResultTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/results/AutodetectResultTests.java @@ -7,10 +7,10 @@ package org.elasticsearch.xpack.ml.job.results; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.ml.job.ModelSizeStats; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.job.process.autodetect.output.FlushAcknowledgement; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase; import java.util.ArrayList; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/status/StatusReporterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/status/StatusReporterTests.java deleted file mode 100644 index 4902649ab8b..00000000000 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/status/StatusReporterTests.java +++ /dev/null @@ -1,308 +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.ml.job.status; - -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.env.Environment; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.xpack.ml.job.DataCounts; -import org.elasticsearch.xpack.ml.job.persistence.JobDataCountsPersister; -import org.elasticsearch.xpack.ml.job.usage.UsageReporter; -import org.junit.Before; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; - -import java.io.IOException; -import java.util.Date; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class StatusReporterTests extends ESTestCase { - private static final String JOB_ID = "SR"; - private static final int MAX_PERCENT_DATE_PARSE_ERRORS = 40; - private static final int MAX_PERCENT_OUT_OF_ORDER_ERRORS = 30; - - private UsageReporter usageReporter; - private JobDataCountsPersister jobDataCountsPersister; - private ThreadPool threadPool; - private Settings settings; - - @Before - public void setUpMocks() { - settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) - .put(StatusReporter.ACCEPTABLE_PERCENTAGE_DATE_PARSE_ERRORS_SETTING.getKey(), MAX_PERCENT_DATE_PARSE_ERRORS) - .put(StatusReporter.ACCEPTABLE_PERCENTAGE_OUT_OF_ORDER_ERRORS_SETTING.getKey(), MAX_PERCENT_OUT_OF_ORDER_ERRORS).build(); - usageReporter = Mockito.mock(UsageReporter.class); - jobDataCountsPersister = Mockito.mock(JobDataCountsPersister.class); - threadPool = Mockito.mock(ThreadPool.class); - - when(threadPool.scheduleWithFixedDelay(any(Runnable.class), any(), any())).thenReturn(new ThreadPool.Cancellable() { - @Override - public void cancel() { - } - - @Override - public boolean isCancelled() { - return false; - } - }); - } - - public void testSettingAcceptablePercentages() throws IOException { - try (StatusReporter statusReporter = new StatusReporter(threadPool, settings, JOB_ID, new DataCounts(JOB_ID), usageReporter, - jobDataCountsPersister)) { - assertEquals(statusReporter.getAcceptablePercentDateParseErrors(), MAX_PERCENT_DATE_PARSE_ERRORS); - assertEquals(statusReporter.getAcceptablePercentOutOfOrderErrors(), MAX_PERCENT_OUT_OF_ORDER_ERRORS); - } - } - - public void testSimpleConstructor() throws Exception { - try (StatusReporter statusReporter = new StatusReporter(threadPool, settings, JOB_ID, new DataCounts(JOB_ID), usageReporter, - jobDataCountsPersister)) { - DataCounts stats = statusReporter.incrementalStats(); - assertNotNull(stats); - assertAllCountFieldsEqualZero(stats); - } - } - - public void testComplexConstructor() throws Exception { - DataCounts counts = new DataCounts("foo", 1L, 1L, 2L, 0L, 3L, 4L, 5L, new Date(), new Date()); - - try (StatusReporter statusReporter = - new StatusReporter(threadPool, settings, JOB_ID, counts, usageReporter, jobDataCountsPersister)) { - DataCounts stats = statusReporter.incrementalStats(); - assertNotNull(stats); - assertAllCountFieldsEqualZero(stats); - - assertEquals(1, statusReporter.getProcessedRecordCount()); - assertEquals(2, statusReporter.getBytesRead()); - assertEquals(3, statusReporter.getDateParseErrorsCount()); - assertEquals(4, statusReporter.getMissingFieldErrorCount()); - assertEquals(5, statusReporter.getOutOfOrderRecordCount()); - assertNull(stats.getEarliestRecordTimeStamp()); - } - } - - public void testResetIncrementalCounts() throws Exception { - try (StatusReporter statusReporter = new StatusReporter(threadPool, settings, JOB_ID, new DataCounts(JOB_ID), usageReporter, - jobDataCountsPersister)) { - DataCounts stats = statusReporter.incrementalStats(); - assertNotNull(stats); - assertAllCountFieldsEqualZero(stats); - - statusReporter.setAnalysedFieldsPerRecord(3); - - statusReporter.reportRecordWritten(5, 1000); - statusReporter.reportRecordWritten(5, 1000); - assertEquals(2, statusReporter.incrementalStats().getInputRecordCount()); - assertEquals(10, statusReporter.incrementalStats().getInputFieldCount()); - assertEquals(2, statusReporter.incrementalStats().getProcessedRecordCount()); - assertEquals(6, statusReporter.incrementalStats().getProcessedFieldCount()); - assertEquals(1000, statusReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); - - assertEquals(statusReporter.incrementalStats(), statusReporter.runningTotalStats()); - - statusReporter.startNewIncrementalCount(); - stats = statusReporter.incrementalStats(); - assertNotNull(stats); - assertAllCountFieldsEqualZero(stats); - } - } - - public void testReportLatestTimeIncrementalStats() throws IOException { - try (StatusReporter statusReporter = new StatusReporter(threadPool, settings, JOB_ID, new DataCounts(JOB_ID), usageReporter, - jobDataCountsPersister)) { - statusReporter.startNewIncrementalCount(); - statusReporter.reportLatestTimeIncrementalStats(5001L); - assertEquals(5001L, statusReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); - } - } - - public void testReportRecordsWritten() { - try (StatusReporter statusReporter = new StatusReporter(threadPool, settings, JOB_ID, new DataCounts(JOB_ID), usageReporter, - jobDataCountsPersister)) { - statusReporter.setAnalysedFieldsPerRecord(3); - - statusReporter.reportRecordWritten(5, 2000); - assertEquals(1, statusReporter.incrementalStats().getInputRecordCount()); - assertEquals(5, statusReporter.incrementalStats().getInputFieldCount()); - assertEquals(1, statusReporter.incrementalStats().getProcessedRecordCount()); - assertEquals(3, statusReporter.incrementalStats().getProcessedFieldCount()); - assertEquals(2000, statusReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); - - statusReporter.reportRecordWritten(5, 3000); - statusReporter.reportMissingField(); - assertEquals(2, statusReporter.incrementalStats().getInputRecordCount()); - assertEquals(10, statusReporter.incrementalStats().getInputFieldCount()); - assertEquals(2, statusReporter.incrementalStats().getProcessedRecordCount()); - assertEquals(5, statusReporter.incrementalStats().getProcessedFieldCount()); - assertEquals(3000, statusReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); - - assertEquals(statusReporter.incrementalStats(), statusReporter.runningTotalStats()); - - verify(jobDataCountsPersister, never()).persistDataCounts(anyString(), any(DataCounts.class), any()); - } - } - - public void testReportRecordsWritten_Given100Records() { - try (DummyStatusReporter statusReporter = new DummyStatusReporter(usageReporter)) { - statusReporter.setAnalysedFieldsPerRecord(3); - - for (int i = 1; i <= 101; i++) { - statusReporter.reportRecordWritten(5, i); - } - - assertEquals(101, statusReporter.incrementalStats().getInputRecordCount()); - assertEquals(505, statusReporter.incrementalStats().getInputFieldCount()); - assertEquals(101, statusReporter.incrementalStats().getProcessedRecordCount()); - assertEquals(303, statusReporter.incrementalStats().getProcessedFieldCount()); - assertEquals(101, statusReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); - - assertEquals(1, statusReporter.getLogStatusCallCount()); - } - } - - public void testReportRecordsWritten_Given1000Records() { - try (DummyStatusReporter statusReporter = new DummyStatusReporter(usageReporter)) { - - statusReporter.setAnalysedFieldsPerRecord(3); - - for (int i = 1; i <= 1001; i++) { - statusReporter.reportRecordWritten(5, i); - } - - assertEquals(1001, statusReporter.incrementalStats().getInputRecordCount()); - assertEquals(5005, statusReporter.incrementalStats().getInputFieldCount()); - assertEquals(1001, statusReporter.incrementalStats().getProcessedRecordCount()); - assertEquals(3003, statusReporter.incrementalStats().getProcessedFieldCount()); - assertEquals(1001, statusReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); - - assertEquals(10, statusReporter.getLogStatusCallCount()); - } - - } - - public void testReportRecordsWritten_Given2000Records() { - try (DummyStatusReporter statusReporter = new DummyStatusReporter(usageReporter)) { - statusReporter.setAnalysedFieldsPerRecord(3); - - for (int i = 1; i <= 2001; i++) { - statusReporter.reportRecordWritten(5, i); - } - - assertEquals(2001, statusReporter.incrementalStats().getInputRecordCount()); - assertEquals(10005, statusReporter.incrementalStats().getInputFieldCount()); - assertEquals(2001, statusReporter.incrementalStats().getProcessedRecordCount()); - assertEquals(6003, statusReporter.incrementalStats().getProcessedFieldCount()); - assertEquals(2001, statusReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); - - assertEquals(11, statusReporter.getLogStatusCallCount()); - } - } - - public void testReportRecordsWritten_Given20000Records() { - try (DummyStatusReporter statusReporter = new DummyStatusReporter(usageReporter)) { - statusReporter.setAnalysedFieldsPerRecord(3); - - for (int i = 1; i <= 20001; i++) { - statusReporter.reportRecordWritten(5, i); - } - - assertEquals(20001, statusReporter.incrementalStats().getInputRecordCount()); - assertEquals(100005, statusReporter.incrementalStats().getInputFieldCount()); - assertEquals(20001, statusReporter.incrementalStats().getProcessedRecordCount()); - assertEquals(60003, statusReporter.incrementalStats().getProcessedFieldCount()); - assertEquals(20001, statusReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); - - assertEquals(29, statusReporter.getLogStatusCallCount()); - } - } - - public void testReportRecordsWritten_Given30000Records() { - try (DummyStatusReporter statusReporter = new DummyStatusReporter(usageReporter)) { - statusReporter.setAnalysedFieldsPerRecord(3); - - for (int i = 1; i <= 30001; i++) { - statusReporter.reportRecordWritten(5, i); - } - - assertEquals(30001, statusReporter.incrementalStats().getInputRecordCount()); - assertEquals(150005, statusReporter.incrementalStats().getInputFieldCount()); - assertEquals(30001, statusReporter.incrementalStats().getProcessedRecordCount()); - assertEquals(90003, statusReporter.incrementalStats().getProcessedFieldCount()); - assertEquals(30001, statusReporter.incrementalStats().getLatestRecordTimeStamp().getTime()); - - assertEquals(30, statusReporter.getLogStatusCallCount()); - } - } - - public void testFinishReporting() { - try (StatusReporter statusReporter = new StatusReporter(threadPool, settings, JOB_ID, new DataCounts(JOB_ID), usageReporter, - jobDataCountsPersister)) { - - statusReporter.setAnalysedFieldsPerRecord(3); - - DataCounts dc = new DataCounts(JOB_ID, 2L, 5L, 0L, 10L, 0L, 1L, 0L, new Date(2000), new Date(3000)); - statusReporter.reportRecordWritten(5, 2000); - statusReporter.reportRecordWritten(5, 3000); - statusReporter.reportMissingField(); - statusReporter.finishReporting(); - - Mockito.verify(usageReporter, Mockito.times(1)).reportUsage(); - Mockito.verify(jobDataCountsPersister, Mockito.times(1)).persistDataCounts(eq("SR"), eq(dc), any()); - assertEquals(dc, statusReporter.incrementalStats()); - } - } - - public void testPersistenceTimeOut() { - - ThreadPool mockThreadPool = Mockito.mock(ThreadPool.class); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Runnable.class); - - when(mockThreadPool.scheduleWithFixedDelay(argumentCaptor.capture(), any(), any())).thenReturn(new ThreadPool.Cancellable() { - @Override - public void cancel() { - - } - - @Override - public boolean isCancelled() { - return false; - } - }); - - try (StatusReporter statusReporter = new StatusReporter(mockThreadPool, settings, JOB_ID, new DataCounts(JOB_ID), usageReporter, - jobDataCountsPersister)) { - - statusReporter.setAnalysedFieldsPerRecord(3); - - statusReporter.reportRecordWritten(5, 2000); - statusReporter.reportRecordWritten(5, 3000); - - Mockito.verify(jobDataCountsPersister, Mockito.times(0)).persistDataCounts(eq("SR"), any(), any()); - argumentCaptor.getValue().run(); - statusReporter.reportRecordWritten(5, 4000); - Mockito.verify(jobDataCountsPersister, Mockito.times(1)).persistDataCounts(eq("SR"), any(), any()); - } - } - - private void assertAllCountFieldsEqualZero(DataCounts stats) throws Exception { - assertEquals(0L, stats.getProcessedRecordCount()); - assertEquals(0L, stats.getProcessedFieldCount()); - assertEquals(0L, stats.getInputBytes()); - assertEquals(0L, stats.getInputFieldCount()); - assertEquals(0L, stats.getInputRecordCount()); - assertEquals(0L, stats.getInvalidDateCount()); - assertEquals(0L, stats.getMissingFieldCount()); - assertEquals(0L, stats.getOutOfOrderTimeStampCount()); - } -} diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/modelsnapshots/GetModelSnapshotsTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/modelsnapshots/GetModelSnapshotsTests.java index 03eb841c419..cb27d89ff13 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/modelsnapshots/GetModelSnapshotsTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/modelsnapshots/GetModelSnapshotsTests.java @@ -8,10 +8,10 @@ package org.elasticsearch.xpack.ml.modelsnapshots; import org.elasticsearch.common.ParseField; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.ml.action.GetModelSnapshotsAction; -import org.elasticsearch.xpack.ml.job.ModelSnapshot; -import org.elasticsearch.xpack.ml.job.persistence.QueryPage; -import org.elasticsearch.xpack.ml.job.quantiles.Quantiles; -import org.elasticsearch.xpack.ml.job.results.PageParams; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; +import org.elasticsearch.xpack.ml.action.util.QueryPage; +import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; +import org.elasticsearch.xpack.ml.action.util.PageParams; import java.util.Arrays; import java.util.Date; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/audit/AuditActivityTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/notifications/AuditActivityTests.java similarity index 98% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/audit/AuditActivityTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/notifications/AuditActivityTests.java index a801de433d9..58e28d27b39 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/audit/AuditActivityTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/notifications/AuditActivityTests.java @@ -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.audit; +package org.elasticsearch.xpack.ml.notifications; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/audit/AuditMessageTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/notifications/AuditMessageTests.java similarity index 98% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/audit/AuditMessageTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/notifications/AuditMessageTests.java index f4a0a321e42..3bbd84e3c1a 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/audit/AuditMessageTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/notifications/AuditMessageTests.java @@ -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.audit; +package org.elasticsearch.xpack.ml.notifications; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.xcontent.XContentParser; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/audit/AuditorTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/notifications/AuditorTests.java similarity index 99% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/audit/AuditorTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/notifications/AuditorTests.java index dbd03e1876e..dbfa7172147 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/audit/AuditorTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/notifications/AuditorTests.java @@ -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.audit; +package org.elasticsearch.xpack.ml.notifications; import org.elasticsearch.action.ListenableActionFuture; import org.elasticsearch.action.index.IndexRequestBuilder; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/audit/LevelTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/notifications/LevelTests.java similarity index 98% rename from elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/audit/LevelTests.java rename to elasticsearch/src/test/java/org/elasticsearch/xpack/ml/notifications/LevelTests.java index 758500e6488..d8019848a60 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/job/audit/LevelTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/notifications/LevelTests.java @@ -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.audit; +package org.elasticsearch.xpack.ml.notifications; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartJobDatafeedActionTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartJobDatafeedActionTests.java index f1ec47b0fdc..07406d7d107 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartJobDatafeedActionTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartJobDatafeedActionTests.java @@ -13,7 +13,7 @@ import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; -import org.elasticsearch.xpack.ml.job.Job; +import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.datafeed.DatafeedJobRunnerTests; import org.elasticsearch.xpack.ml.datafeed.DatafeedConfig; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/DependencySorterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/DependencySorterTests.java index 53acf64730a..7d8e315faf6 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/DependencySorterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/DependencySorterTests.java @@ -11,8 +11,8 @@ import java.util.List; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; public class DependencySorterTests extends ESTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterNumericTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterNumericTests.java index ebe7feeaee9..aaa0ab4154e 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterNumericTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterNumericTests.java @@ -13,8 +13,8 @@ import java.util.List; import org.apache.logging.log4j.Logger; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; +import org.elasticsearch.xpack.ml.job.config.Condition; +import org.elasticsearch.xpack.ml.job.config.Operator; import org.elasticsearch.xpack.ml.transforms.Transform.TransformIndex; import org.elasticsearch.xpack.ml.transforms.Transform.TransformResult; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterTests.java index 96c7004c400..76b72570efc 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/ExcludeFilterTests.java @@ -13,8 +13,8 @@ import java.util.List; import org.apache.logging.log4j.Logger; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; +import org.elasticsearch.xpack.ml.job.config.Condition; +import org.elasticsearch.xpack.ml.job.config.Operator; import org.elasticsearch.xpack.ml.transforms.Transform.TransformIndex; import org.elasticsearch.xpack.ml.transforms.Transform.TransformResult; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/TransformFactoryTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/TransformFactoryTests.java index bc485bdfbfa..013f4bc06b6 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/TransformFactoryTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/TransformFactoryTests.java @@ -17,10 +17,10 @@ import java.util.Map; import org.apache.logging.log4j.Logger; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.config.Condition; +import org.elasticsearch.xpack.ml.job.config.Operator; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; import org.elasticsearch.xpack.ml.transforms.Transform.TransformIndex; public class TransformFactoryTests extends ESTestCase { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/TransformTestUtils.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/TransformTestUtils.java index 8593aa1d650..f20ded1614c 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/TransformTestUtils.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/transforms/TransformTestUtils.java @@ -9,11 +9,11 @@ import java.util.ArrayList; import java.util.List; import java.util.function.BiFunction; -import org.elasticsearch.xpack.ml.job.condition.Condition; -import org.elasticsearch.xpack.ml.job.condition.Operator; -import org.elasticsearch.xpack.ml.job.transform.IntRange; -import org.elasticsearch.xpack.ml.job.transform.TransformConfig; -import org.elasticsearch.xpack.ml.job.transform.TransformType; +import org.elasticsearch.xpack.ml.job.config.Condition; +import org.elasticsearch.xpack.ml.job.config.Operator; +import org.elasticsearch.xpack.ml.job.config.transform.IntRange; +import org.elasticsearch.xpack.ml.job.config.transform.TransformConfig; +import org.elasticsearch.xpack.ml.job.config.transform.TransformType; import org.elasticsearch.xpack.ml.transforms.Transform.TransformIndex; public final class TransformTestUtils {