Package org.gradle.gradleplugin.foundation.settings

Examples of org.gradle.gradleplugin.foundation.settings.SettingsNode


        //now try it with one that doesn't exist. We should get the default value
        assertEquals("default4", rootNode.getValueOfChild("nonexistent", "default4"));

        //now add a single node but don't give it a value (which means its null)
        SettingsNode lastNode = rootNode.addChild("valueless");
        assertNull(lastNode.getValue());

        //now try to get its value. We should get the default value
        assertEquals("default5", rootNode.getValueOfChild("valueless", "default5"));
    }
View Full Code Here


        //set the value of a child
        rootNode.setValueOfChildAsInt(SAMPLE_NAME_1, 8);

        //verify it was set properly
        SettingsNode childNode1 = rootNode.getChildNode(SAMPLE_NAME_1);
        assertNotNull(childNode1);
        assertEquals("8", childNode1.getValue());

        //make sure there's only 1 child.
        children = rootNode.getChildNodes();
        assertEquals(1, children.size());

        //set the value again. This should set the value and NOT add an additional node
        rootNode.setValueOfChildAsInt(SAMPLE_NAME_1, 39);
        childNode1 = rootNode.getChildNode(SAMPLE_NAME_1);
        assertNotNull(childNode1);
        assertEquals("39", childNode1.getValue());

        //make sure there's still only 1 child.
        children = rootNode.getChildNodes();
        assertEquals(1, children.size());
    }
View Full Code Here

        //now try it with one that doesn't exist. We should get the default value
        assertEquals(44, rootNode.getValueOfChildAsInt("nonexistent", 44));

        //now add a single node but don't give it a value (which means its null)
        SettingsNode valuelessNode = rootNode.addChild("valueless");
        assertNull(valuelessNode.getValue());

        //now try to get its value. We should get the default value
        assertEquals(17, rootNode.getValueOfChildAsInt("valueless", 17));

        //now add a single node that has an illegal value
        SettingsNode illegalNode = rootNode.addChild("illegal");
        illegalNode.setValue("abcdefg");

        //now try to get its value. We should get the default value
        assertEquals(333, rootNode.getValueOfChildAsInt("illegal", 333));
    }
View Full Code Here

        //set the value of a child
        rootNode.setValueOfChildAsLong(SAMPLE_NAME_1, 8000000000l);

        //verify it was set properly
        SettingsNode childNode1 = rootNode.getChildNode(SAMPLE_NAME_1);
        assertNotNull(childNode1);
        assertEquals("8000000000", childNode1.getValue());

        //make sure there's only 1 child.
        children = rootNode.getChildNodes();
        assertEquals(1, children.size());

        //set the value again. This should set the value and NOT add an additional node
        rootNode.setValueOfChildAsLong(SAMPLE_NAME_1, 3900000000l);
        childNode1 = rootNode.getChildNode(SAMPLE_NAME_1);
        assertNotNull(childNode1);
        assertEquals("3900000000", childNode1.getValue());

        //make sure there's still only 1 child.
        children = rootNode.getChildNodes();
        assertEquals(1, children.size());
    }
View Full Code Here

        //now try it with one that doesn't exist. We should get the default value
        assertEquals(4400000000l, rootNode.getValueOfChildAsLong("nonexistent", 4400000000l));

        //now add a single node but don't give it a value (which means its null)
        SettingsNode valuelessNode = rootNode.addChild("valueless");
        assertNull(valuelessNode.getValue());

        //now try to get its value. We should get the default value
        assertEquals(1700000000l, rootNode.getValueOfChildAsLong("valueless", 1700000000l));

        //now add a single node that has an illegal value
        SettingsNode illegalNode = rootNode.addChild("illegal");
        illegalNode.setValue("abcdefg");

        //now try to get its value. We should get the default value
        assertEquals(33300000000l, rootNode.getValueOfChildAsLong("illegal", 33300000000l));
    }
