Skip to content

Commit

Permalink
Changing status response format.
Browse files Browse the repository at this point in the history
  • Loading branch information
jzonthemtn committed Jul 1, 2024
1 parent 20a005e commit 353bca0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 71 deletions.
6 changes: 3 additions & 3 deletions src/main/java/ai/philterd/philter/PhilterClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,12 @@ public List<FilteredSpan> replacements(String documentId) throws IOException {

/**
* Gets the status of Philter.
* @return A {@link StatusResponse} object.
* @return A string containing the status of Philter.
* @throws IOException Thrown if the request can not be completed.
*/
public StatusResponse status() throws IOException {
public String status() throws IOException {

final Response<StatusResponse> response = service.status().execute();
final Response<String> response = service.status().execute();

if(response.isSuccessful()) {

Expand Down
62 changes: 0 additions & 62 deletions src/main/java/ai/philterd/philter/model/StatusResponse.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import ai.philterd.philter.model.Alert;
import ai.philterd.philter.model.FilteredSpan;
import ai.philterd.philter.model.ExplainResponse;
import ai.philterd.philter.model.StatusResponse;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
Expand Down Expand Up @@ -49,7 +48,7 @@ public interface PhilterService {
// Status

@GET("/api/status")
Call<StatusResponse> status();
Call<String> status();

// Filter Profiles

Expand Down
6 changes: 2 additions & 4 deletions src/test/java/com/mtnfog/test/philter/PhilterClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@

import ai.philterd.philter.PhilterClient;
import ai.philterd.philter.model.BinaryFilterResponse;
import ai.philterd.philter.model.StatusResponse;
import okhttp3.ConnectionPool;
import okhttp3.OkHttpClient;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Assert;
Expand Down Expand Up @@ -158,9 +156,9 @@ public void status() throws Exception {
.withOkHttpClientBuilder(getUnsafeOkHttpClientBuilder())
.build();

final StatusResponse statusResponse = client.status();
final String status = client.status();

Assert.assertTrue(StringUtils.equals("Healthy", statusResponse.getStatus()));
Assert.assertTrue(status.startsWith("Healhty:"));

}

Expand Down

0 comments on commit 353bca0

Please sign in to comment.