Package org.yaml.snakeyaml

Examples of org.yaml.snakeyaml.Yaml.compose()


    }

    @Override
    public void load(Reader in) throws ConfigurationException {
        Yaml yaml = new Yaml();
        org.yaml.snakeyaml.nodes.Node node = yaml.compose(in);
        Node root = new Node();
        build(node, root);
        setRootNode(root);
    }
View Full Code Here


            longEscURI = longEscURI + longEscURI;
        }
        assertEquals(1024 * 3, longEscURI.length());
        String yaml = "!" + longEscURI + " www";

        Node node = loader.compose(new StringReader(yaml));
        ScalarNode scalar = (ScalarNode) node;
        String etalon = "!";
        for (int i = 0; i < 1024; i++) {
            etalon += "A";
        }
View Full Code Here

        //
        Node node = yaml.represent(list);
        // System.out.println(node);
        assertEquals(
                "Representation tree from an object and from its YAML document must be the same.",
                yaml.compose(new StringReader(etalon)).toString(), node.toString());
        //
        List<Event> events = yaml.serialize(node);
        int i = 0;
        for (Event etalonEvent : yaml.parse(new StringReader(etalon))) {
            Event ev1 = events.get(i++);
View Full Code Here

public class ComposerImplTest extends TestCase {

    public void testGetNode() {
        String data = "american:\n  - Boston Red Sox";
        Yaml yaml = new Yaml();
        Node node = yaml.compose(new StringReader(data));
        assertNotNull(node);
        assertTrue(node instanceof MappingNode);
        String data2 = "---\namerican:\n- Boston Red Sox";
        Node node2 = yaml.compose(new StringReader(data2));
        assertNotNull(node2);
View Full Code Here

        Yaml yaml = new Yaml();
        Node node = yaml.compose(new StringReader(data));
        assertNotNull(node);
        assertTrue(node instanceof MappingNode);
        String data2 = "---\namerican:\n- Boston Red Sox";
        Node node2 = yaml.compose(new StringReader(data2));
        assertNotNull(node2);
        assertFalse(node.equals(node2));
    }

    public void testComposeBean() {
View Full Code Here

    }

    public void testComposeBean() {
        String data = "!!org.yaml.snakeyaml.composer.ComposerImplTest$BeanToCompose {name: Bill, age: 18}";
        Yaml yaml = new Yaml();
        Node node = yaml.compose(new StringReader(data));
        assertNotNull(node);
        assertTrue(node instanceof MappingNode);
        assertEquals(
                "tag:yaml.org,2002:org.yaml.snakeyaml.composer.ComposerImplTest$BeanToCompose",
                node.getTag().getValue());
View Full Code Here

            return mockInclude(node);
        }
        else if (resourceName.endsWith(".raml") || resourceName.endsWith(".yaml") || resourceName.endsWith(".yml"))
        {
            Yaml yamlParser = new Yaml();
            includeNode = yamlParser.compose(new InputStreamReader(inputStream));
        }
        else //scalar value
        {
            //String newValue = IOUtils.toString(inputStream);
            String newValue = StreamUtils.toString(inputStream);
View Full Code Here

        long startTime = currentTimeMillis();

        try
        {
            Yaml yamlParser = new Yaml();
            Node root = yamlParser.compose(content);
            if (root != null && root.getNodeId() == mapping)
            {
                validate((MappingNode) root, resourceLocation);
            }
            else
View Full Code Here

            return result;
        }
        Yaml yamlParser = new Yaml();
        NodeVisitor nodeVisitor = new NodeVisitor(this, new DefaultResourceLoader());
        MappingNode rootNode = null;
        Node compose = yamlParser.compose(new StringReader(suggestRaml));
        if (compose != null && compose.getNodeId() == NodeId.mapping)
        {
            rootNode = (MappingNode) compose;
        }
        nodeVisitor.visitDocument(rootNode);
View Full Code Here

    {
        try
        {
            Yaml yamlParser = new Yaml();
            NodeVisitor nodeVisitor = new NodeVisitor(this, resourceLoader, tagResolvers);
            rootNode = (MappingNode) yamlParser.compose(content);
            contextPath.pushRoot(resourceLocation);
            preBuildProcess();
            nodeVisitor.visitDocument(rootNode);
            postBuildProcess();
            return documentObject;
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.