View Full Code Here

        //set the value of a child
        rootNode.setValueOfChildAsBoolean(SAMPLE_NAME_1, true);

        //verify it was set properly
        SettingsNode childNode1 = rootNode.getChildNode(SAMPLE_NAME_1);
        assertNotNull(childNode1);
        assertEquals("true", childNode1.getValue());

        //make sure there's only 1 child.
        children = rootNode.getChildNodes();
        assertEquals(1, children.size());

        //set the value again. This should set the value and NOT add an additional node
        rootNode.setValueOfChildAsBoolean(SAMPLE_NAME_1, false);
        childNode1 = rootNode.getChildNode(SAMPLE_NAME_1);
        assertNotNull(childNode1);
        assertEquals("false", childNode1.getValue());

        //make sure there's still only 1 child.
        children = rootNode.getChildNodes();
        assertEquals(1, children.size());

        //set the value again to the same value. Again, this should set the value and NOT add an additional node
        rootNode.setValueOfChildAsBoolean(SAMPLE_NAME_1, false);
        childNode1 = rootNode.getChildNode(SAMPLE_NAME_1);
        assertNotNull(childNode1);
        assertEquals("false", childNode1.getValue());

        //make sure there's still only 1 child.
        children = rootNode.getChildNodes();
        assertEquals(1, children.size());
    }
View Full Code Here

        //see header
        assertEquals(false, rootNode.getValueOfChildAsBoolean("nonexistent2", false));

        //now add a single node but don't give it a value (which means its null)
        SettingsNode valuelessNode = rootNode.addChild("valueless");
        assertNull(valuelessNode.getValue());

        //now try to get its value. We should get the default value
        assertEquals(true, rootNode.getValueOfChildAsBoolean("valueless", true));

        //see header
        assertEquals(false, rootNode.getValueOfChildAsBoolean("valueless", false));

        //now add a single node that has an illegal value
        SettingsNode illegalNode = rootNode.addChild("illegal");
        illegalNode.setValue("abcdefg");

        //now try to get its value. We should get the default value
        assertEquals(true, rootNode.getValueOfChildAsBoolean("illegal", true));

        //see header
View Full Code Here

        //add a listener so we can store the current tab when it changes.
        tabbedPane.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                int selection = tabbedPane.getSelectedIndex();
                if (selection >= 0 && selection < gradleTabs.size()) {
                    SettingsNode rootNode = settings.addChildIfNotPresent(MAIN_PANEL);
                    rootNode.setValueOfChild(CURRENT_TAB, gradleTabs.get(selection).getName());
                }
            }
        });
    }
View Full Code Here

            }
        } else //otherwise, try to get the last-used tab
            int lastTabIndex = -1;

            //all this is to just restore the last selected tab
            SettingsNode rootNode = settings.getChildNode(MAIN_PANEL);
            if (rootNode != null) {
                String lastTabName = rootNode.getValueOfChild(CURRENT_TAB, "");
                lastTabIndex = getGradleTabIndex(lastTabName);
            }

            if (lastTabIndex != -1) {
               tabbedPane.setSelectedIndex(lastTabIndex);
View Full Code Here

        assertNull(rootElement.element(SAMPLE_NAME_1));

        //as such, we shouldn't have one at the DOM4JSettingsNode level either.
        assertNull(rootNode.getChildNode(SAMPLE_NAME_1));

        SettingsNode settingsNode = rootNode.addChild(SAMPLE_NAME_1);
        assertNotNull(settingsNode);

        //and now it should be present under both.
        assertNotNull(Dom4JUtility.getChild(rootElement, DOM4JSettingsNode.TAG_NAME, DOM4JSettingsNode.NAME_ATTRIBUTE,
                SAMPLE_NAME_1));
View Full Code Here

TOP

Related Classes of org.gradle.gradleplugin.foundation.settings.SettingsNode

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.