Package com.opengamma.livedata

Examples of com.opengamma.livedata.LiveDataSpecification


    };
  }

  //-------------------------------------------------------------------------
  public void defaultSubscription() {
    LiveDataSpecification spec = new LiveDataSpecification("No Normalization", ExternalId.of(_domainD, "X"));
    LiveDataSubscriptionResponse subscribe = _combiningServer.subscribe(spec, false);
    assertEquals(LiveDataSubscriptionResult.NOT_PRESENT, subscribe.getSubscriptionResult());
  }
View Full Code Here


    assertEquals(LiveDataSubscriptionResult.NOT_PRESENT, subscribe.getSubscriptionResult());
  }

  @Test(expectedExceptions =  Throwable.class)
  public void failingSubscriptionsDontStopWorking() {
    LiveDataSpecification specWorking = new LiveDataSpecification("No Normalization", ExternalId.of(_domainC, "X"));
    LiveDataSpecification specFailed = new LiveDataSpecification("No Normalization", ExternalId.of(_domainD, "X"));
    LiveDataSubscriptionResponseMsg subscriptionRequestMade = _combiningServer.subscriptionRequestMade(new LiveDataSubscriptionRequest(UserPrincipal.getLocalUser(), SubscriptionType.NON_PERSISTENT,  Lists.newArrayList(specWorking, specFailed)));
   
    assertEquals(2, subscriptionRequestMade.getResponses().size());
    for (LiveDataSubscriptionResponse response : subscriptionRequestMade.getResponses()) {
      if (response.getRequestedSpecification().equals(specWorking)) {
View Full Code Here

    assertEquals(0, _serverB.getSubscriptions().size());
    assertEquals(1, _serverC.getSubscriptions().size());
  }

  public void matchingSubscription() {
    LiveDataSpecification spec = new LiveDataSpecification("No Normalization", ExternalId.of(_domainC, "X"));
    LiveDataSubscriptionResponse result = _combiningServer.subscribe(spec, false);
    assertEquals(LiveDataSubscriptionResult.SUCCESS, result.getSubscriptionResult());
   
    assertEquals(0, _serverB.getSubscriptions().size());
    assertEquals(1, _serverC.getSubscriptions().size());
View Full Code Here

    assertEquals(0, _serverB.getSubscriptions().size());
    assertEquals(1, _serverC.getSubscriptions().size());
  }

  public void prioritySubscription() {
    LiveDataSpecification spec = new LiveDataSpecification("No Normalization", ExternalId.of(_domainB, "X"), ExternalId.of(_domainC, "X"));
    LiveDataSubscriptionResponse result = _combiningServer.subscribe(spec, false);
    assertEquals(LiveDataSubscriptionResult.SUCCESS, result.getSubscriptionResult());
   
    assertEquals(1, _serverB.getSubscriptions().size());
    assertEquals(0, _serverC.getSubscriptions().size());
View Full Code Here

    assertEquals(1, _serverB.getSubscriptions().size());
    assertEquals(0, _serverC.getSubscriptions().size());
  }

  public void matchingResolution() {
    LiveDataSpecification spec = new LiveDataSpecification("No Normalization", ExternalId.of(_domainC, "X"));
    DistributionSpecification combined = _combiningServer.getDefaultDistributionSpecificationResolver().resolve(spec);
    DistributionSpecification direct = _serverC.getDistributionSpecificationResolver().resolve(spec);
    assertEquals(direct, combined);
  }
View Full Code Here

  public void snapshot() {
    MutableFudgeMsg msg = FudgeContext.GLOBAL_DEFAULT.newMessage();
    msg.add("FIELD", "VALUE");
    _serverC.addMarketDataMapping("X", msg);
    LiveDataSpecification spec = new LiveDataSpecification("No Normalization", ExternalId.of(_domainC, "X"));
    LiveDataSubscriptionRequest request = new LiveDataSubscriptionRequest(authorizedUser, SubscriptionType.SNAPSHOT, Collections.singleton(spec));
    LiveDataSubscriptionResponseMsg responseMsg = _combiningServer.subscriptionRequestMade(request);
    assertEquals(responseMsg.getRequestingUser(), authorizedUser);
    assertEquals(1, responseMsg.getResponses().size());
    for (LiveDataSubscriptionResponse response : responseMsg.getResponses()) {
View Full Code Here

    assertEquals(0, _serverB.getSubscriptions().size());
    assertEquals(0, _serverC.getSubscriptions().size());
  }

  public void entitled() {
    LiveDataSpecification spec = new LiveDataSpecification("No Normalization", ExternalId.of(_domainC, "X"));
    LiveDataSubscriptionRequest request = new LiveDataSubscriptionRequest(authorizedUser, SubscriptionType.NON_PERSISTENT, Collections.singleton(spec));
    LiveDataSubscriptionResponseMsg responseMsg = _combiningServer.subscriptionRequestMade(request);
    assertEquals(responseMsg.getRequestingUser(), authorizedUser);
    assertEquals(1, responseMsg.getResponses().size());
    for (LiveDataSubscriptionResponse response : responseMsg.getResponses()) {
View Full Code Here

    assertEquals(0, _serverB.getSubscriptions().size());
    assertEquals(1, _serverC.getSubscriptions().size());
  }

  public void notEntitled() {
    LiveDataSpecification spec = new LiveDataSpecification("No Normalization", ExternalId.of(_domainC, "X"));
    LiveDataSubscriptionRequest request = new LiveDataSubscriptionRequest(unauthorizedUser, SubscriptionType.NON_PERSISTENT, Collections.singleton(spec));
    LiveDataSubscriptionResponseMsg responseMsg = _combiningServer.subscriptionRequestMade(request);
    assertEquals(responseMsg.getRequestingUser(), unauthorizedUser);
    assertEquals(1, responseMsg.getResponses().size());
    for (LiveDataSubscriptionResponse response : responseMsg.getResponses()) {
View Full Code Here

  public boolean isValidLiveData(ExternalId subscriptionId, String normalizationScheme) {
    return getLastKnownValueStoreProvider().isAvailable(subscriptionId, normalizationScheme);
  }
 
  public LastKnownValueStore getLastKnownValueStore(ExternalId subscriptionId, String normalizationScheme) {
    LiveDataSpecification ldspec = new LiveDataSpecification(normalizationScheme, subscriptionId);
    // TODO kirk 2012-07-23 -- Check to see if valid.
   
    LastKnownValueStore store = _lastKnownValueStores.get(ldspec);
    if (store == null) {
      LastKnownValueStore fresh = getLastKnownValueStoreProvider().newInstance(subscriptionId, normalizationScheme);
View Full Code Here

  @Test(invocationCount = 5, successPercentage = 19)
  public void basicOperation() throws InterruptedException, IOException {
    LiveDataHeartbeat heartbeatService = Mockito.mock(LiveDataHeartbeat.class);
    ValueDistributor valueDistributor = new ValueDistributor();
    CollectingLiveDataListener listener1 = new CollectingLiveDataListener();
    LiveDataSpecification spec1 = new LiveDataSpecification(
        "Test",
        ExternalId.of("foo", "bar"));
    LiveDataSpecification spec2 = new LiveDataSpecification(
        "Test",
        ExternalId.of("foo", "baz"));
    valueDistributor.addListener(spec1, listener1);
    valueDistributor.addListener(spec2, listener1);
View Full Code Here

TOP

Related Classes of com.opengamma.livedata.LiveDataSpecification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.