|
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-2002 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.test.gui.web.AppletDebug; import java.io.File; import java.awt.event.InputEvent; import org.netbeans.junit.NbTestSuite; import org.netbeans.junit.NbTestCase; import junit.framework.Test; import junit.framework.TestSuite; import org.netbeans.jellytools.EditorOperator; import org.netbeans.jellytools.ExplorerOperator; import org.netbeans.jellytools.JellyTestCase; import org.netbeans.jellytools.MainWindowOperator; import org.netbeans.jemmy.operators.JPopupMenuOperator; import org.netbeans.web.test.actions.ToggleBreakpointAction; import org.netbeans.web.test.actions.AddBreakpointAction; import org.netbeans.web.test.util.Utils; import org.netbeans.test.gui.web.util.CommonUtils; import org.netbeans.test.gui.web.util.AppletResponseWaitable; public class Breakpoints extends JellyTestCase { public static final String delim = "|"; private static String workDir = null; private static String tmpWebModule = null; private static boolean creationAndWMcreated = false; private static String webModule = null; private static String wmName = "wm"; private static String testWMDir = "breakpoints"; private static ExplorerOperator explorer = null; private static EditorOperator editor = null; private String applet1 = "applet1"; private static String appletNameForBreakpoint1 = null; public Breakpoints(String testName) { super(testName); } /** Use for execution inside IDE */ public static void main(java.lang.String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { workDir = System.getProperty("appletdebug.workdir").replace('/',File.separatorChar); webModule = workDir + File.separatorChar + wmName; workDir = webModule+delim+testWMDir; explorer = ExplorerOperator.invoke(); explorer.selectPageFilesystems(); Utils.handleDialogAfterNewWebModule(); TestSuite suite = new NbTestSuite(Breakpoints.class); appletNameForBreakpoint1 = testWMDir+"/"+"applet1"; return suite; } /** Toggle Java Breakpoint On via main menu * public void testToggleBreakpointOnMenu() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(29); (new ToggleBreakpointAction()).performMenu(); if(!CommonUtils.isLineBreakpointExist(appletNameForBreakpoint1, 29)) { fail("Breakpoint do not added to file "+applet1+" and line 29"); } } */ /** Toggle Java Breakpoint Off via main menu * public void testToggleBreakpointOffMenu() { CommonUtils.checkBreakpointExist(applet1, appletNameForBreakpoint1, 29, workDir); editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(29); (new ToggleBreakpointAction()).performMenu(); if(CommonUtils.isLineBreakpointExist(appletNameForBreakpoint1, 29)) { fail("Breakpoint do not removed from file "+applet1+" and line 29"); } } */ /** Toggle Java Breakpoint On via shortcut */ public void testToggleBreakpointOnShortcut() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(32); (new ToggleBreakpointAction()).performShortcut(); if(!CommonUtils.isLineBreakpointExist(appletNameForBreakpoint1, 32)) { fail("Breakpoint do not added to file "+applet1+" and line 32"); } } /** Toggle Java Breakpoint Off via shortcut */ public void testToggleBreakpointOffShortcut() { CommonUtils.checkBreakpointExist(applet1, appletNameForBreakpoint1, 32, workDir); editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(32); (new ToggleBreakpointAction()).performShortcut(); if(CommonUtils.isLineBreakpointExist(appletNameForBreakpoint1, 32)) { fail("Breakpoint do not removed from file "+applet1+" and line 32"); } } /** Toggle Java Breakpoint On via toolbar button * public void testToggleBreakpointOnToolbar() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(36); MainWindowOperator mainWindow = MainWindowOperator.getDefault(); mainWindow.getToolbarButton(mainWindow.getToolbar("Debug"), "Toggle Breakpoint").push(); if(!CommonUtils.isLineBreakpointExist(appletNameForBreakpoint1, 36)) { fail("Breakpoint do not added to file "+applet1+" and line 36"); } } */ /** Toggle Java Breakpoint Off via toolbar button * public void testToggleBreakpointOffToolbar() { CommonUtils.checkBreakpointExist(applet1, appletNameForBreakpoint1, 36, workDir); editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(36); MainWindowOperator mainWindow = MainWindowOperator.getDefault(); mainWindow.getToolbarButton(mainWindow.getToolbar("Debug"), "Toggle Breakpoint").push(); if(CommonUtils.isLineBreakpointExist(appletNameForBreakpoint1, 36)) { fail("Breakpoint do not removed from file "+applet1+" and line 36"); } } */ /** Toggle Java Breakpoint On via one click */ public void testToggleBreakpointOnOneClick() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(36); editor.clickMouse(5, 145, 1, InputEvent.BUTTON1_MASK); if(!CommonUtils.isLineBreakpointExist(appletNameForBreakpoint1, 27)) { fail("Breakpoint do not added to file "+applet1+" and line 27"); } } /** Toggle Java Breakpoint Off via one click */ public void testToggleBreakpointOffOneClick() { CommonUtils.checkBreakpointExist(applet1, appletNameForBreakpoint1, 27, workDir); editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(36); editor.clickMouse(5, 143, 1, InputEvent.BUTTON1_MASK); if(CommonUtils.isLineBreakpointExist(appletNameForBreakpoint1, 27)) { fail("Breakpoint do not removed from file "+applet1+" and line 27"); } } /** Toggle Java Breakpoint On via popup menu */ public void testToggleBreakpointOnContextMenu() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(38); editor.select(38, 1, 2); editor.clickForPopup(); new JPopupMenuOperator().pushMenu("Toggle Breakpoint", "|"); if(!CommonUtils.isLineBreakpointExist(appletNameForBreakpoint1, 38)) { fail("Breakpoint do not added to file "+applet1+" and line 38"); } } /** Toggle Java Breakpoint Off via popup menu */ public void testToggleBreakpointOffContextMenu() { CommonUtils.checkBreakpointExist(applet1, appletNameForBreakpoint1, 38, workDir); editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(38); editor.select(38, 1, 2); editor.clickForPopup(); new JPopupMenuOperator().pushMenu("Toggle Breakpoint", "|"); if(CommonUtils.isLineBreakpointExist(appletNameForBreakpoint1, 38)) { fail("Breakpoint do not removed from file "+applet1+" and line 38"); } } /** Add breakpoint to current method */ public void testAddBreakpointToCurrentMethod() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(27); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointMethod(null, null, null, false); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Method "+testWMDir+"."+applet1+".initComponents")){ fail("Breakpoint do not added"); } } /** Add breakpoint to not-current method */ public void testAddBreakpointToAnyMethod() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(27); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointMethod(null, null, "button2ActionPerformed", false); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Method "+testWMDir+"."+applet1+".button2ActionPerformed")){ fail("Breakpoint do not added"); } } /** Add breakpoint to all methods */ public void testAddBreakpointToAllMethods() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(27); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointMethod(null, null, null, true); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Methods in "+testWMDir+"."+applet1)){ fail("Breakpoint do not added"); } } /** Add breakpoint to exception uncaught */ public void testAddBreakpointToExceptionUncaught() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(38); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointException(null, "ArrayIndexOutOfBoundsException", 1); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Exception java.lang.ArrayIndexOutOfBoundsException uncaught")){ fail("Breakpoint do not added"); } } /** Add breakpoint to exception caught */ public void testAddBreakpointToExceptionCaught() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(38); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointException(null, "ArrayIndexOutOfBoundsException", 0); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Exception java.lang.ArrayIndexOutOfBoundsException caught")){ fail("Breakpoint do not added"); } } /** Add breakpoint to exception caught or uncaught */ public void testAddBreakpointToExceptionCaughtOrUncaught() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(38); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointException(null, "ArrayIndexOutOfBoundsException", 0); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Exception java.lang.ArrayIndexOutOfBoundsException")){ fail("Breakpoint do not added"); } } /** Add breakpoint to class prepare */ public void testAddBreakpointToClassPrepare() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(27); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointClass(null, null, 0); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Class "+testWMDir+"."+applet1+" prepare")){ fail("Breakpoint do not added"); } } /** Add breakpoint to class unload */ public void testAddBreakpointToClassUnload() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(27); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointClass(null, null, 1); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Class "+testWMDir+"."+applet1+" unload")){ fail("Breakpoint do not added"); } } /** Add breakpoint to class prepare & unload */ public void testAddBreakpointToClassPrepareAndUnload() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(27); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointClass(null, null, 2); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Class "+testWMDir+"."+applet1+" prepare / unload")){ fail("Breakpoint do not added"); } } /** Add breakpoint to thread start */ public void testAddBreakpointToThreadStart() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(27); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointThread(0); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Thread start")){ fail("Breakpoint do not added"); } } /** Add breakpoint to thread death */ public void testAddBreakpointToThreadDeath() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(27); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointThread(1); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Thread death")){ fail("Breakpoint do not added"); } } /** Add breakpoint to thread start & death */ public void testAddBreakpointToThreadStartAndDeath() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(27); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointThread(2); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Thread start / death")){ fail("Breakpoint do not added"); } } /** Add breakpoint to variable */ public void testAddBreakpointToVariable() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(38); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointVariable(null, null, "button1", -1); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Variable "+testWMDir+"."+applet1+".button1 modification")){ fail("Breakpoint do not added"); } } /** Add breakpoint to selected variable */ public void testAddBreakpointToSelectedVariable() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(38); editor.select(38, 9, 15); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointVariable(null, null, null, -1); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Variable "+testWMDir+"."+applet1+".button2 modification")){ fail("Breakpoint do not added"); } } /** Add breakpoint to variable access */ public void testAddBreakpointToVariableAccess() { editor = CommonUtils.openFile(workDir, applet1); editor.setCaretPositionToLine(38); (new AddBreakpointAction()).performMenu(); Utils.fillAddBreakpointVariable(null, null, "button2", 0); if(!CommonUtils.isExplorerItemExist("Debugger|Breakpoints|Variable "+testWMDir+"."+applet1+".button2 access")){ fail("Breakpoint do not added"); } } } |
... 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.