Package com.opengamma.livedata.msg

Examples of com.opengamma.livedata.msg.LiveDataSubscriptionResponse


  }

  @Test(groups = {"bbgSubscriptionTests" }, enabled = false)
  public void optionSnapshot() {
    String option = BloombergTestUtils.getSampleEquityOptionTicker();
    LiveDataSubscriptionResponse snapshotResponse = snapshot(option);
   
    assertNotNull(snapshotResponse);
    assertEquals(LiveDataSubscriptionResult.SUCCESS, snapshotResponse.getSubscriptionResult());
    StandardRulesUtils.validateOpenGammaMsg(snapshotResponse.getSnapshot().getFields());
   
    // especially outside market hours, it seems it's not guaranteed that you'll get implied vol
    // assertNotNull(snapshotResponse.getSnapshot().getFields().getDouble(MarketDataFieldNames.IMPLIED_VOLATILITY_FIELD));
  }
View Full Code Here


      _unitTestingProvider.rejectAllfurtherRequests();
    }
   
    assertTrue(listener.waitUntilEnoughUpdatesReceived(30000));
   
    LiveDataSubscriptionResponse workingSub = null;
    LiveDataSubscriptionResponse workingStrongSub = null;
    for (LiveDataSubscriptionResponse response : listener.getSubscriptionResponses()) {
      if (response.getRequestedSpecification().getIdentifiers().contains(working)) {
        assertEquals(response.getSubscriptionResult(), LiveDataSubscriptionResult.SUCCESS);
        workingSub = response;
      } else if (response.getRequestedSpecification().getIdentifiers().contains(broken)) {
        assertEquals(response.getSubscriptionResult(), LiveDataSubscriptionResult.INTERNAL_ERROR);
      } else if (response.getRequestedSpecification().getIdentifiers().contains(workingStrong)) {
        assertEquals(response.getSubscriptionResult(), LiveDataSubscriptionResult.SUCCESS);
        workingStrongSub = response;
      } else {
        throw new Exception("Unexpected subscription response");
      }
    }
    assertEquals(workingSub.getFullyQualifiedSpecification(), workingStrongSub.getFullyQualifiedSpecification());
    assertEquals(workingSub.getTickDistributionSpecification(), workingStrongSub.getTickDistributionSpecification());
    List<LiveDataValueUpdate> allUpdates = listener.getValueUpdates();
    List<LiveDataValueUpdate> workingUpdates = listener.getValueUpdates(getLiveDataSpec(_liveDataClient, working));
    assertEquals(allUpdates, workingUpdates);
    assertFalse(_unitTestingProvider.hadToRejectRequests()); // Necessary, since exceptions are expected from the live data service
  }
View Full Code Here

   
    subscribe(_liveDataClient, listener, instruments);
    assertTrue(listener.waitUntilEnoughUpdatesReceived(30000));
    unsubscribe(_liveDataClient, listener, instruments);
   
    LiveDataSubscriptionResponse strongSub = null;
    LiveDataSubscriptionResponse weakSub = null;
    for (LiveDataSubscriptionResponse response : listener.getSubscriptionResponses()) {
      if (response.getRequestedSpecification().getIdentifiers().contains(strong)) {
        assertEquals(response.getSubscriptionResult(), LiveDataSubscriptionResult.SUCCESS);
        strongSub = response;
      } else if (response.getRequestedSpecification().getIdentifiers().contains(weak)) {
        assertEquals(response.getSubscriptionResult(), LiveDataSubscriptionResult.SUCCESS);
        weakSub = response;
      } else {
        throw new Exception("Unexpected subscription response");
      }
    }
    assertFalse(strongSub.getFullyQualifiedSpecification().equals(weakSub.getFullyQualifiedSpecification()));
    assertFalse(strongSub.getTickDistributionSpecification().equals(weakSub.getTickDistributionSpecification()));
   
    List<LiveDataValueUpdate> allUpdates = listener.getValueUpdates();
    List<LiveDataValueUpdate> stronUpdates = listener.getValueUpdates(getLiveDataSpec(_liveDataClient, strong));
    List<LiveDataValueUpdate> weakUpdates = listener.getValueUpdates(getLiveDataSpec(_liveDataClient, weak));
    assertEquals(1, weakUpdates.size());
View Full Code Here

   
    subscribe(_liveDataClient, listener, instruments);
    assertTrue(listener.waitUntilEnoughUpdatesReceived(30000));
    unsubscribe(_liveDataClient, listener, instruments);
   
    LiveDataSubscriptionResponse strongSub = null;
    LiveDataSubscriptionResponse weakSub = null;
    for (LiveDataSubscriptionResponse response : listener.getSubscriptionResponses()) {
      if (response.getRequestedSpecification().getIdentifiers().contains(working)) {
        assertEquals(LiveDataSubscriptionResult.SUCCESS, response.getSubscriptionResult());
        strongSub = response;
      } else if (response.getRequestedSpecification().getIdentifiers().contains(broken)) {
        assertEquals(LiveDataSubscriptionResult.NOT_PRESENT, response.getSubscriptionResult());
        weakSub = response;
      } else {
        throw new Exception("Unexpected subscription response");
      }
    }
    assertFalse(strongSub.getFullyQualifiedSpecification().equals(weakSub.getFullyQualifiedSpecification()));
    assertFalse(strongSub.getTickDistributionSpecification().equals(weakSub.getTickDistributionSpecification()));
   
    List<LiveDataValueUpdate> allUpdates = listener.getValueUpdates();
    List<LiveDataValueUpdate> brokenUpdates = listener.getValueUpdates(getLiveDataSpec(_liveDataClient, broken));
    List<LiveDataValueUpdate> workingUpdates = listener.getValueUpdates(getLiveDataSpec(_liveDataClient, working));
    assertEquals(0, brokenUpdates.size());
View Full Code Here

  //-------------------------------------------------------------------------
  public void connectionToMarketDataApiDown() {
    // don't start server
   
    LiveDataSubscriptionResponse response = _client.snapshot(TEST_USER, TEST_LIVE_DATA_SPEC, 1000);
    assertNotNull(response);
    assertEquals(LiveDataSubscriptionResult.INTERNAL_ERROR, response.getSubscriptionResult());
    assertEquals(true, response.getUserMessage().contains("Connection to market data API down"));
  }
View Full Code Here

  }

  public void singleSnapshot() {
    _server.start();
   
    LiveDataSubscriptionResponse response = _client.snapshot(TEST_USER, TEST_LIVE_DATA_SPEC, 1000);
    assertNotNull(response);
    assertEquals(LiveDataSubscriptionResult.SUCCESS, response.getSubscriptionResult());
    assertNotNull(response.getSnapshot());
    assertEquals(0, response.getSnapshot().getSequenceNumber());
    assertEquals(_testMsgs[0], response.getSnapshot().getFields());
  }
View Full Code Here

TOP

Related Classes of com.opengamma.livedata.msg.LiveDataSubscriptionResponse

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.