Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge from Sarat
Browse files Browse the repository at this point in the history
  • Loading branch information
kaituo committed Oct 13, 2020
1 parent 99c5a44 commit ff37fd3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public AnomalyDetector(StreamInput input) throws IOException {
uiMetadata = input.readMap();
schemaVersion = input.readInt();
lastUpdateTime = input.readInstant();
this.categoryField = input.readStringList();
this.categoryFields = input.readStringList();
}

public XContentBuilder toXContent(XContentBuilder builder) throws IOException {
Expand All @@ -259,7 +259,7 @@ public void writeTo(StreamOutput output) throws IOException {
output.writeMap(uiMetadata);
output.writeInt(schemaVersion);
output.writeInstant(lastUpdateTime);
output.writeStringCollection(categoryField);
output.writeStringCollection(categoryFields);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private void createAnomalyDetector() {
client
.search(
searchRequest,
ActionListener.wrap(response -> onSearchMultiEntityAdResponse(response), exception -> listener.onFailure(exception) )
ActionListener.wrap(response -> onSearchMultiEntityAdResponse(response), exception -> listener.onFailure(exception))
);
} else {
QueryBuilder query = QueryBuilders.matchAllQuery();
Expand All @@ -231,7 +231,8 @@ private void createAnomalyDetector() {
client
.search(
searchRequest,
ActionListener.wrap(response -> onSearchSingleEntityAdResponse(response), exception -> listener.onFailure(exception))
ActionListener
.wrap(response -> onSearchSingleEntityAdResponse(response), exception -> listener.onFailure(exception))
);
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ public void setUp() throws Exception {

channel = mock(ActionListener.class);

// final RestRequest restRequest = createRestRequest(Method.POST);
// final RestRequest restRequest = createRestRequest(Method.POST);

// when(channel.request()).thenReturn(restRequest);
// when(channel.newErrorBuilder()).thenReturn(JsonXContent.contentBuilder());
// when(channel.detailedErrorsEnabled()).thenReturn(true);
// when(channel.request()).thenReturn(restRequest);
// when(channel.newErrorBuilder()).thenReturn(JsonXContent.contentBuilder());
// when(channel.detailedErrorsEnabled()).thenReturn(true);

anomalyDetectionIndices = mock(AnomalyDetectionIndices.class);
when(anomalyDetectionIndices.doesAnomalyDetectorIndexExist()).thenReturn(true);
Expand Down Expand Up @@ -245,9 +245,7 @@ public void testNoCategoricalField() throws IOException {
verify(channel).onFailure(response.capture());
Exception value = response.getValue();
assertTrue(value instanceof IllegalArgumentException);
assertTrue(
value.getMessage().contains(IndexAnomalyDetectorActionHandler.EXCEEDED_MAX_SINGLE_ENTITY_DETECTORS_PREFIX_MSG)
);
assertTrue(value.getMessage().contains(IndexAnomalyDetectorActionHandler.EXCEEDED_MAX_SINGLE_ENTITY_DETECTORS_PREFIX_MSG));
}

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -523,8 +521,6 @@ public void testMoreThanTenMultiEntityDetectors() throws IOException {
verify(channel).onFailure(response.capture());
Exception value = response.getValue();
assertTrue(value instanceof IllegalArgumentException);
assertTrue(
value.getMessage().contains(IndexAnomalyDetectorActionHandler.EXCEEDED_MAX_MULTI_ENTITY_DETECTORS_PREFIX_MSG)
);
assertTrue(value.getMessage().contains(IndexAnomalyDetectorActionHandler.EXCEEDED_MAX_MULTI_ENTITY_DETECTORS_PREFIX_MSG));
}
}

0 comments on commit ff37fd3

Please sign in to comment.