DataHolidaySourceResource extends AbstractDataResource { @GET @Path("holidays/{holidayId}") public Response get( @PathParam("holidayId") String idStr, @QueryParam("version") String version, @QueryParam("versionAsOf") String versionAsOf, @QueryParam("correctedTo") String correctedTo) { final ObjectId objectId = ObjectId.parse(idStr); if (version != null) { final Holiday result = getHolidaySource().get(objectId.atVersion(version)); return responseOkObject(result); } else { final VersionCorrection vc = VersionCorrection.parse(versionAsOf, correctedTo); Holiday result = getHolidaySource().get(objectId, vc); return responseOkObject(result); } } DataHolidaySourceResource(final HolidaySource holidaySource); HolidaySource getHolidaySource(); @GET Response getHateaos(@Context UriInfo uriInfo); @GET @Path("holidays/{holidayId}") Response get(
      @PathParam("holidayId") String idStr,
      @QueryParam("version") String version,
      @QueryParam("versionAsOf") String versionAsOf,
      @QueryParam("correctedTo") String correctedTo); static URI uriGet(URI baseUri, UniqueId uniqueId); static URI uriGet(URI baseUri, ObjectId objectId, VersionCorrection vc); static URI uriGet(URI baseUri, Currency currency); static URI uriGet(URI baseUri, HolidayType holidayType, ExternalIdBundle regionOrExchangeIds); @GET @Path("holidaySearches/retrieve") Response get(
      @QueryParam("holidayType") HolidayType holidayType,
      @QueryParam("currency") String currencyCode,
      @QueryParam("id") List<String> externalIdStrs); @GET @Path("holidaySearches/check") Response check(
      @QueryParam("date") String localDateStr,
      @QueryParam("holidayType") HolidayType holidayType,
      @QueryParam("currency") String currencyCode,
      @QueryParam("id") List<String> externalIdStrs); static URI uriSearchCheck(URI baseUri, LocalDate date, HolidayType holidayType, Currency currency, ExternalIdBundle regionOrExchangeIds);  }
@Test public void testGetHolidayByUid() { final SimpleHoliday target = new SimpleHoliday(); target.setType(HolidayType.BANK); target.setRegionExternalId(EID); when(_underlying.get(eq(UID))).thenReturn(target); Response test = _resource.get(OID.toString(), UID.getVersion(), "", ""); assertEquals(Status.OK.getStatusCode(), test.getStatus()); assertSame(target, test.getEntity()); }
@Test public void testGetHolidayByOid() { final SimpleHoliday target = new SimpleHoliday(); target.setType(HolidayType.BANK); target.setRegionExternalId(EID); when(_underlying.get(eq(OID), eq(VC))).thenReturn(target); Response test = _resource.get(OID.toString(), null, VC.getVersionAsOfString(), VC.getCorrectedToString()); assertEquals(Status.OK.getStatusCode(), test.getStatus()); assertSame(target, test.getEntity()); }