DataConfigSourceResource extends AbstractDataResource { @GET @Path("configs") public Response search( @QueryParam("type") final String typeStr, @QueryParam("versionCorrection") final String versionCorrectionStr, @QueryParam("name") final String name) { final Class<?> type = ReflectionUtils.loadClass(typeStr); final VersionCorrection versionCorrection = (versionCorrectionStr != null) ? VersionCorrection.parse(versionCorrectionStr) : VersionCorrection.LATEST; if (name == null) { return responseOkObject(configItemCollectionResult(getConfigSource().getAll(type, versionCorrection))); } else { return responseOkObject(configItemCollectionResult(getConfigSource().get(type, name, versionCorrection))); } } DataConfigSourceResource(final ConfigSource configSource); ConfigSource getConfigSource(); @GET Response getHateaos(@Context final UriInfo uriInfo); @GET @Path("configs") Response search(
    @QueryParam("type") final String typeStr,
    @QueryParam("versionCorrection") final String versionCorrectionStr,
    @QueryParam("name") final String name); static URI uriGet(final URI baseUri, final String name, final VersionCorrection versionCorrection, final Class<?> type); @GET @Path("configs/{uid}") Response get(
    @PathParam("uid") final String uidStr); static URI uriGet(final URI baseUri, final UniqueId uniqueId); @GET @Path("configs/{oid}/{versionCorrection}") Response getByOidVersionCorrection(
    @PathParam("oid") final String idStr,
    @PathParam("versionCorrection") final String versionCorrectionStr); static URI uriGet(final URI baseUri, final ObjectId objectId, VersionCorrection versionCorrection); @GET @Path("configSearches/single") Response searchSingle(
    @QueryParam("type") final String typeStr,
    @QueryParam("versionCorrection") final String versionCorrectionStr,
    @QueryParam("name") final String name); static URI uriSearchSingle(final URI baseUri, final String name, final VersionCorrection versionCorrection, final Class<?> type); @GET @Path("configSearches") Response search(
    @QueryParam("type") final String typeStr,
    @QueryParam("versionCorrection") final String versionCorrectionStr); static URI uriSearch(final URI baseUri, final Class<?> type, final VersionCorrection versionCorrection); @PUT @Path("put") Response put(
    @QueryParam("type") final String typeStr,
    @QueryParam("versionCorrection") final String versionCorrectionStr); static URI uriPut(final URI baseUri);  }
@Test public void testSearch() { final ConfigItem<SimpleExchange> target = ConfigItem.of(new SimpleExchange()); target.setName("Test"); when(_underlying.get(eq(SimpleExchange.class), eq(NAME), eq(VC))).thenReturn(Collections.singleton(target)); final Response test = _resource.search(SimpleExchange.class.getName(), VC.toString(), NAME); assertEquals(Status.OK.getStatusCode(), test.getStatus()); final FudgeMsg msg = (FudgeMsg) test.getEntity(); assertEquals(1, msg.getNumFields()); assertEquals(target, OpenGammaFudgeContext.getInstance().fromFudgeMsg(ConfigItem.class, (FudgeMsg) msg.getAllFields().get(0).getValue())); }