Package com.opengamma.engine

Examples of com.opengamma.engine.ComputationTargetSpecification


    assertEquals(target.getContextSpecification(), ComputationTargetSpecification.of(NODE).containing(ComputationTargetType.PORTFOLIO_NODE, NODE.getUniqueId()));
    assertSame(target.getValue(), POSITION);
  }

  public void testCreateResolvedTarget_rewriteSpec() {
    ComputationTarget target = ComputationTargetResolverUtils.createResolvedTarget(new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO_NODE, NODE.getUniqueId().toLatest()), NODE);
    assertEquals(target.getType(), ComputationTargetType.of(SimplePortfolioNode.class));
    assertEquals(target.getUniqueId(), NODE.getUniqueId());
  }
View Full Code Here


    final Security security = Mockito.mock(Security.class);
    Mockito.when(security.getUniqueId()).thenReturn(UniqueId.of("Foo", "Bar", "Cow"));
    Mockito.when(trade.getSecurity()).thenReturn(security);
    Mockito.when(trade.getSecurityLink()).thenReturn(new SimpleSecurityLink(ObjectId.of("Foo", "Bar")));
    assertSame(logged.getSecurity(), security);
    Mockito.verify(logger).log(new ComputationTargetSpecification(ComputationTargetType.SECURITY, UniqueId.of("Foo", "Bar")), UniqueId.of("Foo", "Bar", "Cow"));
    Mockito.verifyNoMoreInteractions(logger);
  }
View Full Code Here

    assertEquals(out.getTerminalOutputSpecifications(), in.getTerminalOutputSpecifications());
  }

  public void testBasic() {
    final ComputationTargetRequirement targetReq = ComputationTargetRequirement.of(ExternalId.of("Foo", "Bar"));
    final ComputationTargetSpecification targetSpec = ComputationTargetSpecification.of(UniqueId.of("Sec", "123"));
    final ValueSpecification valueSpecification = new ValueSpecification("Value", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Foo").get());
    final ValueRequirement valueRequirement = new ValueRequirement("Value", targetReq);
    final ValueSpecification dataSpecification1 = new ValueSpecification("Data1", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get());
    final ValueSpecification dataSpecification2a = new ValueSpecification("Data2a", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get());
    final ValueSpecification dataSpecification2b = new ValueSpecification("Data2b", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get());
View Full Code Here

  //-------------------------------------------------------------------------
  public void test_getParentNode_position() {
    final PortfolioStructure resolver = getPortfolioStructure();
    assertNotNull(resolver);
    assertEquals(_child2,
        resolver.getParentNode(new ComputationTarget(new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO_NODE, _child2.getUniqueId()).containing(
            ComputationTargetType.POSITION, _position1.getUniqueId()), _position1)));
    assertEquals(_child2,
        resolver.getParentNode(new ComputationTarget(new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO_NODE, _root.getUniqueId()).containing(
            ComputationTargetType.PORTFOLIO_NODE, _child2.getUniqueId()).containing(ComputationTargetType.POSITION, _position2.getUniqueId()), _position2)));
  }
View Full Code Here

    final Security security = Mockito.mock(Security.class);
    Mockito.when(security.getUniqueId()).thenReturn(UniqueId.of("Foo", "Bar", "Cow"));
    Mockito.when(position.getSecurity()).thenReturn(security);
    Mockito.when(position.getSecurityLink()).thenReturn(new SimpleSecurityLink(ObjectId.of("Foo", "Bar")));
    assertSame(logged.getSecurity(), security);
    Mockito.verify(logger).log(new ComputationTargetSpecification(ComputationTargetType.SECURITY, UniqueId.of("Foo", "Bar")), UniqueId.of("Foo", "Bar", "Cow"));
    Mockito.verifyNoMoreInteractions(logger);
  }
View Full Code Here

  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_getParentNode_position_badChild() {
    final PortfolioStructure resolver = getPortfolioStructure();
    resolver.getParentNode(new ComputationTarget(new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO_NODE, UniqueId.of("Invalid", "0")).containing(ComputationTargetType.POSITION,
        _badPosition.getUniqueId()), _badPosition));
  }
View Full Code Here

  //-------------------------------------------------------------------------
  public void test_getRootPortfolioNode_position() {
    final PortfolioStructure resolver = getPortfolioStructure();
    assertNotNull(resolver);
    assertEquals(_root,
        resolver.getRootPortfolioNode(new ComputationTarget(new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO_NODE, _child2.getUniqueId()).containing(ComputationTargetType.POSITION,
            _position1.getUniqueId()), _position1)));
    assertEquals(
        _root,
        resolver.getRootPortfolioNode(new ComputationTarget(new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO_NODE, _root.getUniqueId()).containing(
            ComputationTargetType.PORTFOLIO_NODE, _child2.getUniqueId()).containing(
            ComputationTargetType.POSITION, _position2.getUniqueId()), _position2)));
  }
View Full Code Here

  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_getRootPortfolioNode_position_badChild() {
    final PortfolioStructure resolver = getPortfolioStructure();
    resolver.getRootPortfolioNode(new ComputationTarget(new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO_NODE, UniqueId.of("Invalid", "0")).containing(
        ComputationTargetType.POSITION, _badPosition.getUniqueId()), _badPosition));
  }
View Full Code Here

  public void testRequirement() {
    assertEncodeDecodeCycle(ComputationTargetReference.class, new ComputationTargetRequirement(ComputationTargetType.PRIMITIVE, ExternalId.of("Foo", "Bar")));
  }

  public void testSpecification() {
    assertEncodeDecodeCycle(ComputationTargetReference.class, new ComputationTargetSpecification(ComputationTargetType.SECURITY, UniqueId.of("Foo", "Bar")));
  }
View Full Code Here

  public void testRequirement_null() {
    assertEncodeDecodeCycle(ComputationTargetReference.class, new ComputationTargetRequirement(ComputationTargetType.NULL, (ExternalId) null));
  }

  public void testSpecification_null() {
    assertEncodeDecodeCycle(ComputationTargetReference.class, new ComputationTargetSpecification(ComputationTargetType.NULL, null));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.ComputationTargetSpecification

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.