Examples of SimplePosition


Examples of com.opengamma.core.position.impl.SimplePosition

  @Test
  public void getRequirements() {
    FunctionCompilationContext fcctx = mock(FunctionCompilationContext.class);
    DV01_test_fun dv01 = new DV01_test_fun();

    assertTrue(dv01.canApplyTo(fcctx, new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition())));

    ComputationTargetSpecification cts = new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("a", "b"));
    ComputationTarget ct = mock(ComputationTarget.class);
    when(ct.toSpecification()).thenReturn(cts);
View Full Code Here

Examples of com.opengamma.core.position.impl.SimplePosition

  @Test
  public void getResultsTest_2() {
    FunctionCompilationContext fcctx = mock(FunctionCompilationContext.class);
    DV01_test_fun dv01 = new DV01_test_fun();

    assertTrue(dv01.canApplyTo(fcctx, new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition())));

    ComputationTargetSpecification cts = new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("a", "b"));
    ComputationTarget ct = mock(ComputationTarget.class);
    when(ct.toSpecification()).thenReturn(cts);
    ValueProperties valueProperties = ValueProperties.builder().with("A", "1").with("B", "1").with(ValuePropertyNames.FUNCTION, "PV01_Function").get();
View Full Code Here

Examples of com.opengamma.core.position.impl.SimplePosition

  public void testNull() {
    assertEncodeDecodeCycle(ComputationTarget.class, ComputationTarget.NULL);
  }

  public void testBasic() {
    assertEncodeDecodeCycle(ComputationTarget.class, new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition(UniqueId.of("Pos", "Foo"), BigDecimal.ONE, ExternalId.of("Sec", "Bar"))));
  }
View Full Code Here

Examples of com.opengamma.core.position.impl.SimplePosition

  public void testNested_1() {
    assertEncodeDecodeCycle(ComputationTarget.class,
        new ComputationTarget(
            new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO_NODE, UniqueId.of("Prt", "Foo")).containing(ComputationTargetType.POSITION, UniqueId.of("Pos", "Foo")),
            new SimplePosition(UniqueId.of("Pos", "Foo"), BigDecimal.ONE, ExternalId.of("Sec", "Bar"))));
  }
View Full Code Here

Examples of com.opengamma.core.position.impl.SimplePosition

    assertEncodeDecodeCycle(
        ComputationTarget.class,
        new ComputationTarget(
            new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO_NODE, UniqueId.of("Prt", "Foo")).containing(ComputationTargetType.PORTFOLIO_NODE, UniqueId.of("Prt", "Bar")).containing(
                ComputationTargetType.POSITION, UniqueId.of("Pos", "Foo")),
            new SimplePosition(UniqueId.of("Pos", "Foo"), BigDecimal.ONE, ExternalId.of("Sec", "Bar"))));
  }
View Full Code Here

Examples of com.opengamma.core.position.impl.SimplePosition

    final DependencyNode n1 = new DependencyNode(t1.toSpecification());
    n1.setFunction(new MockFunction("F1", t1));
    n1.addOutputValue(new ValueSpecification("Foo", t1.toSpecification(), properties));
    n1.addTerminalOutputValue(new ValueSpecification("Foo", t1.toSpecification(), properties));
    graph.addDependencyNode(n1);
    final ComputationTarget t2 = new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition(UniqueId.of("Pos", "0"), BigDecimal.ONE, ExternalId.of("Security", "Foo")));
    final DependencyNode n2 = new DependencyNode(t2.toSpecification());
    n2.setFunction(new MockFunction("F2", t1));
    n2.addOutputValue(new ValueSpecification("Foo", t2.toSpecification(), properties));
    n1.addInputValue(new ValueSpecification("Foo", t2.toSpecification(), properties));
    n1.addInputNode(n2);
View Full Code Here

Examples of com.opengamma.core.position.impl.SimplePosition

  }

  private FunctionRepository createFunctionRepository() {
    final InMemoryFunctionRepository functions = new InMemoryFunctionRepository();
    functions.addFunction(new MockFunction("F1", new ComputationTarget(ComputationTargetType.PORTFOLIO_NODE, new SimplePortfolioNode(UniqueId.of("Node", "0"), "node"))));
    functions.addFunction(new MockFunction("F2", new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition(UniqueId.of("Pos", "0"), BigDecimal.ONE, ExternalId.of("Security", "Foo")))));
    functions.addFunction(new MockFunction("F3", new ComputationTarget(ComputationTargetType.SECURITY, createSecurity(UniqueId.of("Pos", "0"), ExternalId.of("Security", "Foo")))));
    return functions;
  }
View Full Code Here

Examples of com.opengamma.core.position.impl.SimplePosition

    return new TargetResolverPosition(targetResolver, this);
  }

  @Override
  protected SimplePosition simpleObject() {
    return new SimplePosition(this);
  }
View Full Code Here

Examples of krati.retention.SimplePosition

        assertEquals(Clock.ZERO, c1);
       
        Clock c2 = Clock.parseClock(Clock.ZERO.toString());
        assertEquals(Clock.ZERO, c2);
       
        SimplePosition position = new SimplePosition(1, 23467L, Clock.ZERO);
        Clock c3 = SimplePosition.parsePosition(position.toString()).getClock();
        assertEquals(Clock.ZERO, c3);
    }
View Full Code Here

Examples of krati.retention.SimplePosition

import krati.retention.Position;

public class TestSimplePosition extends TestCase {
   
    public void testStringSerialization() {
        Position p1 = new SimplePosition(10, 5, 3, new Clock(11,17,23));
        Position p2 = new SimplePosition(10, 5, 3, new Clock(11,17,23));
        Position p3 = new SimplePosition(2, 4, 6, new Clock(8,10,12));
        assertEquals(p1, p2);
        assertFalse(p1.equals(p3));
    }
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.