Examples of ExchangeSource


Examples of com.opengamma.core.exchange.ExchangeSource

  }

  //-------------------------------------------------------------------------
  @Override
  protected ExchangeSource createObject() {
    ExchangeSource source = new MasterExchangeSource(getExchangeMaster());
    if (getCacheManager() != null) {
      source = new EHCachingExchangeSource(source, getCacheManager());
    }
    return source;
  }
View Full Code Here

Examples of com.opengamma.core.exchange.ExchangeSource

  @SuppressWarnings("unchecked")
  private static ExchangeSource myExchangeSource() {
    final Exchange exchange = Mockito.mock(Exchange.class);
    Mockito.when(exchange.getUniqueId()).thenReturn(UniqueId.of("SOMETHING", "SOMETHING ELSE"));
    final ExchangeSource source = Mockito.mock(ExchangeSource.class);
    Mockito.when(source.get(Mockito.any(UniqueId.class))).thenReturn(exchange);
    Mockito.when(source.get(Mockito.any(ObjectId.class), Mockito.any(VersionCorrection.class))).thenReturn(exchange);
    ((OngoingStubbing) Mockito.when(source.get(Mockito.any(ExternalIdBundle.class), Mockito.any(VersionCorrection.class)))).thenReturn(Collections.singleton(exchange));
    Mockito.when(source.getSingle(Mockito.any(ExternalId.class))).thenReturn(exchange);
    Mockito.when(source.getSingle(Mockito.any(ExternalIdBundle.class))).thenReturn(exchange);
    return source;
  }
View Full Code Here

Examples of com.opengamma.core.exchange.ExchangeSource

   * @param repo  the component repository, not null
   * @param configuration  the remaining configuration, not null
   */
  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) {
    ExchangeSource source = createExchangeSource(repo);
   
    ComponentInfo info = new ComponentInfo(ExchangeSource.class, getClassifier());
    info.addAttribute(ComponentInfoAttributes.LEVEL, 1);
    info.addAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA, RemoteExchangeSource.class);
    repo.registerComponent(info, source);
View Full Code Here

Examples of com.opengamma.core.exchange.ExchangeSource

   *
   * @param repo  the component repository, only used to register secondary items like lifecycle, not null
   * @return the exchange source, not null
   */
  protected ExchangeSource createExchangeSource(ComponentRepository repo) {
    ExchangeSource source = new MasterExchangeSource(getExchangeMaster());
    if (getCacheManager() != null) {
      source = new EHCachingExchangeSource(source, getCacheManager());
    }
    return source;
  }
View Full Code Here

Examples of com.opengamma.core.exchange.ExchangeSource

  //-------------------------------------------------------------------------
  @Test
  public void getById() throws InterruptedException {
    final AtomicLong getCount = new AtomicLong(0);
    final ExchangeSource underlying = Mockito.mock(ExchangeSource.class);
    Mockito.when(underlying.getSingle(Mockito.<ExternalId>anyObject())).thenAnswer(new Answer<Exchange>() {
      @Override
      public Exchange answer(InvocationOnMock invocation) throws Throwable {
        getCount.incrementAndGet();
        SimpleExchange simpleExchange = new SimpleExchange();
        simpleExchange.setUniqueId(UniqueId.of("Test", "Foo", "0"));
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.