alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 *
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 *
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun
 * Microsystems, Inc. All Rights Reserved.
 */
package org.netbeans.modules.xml.core.settings;

import junit.textui.TestRunner;
import org.openide.options.SystemOption;
import org.netbeans.tests.xml.XTest;

/**
 * ToDo Check:
 * Options > Editing > XML > * settings
 * Options > Editing > Editor Settings > (DTD, XML, CSS) Editor settings
 * Options > Editing > Indentation Engine settings
 * Options > IDE Configuration > Look and Feel > Actions > XML
 * Options > IDE Configuration > Menu Bar > Help > Help Sets > XML support ???
 * Options > System > Object Types >  (DTD, CSS, XML)
 * Options > Source Creation and Management > Templaes > XML & DTD > * ???
 * @author  ms113234
 *
 */
public class CoreSettingsTest extends XTest {
    private static final String CORE_SETTINGS = "org.netbeans.modules.xml.core.settings.CoreSettings";
    
    /** Creates new CoreSettingsTest */
    public CoreSettingsTest(String testName) {
        super(testName);
    }
    
    public void testSystemOptions() throws Exception {
        SystemOptionTest test = new SystemOptionTest();
        ref(test.testSystemOption(CORE_SETTINGS));
        compareReferenceFiles();
    }
    
    public void testDefaultSettings() throws Exception {
        // get option
        Class clazz = Class.forName(CORE_SETTINGS);
        CoreSettings settings = (CoreSettings) SystemOption.findObject(clazz, true);
        
        // change settings
        int def = settings.getAutoParsingDelay();
        settings.setAutoParsingDelay(2*def);
        assertEquals("Invalid setting AutoParsingDelay", settings.getAutoParsingDelay(), 2*def);
        
        /* FIXME - throws NoClassDefFoundError
        // reinstall module
        TestUtil.switchModule(TestUtil.CORE_PACKAGE, false);
        //try {Thread.currentThread().sleep(5000);} catch (Exception e) {}; //!!! hack
        TestUtil.switchAllXMLModules(true);
         
        // check restoreed setting
        assertEquals("Invalid setting AutoParsingDelay", settings.getAutoParsingDelay(), 2*def);
         */
        
        // set default setting
        settings.setAutoParsingDelay(def);
    }
    
    /**
     * Performs this testsuite.
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        TestRunner.run(CoreSettingsTest.class);
    }
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.