Examples of DefaultJDOMFactory


Examples of org.jdom.input.DefaultJDOMFactory

    /**
     * Test getChildren with skip elements.
     */
    public void testGetChildrenSkipElements() {
        JDOMFactory factory = new DefaultJDOMFactory();
        Element parent1 = factory.element("parent1");
        Element child1a = factory.element("child1a");
        Element child2a = factory.element("child2a");
        parent1.addContent(child1a);
        parent1.addContent(child2a);

        Element parent2 = factory.element("parent2");
        Element child1b = factory.element("child1b");
        Element child2b = factory.element("child2b");
        parent2.addContent(child1b);
        parent2.addContent(child2b);

        Element root = factory.element("root");
        root.addContent(parent1);
        root.addContent(parent2);

        // Test that parent1 is skipped but parent2 is not.
        String [] skipElements = { parent1.getName() };
View Full Code Here

Examples of org.jdom.input.DefaultJDOMFactory

    /**
     * Test getChildren() with both stop and skip elements at the same
     * time.
     */
    public void testGetChildrenSkipAndStopElements() {
        JDOMFactory factory = new DefaultJDOMFactory();
        Element parent1 = factory.element("parent1");
        Element child1a = factory.element("child1a");
        Element child2a = factory.element("child2a");
        parent1.addContent(child1a);
        parent1.addContent(child2a);

        Element parent2 = factory.element("parent2");
        Element child1b = factory.element("child1b");
        Element child2b = factory.element("child2b");
        parent2.addContent(child1b);
        parent2.addContent(child2b);

        Element root = factory.element("root");
        root.addContent(parent1);
        root.addContent(parent2);

        Attribute rootAttr1 = factory.attribute("rootAttr1", "value");
        Attribute parentAttr1 = factory.attribute("parentAttr1", "value");

        root.setAttribute(rootAttr1);
        parent1.setAttribute(parentAttr1);

        // Skip both parents.
View Full Code Here

Examples of org.jdom.input.DefaultJDOMFactory

     * Test that getChildren() sorts returned elements and attributes
     * as required i.e. all attributes must come before all elements and
     * both elements and attributes must be ordered alphabetically.
     */
    public void testGetChildrenSorting() {
        JDOMFactory factory = new DefaultJDOMFactory();
        Element parent1 = factory.element("parent1");
        Element child1a = factory.element("child1a");
        Element child2a = factory.element("child2a");
        parent1.addContent(child2a);
        parent1.addContent(child1a);

        Element parent2 = factory.element("parent2");
        Element child1b = factory.element("child1b");
        Element child2b = factory.element("child2b");
        parent2.addContent(child1b);
        parent2.addContent(child2b);

        Element root = factory.element("root");
        root.addContent(parent2);
        root.addContent(parent1);

        Attribute rootAttr1 = factory.attribute("rootAttr1", "value");
        Attribute rootAttr2 = factory.attribute("rootAttr2", "value");
        Attribute parentAttr1 = factory.attribute("parentAttr1", "value");

        root.setAttribute(rootAttr2);
        root.setAttribute(rootAttr1);
        parent1.setAttribute(parentAttr1);

View Full Code Here

Examples of org.jdom.input.DefaultJDOMFactory

    /**
     * Test getElements() when the root element should be displayed.
     */
    public void testGetElementsProvideRoot() {
        JDOMFactory factory = new DefaultJDOMFactory();
        Element parent1 = factory.element("parent1");
        Element child1a = factory.element("child1a");
        Element child2a = factory.element("child2a");
        parent1.addContent(child2a);
        parent1.addContent(child1a);

        Element parent2 = factory.element("parent2");
        Element child1b = factory.element("child1b");
        Element child2b = factory.element("child2b");
        parent2.addContent(child1b);
        parent2.addContent(child2b);

        Element root = factory.element("root");
        root.addContent(parent2);
        root.addContent(parent1);


        ElementChildrenTreeContentProvider provider =
View Full Code Here

Examples of org.jdom.input.DefaultJDOMFactory

    /**
     * Test getElements() when the root element should not be displayed.
     */
    public void testGetElementsNoRoot() {
        JDOMFactory factory = new DefaultJDOMFactory();
        Element parent1 = factory.element("parent1");
        Element child1a = factory.element("child1a");
        Element child2a = factory.element("child2a");
        parent1.addContent(child2a);
        parent1.addContent(child1a);

        Element parent2 = factory.element("parent2");
        Element child1b = factory.element("child1b");
        Element child2b = factory.element("child2b");
        parent2.addContent(child1b);
        parent2.addContent(child2b);

        Element root = factory.element("root");
        root.addContent(parent2);
        root.addContent(parent1);

        ElementChildrenTreeContentProvider provider =
                new ElementChildrenTreeContentProvider(null, null, true, false);
View Full Code Here

Examples of org.jdom.input.DefaultJDOMFactory

                DeviceRepositoryAccessorManager manager =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                new DefaultJDOMFactory(), false);

                String rootDeviceName = manager.retrieveRootDeviceName();
                assertEquals("The root device name is not Master.", "Master",
                        rootDeviceName);
            }
View Full Code Here

Examples of org.jdom.input.DefaultJDOMFactory

            public void execute(File repository) throws Exception {
                DeviceRepositoryAccessorManager manager =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                new DefaultJDOMFactory(), false);
                final String deviceName = "MyTestDevice";

                assertFalse("Test device already exists!",
                            manager.deviceExists(deviceName));
View Full Code Here

Examples of org.jdom.input.DefaultJDOMFactory

                DeviceRepositoryAccessorManager manager =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                new DefaultJDOMFactory(), false);

                assertTrue("Expected the \"PC\" device to exist.",
                        manager.deviceExists("PC"));
                assertFalse("Expected the \"FantasicAmazingDevice\" device to not exist.",
                        manager.deviceExists("FantasticAmazingDevice"));
View Full Code Here

Examples of org.jdom.input.DefaultJDOMFactory

                DeviceRepositoryAccessorManager manager =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                new DefaultJDOMFactory(), false);

                assertEquals("Unexpected device repository name.",
                        repository.getPath(), manager.getDeviceRepositoryName());
            }
        });
View Full Code Here

Examples of org.jdom.input.DefaultJDOMFactory

                DeviceRepositoryAccessorManager manager =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                new DefaultJDOMFactory(), false);

                try {
                    manager.getLocalizedPolicyName(null);
                    fail("Expected an IllegalArgumentException");
                } catch (IllegalArgumentException e) {
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.