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-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

/*
 * File EditNewFileInPropertyEditorAddProperty1.java
 *
 * Created on 19. brezen 2002, 11:07
 */

package org.netbeans.properties.jelly2tests.suites.editing_properties_file;

import java.io.File;
import junit.textui.TestRunner;
import org.netbeans.jellytools.JellyTestCase;
import org.netbeans.jellytools.nodes.FilesystemNode;
import org.netbeans.jemmy.EventTool;
import org.netbeans.junit.NbTestSuite;
import org.netbeans.properties.jelly2tests.operators.PropertiesEditorOperator;


/**
 *
 * @author  Petr Felenda - QA Engineer ( petr.felenda@sun.com )
 */
public class EditNewFileInPropertyEditorAddProperty1 extends JellyTestCase {
    
    
    /*
     * Definition of member variables and objects
     */
    private final String FILE_NAME = "testEditNewFileInPropertyEditorAddProperty1" ;
    private final String DIALOG_NEW_PROPERTY_NAME = "New Property";
    private final String BUTTON_NEW_PROPERTY_NAME = "New Property";
    private final String BUTTON_HELP = "Help";
    
    
     /*
      * Main method for starting test from IDE.
      * There must be mounted necessary jars in Filesystems ( in Explorer Window )
      * - jemmy.jar
      * - jelly2-nb.jar
      *  both jars have been downloaded from http://jellytools.netbeans.org
      *  @param String[] args - arguments are not processed
      */
    public static void main(String[] args) {
        
        NbTestSuite nbTestSuite = new NbTestSuite();
        nbTestSuite.addTest(new EditNewFileInPropertyEditorAddProperty1());
        TestRunner.run(nbTestSuite);
    }
    
    
    /**
     * Constructor - Creates new instance of this class
     */
    public EditNewFileInPropertyEditorAddProperty1() {
        super("testEditNewFileInPropertyEditorAddProperty1");
        
    }
    
    
    /**
     * This method contains body of test
     * @return void
     */
    public void testEditNewFileInPropertyEditorAddProperty1() throws Exception {
        
        // Print test description to the Output window
        System.out.println();
        System.out.println("===================================================================================");
        System.out.println("=   Test :  Edit new file in property editor - Add property 1                     =");
        System.out.println("=   See testspec of properties module on web :                                    =");
        System.out.println("=   http://properties.netbeans.org/qa/testspecs/nb34/PropertiesTestSpec.html      =");
        System.out.println("===================================================================================");
        
        /*
         * 1st step of testcase
         * (Open property file ) Use file from previous case.(empty properties file)
         */
        
        //create a node for the sampledir directory
        FilesystemNode filesystemNode = new FilesystemNode(
        System.getProperty( "xtest.workdir") +
        File.separator +
        "tmpdir");
        
        PropertiesEditorOperator propertiesEditorOperator = new PropertiesEditorOperator();
        propertiesEditorOperator.createNewPropertiesFile(filesystemNode, this.FILE_NAME);
        
        
        /*
         * 2nd step of testcase
         * Add new property. Push button 'New Property'.
         */
        propertiesEditorOperator.propertiesEditorClickNewPropertyButton(this.FILE_NAME);
        
        
        /*
         * 3th step of testcase
         * In appeared dialog open help Click to 'Help' button.
         */
        propertiesEditorOperator.newPropertyDialogClickHelpButton();
        new EventTool().waitNoEvent(4000);
        
        
        /*
         * 5th step of testcase
         * Close Help. Use cros in window border or close button.
         */
        propertiesEditorOperator.closeHelp();
        
        /*
         * 4th step of testcase
         * Type key, value and comment to appropriate places
         */
        propertiesEditorOperator.newPropertyDialogFill(this.FILE_NAME, "key1","value1","Comment of key1");        
                
        /*
         * 6th step of testcase
         * Confirm dialog. Push 'Ok' button.
         */
        propertiesEditorOperator.newPropertyDialogClickCloseButton();
        
        /*
         * Results
         */
        try {
            propertiesEditorOperator.checkPropertiesInSheet(this.FILE_NAME, "key1", "value1", "Comment of key1",1,1,1);
            propertiesEditorOperator.openExistedPropetiesFileInClassicEditor(filesystemNode,this.FILE_NAME);
            propertiesEditorOperator.checkPropertiesFileIntegrityInClassicEditor(this.FILE_NAME);
        } finally {
        /*
         * Cleanup
         */
            propertiesEditorOperator.deletePropertiesFileFromExplorer(filesystemNode,this.FILE_NAME);
        }
    }
    
    
    /*
     * This static method is used for starting test from xtest framwork
     * @return NBTestSuite - instace of test suite
     */
    public static NbTestSuite suite() {
        NbTestSuite suite = new NbTestSuite();
        suite.addTest(new EditNewFileInPropertyEditorAddProperty1());
        return suite;
    }
    
}
... 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.