Package org.candlepin.util.X509V3ExtensionUtil

Examples of org.candlepin.util.X509V3ExtensionUtil.PathNode


        util = new X509V3ExtensionUtil(config, ec);
    }

    @Test
    public void compareToEquals() {
        PathNode pn = util.new PathNode();
        NodePair np = new NodePair("name", pn);
        NodePair np1 = new NodePair("name", pn);
        assertEquals(0, np.compareTo(np1));
        assertEquals(np, np1);
    }
View Full Code Here


        assertEquals(np, np1);
    }

    @Test(expected = NullPointerException.class)
    public void nullCompareTo() {
        PathNode pn = util.new PathNode();
        NodePair np = new NodePair("name", pn);
        assertEquals(1, np.compareTo(null));
    }
View Full Code Here

        assertEquals(1, np.compareTo(null));
    }

    @Test
    public void nullEquals() {
        PathNode pn = util.new PathNode();
        NodePair np = new NodePair("name", pn);
        assertFalse(np.equals(null));
    }
View Full Code Here

        assertFalse(np.equals(null));
    }

    @Test
    public void otherObjectEquals() {
        PathNode pn = util.new PathNode();
        NodePair np = new NodePair("name", pn);
        assertFalse(np.equals(pn));
    }
View Full Code Here

        assertFalse(np.equals(pn));
    }

    @Test
    public void notEqualNodes() {
        PathNode pn = util.new PathNode();
        NodePair np = new NodePair("name", pn);
        NodePair np1 = new NodePair("diff", pn);
        assertTrue(np.compareTo(np1) > 0);
        assertFalse(np.equals(np1));
    }
View Full Code Here

                new org.candlepin.json.model.Content();
            cont.setPath("/head/neck/shoulders/heart" + i + "/waist" +
                i + "/leg/foot/heel");
            contentList.add(cont);
        }
        PathNode location = v3extensionUtil.makePathTree(contentList,
            v3extensionUtil.new PathNode());
        v3extensionUtil.printTree(location, 0);
        assertEquals(location.getChildren().size(), 1);
        assertEquals(location.getChildren().get(0).getName(), "head");
        location = location.getChildren().get(0).getConnection();
        assertEquals(location.getChildren().size(), 1);
        assertEquals(location.getChildren().get(0).getName(), "neck");
        location = location.getChildren().get(0).getConnection();
        assertEquals(location.getChildren().size(), 1);
        assertEquals(location.getChildren().get(0).getName(), "shoulders");
        location = location.getChildren().get(0).getConnection();
        assertEquals(location.getChildren().size(), 20);

        // find the common footer nodes and make sure they are merged.
        long legId = -1;
        long footId = -1;
        long heelId = -1;
        for (NodePair np : location.getChildren()) {
            // np is a "heart" pair
            assertTrue(np.getName().startsWith("heart"));

            // now waist node
            PathNode waist = np.getConnection();
            assertEquals(waist.getChildren().size(), 1);
            assertTrue(waist.getChildren().get(0).getName().startsWith("waist"));

            // go to "leg" node
            PathNode leg = waist.getChildren().get(0).getConnection();
            if (legId == -1) {
                legId = leg.getId();
            }
            else {
                assertEquals(leg.getId(), legId);
            }
            assertEquals(leg.getChildren().size(), 1);
            assertEquals(leg.getChildren().get(0).getName(), "leg");

            // go to "foot" node
            PathNode foot = leg.getChildren().get(0).getConnection();
            if (footId == -1) {
                footId = foot.getId();
            }
            else {
                assertEquals(foot.getId(), footId);
            }
            assertEquals(foot.getChildren().size(), 1);
            assertEquals(foot.getChildren().get(0).getName(), "foot");

            // go to "heel" node
            PathNode heel = foot.getChildren().get(0).getConnection();
            if (heelId == -1) {
                heelId = heel.getId();
            }
            else {
                assertEquals(heel.getId(), heelId);
            }
            assertEquals(heel.getChildren().size(), 1);
            assertEquals(heel.getChildren().get(0).getName(), "heel");
        }
    }
View Full Code Here

        contentList.add(contentB);
        contentList.add(contentC);
        contentList.add(contentA);

        PathNode location = v3extensionUtil.makePathTree(contentList,
            v3extensionUtil.new PathNode());

        assertEquals(3, location.getChildren().size(), 3);
        assertEquals("AAA", location.getChildren().get(0).getName());
        assertEquals("BBB", location.getChildren().get(1).getName());
        assertEquals("CCC", location.getChildren().get(2).getName());
    }
View Full Code Here

        contentList.add(cont);
        cont = new org.candlepin.json.model.Content();
        cont.setPath("/head/neck/shoulders/chest/torso/leg");
        contentList.add(cont);

        PathNode location = v3extensionUtil.makePathTree(contentList,
            v3extensionUtil.new PathNode());
        List<String> nodeStrings = v3extensionUtil.orderStrings(location);
        assertEquals(nodeStrings.size(), 48);
        // frequency sorted
        assertEquals(nodeStrings.get(46), "foot");
        assertEquals(nodeStrings.get(47), "leg");
View Full Code Here

TOP

Related Classes of org.candlepin.util.X509V3ExtensionUtil.PathNode

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.