Skip to content

Commit

Permalink
Remove Jsonp tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wendigo committed Nov 28, 2024
1 parent ed01bf8 commit cbad236
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions jmx-http/src/test/java/io/airlift/jmx/TestMBeanResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ public void testGetMBeans()
assertMBeansResponse(jsonRequest(uriFor("/v1/jmx/mbean")));
}

@Test
public void testGetMBeansJsonp()
throws Exception
{
assertMBeansResponse(jsonpRequest(uriFor("/v1/jmx/mbean")));
}

private void assertMBeansResponse(JsonNode mbeans)
{
List<String> names = new ArrayList<>();
Expand Down Expand Up @@ -135,22 +128,6 @@ public void testGetMBean()
}
}

@Test
public void testGetMBeanJsonp()
throws Exception
{
for (String mbeanName : getMBeanNames()) {
URI uri = uriBuilderFrom(uriFor("/v1/jmx/mbean"))
.appendPath(mbeanName)
.build();
JsonNode mbean = jsonpRequest(uri);

JsonNode name = mbean.get("objectName");
assertThat(name.isTextual()).isTrue();
assertThat(name.asText()).isEqualTo(mbeanName);
}
}

private JsonNode jsonRequest(URI uri)
throws IOException
{
Expand All @@ -163,26 +140,6 @@ private JsonNode jsonRequest(URI uri)
return new ObjectMapperProvider().get().readTree(response.getBody());
}

private JsonNode jsonpRequest(URI uri)
throws IOException
{
uri = uriBuilderFrom(uri)
.addParameter("jsonp", "test")
.build();
Request request = prepareGet().setUri(uri).build();
StringResponse response = client.execute(request, createStringResponseHandler());

assertThat(response.getStatusCode()).as(response.getBody()).isEqualTo(200);
assertContentType(response, JSON_UTF_8);

String jsonp = response.getBody().trim();
assertThat(jsonp).startsWith("test(");
assertThat(jsonp).endsWith(")");
jsonp = jsonp.substring(5, jsonp.length() - 1);

return new ObjectMapperProvider().get().readTree(jsonp);
}

private URI uriFor(String path)
{
return server.getBaseUrl().resolve(path);
Expand Down

0 comments on commit cbad236

Please sign in to comment.