use of com.yahoo.vespa.orchestrator.restapi.wire.SlobrokEntryResponse in project vespa by vespa-engine.
the class InstanceResourceTest method testGetSlobrokEntriesWith.
private void testGetSlobrokEntriesWith(String pattern, String expectedLookupPattern) throws Exception {
when(slobrokApi.lookup(APPLICATION_ID, expectedLookupPattern)).thenReturn(ENTRIES);
List<SlobrokEntryResponse> response = resource.getSlobrokEntries(APPLICATION_INSTANCE_REFERENCE, pattern);
verify(slobrokApi).lookup(APPLICATION_ID, expectedLookupPattern);
ObjectMapper mapper = new ObjectMapper();
String actualJson = mapper.writeValueAsString(response);
assertEquals("[{\"name\":\"name1\",\"spec\":\"spec1\"},{\"name\":\"name2\",\"spec\":\"spec2\"}]", actualJson);
}
use of com.yahoo.vespa.orchestrator.restapi.wire.SlobrokEntryResponse in project vespa by vespa-engine.
the class InstanceResource method getSlobrokEntries.
@GET
@Path("/{instanceId}/slobrok")
@Produces(MediaType.APPLICATION_JSON)
public List<SlobrokEntryResponse> getSlobrokEntries(@PathParam("instanceId") String instanceId, @QueryParam("pattern") String pattern) {
ApplicationInstanceReference reference = parseInstanceId(instanceId);
ApplicationId applicationId = OrchestratorUtil.toApplicationId(reference);
if (pattern == null) {
pattern = DEFAULT_SLOBROK_PATTERN;
}
List<Mirror.Entry> entries = slobrokApi.lookup(applicationId, pattern);
return entries.stream().map(entry -> new SlobrokEntryResponse(entry.getName(), entry.getSpec())).collect(Collectors.toList());
}
Aggregations