Skip to content

Commit

Permalink
fix a bug in MLCreateConnectorInput class
Browse files Browse the repository at this point in the history
Signed-off-by: Sicheng Song <[email protected]>
  • Loading branch information
b4sjoo committed Jul 12, 2023
1 parent baf4031 commit 2cf62e0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jacocoTestCoverageVerification {
rule {
limit {
counter = 'LINE'
minimum = 0.6 //TODO: add more test to meet the coverage bar 0.9
minimum = 0.8 //TODO: add more test to meet the coverage bar 0.9
}
limit {
counter = 'BRANCH'
minimum = 0.5 //TODO: add more test to meet the coverage bar 0.9
minimum = 0.7 //TODO: add more test to meet the coverage bar 0.9
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void writeTo(StreamOutput output) throws IOException {
}
if (!CollectionUtils.isEmpty(backendRoles)) {
output.writeBoolean(true);
output.writeOptionalStringCollection(backendRoles);
output.writeStringCollection(backendRoles);
} else {
output.writeBoolean(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -42,7 +43,6 @@ public void setUp(){
String postProcessFunction = MLPostProcessFunction.OPENAI_EMBEDDING;
ConnectorAction action = new ConnectorAction(actionType, method, url, headers, mlCreateConnectorRequestBody, preProcessFunction, postProcessFunction);

// java.lang.IllegalStateException: unexpected byte [0x6f] will be thrown if we specify backendRoles field.
mlCreateConnectorInput = MLCreateConnectorInput.builder()
.name("test_connector_name")
.description("this is a test connector")
Expand All @@ -52,7 +52,8 @@ public void setUp(){
.credential(Map.of("key", "test_key_value"))
.actions(List.of(action))
.access(AccessMode.PUBLIC)
.addAllBackendRoles(true)
.backendRoles(Arrays.asList("role1", "role2"))
.addAllBackendRoles(false)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -52,7 +53,8 @@ public void setUp(){
.credential(Map.of("key", "test_key_value"))
.actions(List.of(action))
.access(AccessMode.PUBLIC)
.addAllBackendRoles(true)
.backendRoles(Arrays.asList("role1", "role2"))
.addAllBackendRoles(false)
.build();
}

Expand Down

0 comments on commit 2cf62e0

Please sign in to comment.