DependencyGraphTraceProviderResource extends AbstractDataResource { public static URI uriMarketData(URI baseUri, List<MarketDataSpecification> marketData) { for (MarketDataSpecification mdSpec : marketData) { if (mdSpec instanceof UserMarketDataSpecification) { String snapshotId = ((UserMarketDataSpecification) mdSpec).getUserSnapshotId().toString(); UriBuilder bld = UriBuilder.fromUri(baseUri).path("marketDataSnapshot/{snapshotId}"); baseUri = bld.build(snapshotId); } else if (mdSpec instanceof LiveMarketDataSpecification) { String dataSource = ((LiveMarketDataSpecification) mdSpec).getDataSource(); if (dataSource == null) { UriBuilder bld = UriBuilder.fromUri(baseUri).path("marketDataLiveDefault"); baseUri = bld.build(); } else { UriBuilder bld = UriBuilder.fromUri(baseUri).path("marketDataLive/{dataSource}"); baseUri = bld.build(dataSource); } } else if (mdSpec instanceof FixedHistoricalMarketDataSpecification) { String snapshotDate = ((FixedHistoricalMarketDataSpecification) mdSpec).getSnapshotDate().toString(); String timeSeriesResolverKey = ((FixedHistoricalMarketDataSpecification) mdSpec).getTimeSeriesResolverKey(); UriBuilder bld = UriBuilder.fromUri(baseUri).path("marketDataHistorical/{localDate}/{timeSeriesResolverKey}"); baseUri = bld.build(snapshotDate, timeSeriesResolverKey); } } return baseUri; } DependencyGraphTraceProviderResource(final DependencyGraphTraceProvider provider, final FudgeContext fudgeContext); private  DependencyGraphTraceProviderResource(DependencyGraphTraceProvider provider, FudgeContext fudgeContext, DependencyGraphTraceBuilderProperties properties); @GET Response getHateaos(@Context UriInfo uriInfo); @Path("valuationTime/{valuationTime}") DependencyGraphTraceProviderResource setValuationTime(@PathParam("valuationTime") final String valuationTime); @Path("resolutionTime/{resolutionTime}") DependencyGraphTraceProviderResource setResolutionTime(@PathParam("resolutionTime") final String resolutionTime); @Path("calculationConfigurationName/{calculationConfigurationName}") DependencyGraphTraceProviderResource setCalculationConfigurationName(@PathParam("calculationConfigurationName") final String calculationConfigurationName); @Path("defaultProperties/{defaultProperties}") DependencyGraphTraceProviderResource setDefaultProperties(@PathParam("defaultProperties") final String defaultProperties); @Path("value/{valueName}/{targetType}/{targetId}") DependencyGraphTraceProviderResource setValueRequirementByUniqueId(@PathParam("valueName") final String valueName, @PathParam("targetType") final String targetType,
      @PathParam("targetId") final String targetId); @Path("requirement/{valueName}/{targetType}/{targetId}") DependencyGraphTraceProviderResource setValueRequirementByExternalId(@PathParam("valueName") final String valueName, @PathParam("targetType") final String targetType,
      @PathParam("targetId") final String targetId); @Path("marketDataSnapshot/{snapshotId}") DependencyGraphTraceProviderResource setMarketDataSnapshot(@PathParam("snapshotId") final String snapshotId); @Path("marketDataLiveDefault") DependencyGraphTraceProviderResource setMarketDataLiveDefault(); @Path("marketDataLive/{dataSource}") DependencyGraphTraceProviderResource setMarketDataLive(@PathParam("dataSource") final String dataSource); @Path("marketDataHistorical/{localDate}/{timeSeriesResolverKey}") DependencyGraphTraceProviderResource setMarketDataHistorical(@PathParam("localDate") final String localDateStr, @PathParam("timeSeriesResolverKey") final String timeSeriesResolverKey); @GET @Path("build") FudgeMsgEnvelope build(); static URI uriCalculationConfigurationName(URI baseUri, String calculationConfigurationName); static URI uriValuationTime(URI baseUri, Instant valuationInstant); static URI uriResolutionTime(URI baseUri, VersionCorrection resolutionTime); static URI uriDefaultProperties(URI baseUri, ValueProperties defaultProperties); static URI uriMarketData(URI baseUri, List<MarketDataSpecification> marketData); static URI uriValueRequirementByUniqueId(URI baseUri, String valueName, String targetType, UniqueId uniqueId); static URI uriValueRequirementByExternalId(URI baseUri, String valueName, String targetType, ExternalId externalId); static URI uriBuild(URI baseUri);  }
@Test public void uriMarketDataSnapshot() throws UnsupportedEncodingException { String snapshotId = "Foo~1"; MarketDataSpecification marketData = MarketData.user(UniqueId.parse(snapshotId)); URI uri = DependencyGraphTraceProviderResource.uriMarketData(_baseUri, Lists.newArrayList(marketData)); String url = decode(uri); assertEquals(s_testUrl + "marketDataSnapshot/" + snapshotId, url); }
@Test public void uriMarketDataLiveDefault() throws UnsupportedEncodingException { MarketDataSpecification marketData = MarketData.live(); URI uri = DependencyGraphTraceProviderResource.uriMarketData(_baseUri, Lists.newArrayList(marketData)); String url = decode(uri); assertEquals(s_testUrl + "marketDataLiveDefault", url); }
@Test public void uriMarketDataLive() throws UnsupportedEncodingException { MarketDataSpecification marketData = MarketData.live("BB"); URI uri = DependencyGraphTraceProviderResource.uriMarketData(_baseUri, Lists.newArrayList(marketData)); String url = decode(uri); assertEquals(s_testUrl + "marketDataLive/BB", url); }
@Test public void uriMarketDataHistorical() throws UnsupportedEncodingException { LocalDate now = LocalDate.now(); MarketDataSpecification marketData = MarketData.historical(now, "ts"); URI uri = DependencyGraphTraceProviderResource.uriMarketData(_baseUri, Lists.newArrayList(marketData)); String url = decode(uri); assertEquals(s_testUrl + "marketDataHistorical/" + now + "/ts", url); }