@@ -55,19 +55,18 @@ public class MLCreateConnectorInputTests {
5555 private static final String TEST_CREDENTIAL_VALUE = "test_key_value" ;
5656 private static final String TEST_ROLE1 = "role1" ;
5757 private static final String TEST_ROLE2 = "role2" ;
58- private final String expectedInputStr = """
59- {"name":"test_connector_name","description":"this is a test connector","version":"1","protocol":"http",\
60- "parameters":{"input":"test input value"},"credential":{"key":"test_key_value"},\
61- "actions":[{"action_type":"PREDICT","method":"POST","url":"https://test.com",\
62- "headers":{"api_key":"${credential.key}"},\
63- "request_body":"{\\ "input\\ ": \\ "${parameters.input}\\ "}",\
64- "pre_process_function":"connector.pre_process.openai.embedding",\
65- "post_process_function":"connector.post_process.openai.embedding"}],\
66- "backend_roles":["role1","role2"],"add_all_backend_roles":false,\
67- "access_mode":"PUBLIC","client_config":{"max_connection":20,\
68- "connection_timeout":10000,"read_timeout":10000,\
69- "retry_backoff_millis":10,"retry_timeout_seconds":10,"max_retry_times":-1,"retry_backoff_policy":"constant"}}\
70- """ ;
58+ private final String expectedInputStr = "{\" name\" :\" test_connector_name\" ,"
59+ + "\" description\" :\" this is a test connector\" ,\" version\" :\" 1\" ,\" protocol\" :\" http\" ,"
60+ + "\" parameters\" :{\" input\" :\" test input value\" },\" credential\" :{\" key\" :\" test_key_value\" },"
61+ + "\" actions\" :[{\" action_type\" :\" PREDICT\" ,\" method\" :\" POST\" ,\" url\" :\" https://test.com\" ,"
62+ + "\" headers\" :{\" api_key\" :\" ${credential.key}\" },"
63+ + "\" request_body\" :\" {\\ \" input\\ \" : \\ \" ${parameters.input}\\ \" }\" ,"
64+ + "\" pre_process_function\" :\" connector.pre_process.openai.embedding\" ,"
65+ + "\" post_process_function\" :\" connector.post_process.openai.embedding\" }],"
66+ + "\" backend_roles\" :[\" role1\" ,\" role2\" ],\" add_all_backend_roles\" :false,"
67+ + "\" access_mode\" :\" PUBLIC\" ,\" client_config\" :{\" max_connection\" :20,"
68+ + "\" connection_timeout\" :10000,\" read_timeout\" :10000,"
69+ + "\" retry_backoff_millis\" :10,\" retry_timeout_seconds\" :10,\" max_retry_times\" :-1,\" retry_backoff_policy\" :\" constant\" }}" ;
7170
7271 @ Before
7372 public void setUp () {
@@ -238,15 +237,16 @@ public void testParse() throws Exception {
238237
239238 @ Test
240239 public void testParse_ArrayParameter () throws Exception {
241- String expectedInputStr = """
242- {"name":"test_connector_name","description":"this is a test connector","version":"1",\
243- "protocol":"http","parameters":{"input":["test input value"]},"credential":{"key":"test_key_value"},\
244- "actions":[{"action_type":"PREDICT","method":"POST","url":"https://test.com",\
245- "headers":{"api_key":"${credential.key}"},"request_body":"{\\ "input\\ ": \\ "${parameters.input}\\ "}",\
246- "pre_process_function":"connector.pre_process.openai.embedding",\
247- "post_process_function":"connector.post_process.openai.embedding"}],\
248- "backend_roles":["role1","role2"],"add_all_backend_roles":false,"access_mode":"PUBLIC"};\
249- """ ;
240+ String expectedInputStr = "{\" name\" :\" test_connector_name\" ,"
241+ + "\" description\" :\" this is a test connector\" ,\" version\" :\" 1\" ,\" protocol\" :\" http\" ,"
242+ + "\" parameters\" :{\" input\" :[\" test input value\" ]},\" credential\" :{\" key\" :\" test_key_value\" },"
243+ + "\" actions\" :[{\" action_type\" :\" PREDICT\" ,\" method\" :\" POST\" ,\" url\" :\" https://test.com\" ,"
244+ + "\" headers\" :{\" api_key\" :\" ${credential.key}\" },"
245+ + "\" request_body\" :\" {\\ \" input\\ \" : \\ \" ${parameters.input}\\ \" }\" ,"
246+ + "\" pre_process_function\" :\" connector.pre_process.openai.embedding\" ,"
247+ + "\" post_process_function\" :\" connector.post_process.openai.embedding\" }],"
248+ + "\" backend_roles\" :[\" role1\" ,\" role2\" ],\" add_all_backend_roles\" :false,"
249+ + "\" access_mode\" :\" PUBLIC\" }" ;
250250 testParseFromJsonString (expectedInputStr , parsedInput -> {
251251 assertEquals (TEST_CONNECTOR_NAME , parsedInput .getName ());
252252 assertEquals (1 , parsedInput .getParameters ().size ());
0 commit comments