Skip to content

Commit

Permalink
Apply review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
przemekwitek committed Mar 30, 2020
1 parent 26a0ac4 commit 70fbc6e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public final class Messages {
public static final String JOB_AUDIT_DELETED = "Job deleted";
public static final String JOB_AUDIT_KILLING = "Killing job";
public static final String JOB_AUDIT_OLD_RESULTS_DELETED = "Deleted results prior to {0}";
public static final String JOB_AUDIT_SNAPSHOT_STORED = "Job model snapshot stored";
public static final String JOB_AUDIT_SNAPSHOT_STORED = "Job model snapshot with id [{0}] stored";
public static final String JOB_AUDIT_REVERTED = "Job model snapshot reverted to ''{0}''";
public static final String JOB_AUDIT_SNAPSHOT_DELETED = "Model snapshot [{0}] with description ''{1}'' deleted";
public static final String JOB_AUDIT_FILTER_UPDATED_ON_PROCESS = "Updated filter [{0}] in running process";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,11 @@ private Annotation createModelSnapshotAnnotation(ModelSnapshot modelSnapshot) {
assert modelSnapshot != null;
Date currentTime = new Date(clock.millis());
return new Annotation(
Messages.JOB_AUDIT_SNAPSHOT_STORED,
Messages.getMessage(Messages.JOB_AUDIT_SNAPSHOT_STORED, modelSnapshot.getSnapshotId()),
currentTime,
XPackUser.NAME,
modelSnapshot.getTimestamp(),
modelSnapshot.getLatestRecordTimeStamp(),
modelSnapshot.getTimestamp(),
jobId,
currentTime,
XPackUser.NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
package org.elasticsearch.xpack.ml.integration;

import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.support.IndicesOptions;
Expand Down Expand Up @@ -224,7 +225,10 @@ public void testProcessResults() throws Exception {
// Verify that creating model snapshot also creates associated annotation
List<Annotation> annotations = getAnnotations();
assertThat(annotations, hasSize(1));
assertThat(annotations.get(0).getAnnotation(), is(equalTo("Job model snapshot stored")));
assertThat(
annotations.get(0).getAnnotation(),
is(equalTo(
new ParameterizedMessage("Job model snapshot with id [{}] stored", modelSnapshot.getSnapshotId()).getFormattedMessage())));

Optional<Quantiles> persistedQuantiles = getQuantiles();
assertTrue(persistedQuantiles.isPresent());
Expand All @@ -246,7 +250,10 @@ public void testProcessResults_ModelSnapshot() throws Exception {
// Verify that creating model snapshot also creates associated annotation
List<Annotation> annotations = getAnnotations();
assertThat(annotations, hasSize(1));
assertThat(annotations.get(0).getAnnotation(), is(equalTo("Job model snapshot stored")));
assertThat(
annotations.get(0).getAnnotation(),
is(equalTo(
new ParameterizedMessage("Job model snapshot with id [{}] stored", modelSnapshot.getSnapshotId()).getFormattedMessage())));

// Verify that deleting model snapshot also deletes associated annotation
deleteModelSnapshot(JOB_ID, modelSnapshot.getSnapshotId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,11 @@ public void testProcessResult_modelSnapshot() {
Annotation annotation = annotationCaptor.getValue();
Annotation expectedAnnotation =
new Annotation(
"Job model snapshot stored",
"Job model snapshot with id [a_snapshot_id] stored",
Date.from(CURRENT_TIME),
XPackUser.NAME,
modelSnapshot.getTimestamp(),
modelSnapshot.getLatestRecordTimeStamp(),
modelSnapshot.getTimestamp(),
JOB_ID,
Date.from(CURRENT_TIME),
XPackUser.NAME,
Expand Down

0 comments on commit 70fbc6e

Please sign in to comment.