Package com.opengamma.livedata.server

Examples of com.opengamma.livedata.server.ExpirationManager


  }

  @Test
  public void testExpiration() throws Exception {
    int period = 15000;
    ExpirationManager expirationManager = _server.getExpirationManager();
    expirationManager.stop();
    expirationManager.setCheckPeriod(15000);
    expirationManager.setTimeoutExtension(15000);
    expirationManager.start();
   
    final AtomicInteger combinedSubs = countSubscriptions(_server);
    final AtomicInteger fakeSubs = countSubscriptions(_server.getFakeServer());
    final AtomicInteger realSubs = countSubscriptions(_server.getRealServer());
   
    ExternalId weak = ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER_WEAK, "GBP Curncy");
   
    List<ExternalId> instruments = Lists.newArrayList(weak);
    CollectingLiveDataListener listener = new CollectingLiveDataListener(1, 1);
   
    subscribe(_liveDataClient, listener, instruments);
   
    assertEquals(1, combinedSubs.get());
    assertEquals(combinedSubs.get(), fakeSubs.get());
    assertEquals(0, realSubs.get());
    assertTrue(listener.waitUntilEnoughUpdatesReceived(30000));
    for (int i = 0; i < 3; i++) {
      expirationManager.extendPublicationTimeout(ImmutableSet.of(getLiveDataSpec(_liveDataClient, weak)));
      Thread.sleep(period / 2);
    }
    assertEquals(1, combinedSubs.get());
    assertEquals(combinedSubs.get(), fakeSubs.get());
    assertEquals(0, realSubs.get());
View Full Code Here

TOP

Related Classes of com.opengamma.livedata.server.ExpirationManager

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.