Package com.opengamma.master.exchange

Examples of com.opengamma.master.exchange.ExchangeMaster


  private boolean _publishRest = true;


  @Override
  public void init(final ComponentRepository repo, final LinkedHashMap<String, String> configuration) {
    final ExchangeMaster master = new InMemoryExchangeMaster();
    final ComponentInfo info = new ComponentInfo(ExchangeMaster.class, getClassifier());
    info.addAttribute(ComponentInfoAttributes.LEVEL, 1);
    info.addAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA, RemoteExchangeMaster.class);
    info.addAttribute(ComponentInfoAttributes.UNIQUE_ID_SCHEME, InMemoryExchangeMaster.DEFAULT_OID_SCHEME);
    repo.registerComponent(info, master);
View Full Code Here


  }

  //-------------------------------------------------------------------------
  @Override
  protected void doRun() {
    ExchangeMaster master = getToolContext().getExchangeMaster();
    CoppClarkExchangeFileReader.createPopulated(master);
  }
View Full Code Here

   * Stores the exchange in the exchange master. If there is already an exchange with that name it is updated.
   *
   * @param exchange the exchange to add
   */
  private void storeExchange(final ManageableExchange exchange) {
    final ExchangeMaster master = getToolContext().getExchangeMaster();
    final ExchangeSearchRequest request = new ExchangeSearchRequest();
    request.setName(exchange.getName());
    final ExchangeSearchResult result = master.search(request);
    if (result.getFirstDocument() != null) {
      //System.out.println("Updating " + exchange.getName());
      final ExchangeDocument document = result.getFirstDocument();
      document.setExchange(exchange);
      master.update(document);
    } else {
      //System.out.println("Adding " + exchange.getName());
      master.add(new ExchangeDocument(exchange));
    }
  }
View Full Code Here

  //-------------------------------------------------------------------------
  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> exchangeuration) {

    ExchangeMaster master = new EHCachingExchangeMaster(getClassifier(),
                                                        getUnderlying(),
                                                        getCacheManager());

    // register
    ComponentInfo info = new ComponentInfo(ExchangeMaster.class, getClassifier());
View Full Code Here

    new MasterExchangeSource(null, null);
  }

  //-------------------------------------------------------------------------
  public void test_getExchange_UniqueId_noOverride_found() throws Exception {
    ExchangeMaster mock = mock(ExchangeMaster.class);
   
    ExchangeDocument doc = new ExchangeDocument(example());
    when(mock.get(UID)).thenReturn(doc);
    MasterExchangeSource test = new MasterExchangeSource(mock);
    Exchange testResult = test.get(UID);
    verify(mock, times(1)).get(UID);
   
    assertEquals(example(), testResult);
View Full Code Here

   
    assertEquals(example(), testResult);
  }

  public void test_getExchange_UniqueId_found() throws Exception {
    ExchangeMaster mock = mock(ExchangeMaster.class);
   
    ExchangeDocument doc = new ExchangeDocument(example());
    when(mock.get(OID, VC)).thenReturn(doc);
    MasterExchangeSource test = new MasterExchangeSource(mock, VC);
    Exchange testResult = test.get(UID);
    verify(mock, times(1)).get(OID, VC);
   
    assertEquals(example(), testResult);
View Full Code Here

    assertEquals(example(), testResult);
  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_getExchange_UniqueId_notFound() throws Exception {
    ExchangeMaster mock = mock(ExchangeMaster.class);
   
    when(mock.get(OID, VC)).thenThrow(new DataNotFoundException(""));
    MasterExchangeSource test = new MasterExchangeSource(mock, VC);
    try {
      test.get(UID);
    } finally {
      verify(mock, times(1)).get(OID, VC);
View Full Code Here

    }
  }

  //-------------------------------------------------------------------------
  public void test_getExchange_ObjectId_found() throws Exception {
    ExchangeMaster mock = mock(ExchangeMaster.class);
   
    ExchangeDocument doc = new ExchangeDocument(example());
    when(mock.get(OID, VC)).thenReturn(doc);
    MasterExchangeSource test = new MasterExchangeSource(mock, VC);
    Exchange testResult = test.get(OID, VC);
    verify(mock, times(1)).get(OID, VC);
   
    assertEquals(example(), testResult);
View Full Code Here

    assertEquals(example(), testResult);
  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_getExchange_ObjectId_notFound() throws Exception {
    ExchangeMaster mock = mock(ExchangeMaster.class);
   
    when(mock.get(OID, VC)).thenThrow(new DataNotFoundException(""));
    MasterExchangeSource test = new MasterExchangeSource(mock, VC);
    try {
      test.get(OID, VC);
    } finally {
      verify(mock, times(1)).get(OID, VC);
View Full Code Here

    }
  }

  //-------------------------------------------------------------------------
  public void test_getSingleExchange_ExternalId_found() throws Exception {
    ExchangeMaster mock = mock(ExchangeMaster.class);
    ExchangeSearchRequest request = new ExchangeSearchRequest(ID);
    request.setPagingRequest(PagingRequest.ONE);
    request.setPagingRequest(PagingRequest.ONE);
    request.setVersionCorrection(VC);
   
    ExchangeSearchResult result = new ExchangeSearchResult();
    result.getDocuments().add(new ExchangeDocument(example()));
   
    when(mock.search(request)).thenReturn(result);
    MasterExchangeSource test = new MasterExchangeSource(mock, VC);
    Exchange testResult = test.getSingle(ID);
    verify(mock, times(1)).search(request);
   
    assertEquals(example(), testResult);
View Full Code Here

TOP

Related Classes of com.opengamma.master.exchange.ExchangeMaster

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.