Package com.opengamma.core.position.impl

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


  @Test
  public void testEmptyPortfolioIsReturnedWhenAllNodesAreDenied() {

    SimplePortfolioNode root = nodeTree(1, nodeTree(2, nodeTree(4)), nodeTree(3));
    Portfolio pf = new SimplePortfolio("node-1", root);

    Portfolio portfolio = new NodeCheckingPortfolioFilter(createDenyNodeChecker()).generateRestrictedPortfolio(pf);

    assertThat(portfolio.getRootNode().size(), is(0));
    assertThat(portfolio.getName(), is("Access Denied"));
View Full Code Here


    4 is allowed
    Portfolio should just contain 1, 2 & 4 (1 is a restricted version though)

    */
    SimplePortfolioNode root = nodeTree(1, nodeTree(2), nodeTree(3), nodeTree(4));
    Portfolio pf = new SimplePortfolio("node-1", root);

    Map<Integer, PortfolioPermission> permissions = ImmutableMap.of(
        1, ALLOW,
        2, ALLOW,
        3, DENY,
View Full Code Here

    4 is denied
    Portfolio should just contain 2

    */
    SimplePortfolioNode root = nodeTree(1, nodeTree(2), nodeTree(3), nodeTree(4));
    Portfolio pf = new SimplePortfolio("node-1", root);

    Map<Integer, PortfolioPermission> permissions = ImmutableMap.of(
        1, ALLOW,
        2, ALLOW,
        3, DENY,
View Full Code Here

                          nodeTree(5,
                                   nodeTree(6),
                                   nodeTree(7))),
                 nodeTree(3),
                 nodeTree(4));
    Portfolio pf = new SimplePortfolio("node-1", root);

    Map<Integer, PortfolioPermission> permissions =
        ImmutableMap.<Integer, PortfolioPermission>builder()
            .put(1, ALLOW)
            .put(2, ALLOW)
View Full Code Here

                                   nodeTree(15)),
                          nodeTree(8,
                                   nodeTree(16),
                                   nodeTree(17))));

    Portfolio pf = new SimplePortfolio("node-1", root);

    Map<Integer, PortfolioPermission> permissions =
        ImmutableMap.<Integer, PortfolioPermission> builder()
          .put(1, ALLOW)
          .put(2, ALLOW)
View Full Code Here

  @Test
  public void testNonExistentNodeIsDenied() {

    SimplePortfolioNode node = new SimplePortfolioNode("not in the portfolio");
    PortfolioPermissionChecker checker = new PortfolioPermissionChecker(new SimplePortfolio("test"), createAllowNodeChecker());
    assertThat(checker.permissionCheck(node), is(DENY));
  }
View Full Code Here

  @Test
  public void testSingleNodeWithAllow() {

    SimplePortfolioNode node = new SimplePortfolioNode();

    PortfolioPermissionChecker checker = new PortfolioPermissionChecker(new SimplePortfolio("test", node),
                                                                        createAllowNodeChecker());

    assertThat(checker.permissionCheck(node), is(ALLOW));
  }
View Full Code Here

  @Test
  public void testSingleNodeWithDeny() {

    SimplePortfolioNode node = new SimplePortfolioNode();

    PortfolioPermissionChecker checker = new PortfolioPermissionChecker(new SimplePortfolio("test", node),
                                                                        createDenyNodeChecker());

    assertThat(checker.permissionCheck(node), is(DENY));
  }
View Full Code Here

        1, ALLOW,
        2, ALLOW,
        3, ALLOW,
        4, ALLOW);

    PortfolioPermissionChecker checker = new PortfolioPermissionChecker(new SimplePortfolio("test", root),
                                                                        createMappedNodeChecker(permissions));

    assertThat(checker.permissionCheck(root), is(ALLOW));
  }
View Full Code Here

        1, ALLOW,
        2, DENY,
        3, DENY,
        4, DENY);

    PortfolioPermissionChecker checker = new PortfolioPermissionChecker(new SimplePortfolio("test", root),
                                                                        createMappedNodeChecker(permissions));

    assertThat(checker.permissionCheck(root), is(PARTIAL));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.core.position.impl.SimplePortfolio

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.