Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed May 8, 2024
1 parent d160a9b commit 8925ce8
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;

import lombok.SneakyThrows;
import org.apache.hc.core5.http.ParseException;
import org.junit.After;
import org.junit.Before;
Expand All @@ -26,6 +25,7 @@

import com.sun.net.httpserver.HttpServer;

import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;

@Log4j2
Expand Down Expand Up @@ -82,22 +82,17 @@ private void waitModelUndeployed(String modelId) {
Map<String, Object> responseInMap = parseResponseToMap(response);
String state = responseInMap.get(MLModel.MODEL_STATE_FIELD).toString();
return !state.equals(MLModelState.DEPLOYED.toString())
&& !state.equals(MLModelState.DEPLOYING.toString())
&& !state.equals(MLModelState.PARTIALLY_DEPLOYED.toString());
&& !state.equals(MLModelState.DEPLOYING.toString())
&& !state.equals(MLModelState.PARTIALLY_DEPLOYED.toString());
} catch (IOException e) {
return false;
return false;
}
};
waitResponseMeetingCondition("GET", "/_plugins/_ml/models/" + modelId, null, condition);
}

@SneakyThrows
protected Response waitResponseMeetingCondition(
String method,
String endpoint,
String jsonEntity,
Predicate<Response> condition
) {
protected Response waitResponseMeetingCondition(String method, String endpoint, String jsonEntity, Predicate<Response> condition) {
for (int i = 0; i < MAX_TASK_RESULT_QUERY_TIME_IN_SECOND; i++) {
Response response = TestHelper.makeRequest(client(), method, endpoint, null, jsonEntity, null);
assertEquals(RestStatus.OK, RestStatus.fromCode(response.getStatusLine().getStatusCode()));
Expand Down

0 comments on commit 8925ce8

Please sign in to comment.