Package com.opengamma.master.portfolio

Examples of com.opengamma.master.portfolio.PortfolioDocument


  }

  @Test
  public void test_get_versioned() {
    UniqueId uniqueId = UniqueId.of("DbPrt", "101", "0");
    PortfolioDocument test = _prtMaster.get(uniqueId);
    assert101(test, 999);
  }
View Full Code Here


  }

  @Test
  public void test_get_versioned_notLatest() {
    UniqueId uniqueId = UniqueId.of("DbPrt", "201", "0");
    PortfolioDocument test = _prtMaster.get(uniqueId);
    assert201(test);
  }
View Full Code Here

  }

  @Test
  public void test_get_versioned_latest() {
    UniqueId uniqueId = UniqueId.of("DbPrt", "201", "1");
    PortfolioDocument test = _prtMaster.get(uniqueId);
    assert202(test);
  }
View Full Code Here

  }

  @Test
  public void test_get_unversioned_latest() {
    UniqueId oid = UniqueId.of("DbPrt", "201");
    PortfolioDocument test = _prtMaster.get(oid);
    assert202(test);
  }
View Full Code Here

  }

  @Test
  public void test_get_unversioned_nodesLoaded() {
    UniqueId oid = UniqueId.of("DbPrt", "101");
    PortfolioDocument test = _prtMaster.get(oid);
    assert101(test, 999);
  }
View Full Code Here

    assertNotNull(_prtMaster.getClock());
  }
 
  @Test(description = "[PLAT-1723]")
  public void test_duplicate_names() throws Exception {
    PortfolioDocument a = new PortfolioDocument();
    a.setPortfolio( new ManageablePortfolio("Name"));
    _prtMaster.add(a);
   
    PortfolioDocument b = new PortfolioDocument();
    b.setPortfolio( new ManageablePortfolio("Name"));
    _prtMaster.add(b);
   
    PortfolioSearchResult search = _prtMaster.search(new PortfolioSearchRequest());
    assertEquals(2, search.getPortfolios().size());
  }
View Full Code Here

   
    //Try to make the table big enough that database looses presumed order guarantees
    for (int i=0;i<10;i++)
    {
      String portfolioName = "Portfolio";
      PortfolioDocument a = new PortfolioDocument();
      a.setPortfolio( new ManageablePortfolio(portfolioName));
      _prtMaster.add(a);
      for (int j = 0;j<10;j++){
        ManageablePortfolioNode child = new ManageablePortfolioNode("X");
        child.addChildNode(new ManageablePortfolioNode("Y"));
        a.getPortfolio().getRootNode().addChildNode(child);
        _prtMaster.update(a);
      }
     
      PortfolioDocument b = new PortfolioDocument();
      b.setPortfolio( new ManageablePortfolio(portfolioName));
      for (int j = 0;j<10;j++){
        ManageablePortfolioNode childB = new ManageablePortfolioNode("X");
        childB.addChildNode(new ManageablePortfolioNode("Y"));
        b.getPortfolio().getRootNode().addChildNode(childB);
      }
      _prtMaster.add(b);
 
      for (int j = 0;j<10;j++){
        ManageablePortfolioNode child = new ManageablePortfolioNode("X");
View Full Code Here

  public void test_remove_removed() {
    Instant now = Instant.now(_prtMaster.getClock());
   
    UniqueId uniqueId = UniqueId.of("DbPrt", "201", "1");
    _prtMaster.remove(uniqueId);
    PortfolioDocument test = _prtMaster.get(uniqueId);
   
    assertEquals(uniqueId, test.getUniqueId());
    assertEquals(_version2Instant, test.getVersionFromInstant());
    assertEquals(now, test.getVersionToInstant());
    assertEquals(_version2Instant, test.getCorrectionFromInstant());
    assertEquals(null, test.getCorrectionToInstant());
    ManageablePortfolio portfolio = test.getPortfolio();
    assertNotNull(portfolio);
    assertEquals(uniqueId, portfolio.getUniqueId());
    assertEquals("TestNode212", portfolio.getRootNode().getName());
    assertEquals(0, portfolio.getRootNode().getChildNodes().size());
  }
View Full Code Here

    final ManageablePortfolioNode rootNode = new ManageablePortfolioNode("ROOT");
    final ManageablePortfolio portfolio = new ManageablePortfolio(portfolioName, rootNode);
    for (ManageablePortfolioNode node : nodes) {
      rootNode.addChildNode(node);
    }
    _portfolios.add(new PortfolioDocument(portfolio));
  }
View Full Code Here

  }
 
  private String getPortfolioName(UniqueId uniqueId) {
    if (uniqueId != null) {
      try {
        PortfolioDocument portfolioDocument = _portfolioMaster.get(uniqueId);
        if (portfolioDocument != null) {
          return portfolioDocument.getPortfolio().getName();
        }
      } catch (DataNotFoundException dnfe) {
        if (_verbose) {
          s_logger.warn("Couldn't find portfolio for " + uniqueId);
        }
View Full Code Here

TOP

Related Classes of com.opengamma.master.portfolio.PortfolioDocument

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.