Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@
import org.opensearch.ml.common.exception.MLException;
import org.opensearch.ml.common.output.MLOutput;
import org.opensearch.ml.common.output.MLOutputType;
import org.opensearch.tools.jackson.core.JsonParseException;
import org.reflections.Reflections;

import com.fasterxml.jackson.core.JsonParseException;

import lombok.extern.log4j.Log4j2;

@Log4j2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
import org.opensearch.ml.common.output.execute.metrics_correlation.MetricsCorrelationOutput;
import org.opensearch.ml.common.output.execute.samplecalculator.LocalSampleCalculatorOutput;
import org.opensearch.search.SearchModule;

import com.fasterxml.jackson.core.JsonParseException;
import org.opensearch.tools.jackson.core.JsonParseException;

public class MLCommonsClassLoaderTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.core.xcontent.XContentParser;
import org.opensearch.search.SearchModule;

import com.fasterxml.jackson.core.JsonParseException;
import org.opensearch.tools.jackson.core.JsonParseException;

public class MLDeployingSettingTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
package org.opensearch.ml.engine.algorithms.agent;

import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.*;
import static org.opensearch.ml.common.CommonValue.MCP_CONNECTORS_FIELD;
import static org.opensearch.ml.common.agui.AGUIConstants.AGUI_PARAM_CONTEXT;
Expand Down Expand Up @@ -1861,7 +1864,6 @@ public void test_ExecuteAgent_NonV2Agent_DoesNotRouteToExecuteV2Agent() throws I

// agentType.isV2() = false → V2 execution path must not be entered
verify(memory, never()).getStructuredMessages(any());
verify(listener, timeout(5000)).onFailure(any());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2501,14 +2501,12 @@ public void onResponse(SearchResponse newSearchResponse) {

@Override
public void onFailure(Exception e) {
System.out.println("Message: " + e.getMessage());
assertEquals(
"cannot find all required input fields: [text] in hit:{\n"
+ " \"_id\" : \"doc 0\",\n"
+ " \"_score\" : 0.0,\n"
+ " \"_source\" : {\n"
+ " \"texttypo\" : \"value 0\",\n"
+ " \"image\" : \"value 0\"\n"
+ " }\n"
+ " \"_source\":{ \"texttypo\" : \"value 0\", \"image\" : \"value 0\" }\n"
+ "} and query body:{\"size\":5,\"query\":{\"term\":{\"text\":{\"value\":\"foo\",\"boost\":1.0}}},\"sort\":[{\"text\":{\"order\":\"asc\"}}]}",
e.getMessage()
);
Expand Down Expand Up @@ -3314,9 +3312,7 @@ public void onFailure(Exception e) {
"cannot find all required input fields: [text] in hit:{\n"
+ " \"_id\" : \"doc 2\",\n"
+ " \"_score\" : 2.0,\n"
+ " \"_source\" : {\n"
+ " \"textMissing\" : \"value 2\"\n"
+ " }\n"
+ " \"_source\":{ \"textMissing\" : \"value 2\" }\n"
+ "} and query body:{\"size\":5,\"query\":{\"term\":{\"text\":{\"value\":\"foo\",\"boost\":1.0}}},\"sort\":[{\"text\":{\"order\":\"asc\"}}]}",
e.getMessage()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
package org.opensearch.ml.processor;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -67,7 +69,7 @@ public void testToXContent() throws IOException {
XContent xc = mock(XContent.class);
OutputStream os = mock(OutputStream.class);
XContentGenerator generator = mock(XContentGenerator.class);
when(xc.createGenerator(any(), any(), any())).thenReturn(generator);
when(xc.createGenerator(any(), any(), any(), anyBoolean())).thenReturn(generator);
XContentBuilder builder = new XContentBuilder(xc, os);
XContentBuilder actual = searchResponse.toXContent(builder, ToXContent.EMPTY_PARAMS);
assertNotNull(actual);
Expand Down Expand Up @@ -105,7 +107,7 @@ public void testToXContentWithNullParams() throws IOException {
XContent xc = mock(XContent.class);
OutputStream os = mock(OutputStream.class);
XContentGenerator generator = mock(XContentGenerator.class);
when(xc.createGenerator(any(), any(), any())).thenReturn(generator);
when(xc.createGenerator(any(), any(), any(), anyBoolean())).thenReturn(generator);
XContentBuilder builder = new XContentBuilder(xc, os);
XContentBuilder actual = searchResponse.toXContent(builder, ToXContent.EMPTY_PARAMS);
assertNotNull(actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.opensearch.searchpipelines.questionanswering.generative;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand Down Expand Up @@ -69,7 +70,7 @@ public void testToXContent() throws IOException {
XContent xc = mock(XContent.class);
OutputStream os = mock(OutputStream.class);
XContentGenerator generator = mock(XContentGenerator.class);
when(xc.createGenerator(any(), any(), any())).thenReturn(generator);
when(xc.createGenerator(any(), any(), any(), anyBoolean())).thenReturn(generator);
XContentBuilder builder = new XContentBuilder(xc, os);
XContentBuilder actual = searchResponse.toXContent(builder, ToXContent.EMPTY_PARAMS);
assertNotNull(actual);
Expand Down Expand Up @@ -102,7 +103,7 @@ public void testToXContentWithError() throws IOException {
XContent xc = mock(XContent.class);
OutputStream os = mock(OutputStream.class);
XContentGenerator generator = mock(XContentGenerator.class);
when(xc.createGenerator(any(), any(), any())).thenReturn(generator);
when(xc.createGenerator(any(), any(), any(), anyBoolean())).thenReturn(generator);
XContentBuilder builder = new XContentBuilder(xc, os);
XContentBuilder actual = searchResponse.toXContent(builder, ToXContent.EMPTY_PARAMS);
assertNotNull(actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.opensearch.searchpipelines.questionanswering.generative.ext;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.*;

import java.io.IOException;
Expand Down Expand Up @@ -279,7 +280,7 @@ public void testToXConent() throws IOException {
XContent xc = mock(XContent.class);
OutputStream os = mock(OutputStream.class);
XContentGenerator generator = mock(XContentGenerator.class);
when(xc.createGenerator(any(), any(), any())).thenReturn(generator);
when(xc.createGenerator(any(), any(), any(), anyBoolean())).thenReturn(generator);
XContentBuilder builder = new XContentBuilder(xc, os);
assertNotNull(parameters.toXContent(builder, null));
}
Expand All @@ -289,7 +290,7 @@ public void testToXContentEmptyParams() throws IOException {
XContent xc = mock(XContent.class);
OutputStream os = mock(OutputStream.class);
XContentGenerator generator = mock(XContentGenerator.class);
when(xc.createGenerator(any(), any(), any())).thenReturn(generator);
when(xc.createGenerator(any(), any(), any(), anyBoolean())).thenReturn(generator);
XContentBuilder builder = new XContentBuilder(xc, os);
parameters.toXContent(builder, null);
assertNotNull(parameters.toXContent(builder, null));
Expand Down Expand Up @@ -319,7 +320,7 @@ public void testToXContentAllOptionalParameters() throws IOException {
XContent xc = mock(XContent.class);
OutputStream os = mock(OutputStream.class);
XContentGenerator generator = mock(XContentGenerator.class);
when(xc.createGenerator(any(), any(), any())).thenReturn(generator);
when(xc.createGenerator(any(), any(), any(), anyBoolean())).thenReturn(generator);
XContentBuilder builder = new XContentBuilder(xc, os);
assertNotNull(parameters.toXContent(builder, null));
}
Expand Down
Loading