Package com.opengamma.core.position

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


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

  public void getCounterparty() {
View Full Code Here


    assertEquals(trade.getUniqueId(), UniqueId.of("Trade", "0"));
    assertEquals(mock.getResolveCalls(), 0);
    assertEquals(trade.getAttributes(), Collections.emptyMap());
    trade.setAttributes(ImmutableMap.of("K1", "V1"));
    assertEquals(trade.getAttributes(), ImmutableMap.of("K1", "V1"));
    trade.addAttribute("K2", "V2");
    assertEquals(trade.getAttributes(), ImmutableMap.of("K1", "V1", "K2", "V2"));
    assertEquals(trade.getCounterparty(), new SimpleCounterparty(ExternalId.of("Counterparty", "Mock")));
    assertEquals(trade.getPremium(), null);
    assertEquals(trade.getPremiumCurrency(), null);
    assertEquals(trade.getPremiumDate(), null);
View Full Code Here

    final Trade underlying = resolver.getPositionSource().getTrade(UniqueId.of("Trade", "0"));
    Trade trade = new LazyResolvedTrade(new LazyResolveContext(resolver.getSecuritySource(), null).atVersionCorrection(VersionCorrection.LATEST), underlying);
    assertEquals(trade.getAttributes(), underlying.getAttributes());
    trade.setAttributes(ImmutableMap.of("K1", "V1"));
    assertEquals(trade.getAttributes(), underlying.getAttributes());
    trade.addAttribute("K2", "V2");
    assertEquals(trade.getAttributes().size(), 2);
    assertEquals(trade.getCounterparty(), underlying.getCounterparty());
    assertEquals(trade.getPremium(), underlying.getPremium());
    assertEquals(trade.getPremiumCurrency(), underlying.getPremiumCurrency());
    assertEquals(trade.getPremiumDate(), underlying.getPremiumDate());
View Full Code Here

    new ObjectOutputStream(baos).writeObject(trade);
    final Object result = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())).readObject();
    assertTrue(result instanceof SimpleTrade);
    trade = (Trade) result;
    assertEquals(trade.getAttributes(), underlying.getAttributes());
    trade.addAttribute("K2", "V2");
    assertEquals(trade.getAttributes().size(), 2);
    assertEquals(trade.getCounterparty(), underlying.getCounterparty());
    assertEquals(trade.getPremium(), underlying.getPremium());
    assertEquals(trade.getPremiumCurrency(), underlying.getPremiumCurrency());
    assertEquals(trade.getPremiumDate(), underlying.getPremiumDate());
View Full Code Here

    new ObjectOutputStream(baos).writeObject(trade);
    final Object result = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())).readObject();
    assertTrue(result instanceof TargetResolverTrade);
    trade = (Trade) result;
    assertEquals(trade.getAttributes(), underlying.getAttributes());
    trade.addAttribute("K2", "V2");
    assertEquals(trade.getAttributes().size(), 2);
    assertEquals(trade.getCounterparty(), underlying.getCounterparty());
    assertEquals(trade.getPremium(), underlying.getPremium());
    assertEquals(trade.getPremiumCurrency(), underlying.getPremiumCurrency());
    assertEquals(trade.getPremiumDate(), underlying.getPremiumDate());
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.