StateResource implements StateClient { @SuppressWarnings("rawtypes") @Override @GET @Path("v1/tenant/{tenantName}/application/{applicationName}/environment/{environmentName}/region/{regionName}/instance/{instanceName}/service/{serviceIdentifier}/{apiParams: .*}") @Produces(MediaType.APPLICATION_JSON) public HashMap singleService(@PathParam("tenantName") String tenantName, @PathParam("applicationName") String applicationName, @PathParam("environmentName") String environmentName, @PathParam("regionName") String regionName, @PathParam("instanceName") String instanceName, @PathParam("serviceIdentifier") String identifier, @PathParam("apiParams") String apiParams) { ServiceModel model = new ServiceModel(getModelConfig(tenantName, applicationName, environmentName, regionName, instanceName)); Service s = model.getService(identifier); int requestedPort = s.matchIdentifierWithPort(identifier); Client client = client(); try { HealthClient resource = getHealthClient(apiParams, s, requestedPort, client); HashMap<?, ?> apiResult = resource.getHealthInfo(); rewriteResourceLinks(apiResult, model, s, applicationIdentifier(tenantName, applicationName, environmentName, regionName, instanceName), identifier); return apiResult; } finally { client.close(); } } StateResource(@Component ConfigServerLocation configServer, @Context UriInfo ui); @Override @GET @Path("v1/") @Produces(MediaType.APPLICATION_JSON) ApplicationView getDefaultUserInfo(); @Override @GET @Path("v1/tenant/{tenantName}/application/{applicationName}/environment/{environmentName}/region/{regionName}/instance/{instanceName}") @Produces(MediaType.APPLICATION_JSON) ApplicationView getUserInfo(@PathParam("tenantName") String tenantName,
                                @PathParam("applicationName") String applicationName,
                                @PathParam("environmentName") String environmentName,
                                @PathParam("regionName") String regionName,
                                @PathParam("instanceName") String instanceName); @SuppressWarnings("rawtypes") @Override @GET @Path("v1/tenant/{tenantName}/application/{applicationName}/environment/{environmentName}/region/{regionName}/instance/{instanceName}/service/{serviceIdentifier}/{apiParams: .*}") @Produces(MediaType.APPLICATION_JSON) HashMap singleService(@PathParam("tenantName") String tenantName,
            @PathParam("applicationName") String applicationName,
            @PathParam("environmentName") String environmentName,
            @PathParam("regionName") String regionName,
            @PathParam("instanceName") String instanceName,
            @PathParam("serviceIdentifier") String identifier,
            @PathParam("apiParams") String apiParams);  }
@SuppressWarnings("rawtypes") @Test public final void test() { Service s = correspondingModel.resolve("vespa.yahoo.com", 8080, null); String api = "/state/v1"; HashMap boom = testResource.singleService("default", "default", "default", "default", "default", s.getIdentifier(8080), api); assertEquals(EXTERNAL_BASE_URI + "v1/tenant/default/application/default/environment/default/region/default/instance/default/service/" + s.getIdentifier(8080) + api, ((Map) ((List) boom.get("resources")).get(0)).get("url")); }