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

package gui.explorer;

//import java.awt.event.KeyEvent;
//import java.io.*;
//import java.io.File;
//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.io.InputStream;
//import java.io.OutputStream;
//import java.lang.reflect.InvocationTargetException;
//import java.lang.reflect.Method;
//import org.netbeans.jellytools.Bundle;
//import org.netbeans.jellytools.EditorOperator;
import org.netbeans.jellytools.JellyTestCase;
//import org.netbeans.jellytools.NbDialogOperator;
//import org.netbeans.jellytools.RepositoryTabOperator;
//import org.netbeans.jellytools.actions.Action;
//import org.netbeans.jellytools.actions.CopyAction;
//import org.netbeans.jellytools.actions.CutAction;
//import org.netbeans.jellytools.actions.DeleteAction;
//import org.netbeans.jellytools.actions.OpenAction;
//import org.netbeans.jellytools.nodes.Node;
//import org.netbeans.jellytools.nodes.RepositoryRootNode;
//import org.netbeans.jemmy.operators.JMenuItemOperator;
//import org.netbeans.jemmy.operators.JPopupMenuOperator;
//import org.netbeans.jemmy.operators.Operator;
//
///**
// *
// * @author  Jan Lahoda, Lukas Hasik
// */
public class CopyCutPasteRenameTest extends JellyTestCase {
// //declare variables
//        private String S_TESTCLASS;
//        private String S_TESTCLASS1;
//        private String S_TESTCLASS2;
//        private String S_TESTCLASSROOT;
//        private String S_TESTFORM1;
//        private String S_TESTFORM2;
//        private String S_TEST;
//        private String S_TESTPROPERTIES;
//        private String S_TESTTEXT;
//       
//        private String D_TESTCLASSROOT;
//        private String D_TARGET;
//        private String D_TESTCLASS;
//        private String D_TESTCLASS1;
//        private String D_TESTCLASS2;
//        private String D_TESTFORM1;
//        private String D_TESTFORM2;
//        
//        private String JAR_JARTESTCLASS;
//        private String JAR_TARGET;
//        private String D_JARTESTCLASS;
//    
//    /** Creates a new instance of CopyCutPasteRenameTest */
    public CopyCutPasteRenameTest(String name) {
        super(name);	
    }
//
//    private void init() {
//        try {   
//        S_TESTCLASS = getSrcDir() + "|org|test|TestClass";
//        S_TESTCLASS1 = getSrcDir() + "|org|test|TestClass1";
//        S_TESTCLASS2 = getSrcDir() + "|org|test|TestClass2";
//        S_TESTCLASSROOT = getSrcDir() + "|TestClassRoot";
//        S_TESTFORM1 = getSrcDir() + "|org|test|TestForm1";
//        S_TESTFORM2 = getSrcDir() + "|org|test|TestForm2";
//        S_TEST = getSrcDir() + "|org|test";
//        S_TESTPROPERTIES = getSrcDir() + "|org|test|TestProperties";
//        S_TESTTEXT = getSrcDir() + "|org|test|TestText";
//        
//        D_TESTCLASSROOT = getDest1Dir() + "|TestClassRoot";
//        D_TARGET = getDest1Dir() + "|org|target";
//        D_TESTCLASS = getDest1Dir() + "|org|target|TestClass";
//        D_TESTCLASS1 = getDest1Dir() + "|org|target|TestClass1";
//        D_TESTCLASS2 = getDest1Dir() + "|org|target|TestClass2";
//        D_TESTFORM1 = getDest1Dir() + "|org|target|TestForm1";
//        D_TESTFORM2 = getDest1Dir() + "|org|target|TestForm2";
//        
//        JAR_JARTESTCLASS = JAR_NAME + "|org|target|JarTestClass";
//        JAR_TARGET = JAR_NAME + "|org|target";
//        D_JARTESTCLASS = getDest1Dir() + "|org|target|JarTestClass";
//        } catch (IOException ioe) {
//            System.out.println("====================== problem in inicialization =========================");
//            ioe.printStackTrace();
//        }
//    }
//
//    private static final String SRC_NAME = "src";
//    private static final String DEST1_NAME = "dest1";
//    private static final String DEST2_NAME = "dest2";
//    private static final String JAR_NAME = "test.jar";
//
//    private boolean standalone = false;
//    private String  standaloneWorkdir = "";
//    
//    public File getWorkDir() throws IOException {
//        if (standalone)
//            return new File(getWorkDirPath());
//        else
//            return super.getWorkDir();
//    }
//    
//    /** it's not useful anymore
//     public String getWorkDirPath() throws IOException {
//        if (standalone)
//            return standaloneWorkdir;
//	else
//	    return super.getWorkDirPath();
//    }
//     */
//    
//    private File getSrcDir() throws IOException {
//        return new File(getWorkDir(), SRC_NAME);
//    }
//
//    private File getDest1Dir() throws IOException {
//        return new File(getWorkDir(), DEST1_NAME);
//    }
//    
//    private File getDest2Dir() throws IOException {
//        return new File(getWorkDir(), DEST2_NAME);
//    }
//    
//    private File getJarFile() throws IOException {
//        return new File(getWorkDir(), JAR_NAME);
//    }
//
//    private void copyFiles(String inResource, File outputFile) throws IOException {
//        InputStream in = null;
//        OutputStream out = null; 
//        
//        try {
//            in  = getClass().getResourceAsStream(inResource);
//            out = new FileOutputStream(outputFile);
//            int read;
//            
//            while ((read = in.read()) != (-1)) {
//                out.write(read);
//            }
//        } finally {
//            if (in != null) {
//                try {
//                    in.close();
//                } catch (IOException e) {
//                    e.printStackTrace(System.err);
//                }
//            }
//            
//            if (out != null) {
//                try {
//                    out.close();
//                } catch (IOException e) {
//                    e.printStackTrace(System.err);
//                }
//            }
//        }
//    }
//
//    private void createTestingData() throws IOException {
//        System.out.println("====================== creating testing data =========================");
//
//        File workFolder = new File(new File(getSrcDir(), "org"), "test");;
//        new File(new File(getDest1Dir(), "org"), "target").mkdirs();
//        new File(new File(getDest2Dir(), "org"), "target").mkdirs();
//        
//        workFolder.mkdirs();
//        
//        copyFiles("/gui/explorer/data/testfiles/CopyCutPasteRenameTest/TestClass.java", new File(workFolder, "TestClass.java"));
//        copyFiles("/gui/explorer/data/testfiles/CopyCutPasteRenameTest/TestClass1.java", new File(workFolder, "TestClass1.java"));
//        copyFiles("/gui/explorer/data/testfiles/CopyCutPasteRenameTest/TestClass2.java", new File(workFolder, "TestClass2.java"));
//        copyFiles("/gui/explorer/data/testfiles/CopyCutPasteRenameTest/TestClassRoot.java", new File(getSrcDir(), "TestClassRoot.java"));
//        copyFiles("/gui/explorer/data/testfiles/CopyCutPasteRenameTest/TestProperties.properties", new File(workFolder, "TestProperties.properties"));
//        copyFiles("/gui/explorer/data/testfiles/CopyCutPasteRenameTest/TestText.txt", new File(workFolder, "TestText.txt"));
//        copyFiles("/gui/explorer/data/testfiles/CopyCutPasteRenameTest/test.jar", new File(getWorkDir(), "test.jar"));
//        copyFiles("/gui/explorer/data/testfiles/CopyCutPasteRenameTest/TestForm1.form", new File(workFolder, "TestForm1.form"));
//        copyFiles("/gui/explorer/data/testfiles/CopyCutPasteRenameTest/TestForm1.java", new File(workFolder, "TestForm1.java"));
//        copyFiles("/gui/explorer/data/testfiles/CopyCutPasteRenameTest/TestForm2.form", new File(workFolder, "TestForm2.form"));
//        copyFiles("/gui/explorer/data/testfiles/CopyCutPasteRenameTest/TestForm2.java", new File(workFolder, "TestForm2.java"));
//        System.out.println("====================== creating testing data finished =========================");
//
//    }
//
//    private void fullDelete(File dir) throws IOException {
//        File[] children = dir.listFiles();
//        
//        for (int cntr = 0; cntr < children.length; cntr++) {
//            if (children[cntr].isDirectory()) {
//                fullDelete(children[cntr]);
//            } else {
//                children[cntr].delete();
//            }
//        }
//    }
//    
//    private void destroyTestingData() throws IOException {
//        fullDelete(getSrcDir());
//        fullDelete(getDest1Dir());
//        fullDelete(getDest2Dir());
//    }
//    
////    private static final String copyActionName = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Copy");
////    private static final String cutActionName = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Cut");
////    private static final String pasteActionName = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Paste");
//
//    private void umountFilesystem(String filesystemName) {
//        new Node(RepositoryTabOperator.invoke().getRootNode(), filesystemName).callPopup().pushMenu(new String[] {Bundle.getStringTrimmed("org.netbeans.core.actions.Bundle", "UnmountFS")});
//    }
//    
//    private static RepositoryRootNode getRRN() {
//        return RepositoryTabOperator.invoke().getRootNode();
//    }
//    
//    private static class ActionDescriptor {
//        private TestAction action;
//        private String[] arguments;
//        
//        public ActionDescriptor(TestAction action, String[] arguments) {
//            this.action = action;
//            this.arguments = arguments;
//        }
//        
//        public ActionDescriptor(TestAction action, String argument) {
//            this(action, new String[] {argument});
//        }
//
//        public ActionDescriptor(TestAction action, String argument1, String argument2) {
//            this(action, new String[] {argument1, argument2});
//        }
//
//    }
//
//    public void setUp() throws IOException {
//        init();
//        createTestingData();
//        
//        RepositoryTabOperator.invoke().mountLocalDirectoryAPI(getSrcDir().getAbsolutePath());
//        RepositoryTabOperator.invoke().mountLocalDirectoryAPI(getDest1Dir().getAbsolutePath());
//        RepositoryTabOperator.invoke().mountLocalDirectoryAPI(getDest2Dir().getAbsolutePath());
//        RepositoryTabOperator.invoke().mountArchiveFileAPI(getJarFile().getAbsolutePath());
//    }
//    
//    public void tearDown() throws IOException {
//        umountFilesystem(getSrcDir().getAbsolutePath());
//        umountFilesystem(getDest1Dir().getAbsolutePath());
//        umountFilesystem(getDest2Dir().getAbsolutePath());
//        umountFilesystem(JAR_NAME);
//        
//        destroyTestingData();
//    }
//    
//    /**
//     * copy
//     *    TestClassRoot.java
//     * from
//     *    /src
//     * to
//     *    /dest1
//     */    
//    public void testCopyJavaFromRootOfFS1toRootOfFS2() throws IOException {
//        copyAction.perform(S_TESTCLASSROOT);
//        pasteCopyAction.perform(getDest1Dir().getAbsolutePath());
//        verify.perform(D_TESTCLASSROOT);
//        verify.perform(S_TESTCLASSROOT);
//    }
//    
//    /**
//     * @throws IOException
//     */    
//    public void testCopyJavaFromPackageInFS1toPackageInFS2() throws IOException {
//        copyAction.perform(S_TESTCLASS);
//        pasteCopyAction.perform(D_TARGET);
//        verify.perform(D_TESTCLASS);
//        verify.perform(S_TESTCLASS);
//    }
//
//    public void testCopyFormFromPackageInFS1toPackageInFS2() throws IOException {
//        copyAction.perform(S_TESTFORM1);
//        pasteCopyAction.perform(D_TARGET);
//        verify.perform(D_TESTFORM1);
//        verify.perform(S_TESTFORM1);
//    }
//
//    public void testCopyJavaFromPackageInFS1toJarFS2() throws IOException {
//        copyAction.perform(S_TESTCLASS);
//        pasteDisabledAction.perform(JAR_NAME);
//        verify.perform(S_TESTCLASS);
//    }
//
//    public void testCopyJavaFromPackageInFS1toPackageInJarFS2() throws IOException {
//        copyAction.perform(S_TESTCLASS);
//        pasteDisabledAction.perform(JAR_TARGET);
//        verify.perform(S_TESTCLASS);
//    }
//
//    public void testJavaFromPackageInJarFS1toPackageInFS2() throws IOException {
//        copyAction.perform(JAR_JARTESTCLASS);
//        pasteCopyAction.perform(D_TARGET);
//        verify.perform(D_JARTESTCLASS);
//        verify.perform(JAR_JARTESTCLASS);
//    }
//
//    public void testCopyMoreJavasAndFormsFromPackageInFS1toPackageInFS2() throws IOException {
//        copyAction.perform(new String[] {S_TESTCLASS1,
//                                         S_TESTCLASS2,
//                                         S_TESTFORM1,
//                                         S_TESTFORM2});      
//        pasteCopyAction.perform(D_TARGET);
//        verify.perform(new String[] {D_TESTCLASS1,
//                                     D_TESTCLASS2,
//                                     D_TESTFORM1,
//                                     D_TESTFORM2,
//                                     S_TESTCLASS1,
//                                     S_TESTCLASS2,
//                                     S_TESTFORM1,
//                                     S_TESTFORM2});
//    }
//    
//    public void testCutJavaFromRootOfFS1toFS2() throws IOException {
//        cutAction.perform(S_TESTCLASSROOT);
//        pasteDirectAction.perform(getDest1Dir().getAbsolutePath());
//        verify.perform(D_TESTCLASSROOT);
//        verifyMissing.perform(S_TESTCLASSROOT);
//    }
//
//    public void testCutJavaFromPackageInFS1toPackageInFS2() throws IOException {
//        cutAction.perform(S_TESTCLASS1);
//        pasteDirectAction.perform(D_TARGET);
//        verify.perform(D_TESTCLASS1);
//        verifyMissing.perform(S_TESTCLASS1);
//    }
//
//    public void testCutFormFromPackageInFS1toPackageInFS2() throws IOException {
//        cutAction.perform(S_TESTFORM1);
//        pasteDirectAction.perform(D_TARGET);
//        verify.perform(D_TESTFORM1);
//        verifyMissing.perform(S_TESTFORM1);
//    }
//    
//    public void testCopyPackageInFS1toPackageInFS2() throws IOException {
//        copyAction.perform(S_TEST);
//        pasteCopyAction.perform(getDest1Dir() + "|org");
//
//        verify.perform(new String[] {getDest1Dir() + "|org|test|TestClass",
//         getDest1Dir() + "|org|test|TestClass1",
//         getDest1Dir() + "|org|test|TestClass2",
//         getDest1Dir() + "|org|test|TestProperties",
//         getDest1Dir() + "|org|test|TestText",
//         getDest1Dir() + "|org|test|TestForm1",
//         getDest1Dir() + "|org|test|TestForm2",
//
//         S_TESTCLASS,
//         S_TESTCLASS1,
//         S_TESTCLASS2,
//         S_TESTPROPERTIES,
//         S_TESTTEXT,
//         S_TESTFORM1,
//         S_TESTFORM2,
//         S_TESTFORM1,
//         S_TESTFORM2});       
//    }
//     
//    public void testCutPackageInFS1toPackageInFS2() throws IOException {
//        cutAction.perform(S_TEST);
//        pasteDirectAction.perform(getDest1Dir() + "|org");
//
//        verify.perform(new String[] {getDest1Dir() + "|org|test|TestClass",
//                                     getDest1Dir() + "|org|test|TestClass1",
//                                     getDest1Dir() + "|org|test|TestClass2",
//                                     getDest1Dir() + "|org|test|TestProperties",
//                                     getDest1Dir() + "|org|test|TestText",
//                                     getDest1Dir() + "|org|test|TestForm1",
//                                     getDest1Dir() + "|org|test|TestForm2"});
//         verifyMissing.perform(S_TEST);       
//    }
//    
//    public void testCutMoreJavasAndFormsFromPackageInFS1toPackageInFS2() throws IOException {
//        cutAction.perform(new String[] {S_TESTCLASS1,
//                                         S_TESTCLASS2,
//                                         S_TESTFORM1,
//                                         S_TESTFORM2});
//        pasteDirectAction.perform(D_TARGET);
//        verify.perform(new String[] {D_TESTCLASS1,
//                                     D_TESTCLASS2,
//                                     D_TESTFORM1,
//                                     D_TESTFORM2});
//                                     
//         verifyMissing.perform(new String[] {S_TESTCLASS1,
//                                         S_TESTCLASS2,
//                                         S_TESTFORM1,
//                                         S_TESTFORM2});
//    }
//    
//    public void testDeleteOpenedJavaFile() throws IOException {
//        openInEditorAction.perform(S_TESTCLASS1);
//        deleteConfirmAction.perform(S_TESTCLASS1);
//        verifyMissing.perform(S_TESTCLASS1);
//        //verifyEditorClosed.perform("TestClass1");
//    }
//    
//    public void testDeleteOpenedAndNotOpenedJavaFile() throws IOException {
//        openInEditorAction.perform(S_TESTCLASS1);
//        deleteConfirmAction.perform(new String[] {S_TESTCLASS1,
//                                                 S_TESTCLASS2});
//        verifyMissing.perform(new String[] {S_TESTCLASS1,
//                                                 S_TESTCLASS2});
//        //verifyEditorClosed.perform("TestClass1");
//    }
//    
//     public void testDeletePackage() throws IOException {
//        deleteConfirmAction.perform(S_TEST);
//         verifyMissing.perform(S_TEST);
//    }
//     
//     public void testDeletePackageWithOpenedFiles() throws IOException {
//        openInEditorAction.perform(S_TESTCLASS1);
//                                    
//        deleteConfirmAction.perform(S_TEST);
//        verifyMissing.perform(S_TEST);
//        //verifyEditorClosed.perform("TestClass1");
//    }
//    
//     public void testDeleteOpenedForm() throws IOException {
//        openInEditorAction.perform(S_TESTFORM1);
//        deleteConfirmAction.perform(S_TESTFORM1);
//        verifyMissing.perform(new String[] {S_TESTFORM1,
//                                                 getSrcDir() + "|org|test|TestForm1.form"});
//        //verifyEditorClosed.perform(new String[] {"TestForm1", "testForm1 [form]"});
//    }
//
//     public void testDeleteOpenedFormJavaAndPackage() throws IOException {
//        openInEditorAction.perform(S_TESTFORM1);
//        openInEditorAction.perform(S_TESTCLASS1);
//
//        deleteConfirmAction.perform(new String[] {S_TESTCLASS1,
//                                                  S_TESTFORM1,
//                                                  D_TARGET});
//        verifyMissing.perform(new String[] {S_TESTCLASS1,
//                                            S_TESTFORM1,
//                                            D_TARGET});
//        //verifyEditorClosed.perform(new String[] {"TestForm1", "testForm1 [form]"});
//    }
//     
//    public void donotruntest12() throws IOException {
//        cutDisabledAction.perform(JAR_JARTESTCLASS);
//    }
//    
//    private static final void invokeMethod(Object obj, String method) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException{
//        Method m = obj.getClass().getMethod(method, new Class[] {});
//        
//        m.invoke(obj, new Object[] {});
//    }
//    
//    private static final void invokeTest(String testName) throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
//        CopyCutPasteRenameTest inst = new CopyCutPasteRenameTest(testName);
//        
//        inst.standalone = true;
//        inst.standaloneWorkdir = "F:\\tmp\\work";
//        
//        System.err.println("Set up for test: " + testName);
//        invokeMethod(inst, "setUp");
//        System.err.println("Test: " + testName);
//        invokeMethod(inst, testName);
//        System.err.println("Tear down for test: " + testName);
//        invokeMethod(inst, "tearDown");
//    }
//    
//    public static final void main(String[] args) throws Exception {
////        String[] tests = new String[] {"test1", "test2", "test3", "test4", "test5", "test6", "test7", "test9", "test10", "test11"/*, "test12"*/};
////        
////        for (int cntr = 0; cntr < tests.length; cntr++) {
////            invokeTest(tests[cntr]);
////        }
//            System.setProperty("nbjunit.workdir", ".");
//            //   junit.textui.TestRunner.run(new org.netbeans.junit.NbTestSuite(CopyCutPasteRenameTest.class)); 
//           invokeTest("testDeleteOpenedFormJavaAndPackage");
//    }
// 
//    //Local utility:
//    private static final String pasteActionName = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Paste");
//    private static final String copyActionName = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Copy");
//    private static final String cutActionName = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Cut");
//
//    private static final TestAction copyAction = new PopupTestAction(new CopyAction());
//    private static final TestAction cutAction = new PopupTestAction(new CutAction());
//
//    private static final TestAction deleteAction = new PopupTestAction(new DeleteAction());
//    private static final TestAction deleteConfirmAction = new DeleteConfirmTestAction();
//
//    private static final TestAction pasteDirectAction= new PopupTestAction(new Action(null, pasteActionName));
//    private static final TestAction pasteCopyAction= new PopupTestAction(new Action(null, pasteActionName + "|" + copyActionName));
//    
//    private static final TestAction pasteDisabledAction = new IsDisabledPopupTestAction(pasteActionName);
//    private static final TestAction cutDisabledAction = new IsDisabledPopupTestAction(cutActionName);
//    
//    private static final TestAction verify = new VerifyExistsTestAction();
//    private static final TestAction verifyMissing = new VerifyNotExistTestAction();
//    private static final CopyCutPasteRenameTest.VerifyFilesExistTestAction verifyFiles = new VerifyFilesExistTestAction();
//    
//    private static final TestAction openInEditorAction = new PopupTestAction(new OpenAction());
//    private static final TestAction verifyEditorOpened = new VerifyEditorIsOpened();
//    private static final TestAction verifyEditorClosed = new VerifyEditorIsClosed();
//    
//    private static class ExactStringComparator implements Operator.StringComparator {
//        
//        public boolean equals(String str, String str1) {
//            if (str == str1)
//                return true;
//            
//            if (str == null || str1 == null)
//                return false;
//            
//            return str.equals(str1);
//        }
//        
//    }
//    
//    private static boolean isPopupActionDisabled(Node node, String path) {
//        JPopupMenuOperator oper = node.callPopup();
//        
//        oper.waitComponentVisible(true);
//        
//        JMenuItemOperator item = oper.showMenuItem(path, "|", new ExactStringComparator());
//        
//        item.waitComponentVisible(true);
//        
//        boolean result = !item.isEnabled();
//        
//        if (oper.isVisible())
//            oper.pushKey(KeyEvent.VK_ESCAPE);
//        
//        return result;
//    }
//    
//    private abstract static class TestAction {
//        public void perform(String nodes) {
//            perform(new String[] {nodes});
//        }
//        
//        public abstract void perform(String[] nodes);
//    }
//    
//    private static class PopupTestAction extends TestAction {
//        private org.netbeans.jellytools.actions.Action toCall;
//        
//        public PopupTestAction(Action toCall) {
//            this.toCall = toCall;
//        }
//        
//        public void perform(String[] nodes) {
//            System.out.println("=============================== Calling " +toCall.toString()+ " on nodes "+ nodes +"=====================================");
//            Node[] nodesImpl = new Node[nodes.length];
//            
//            for (int cntr = 0; cntr < nodes.length; cntr++) {
//                nodesImpl[cntr] = new Node(getRRN(), nodes[cntr]);
//            }
//            
//            toCall.performPopup(nodesImpl);
//        }
//    }
//    
//    private static class IsDisabledPopupTestAction extends TestAction {
//        
//        private String actionPath;
//        
//        public IsDisabledPopupTestAction(String actionPath) {
//            this.actionPath = actionPath;
//        }
//        
//        public void perform(String[] nodes) {
//            for (int cntr = 0; cntr < nodes.length; cntr++) {
//                Node working = new Node(getRRN(), nodes[cntr]);
//                assertTrue("Action " + actionPath + " is not disabled on node " + working.getPath() + ".",
//                           isPopupActionDisabled(working, actionPath));
//                    
//            }
//        }
//    }
//    
//    private static class VerifyExistsTestAction extends TestAction {
//        
//        public void perform(String[] nodes) {
//            for (int cntr = 0; cntr < nodes.length; cntr++) {
//                Node working = new Node(getRRN(), nodes[cntr]);
//            }
//        }
//        
//    }
//    
//    private static class VerifyNotExistTestAction extends TestAction {
//        
//        public void perform(String[] nodes) {
//            for (int cntr = 0; cntr < nodes.length; cntr++) {
//                String current = nodes[cntr];
//                
//                int lastPipe = current.lastIndexOf('|');
//                
//                if (lastPipe == (-1)) {
//                    //We can not do anything with this.
//                    System.err.println("VerifyNotExistTestAction: lastPipe=(-1)"); //!!!!
//                    continue;
//                }
//                
//                String parent = current.substring(0, lastPipe);
//                String child  = current.substring(lastPipe + 1);
//
//                Node working = new Node(getRRN(), parent);
//                
//                working.waitChildNotPresent(child);
//            }
//        }
//        
//    }
//
//    private static class VerifyFilesExistTestAction extends TestAction {
//        
//        public void perform2(String[] files) throws FileNotFoundException{
//            for (int cntr = 0; cntr < files.length; cntr++) {
//                String current = files[cntr];
//                File file = new File(current);
//                if(!file.exists()) 
//                    throw new FileNotFoundException("File "+current+" doesn't exist and it should");
//            }
//        }
//        
//        public void perform(String[] nodes) {
//        }
//        
//    }
//    
//    private static class VerifyEditorIsOpened extends TestAction {
//        
//        public void perform(String[] nodes) {
//            for (int cntr = 0; cntr < nodes.length; cntr++) {
//                EditorOperator editor = new EditorOperator(nodes[cntr]);
//            }
//        }        
//    }
//    
//     private static class VerifyEditorIsClosed extends TestAction {
//        
//        public void perform(String[] nodes) {
//            System.out.println("=============================== Verifying if these "+ nodes +" aren't opened in Editor =====================================");
//
//            for (int cntr = 0; cntr < nodes.length; cntr++) {
//                try {
//                    EditorOperator editor = new EditorOperator(nodes[cntr]);
//                } catch(org.netbeans.jemmy.TimeoutExpiredException e) {
//                    //everything is OK
//                }
//            }
//            System.out.println("========================= Editor is opened and should be closed ===========================");
//            
//            fail(); 
//        }
//        
//    }
//     
//     private static class DeleteConfirmTestAction extends TestAction {
//        private org.netbeans.jellytools.actions.Action toCall = new DeleteAction();
//                      
//        public void perform(String[] nodes) {
//            Node[] nodesImpl = new Node[nodes.length];
//            System.out.println("=============================== Calling " +toCall.toString()+ " on nodes "+ nodes +"=====================================");
//
//            String title = (nodes.length == 1) ? "Confirm Object Deletion" : "Confirm Multiple Object Deletion";
//            
//            for (int cntr = 0; cntr < nodes.length; cntr++) {
//                System.out.println("------- " + nodes[cntr]);
//                nodesImpl[cntr] = new Node(getRRN(), nodes[cntr]);
//            }
//            
//            toCall.performPopup(nodesImpl);
//            //wait on confirm dialog
//            NbDialogOperator confirm = new NbDialogOperator(title);
//            confirm.yes();
//            
//        }
//    }

}
... 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.