DataHistoricalTimeSeriesMasterResource extends AbstractDataResource { @POST @Path("infos") public Response add(@Context UriInfo uriInfo, HistoricalTimeSeriesInfoDocument request) { HistoricalTimeSeriesInfoDocument result = getHistoricalTimeSeriesMaster().add(request); URI createdUri = (new DataHistoricalTimeSeriesResource()).uriVersion(uriInfo.getBaseUri(), result.getUniqueId()); return responseCreatedObject(createdUri, result); } DataHistoricalTimeSeriesMasterResource(final HistoricalTimeSeriesMaster infoMaster); HistoricalTimeSeriesMaster getHistoricalTimeSeriesMaster(); @GET Response getHateaos(@Context UriInfo uriInfo); @HEAD @Path("infos") Response status(); @GET @Path("metaData") Response metaData(@Context UriInfo uriInfo); @POST @Path("infoSearches") Response search(HistoricalTimeSeriesInfoSearchRequest request); @POST @Path("infos") Response add(@Context UriInfo uriInfo, HistoricalTimeSeriesInfoDocument request); @Path("infos/{infoId}") DataHistoricalTimeSeriesResource findHistoricalTimeSeries(@PathParam("infoId") String idStr); @Path("dataPoints/{dpId}") DataHistoricalDataPointsResource findHistoricalDataPoints(@PathParam("dpId") String idStr); static URI uriMetaData(URI baseUri, HistoricalTimeSeriesInfoMetaDataRequest request); static URI uriSearch(URI baseUri); static URI uriAdd(URI baseUri);  }
@Test public void testAddHistoricalTimeSeries() { final ManageableHistoricalTimeSeriesInfo target = new ManageableHistoricalTimeSeriesInfo(); target.setDataField("DF"); target.setDataProvider("DP"); target.setDataSource("DS"); final HistoricalTimeSeriesInfoDocument request = new HistoricalTimeSeriesInfoDocument(target); final HistoricalTimeSeriesInfoDocument result = new HistoricalTimeSeriesInfoDocument(target); result.setUniqueId(UID); when(_underlying.add(same(request))).thenReturn(result); Response test = _resource.add(_uriInfo, request); assertEquals(Status.CREATED.getStatusCode(), test.getStatus()); assertSame(result, test.getEntity()); }