|
What this is
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-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.test.java.gui.synchronization; import junit.textui.TestRunner; import org.netbeans.jellytools.Bundle; import org.netbeans.jellytools.JellyTestCase; import org.netbeans.jellytools.RepositoryTabOperator; import org.netbeans.jellytools.modules.java.SynchronizeOperator; import org.netbeans.jellytools.nodes.JavaNode; import org.netbeans.junit.NbTestSuite; import org.netbeans.modules.java.settings.JavaSynchronizationSettings; import org.netbeans.test.java.Utilities; import org.openide.src.ClassElement; import org.openide.src.Identifier; import org.openide.src.SourceException; public class SynchronizeDialog extends JellyTestCase { private static final String NAME_TEST_FILE = "TestFile"; private static final String NAME_DATA_DIR = "org/netbeans/test/java/gui/customizers/data/"; /** Need to be defined because of JUnit */ public SynchronizeDialog(String name) { super(name); } public static NbTestSuite suite() { NbTestSuite suite = new NbTestSuite(); suite.addTest(new SynchronizeDialog("testSynchronizeDialog")); return suite; } /** Use for execution inside IDE */ public static void main(java.lang.String[] args) { // run whole suite TestRunner.run(suite()); // run only selected test case //junit.textui.TestRunner.run(new BeansTemplates("testJavaBean")); } /** setUp method */ public void setUp() { System.out.println("######## "+getName()+" #######"); } /** tearDown method */ public void tearDown() { } private void synchronizeDialog() { setSync(false); try { ClassElement.forName("TestFile").setInterfaces(new Identifier[] {Identifier.create("java.lang.Runnable")}); } catch (SourceException e) { fail(e); } RepositoryTabOperator.invoke(); JavaNode testFile = new JavaNode(Utilities.getSampleDir().getDisplayName()+"|"+NAME_TEST_FILE); testFile.select(); testFile.performPopupActionNoBlock(Bundle.getString("org.openide.actions.Bundle", "CTL_Tools") + '|' + Bundle.getString("org.netbeans.modules.java.Bundle", "LAB_SynchronizeAction")); //customize it final SynchronizeOperator synchronize = new SynchronizeOperator(); synchronize.processAll(); setSync(true); } private void setSync(boolean mode) { JavaSynchronizationSettings jss = (JavaSynchronizationSettings) JavaSynchronizationSettings.findObject(JavaSynchronizationSettings.class, true); jss.setEnabled(mode); } public void testSynchronizeDialog() { //create test file Utilities.copyToSampleDir(NAME_DATA_DIR + NAME_TEST_FILE + ".java"); synchronizeDialog(); ref(Utilities.getAsString(NAME_TEST_FILE + ".java")); Utilities.saveAll(); Utilities.delete(NAME_TEST_FILE + ".java"); compareReferenceFiles(); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
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.