Examples of dumpAsMap()


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

        ov.setValues(prop2values);
        ov.setPossible(props);

        Yaml dumper = new Yaml();
        String dumpedStr = dumper.dumpAsMap(ov);
        Yaml loader = new Yaml();
        ObjectValuesWithParam<String, Integer> ov2 = loader.loadAs(dumpedStr,
                new ObjectValuesWithParam<String, Integer>().getClass());

        assertEquals(ov.getObject(), ov2.getObject());
View Full Code Here

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

        List<Developer> developers = new ArrayList<Developer>();
        developers.add(new Developer("Fred", "creator"));
        developers.add(new Developer("John", "committer"));
        bean.setDevelopers(developers);
        Yaml yaml = new Yaml();
        String output = yaml.dumpAsMap(bean);
        // System.out.println(output);
        String etalon = Util.getLocalResource("examples/list-bean-4.yaml");
        assertEquals(etalon, output);
    }
View Full Code Here

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

        List<Human> developers = new ArrayList<Human>();
        developers.add(new Developer("Fred", "creator"));
        developers.add(new Committer("John", "committer", 34));
        bean.setDevelopers(developers);
        Yaml yaml = new Yaml();
        String output = yaml.dumpAsMap(bean);
        // System.out.println(output);
        String etalon = Util.getLocalResource("examples/list-bean-2.yaml");
        assertEquals(etalon, output);
    }
View Full Code Here

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

        Properties props = new Properties();
        props.setProperty("key1", "value1");
        props.setProperty("key2", "value2");
        bean.setProperties(props);
        Yaml yaml = new Yaml();
        String output = yaml.dumpAsMap(bean);
        // System.out.println(output);
        String etalon = Util.getLocalResource("examples/map-bean-1.yaml");
        assertEquals(etalon, output);
    }
View Full Code Here

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

        Yaml loader = new Yaml();
        Invoice invoice = loader.loadAs(Util.getLocalResource("specification/example2_27.yaml"),
                Invoice.class);
        Yaml dumper = new Yaml();
        long time1 = System.nanoTime();
        dumper.dumpAsMap(invoice);
        long time2 = System.nanoTime();
        float duration = (time2 - time1) / 1000000;
        System.out.println("\nSingle dump was " + duration + " ms.");

        int[] range = new int[] { 1000, 2000 /* , 8000 */};
 
View Full Code Here

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

        System.out.println("\nMany instances.");
        for (int number : range) {
            time1 = System.nanoTime();
            for (int i = 0; i < number; i++) {
                dumper = new Yaml();
                dumper.dumpAsMap(invoice);
            }
            time2 = System.nanoTime();
            duration = ((time2 - time1) / 1000000) / (float) number;
            System.out.println("Duration for r=" + number + " was " + duration + " ms/dump.");
            // cobertura may make it very slow
View Full Code Here

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

        MyCompositeObject obj = (MyCompositeObject) yamlParser.load(getInput());
        check(obj);

        // dump the object
        Yaml yaml = new Yaml();
        String output = yaml.dumpAsMap(obj);
        assertEquals(Util.getLocalResource("issues/issue112-2.yaml"), output);
    }

    @Test
    public void testJavaBeanLoader() throws IOException {
View Full Code Here

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

public class CollectionTest extends TestCase {

    public void testCollectionList() {
        CollectionList bean = new CollectionList();
        Yaml yaml = new Yaml();
        String doc = yaml.dumpAsMap(bean);
        // System.out.println(doc);
        Yaml beanLoader = new Yaml();
        CollectionList parsed = beanLoader.loadAs(doc, CollectionList.class);
        assertTrue(parsed.getNames().contains("aaa"));
        assertTrue(parsed.getNames().contains("bbb"));
View Full Code Here

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

    }

    public void testCollectionSet() {
        CollectionSet bean = new CollectionSet();
        Yaml yaml = new Yaml();
        String doc = yaml.dumpAsMap(bean);
        // System.out.println(doc);
        Yaml beanLoader = new Yaml();
        CollectionSet parsed = beanLoader.loadAs(doc, CollectionSet.class);
        assertTrue(parsed.getRoles().contains(11));
        assertTrue(parsed.getRoles().contains(13));
View Full Code Here

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

    public void testEmitNoTags() {
        TestObject result = parseObject(Util.getLocalResource("ruby/ruby1.yaml"));
        DumperOptions options = new DumperOptions();
        options.setExplicitStart(true);
        Yaml yaml2 = new Yaml(options);
        String output = yaml2.dumpAsMap(result);
        assertFalse("No tags expected.", output.contains("Sub1"));
        // System.out.println(output);
        // parse back. Without tags it shall still work
        Yaml beanLoader = new Yaml();
        TestObject result2 = beanLoader.loadAs(output, TestObject.class);
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.