Package hudson

Examples of hudson.XmlFile


        getConfigFile().write(this);
        SaveableListener.fireOnChange(this, getConfigFile());
    }

    public synchronized boolean load() throws IOException {
        XmlFile config = getConfigFile();
        if (config != null && config.exists()) {
            config.unmarshal(this);
            return true;
        }
        return false;

View Full Code Here



    }

    protected final XmlFile getConfigFile() {
        return new XmlFile(XSTREAM, new File(getRootDir(), name + "/config.xml"));
    }
View Full Code Here

    String oldDescription = implementation.getDescription();
    boolean oldDisabled = implementation.isDisabled();
        Map<TriggerDescriptor, Trigger> oldTriggers = implementation.getTriggers();

        XmlFile implementationXmlFile = replaceConfig(template, implementation, propertiesMap);
    refreshAndSave(template, implementationBuildWrapper, implementationXmlFile, oldDescription, oldDisabled, oldTriggers);
  }
View Full Code Here

    return patternPairsBuilder.build();
  }

  private static XmlFile replaceConfig(AbstractProject template, AbstractProject implementation, Map<Pattern, String> propertiesMap) throws IOException {
    XmlFile implementationXmlFile = implementation.getConfigFile();
    File implementationFile = implementationXmlFile.getFile();

    assert template.getConfigFile() != null : "template config file shouldn't be null";

    InputStream templateFileStream = new FileInputStream(template.getConfigFile().getFile());
    try {
View Full Code Here

    /**
     * The file we save our configuration.
     */
    private XmlFile getConfigFile() {
        return new XmlFile(XSTREAM, new File(root,"config.xml"));
    }
View Full Code Here

            public void run(Reactor session) throws Exception {
                // JENKINS-8043: some slaves (eg. swarm slaves) are not saved into the config file
                // and will get overwritten when reloading. Make a backup copy now, and re-add them later
                NodeList oldSlaves = slaves;
               
                XmlFile cfg = getConfigFile();
                if (cfg.exists()) {
                    // reset some data that may not exist in the disk file
                    // so that we can take a proper compensation action later.
                    primaryView = null;
                    views.clear();

                    // load from disk
                    cfg.unmarshal(Jenkins.this);
                }

                // if we are loading old data that doesn't have this field
                if (slaves == null) slaves = new NodeList();
View Full Code Here

     * XML prior to the test code refactoring.
     *
     * @throws Exception
     */
    public void testXmlCompatibility() throws Exception {
        XmlFile xmlFile = new XmlFile(XSTREAM, getDataFile("junitResult.xml"));
        TestResult result = (TestResult)xmlFile.read();

        // Regenerate the transient data
        result.tally();
        assertEquals(9, result.getTotalCount());
        assertEquals(1, result.getSkipCount());
View Full Code Here

    public void testSuiteResultPersistence() throws Exception {
        SuiteResult source = parseOne(getDataFile("junit-report-1233.xml"));

        File dest = File.createTempFile("testSuiteResultPersistence", ".xml");
        try {
            XmlFile xmlFile = new XmlFile(dest);
            xmlFile.write(source);

            SuiteResult result = (SuiteResult)xmlFile.read();
            assertNotNull(result);

            assertEquals(source.getName(), result.getName());
            assertEquals(source.getTimestamp(), result.getTimestamp());
            assertEquals(source.getDuration(), result.getDuration());
View Full Code Here

        Foo foo = new Foo();
        foo.m.put("abc","def");
        foo.m.put("ghi","jkl");
        File v = File.createTempFile("hashmap", "xml");
        try {
            new XmlFile(v).write(foo);

            // should serialize like map
            String xml = FileUtils.readFileToString(v);
            assertFalse(xml.contains("java.util.concurrent"));
            //System.out.println(xml);
View Full Code Here

    public void testSerialization() throws Exception {
        NodeList nl = new NodeList(new DummyNode(), new EphemeralNode());

        File tmp = File.createTempFile("test","test");
        try {
            XmlFile x = new XmlFile(Jenkins.XSTREAM, tmp);
            x.write(nl);

            String xml = FileUtils.readFileToString(tmp);
            System.out.println(xml);
            assertEquals(6,xml.split("\n").length);

            NodeList back = (NodeList)x.read();

            assertEquals(1,back.size());
            assertEquals(DummyNode.class,back.get(0).getClass());
        } finally {
            tmp.delete();
View Full Code Here

TOP

Related Classes of hudson.XmlFile

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.