Package com.opengamma.core.position

Examples of com.opengamma.core.position.Portfolio.addAttribute()


  public void addAttribute() {
    final Portfolio portfolio = Mockito.mock(Portfolio.class);
    final ResolutionLogger logger = Mockito.mock(ResolutionLogger.class);
    final Portfolio logged = new LoggedResolutionPortfolio(portfolio, logger);
    logged.addAttribute("Foo", "Bar");
    Mockito.verify(portfolio).addAttribute("Foo", "Bar");
    Mockito.verifyZeroInteractions(logger);
  }

  public void getRootNode() {
View Full Code Here


    portfolio = (Portfolio) resultObject;
    assertEquals(portfolio.getUniqueId(), underlying.getUniqueId());
    assertEquals(portfolio.getAttributes(), underlying.getAttributes());
    portfolio.setAttributes(ImmutableMap.of("K1", "V1", "K2", "V2"));
    assertNotEquals(portfolio.getAttributes(), underlying.getAttributes());
    portfolio.addAttribute("K3", "V3");
    assertNotEquals(portfolio.getAttributes(), underlying.getAttributes());
    assertEquals(portfolio.getAttributes().size(), 3);
    assertEquals(portfolio.getName(), underlying.getName());
    assertEquals(portfolio.getRootNode().getUniqueId(), underlying.getRootNode().getUniqueId());
    assertEquals(portfolio.getRootNode().getChildNodes().size(), underlying.getRootNode().getChildNodes().size());
View Full Code Here

    portfolio = (Portfolio) resultObject;
    assertEquals(portfolio.getUniqueId(), underlying.getUniqueId());
    assertEquals(portfolio.getAttributes(), underlying.getAttributes());
    portfolio.setAttributes(ImmutableMap.of("K1", "V1", "K2", "V2"));
    assertNotEquals(portfolio.getAttributes(), underlying.getAttributes());
    portfolio.addAttribute("K3", "V3");
    assertNotEquals(portfolio.getAttributes(), underlying.getAttributes());
    assertEquals(portfolio.getAttributes().size(), 3);
    assertEquals(portfolio.getName(), underlying.getName());
    assertEquals(portfolio.getRootNode().getUniqueId(), underlying.getRootNode().getUniqueId());
    assertEquals(portfolio.getRootNode().getChildNodes().size(), underlying.getRootNode().getChildNodes().size());
View Full Code Here

    final Portfolio underlying = resolver.getPositionSource().getPortfolio(UniqueId.of("Portfolio", "0"), VersionCorrection.LATEST);
    final Portfolio portfolio = new LazyResolvedPortfolio(new LazyResolveContext(resolver.getSecuritySource(), null).atVersionCorrection(VersionCorrection.LATEST), underlying);
    assertEquals(portfolio.getAttributes(), underlying.getAttributes());
    portfolio.setAttributes(ImmutableMap.of("K1", "V1", "K2", "V2"));
    assertEquals(portfolio.getAttributes(), underlying.getAttributes());
    portfolio.addAttribute("K3", "V3");
    assertEquals(portfolio.getAttributes().size(), 3);
    assertEquals(underlying.getAttributes().size(), 3);
    assertEquals(portfolio.getName(), underlying.getName());
    assertEquals(portfolio.getUniqueId(), underlying.getUniqueId());
    assertEquals(portfolio.getRootNode().getUniqueId(), underlying.getRootNode().getUniqueId());
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.