Examples of ConfigurationNode


Examples of org.apache.commons.configuration.tree.ConfigurationNode

     *
     * @param p the node pointer to test
     */
    private void checkIterators(NodePointer p)
    {
        ConfigurationNode node = (ConfigurationNode) p.getNode();
        NodeIterator it = p.childIterator(null, false, null);
        assertEquals("Iterator count differs from children count", node
                .getChildrenCount(), iteratorSize(it));

        for (int index = 1; it.setPosition(index); index++)
        {
            NodePointer pchild = it.getNodePointer();
            assertEquals("Wrong child", node.getChild(index - 1), pchild
                    .getNode());
            checkIterators(pchild);
        }

        it = p.attributeIterator(new QName(null, "*"));
        assertEquals("Iterator count differs from attribute count", node
                .getAttributeCount(), iteratorSize(it));
        for (int index = 1; it.setPosition(index); index++)
        {
            NodePointer pattr = it.getNodePointer();
            assertTrue("Node pointer is no attribute", pattr.isAttribute());
            assertEquals("Wrong attribute", node.getAttribute(index - 1), pattr
                    .getNode());
            checkIterators(pattr);
        }
    }
View Full Code Here

Examples of org.apache.commons.configuration.tree.ConfigurationNode

    /**
     * Tests nodeKey() for an attribute node.
     */
    public void testNodeKeyAttribute()
    {
        ConfigurationNode node = new DefaultConfigurationNode("attr");
        node.setAttribute(true);
        assertEquals("Wrong attribute key", "node@attr", engine.nodeKey(node,
                "node"));
    }
View Full Code Here

Examples of org.apache.commons.configuration.tree.ConfigurationNode

    /**
     * Tests node key() for direct children of the root node.
     */
    public void testNodeKeyForRootChild()
    {
        ConfigurationNode node = new DefaultConfigurationNode("child");
        assertEquals("Wrong key for root child node", "child", engine.nodeKey(
                node, ""));
        node.setAttribute(true);
        assertEquals("Wrong key for root attribute", "@child", engine.nodeKey(
                node, ""));
    }
View Full Code Here

Examples of org.apache.commons.configuration.tree.ConfigurationNode

     * @param levels the number of levels in the hierarchy
     * @return the root node of the hierarchy
     */
    protected ConfigurationNode constructHierarchy(int levels)
    {
        ConfigurationNode result = new DefaultConfigurationNode();
        createLevel(result, levels);
        return result;
    }
View Full Code Here

Examples of org.apache.commons.configuration.tree.ConfigurationNode

            String prefix = (parent.getValue() == null) ? "" : parent
                    .getValue()
                    + ".";
            for (int i = 1; i <= CHILD_COUNT; i++)
            {
                ConfigurationNode child = new DefaultConfigurationNode(
                        (i % 2 == 0) ? CHILD_NAME1 : CHILD_NAME2, prefix + i);
                parent.addChild(child);
                child.addAttribute(new DefaultConfigurationNode(ATTR_NAME,
                        String.valueOf(i)));

                createLevel(child, level - 1);
            }
        }
View Full Code Here

Examples of org.apache.commons.configuration.tree.ConfigurationNode

        List nodes = iterationElements(it);
        assertEquals("Wrong size of iteration", CHILD_COUNT - 3, nodes.size());
        int index = 4;
        for (Iterator it2 = nodes.iterator(); it2.hasNext(); index++)
        {
            ConfigurationNode node = (ConfigurationNode) it2.next();
            assertEquals("Wrong node value", String.valueOf(index), node
                    .getValue());
        }
    }
View Full Code Here

Examples of org.apache.commons.configuration.tree.ConfigurationNode

        ConfigurationNodeIteratorChildren it = new ConfigurationNodeIteratorChildren(
                rootPointer, null, true, childPointer);
        int value = 3;
        for (int index = 1; it.setPosition(index); index++, value--)
        {
            ConfigurationNode node = (ConfigurationNode) it.getNodePointer()
                    .getNode();
            assertEquals("Incorrect value at index " + index, String
                    .valueOf(value), node.getValue());
        }
        assertEquals("Iteration ended not at end node", 0, value);
    }
View Full Code Here

Examples of org.apache.commons.configuration.tree.ConfigurationNode

                new DefaultConfigurationNode("newNode"));
        ConfigurationNodeIteratorChildren it = new ConfigurationNodeIteratorChildren(
                rootPointer, null, false, childPointer);
        assertEquals("Wrong size of iteration", CHILD_COUNT, iteratorSize(it));
        it.setPosition(1);
        ConfigurationNode node = (ConfigurationNode) it.getNodePointer()
                .getNode();
        assertEquals("Wrong start node", "1", node.getValue());
    }
View Full Code Here

Examples of org.apache.commons.configuration.tree.ConfigurationNode

    private void checkValues(NodeIterator iterator, int[] expectedIndices)
    {
        List nodes = iterationElements(iterator);
        for (int i = 0; i < expectedIndices.length; i++)
        {
            ConfigurationNode child = (ConfigurationNode) nodes.get(i);
            assertTrue("Wrong index value for child " + i, child.getValue()
                    .toString().endsWith(String.valueOf(expectedIndices[i])));
        }
    }
View Full Code Here

Examples of org.apache.manifoldcf.core.interfaces.ConfigurationNode

   *@param os is the current output specification for this job.
   *@return null if all is well, or a string error message if there is an error that should prevent saving of the job (and cause a redirection to an error page).
   */
  @Override
  public String processSpecificationPost(IPostParameters variableContext, Locale locale, OutputSpecification os) throws ManifoldCFException {
    ConfigurationNode specNode = getSpecNode(os);
    boolean bAdd = (specNode == null);
    if (bAdd) {
      specNode = new SpecificationNode(FileOutputConstant.PARAM_ROOTPATH);
    }
    FileOutputSpecs.contextToSpecNode(variableContext, specNode);
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.