Examples of CollectingLiveDataListener


Examples of com.opengamma.livedata.test.CollectingLiveDataListener

  public void releaseTicksServerRestart() {
    LiveDataSpecification spec =
      new LiveDataSpecification(
          "NormalizationId1",
          ExternalId.of("Domain1", "Value1"));
    CollectingLiveDataListener listener = new CollectingLiveDataListener();
    SubscriptionHandle handle = new SubscriptionHandle(_user, SubscriptionType.NON_PERSISTENT, spec, listener);
   
    handle.addTickOnHold(new LiveDataValueUpdateBean(500, spec, FudgeContext.EMPTY_MESSAGE));
    handle.addTickOnHold(new LiveDataValueUpdateBean(501, spec, FudgeContext.EMPTY_MESSAGE));
    handle.addSnapshotOnHold(new LiveDataValueUpdateBean(502, spec, FudgeContext.EMPTY_MESSAGE));
    handle.addTickOnHold(new LiveDataValueUpdateBean(0, spec, FudgeContext.EMPTY_MESSAGE));
    handle.addTickOnHold(new LiveDataValueUpdateBean(1, spec, FudgeContext.EMPTY_MESSAGE));
    handle.releaseTicksOnHold();
   
    assertEquals(2, listener.getValueUpdates().size());
   
    assertEquals(0, listener.getValueUpdates().get(0).getSequenceNumber());
    assertEquals(1, listener.getValueUpdates().get(1).getSequenceNumber());
  }
View Full Code Here

Examples of com.opengamma.livedata.test.CollectingLiveDataListener

  public void releaseTicksMultipleServerRestarts() {
    LiveDataSpecification spec =
      new LiveDataSpecification(
          "NormalizationId1",
          ExternalId.of("Domain1", "Value1"));
    CollectingLiveDataListener listener = new CollectingLiveDataListener();
    SubscriptionHandle handle = new SubscriptionHandle(_user, SubscriptionType.NON_PERSISTENT, spec, listener);
   
    handle.addTickOnHold(new LiveDataValueUpdateBean(500, spec, FudgeContext.EMPTY_MESSAGE));
    handle.addSnapshotOnHold(new LiveDataValueUpdateBean(501, spec, FudgeContext.EMPTY_MESSAGE));
    handle.addTickOnHold(new LiveDataValueUpdateBean(502, spec, FudgeContext.EMPTY_MESSAGE));
    handle.addTickOnHold(new LiveDataValueUpdateBean(0, spec, FudgeContext.EMPTY_MESSAGE));
    handle.addTickOnHold(new LiveDataValueUpdateBean(1, spec, FudgeContext.EMPTY_MESSAGE));
    handle.addTickOnHold(new LiveDataValueUpdateBean(0, spec, FudgeContext.EMPTY_MESSAGE));
    handle.addTickOnHold(new LiveDataValueUpdateBean(1, spec, FudgeContext.EMPTY_MESSAGE));
    handle.releaseTicksOnHold();
   
    assertEquals(2, listener.getValueUpdates().size());
   
    assertEquals(0, listener.getValueUpdates().get(0).getSequenceNumber());
    assertEquals(1, listener.getValueUpdates().get(1).getSequenceNumber());
  }
View Full Code Here

Examples of com.opengamma.livedata.test.CollectingLiveDataListener

  }

  public void singleSubscribe() {
    _server.start();
   
    CollectingLiveDataListener listener = new CollectingLiveDataListener();
   
    _client.subscribe(TEST_USER, TEST_LIVE_DATA_SPEC, listener);
   
    assertEquals(1, listener.getSubscriptionResponses().size());
    assertEquals(LiveDataSubscriptionResult.SUCCESS, listener.getSubscriptionResponses().get(0).getSubscriptionResult());
   
    // As part of subscribe(), the client does a snapshot and sends it to the listener.
    assertEquals(1, listener.getValueUpdates().size());
    assertEquals(_testMsgs[0], listener.getValueUpdates().get(0).getFields());
   
    _server.sendLiveDataToClient();

    // Normal data received.
    assertEquals(2, listener.getValueUpdates().size());
    assertEquals(_testMsgs[0], listener.getValueUpdates().get(1).getFields());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.