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

/*
 * DataObjectTest_manipulation.java
 *
 * Tests ...
 *
 * Created on June 26, 2001, 3:39 PM
 */

package DataLoaderTests.DataObjectTest;

import junit.framework.*;
import org.netbeans.junit.*;

public class DataObjectTest_manipulation extends NbTestCase {
    
    /** Creates new DataObjectTest_manipulation */
    public DataObjectTest_manipulation(java.lang.String testName) {
        super(testName);
    }
    
    /**Allows this test to be executed inside ide*/
    public static void main(java.lang.String[] args) {
        junit.textui.TestRunner.run(suite());
    }
    
     /**This suite*/
    public static Test suite() {
        NbTestSuite suite = new NbTestSuite(DataObjectTest_manipulation.class);
        return suite;
    }    
    
//     boolean successful = true;
     DataObjectTest DOT = null;
    

    /**
     *Performs initializing before own tests starts
     */
     void prepare() {
        try {
            //when not in XTest harness -> woring directory will be under actual userdir
//            if (Manager.getWorkDirPath()==null) System.setProperty("nbjunit.workdir",System.getProperty("netbeans.user"));
            //clearWorkDir();
//            String newname = NAME.substring(NAME.lastIndexOf('/')+1,((NAME.lastIndexOf('.')==-1)?NAME.length():NAME.lastIndexOf('.')));
            DOT = new DataObjectTest(getName());
            System.out.println("Name: " + DOT.getName());
  //          successful = true;
            //next condition removes the last dot from folder
            if (NAME.endsWith(".")) {
                NAME = NAME.substring(0,NAME.length()-1);
            }
            DOT.prepare();
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace(getRef());
            assertTrue("Initialization of test failed! ->" + e,false);
        }
    }
    
    /**
     *Performs clean up
     */
     void clean() {
        DOT.clean();
    }
    
    /**
     *Performs waiting of current thread for time in millis
     *@param millist integer number - time in millis to wait
     */
     void dummyWait(int millis) {
        try {
            Thread.sleep(millis);
        } catch (Exception ex) {
            DOT.printException(ex);
        }
    }
    
    /**Own test:
     *
     */
    public void testDOManipulation() throws Exception {

            prepare();
            log("dataDir " + getDataDir());
//            org.openide.filesystems.FileObject fo = DOT.rep.findResource(new DataObjectTest("x").getClass().getPackage().getName().replace('.','/')
//                                                                                  + NAME);
  //          org.openide.loaders.DataObject testedDO = org.openide.loaders.DataObject.find(fo);
            log("resource:" + NAME);
            DOT.checkManipulationOperations(DataObjectTest.findResource(NAME));
            clean();
            //do not forget to merge the results!
//            successful = successful && DOT.successful;
//            System.out.println("\n" + successful );
   
        assertTrue("Manipulation test failed!",DOT.successful);                
    }
    
    //if you want print exceptions into log file, put here true.
    public static final boolean PRINT_EXCEPTIONS = true;
    
    public static final String PASSED = "passed.\n";
    public static final String FAILED = "failed.\n";
    
    protected  String NAME = "/DataObjects/JavaSourceObject.java";//null;
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 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.