├── make ├── jemmy-v2-ii │ ├── .idea │ │ ├── .name │ │ ├── copyright │ │ │ ├── profiles_settings.xml │ │ │ └── GNU_CPE.xml │ │ ├── encodings.xml │ │ ├── modules.xml │ │ ├── misc.xml │ │ └── compiler.xml │ └── JemmyV2.iml └── jemmy-v2-nb │ └── nbproject │ ├── genfiles.properties │ └── project.xml ├── test ├── TEST.ROOT └── org │ └── netbeans │ └── jemmy │ ├── operators │ ├── resources │ │ └── page1.html │ ├── TextComponentOperatorTest.java │ ├── JTextComponentOperatorTest.java │ ├── ComponentChooserTest.java │ ├── FileChooserApp.java │ ├── AcessibleDumpPropertiesTest.java │ └── MenuApp.java │ ├── scenario │ ├── Util.java │ └── TestFrame.java │ ├── LookAndFeelProvider.java │ ├── stress │ └── TimeoutsGetSetTest.java │ └── util │ └── DumpTest.java ├── .gitignore ├── .jcheck └── conf ├── src └── org │ └── netbeans │ └── jemmy │ ├── version_info │ ├── debug.timeouts │ ├── drivers │ ├── menus │ │ └── package-info.java │ ├── focus │ │ ├── package-info.java │ │ └── APIFocusDriver.java │ ├── windows │ │ └── package-info.java │ ├── buttons │ │ └── package-info.java │ ├── lists │ │ ├── package-info.java │ │ ├── JTabAPIDriver.java │ │ └── ListAPIDriver.java │ ├── text │ │ ├── package-info.java │ │ ├── OffsetKey.java │ │ ├── GoAndBackKey.java │ │ ├── HomeKey.java │ │ ├── NavigationKey.java │ │ ├── DownKey.java │ │ ├── UpKey.java │ │ ├── EndKey.java │ │ ├── AWTTextAPIDriver.java │ │ └── SwingTextAPIDriver.java │ ├── trees │ │ └── package-info.java │ ├── tables │ │ └── package-info.java │ ├── DriverInstaller.java │ ├── input │ │ └── package-info.java │ ├── scrolling │ │ ├── package-info.java │ │ ├── KeyboardJSliderScrollDriver.java │ │ └── ScrollAdjuster.java │ ├── FocusDriver.java │ ├── DescriptablePathChooser.java │ ├── ListDriver.java │ ├── MultiSelListDriver.java │ ├── InternalFrameDriver.java │ ├── Driver.java │ ├── EditorDriver.java │ ├── LightDriver.java │ ├── OrderedListDriver.java │ ├── MenuDriver.java │ ├── package-info.java │ ├── ButtonDriver.java │ ├── PathChooser.java │ ├── TableDriver.java │ ├── FrameDriver.java │ ├── ArrayDriverInstaller.java │ ├── SupportiveDriver.java │ ├── LightSupportiveDriver.java │ ├── TreeDriver.java │ ├── ScrollDriver.java │ └── WindowDriver.java │ ├── demo │ ├── package-info.java │ └── DemoInterruptedException.java │ ├── explorer │ └── package-info.java │ ├── image │ ├── package-info.java │ ├── ImageLoader.java │ ├── ImageSaver.java │ ├── ImageComparator.java │ ├── PNGImageLoader.java │ ├── ImageFinder.java │ ├── PNGImageSaver.java │ └── StrictImageComparator.java │ ├── package-info.java │ ├── util │ ├── package-info.java │ ├── DumpController.java │ ├── EmptyVisualizer.java │ ├── WindowJob.java │ └── Platform.java │ ├── TimeoutExpiredException.java │ ├── NoComponentUnderMouseException.java │ ├── Waitable.java │ ├── ComponentIsNotVisibleException.java │ ├── ComponentIsNotFocusedException.java │ ├── Action.java │ ├── Timeoutable.java │ ├── Scenario.java │ ├── Outputable.java │ ├── ComponentChooser.java │ ├── CharBindingMap.java │ ├── accessibility │ ├── AccessibilityChooser.java │ ├── AccessibleNameChooser.java │ └── AccessibleDescriptionChooser.java │ ├── JemmyInputException.java │ ├── operators │ └── package-info.java │ ├── UIStatus.java │ └── TestCompletedException.java ├── doc └── samples │ ├── resourcesample.txt │ ├── MyTest.java │ ├── WaitWindowSample.java │ ├── WaitDialogSample.java │ ├── TreeActionsSample.java │ ├── GrabImageAndXMLSample.java │ ├── ResourceSample.java │ ├── TableActionsSample.java │ ├── ActionsSample.java │ ├── QueueUsingSample.java │ └── FindComponentsSample.java ├── README.md └── COPYRIGHT /make/jemmy-v2-ii/.idea/.name: -------------------------------------------------------------------------------- 1 | Jemmy v2 -------------------------------------------------------------------------------- /test/TEST.ROOT: -------------------------------------------------------------------------------- 1 | TestNG.dirs = . 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | .idea 3 | jemmy-v2.iml 4 | out 5 | -------------------------------------------------------------------------------- /.jcheck/conf: -------------------------------------------------------------------------------- 1 | project=code-tools 2 | comments=lax 3 | tags=lax 4 | -------------------------------------------------------------------------------- /make/jemmy-v2-ii/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/version_info: -------------------------------------------------------------------------------- 1 | Manifest-version: 1.0 2 | Main-Class: org.netbeans.jemmy.JemmyProperties 3 | Jemmy-MajorVersion: 3.0 4 | Jemmy-MinorVersion: 13.0 5 | Jemmy-Build: @BUILD_NUMBER@ 6 | 7 | -------------------------------------------------------------------------------- /make/jemmy-v2-ii/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /doc/samples/resourcesample.txt: -------------------------------------------------------------------------------- 1 | guibrowser.main_class=org.netbeans.jemmy.explorer.GUIBrowser 2 | guibrowser.main_window=GUI Browser 3 | guibrowser.reload_button=Reload In ... 4 | guibrowser.reloaded_label=Reloaded 5 | guibrowser.show_window_hierarchy=View 6 | 7 | -------------------------------------------------------------------------------- /make/jemmy-v2-ii/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/org/netbeans/jemmy/operators/resources/page1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Page 1 4 | 5 | 6 | 7 | Page 1 Body. hi 8 |

Page2

9 | 10 | -------------------------------------------------------------------------------- /make/jemmy-v2-ii/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /make/jemmy-v2-nb/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=02f5761e 2 | build.xml.script.CRC32=266cf086 3 | build.xml.stylesheet.CRC32=8064a381@1.88.0.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=02f5761e 7 | nbproject/build-impl.xml.script.CRC32=a1b96d48 8 | nbproject/build-impl.xml.stylesheet.CRC32=bade6ae5@1.88.0.48 9 | -------------------------------------------------------------------------------- /make/jemmy-v2-ii/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Jemmy Swing UI test automation library 2 | 3 | Jemmy is a Java library which provides API to simulate user actions on Swing/AWT UI. 4 | 5 | Base concept of the library design is "Operator" class proxies. 6 | 7 | A code could look something like this: 8 | ``` 9 | var window = new JFrameOperator("My application"); 10 | new JMenuBarOperator(window).pushMenu("Help/About"); 11 | var dialog = new JDialogOperator("About my application"); 12 | new JLabelOperator(dialog, "My application is very good!"); 13 | new JButtonOperator(dialog, "OK").push(); 14 | ``` 15 | 16 | See tutorial for more usage examples. -------------------------------------------------------------------------------- /doc/samples/MyTest.java: -------------------------------------------------------------------------------- 1 | import junit.framework.Test; 2 | import junit.framework.TestCase; 3 | import junit.framework.TestResult; 4 | import junit.framework.TestSuite; 5 | 6 | public class MyTest extends TestCase { 7 | public MyTest(String name) { 8 | super(name); 9 | } 10 | public void testPass() { 11 | System.out.println("Test supposed to be passed"); 12 | } 13 | public void testFail() { 14 | System.out.println("Test supposed to be failed"); 15 | fail(); 16 | } 17 | /* 18 | public static TestSuite suite() { 19 | TestSuite suite = new TestSuite(); 20 | suite.addTest(new MyTest("testPass")); 21 | suite.addTest(new MyTest("testFail")); 22 | return(suite); 23 | } 24 | */ 25 | } 26 | -------------------------------------------------------------------------------- /doc/samples/WaitWindowSample.java: -------------------------------------------------------------------------------- 1 | import org.netbeans.jemmy.*; 2 | import org.netbeans.jemmy.explorer.*; 3 | import org.netbeans.jemmy.operators.*; 4 | 5 | public class WaitWindowSample implements Scenario { 6 | public int runIt(Object param) { 7 | try { 8 | //start application 9 | new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser").startApplication(); 10 | //wait frame 11 | new JFrameOperator("GUI Browser"); 12 | } catch(Exception e) { 13 | e.printStackTrace(); 14 | return(1); 15 | } 16 | return(0); 17 | } 18 | public static void main(String[] argv) { 19 | String[] params = {"WaitWindowSample"}; 20 | org.netbeans.jemmy.Test.main(params); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/debug.timeouts: -------------------------------------------------------------------------------- 1 | AbstractButtonOperator.PushButtonTimeout=100 2 | ComponentOperator.AfterDragTimeout=100 3 | ComponentOperator.BeforeDragTimeout=100 4 | ComponentOperator.MouseClickTimeout=100 5 | ComponentOperator.PushKeyTimeout=100 6 | DialogWaiter.AfterDialogTimeout=3000 7 | EventDispatcher.RobotAutoDelay=100 8 | FrameWaiter.AfterFrameTimeout=3000 9 | JComboBoxOperator.BeforeSelectingTimeout=100 10 | JComponentOperator.ShowToolTipTimeout=1000 11 | JMenuItemOperator.PushMenuTimeout=100 12 | JMenuOperator.WaitBeforePopupTimeout=100 13 | JScrollBarOperator.OneScrollClickTimeout=10 14 | JSplitPaneOperator.ScrollClickTimeout=10 15 | JTextComponentOperator.BetweenKeysTimeout=100 16 | JTextComponentOperator.PushKeyTimeout=100 17 | JTextComponentOperator.TypeTextTimeout=60000 18 | JTreeOperator.WaitAfterNodeExpandedTimeout=100 19 | WindowWaiter.AfterWindowTimeout=3000 20 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. 2 | DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 | 4 | This code is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU General Public License version 2 only, as 6 | published by the Free Software Foundation. 7 | 8 | This code is distributed in the hope that it will be useful, but WITHOUT 9 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 | version 2 for more details (a copy is included in the LICENSE file that 12 | accompanied this code). 13 | 14 | You should have received a copy of the GNU General Public License version 15 | 2 along with this work; if not, write to the Free Software Foundation, 16 | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 | 18 | Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | or visit www.oracle.com if you need additional information or have any 20 | questions. 21 | -------------------------------------------------------------------------------- /doc/samples/WaitDialogSample.java: -------------------------------------------------------------------------------- 1 | import org.netbeans.jemmy.*; 2 | import org.netbeans.jemmy.explorer.*; 3 | import org.netbeans.jemmy.operators.*; 4 | 5 | public class WaitDialogSample implements Scenario { 6 | public int runIt(Object param) { 7 | try { 8 | //start application 9 | new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser").startApplication(); 10 | //wait frame 11 | JFrameOperator mainFrame = new JFrameOperator("GUI Browser"); 12 | //push menu 13 | //pushMenuNoBlock is used, because dialog is modal 14 | //see tutorial for more information 15 | new JButtonOperator(mainFrame, "Dump").pushNoBlock(); 16 | //wait dialog 17 | new JDialogOperator(mainFrame, "Save"); 18 | } catch(Exception e) { 19 | e.printStackTrace(); 20 | return(1); 21 | } 22 | return(0); 23 | } 24 | public static void main(String[] argv) { 25 | String[] params = {"WaitDialogSample"}; 26 | org.netbeans.jemmy.Test.main(params); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /doc/samples/TreeActionsSample.java: -------------------------------------------------------------------------------- 1 | import org.netbeans.jemmy.*; 2 | import org.netbeans.jemmy.explorer.*; 3 | import org.netbeans.jemmy.operators.*; 4 | 5 | public class TreeActionsSample implements Scenario { 6 | public int runIt(Object param) { 7 | try { 8 | new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser").startApplication(); 9 | JFrameOperator mainFrame = new JFrameOperator("GUI Browser"); 10 | 11 | new JButtonOperator(mainFrame, "Reload In").push(); 12 | new JLabelOperator(mainFrame, "Reloaded"); 13 | 14 | JTreeOperator tree = new JTreeOperator(mainFrame); 15 | 16 | //click in the middle of the tree 17 | tree.clickMouse(); 18 | 19 | //collapse node 20 | tree.collapsePath(tree.findPath("", "|")); 21 | 22 | //expand node 23 | tree.expandPath(tree.findPath("", "|")); 24 | 25 | //select node 26 | tree.selectPath(tree.findPath("GUI Browser", "|")); 27 | 28 | } catch(Exception e) { 29 | e.printStackTrace(); 30 | return(1); 31 | } 32 | return(0); 33 | } 34 | public static void main(String[] argv) { 35 | String[] params = {"TreeActionsSample"}; 36 | org.netbeans.jemmy.Test.main(params); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /doc/samples/GrabImageAndXMLSample.java: -------------------------------------------------------------------------------- 1 | import org.netbeans.jemmy.*; 2 | import org.netbeans.jemmy.explorer.*; 3 | import org.netbeans.jemmy.operators.*; 4 | import org.netbeans.jemmy.util.*; 5 | 6 | public class GrabImageAndXMLSample implements Scenario { 7 | public int runIt(Object param) { 8 | try { 9 | new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser").startApplication(); 10 | JFrameOperator mainFrame = new JFrameOperator("GUI Browser"); 11 | new JMenuBarOperator(mainFrame).pushMenuNoBlock("Tools|Properties", "|"); 12 | 13 | //grab image 14 | PNGEncoder.captureScreen(System.getProperty("user.dir") + 15 | System.getProperty("file.separator") + 16 | "screen.png"); 17 | 18 | //grab component state 19 | Dumper.dumpAll(System.getProperty("user.dir") + 20 | System.getProperty("file.separator") + 21 | "dump.xml"); 22 | } catch(Exception e) { 23 | e.printStackTrace(); 24 | return(1); 25 | } 26 | return(0); 27 | } 28 | public static void main(String[] argv) { 29 | String[] params = {"GrabImageAndXMLSample"}; 30 | org.netbeans.jemmy.Test.main(params); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /make/jemmy-v2-ii/.idea/copyright/GNU_CPE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/menus/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Menu drivers.

27 | * Different drivers to perform a menu operations.
28 | *
29 | */ 30 | package org.netbeans.jemmy.drivers.menus; 31 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/focus/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Focus drivers.

27 | * Different drivers to give input focus to a component.
28 | *
29 | */ 30 | package org.netbeans.jemmy.drivers.focus; 31 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/windows/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Window drivers.

27 | * Different drivers to perform a window operations.
28 | *
29 | */ 30 | package org.netbeans.jemmy.drivers.windows; 31 | -------------------------------------------------------------------------------- /doc/samples/ResourceSample.java: -------------------------------------------------------------------------------- 1 | import org.netbeans.jemmy.*; 2 | import org.netbeans.jemmy.explorer.*; 3 | import org.netbeans.jemmy.operators.*; 4 | 5 | public class ResourceSample implements Scenario { 6 | public int runIt(Object param) { 7 | try { 8 | //load bundle 9 | Bundle bundle = new Bundle(); 10 | bundle.loadFromFile(System.getProperty("user.dir") + 11 | System.getProperty("file.separator") + 12 | "resourcesample.txt"); 13 | 14 | new ClassReference(bundle.getResource("guibrowser.main_class")). 15 | startApplication(); 16 | 17 | JFrameOperator mainFrame = 18 | new JFrameOperator(bundle.getResource("guibrowser.main_window")); 19 | 20 | new JButtonOperator(mainFrame, bundle.getResource("guibrowser.reload_button")).push(); 21 | new JLabelOperator(mainFrame, bundle.getResource("guibrowser.reloaded_label")); 22 | 23 | new JTreeOperator(mainFrame).selectRow(1); 24 | 25 | new JButtonOperator(mainFrame, bundle.getResource("show_window_hierarchy")).push(); 26 | 27 | new JFrameOperator(1); 28 | 29 | } catch(Exception e) { 30 | e.printStackTrace(); 31 | return(1); 32 | } 33 | return(0); 34 | } 35 | public static void main(String[] argv) { 36 | String[] params = {"ResourceSample"}; 37 | org.netbeans.jemmy.Test.main(params); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/demo/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Demo package

27 | * Contains classes alowing to create automated application demoes.
28 | * @since 9 Nov 2002 29 | *
30 | */ 31 | package org.netbeans.jemmy.demo; 32 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/buttons/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Button drivers

27 | * Different drivers to push a button.
28 | * 29 | * @since 4/17/2002 30 | *
31 | */ 32 | package org.netbeans.jemmy.drivers.buttons; 33 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/lists/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

List drivers

27 | * Different drivers to perform a list operations.
28 | * 29 | * @since 4/17/2002 30 | *
31 | */ 32 | package org.netbeans.jemmy.drivers.lists; 33 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/text/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Text drivers

27 | * Different drivers to perform a text operations.
28 | * 29 | * @since 17 Apr 2002 30 | *
31 | */ 32 | package org.netbeans.jemmy.drivers.text; 33 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/trees/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Tree drivers

27 | * Different drivers to perform a tree operations.
28 | * 29 | * @since 17 Apr 2002 30 | *
31 | */ 32 | package org.netbeans.jemmy.drivers.trees; 33 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/tables/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Table drivers

27 | * Different drivers to perform a table operations.
28 | * 29 | * @since 17 Apr 2002 30 | *
31 | */ 32 | package org.netbeans.jemmy.drivers.tables; 33 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/DriverInstaller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | /** 28 | * 29 | * @author Alexandre Iline (alexandre.iline@oracle.com) 30 | */ 31 | public interface DriverInstaller { 32 | 33 | public void install(); 34 | } 35 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/input/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Mouse and keyboard drivers

27 | * Contains low-level drivers to perform user input.
28 | * 29 | * @since 17 Apr 2002 30 | *
31 | */ 32 | package org.netbeans.jemmy.drivers.input; 33 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/scrolling/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Scrolling drivers

27 | * Different drivers to perform a scrolling operations.
28 | * 29 | * @since 17 Apr 2002 30 | *
31 | */ 32 | package org.netbeans.jemmy.drivers.scrolling; 33 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/explorer/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Package org.netbeans.jemmy.explorer

27 | * Contains auxiliary classes to explore tested application.
28 | * 29 | * @since 23 Feb 2002 30 | *
31 | */ 32 | package org.netbeans.jemmy.explorer; 33 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/image/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Image library

27 | * Contains classes allowing to compare two images and to find one image inside 28 | * another.

29 | * 30 | * @since 9 Nov 2002 31 | *
32 | */ 33 | package org.netbeans.jemmy.image; 34 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/text/OffsetKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.text; 26 | 27 | abstract class OffsetKey extends NavigationKey { 28 | 29 | public OffsetKey(int keyCode, int mods) { 30 | super(keyCode, mods); 31 | } 32 | 33 | public abstract int getExpectedPosition(); 34 | } 35 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/text/GoAndBackKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.text; 26 | 27 | abstract class GoAndBackKey extends NavigationKey { 28 | 29 | public GoAndBackKey(int keyCode, int mods) { 30 | super(keyCode, mods); 31 | } 32 | 33 | public abstract GoAndBackKey getBackKey(); 34 | } 35 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Main Jemmy package

27 | * Contains basic Jemmy classes.

28 | * Low-level classes to find/wait components, classes to perform waitings, time 29 | * resricted actions and so on.
30 | * 31 | * @since 02/23/2002 32 | *
33 | */ 34 | package org.netbeans.jemmy; 35 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/util/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Util package

27 | * Contains different util classes and additional implementations of some Jemmy 28 | * interfaces.
29 | * 30 | * @since 02/28/2002 31 | *
32 | *
33 | */ 34 | package org.netbeans.jemmy.util; 35 | -------------------------------------------------------------------------------- /test/org/netbeans/jemmy/scenario/Util.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.scenario; 26 | 27 | import org.netbeans.jemmy.JemmyProperties; 28 | 29 | /** 30 | * Created by shura on 7/20/17. 31 | */ 32 | public class Util { 33 | public static void testInfraSetup() { 34 | JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/util/DumpController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.util; 26 | 27 | import java.awt.Component; 28 | 29 | /** 30 | * 31 | * @author shura 32 | */ 33 | public interface DumpController { 34 | 35 | public boolean onComponentDump(Component comp); 36 | 37 | public boolean onPropertyDump(Component comp, String name, String value); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /doc/samples/TableActionsSample.java: -------------------------------------------------------------------------------- 1 | import org.netbeans.jemmy.*; 2 | import org.netbeans.jemmy.explorer.*; 3 | import org.netbeans.jemmy.operators.*; 4 | 5 | public class TableActionsSample implements Scenario { 6 | public int runIt(Object param) { 7 | try { 8 | new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser").startApplication(); 9 | JFrameOperator mainFrame = new JFrameOperator("GUI Browser"); 10 | 11 | new JButtonOperator(mainFrame, "Reload In").push(); 12 | new JLabelOperator(mainFrame, "Reloaded"); 13 | 14 | JTreeOperator tree = new JTreeOperator(mainFrame); 15 | tree.selectPath(tree.findPath("GUI Browser", "|")); 16 | 17 | new JButtonOperator(mainFrame, "View").push(); 18 | 19 | JFrameOperator viewFrame = new JFrameOperator("GUIBrowser"); 20 | 21 | new JTabbedPaneOperator(viewFrame).selectPage("Properties"); 22 | 23 | //find table 24 | JTableOperator table = new JTableOperator(viewFrame); 25 | 26 | //find row 27 | int titleRow = table.findCellRow("GUI Browser"); 28 | 29 | //select cell containing window title 30 | table.selectCell(titleRow, 1); 31 | 32 | //change table text 33 | //table.changeCellObject(titleRow, 1, "That was window title :)"); 34 | 35 | } catch(Exception e) { 36 | e.printStackTrace(); 37 | return(1); 38 | } 39 | return(0); 40 | } 41 | public static void main(String[] argv) { 42 | String[] params = {"TableActionsSample"}; 43 | org.netbeans.jemmy.Test.main(params); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/text/HomeKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.text; 26 | 27 | class HomeKey extends OffsetKey { 28 | 29 | public HomeKey(int keyCode, int mods) { 30 | super(keyCode, mods); 31 | } 32 | 33 | @Override 34 | public int getDirection() { 35 | return -1; 36 | } 37 | 38 | @Override 39 | public int getExpectedPosition() { 40 | return 0; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/FocusDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | /** 30 | * Defines how to manage focus. 31 | */ 32 | public interface FocusDriver { 33 | 34 | /** 35 | * Makes a compoennt having focus. 36 | * 37 | * @param operator Component operator. 38 | */ 39 | public void giveFocus(ComponentOperator operator); 40 | } 41 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/DescriptablePathChooser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | /** 28 | * Specifies an interface for objects defining path searching criteria. 29 | * 30 | * @author Alexandre Iline(alexandre.iline@oracle.com) 31 | */ 32 | public interface DescriptablePathChooser extends PathChooser { 33 | 34 | /** 35 | * Gives path description. 36 | */ 37 | public String getDescription(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/ListDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | /** 30 | * Defines how to work with lists. 31 | */ 32 | public interface ListDriver { 33 | 34 | /** 35 | * Selects an item. 36 | * 37 | * @param oper List operator. 38 | * @param index Item index. 39 | */ 40 | public void selectItem(ComponentOperator oper, int index); 41 | } 42 | -------------------------------------------------------------------------------- /make/jemmy-v2-nb/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 24 | 25 | org.netbeans.modules.java.j2seproject 26 | 27 | 28 | Jemmy v2 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/MultiSelListDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | /** 30 | * Defines how to work with lists allowing multiple selection. 31 | */ 32 | public interface MultiSelListDriver extends ListDriver { 33 | 34 | /** 35 | * Selects some items. 36 | * 37 | * @param oper List operator. 38 | * @param indices Item indices. 39 | */ 40 | public void selectItems(ComponentOperator oper, int[] indices); 41 | } 42 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/text/NavigationKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.text; 26 | 27 | abstract class NavigationKey { 28 | 29 | private int keyCode; 30 | private int mods; 31 | 32 | public NavigationKey(int keyCode, int mods) { 33 | this.keyCode = keyCode; 34 | this.mods = mods; 35 | } 36 | 37 | public int getKeyCode() { 38 | return keyCode; 39 | } 40 | 41 | public int getModifiers() { 42 | return mods; 43 | } 44 | 45 | public abstract int getDirection(); 46 | } 47 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/InternalFrameDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import java.awt.Component; 28 | 29 | import org.netbeans.jemmy.operators.ComponentOperator; 30 | 31 | /** 32 | * Defines the way to get a title pane. 33 | */ 34 | public interface InternalFrameDriver { 35 | 36 | /** 37 | * Returns the title pane component. 38 | * 39 | * @param oper operator for an internal frame. 40 | * @return a component - title pane. 41 | */ 42 | public Component getTitlePane(ComponentOperator oper); 43 | } 44 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/text/DownKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.text; 26 | 27 | class DownKey extends GoAndBackKey { 28 | 29 | private UpKey backKey; 30 | 31 | public DownKey(int keyCode, int mods) { 32 | super(keyCode, mods); 33 | } 34 | 35 | public void setUpKey(UpKey key) { 36 | backKey = key; 37 | } 38 | 39 | @Override 40 | public int getDirection() { 41 | return 1; 42 | } 43 | 44 | @Override 45 | public GoAndBackKey getBackKey() { 46 | return backKey; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/text/UpKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.text; 26 | 27 | class UpKey extends GoAndBackKey { 28 | 29 | private DownKey backKey; 30 | 31 | public UpKey(int keyCode, int mods) { 32 | super(keyCode, mods); 33 | } 34 | 35 | public void setDownKey(DownKey key) { 36 | backKey = key; 37 | } 38 | 39 | @Override 40 | public int getDirection() { 41 | return -1; 42 | } 43 | 44 | @Override 45 | public GoAndBackKey getBackKey() { 46 | return backKey; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/Driver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | /** 28 | * Implements "heavy" model of driver because requires to load classes for all 29 | * supported operator types. 30 | * 31 | * @see LightDriver 32 | * 33 | * @author Alexandre Iline (alexandre.iline@oracle.com) 34 | */ 35 | public interface Driver { 36 | 37 | /** 38 | * Returns an array of operator classes which are supported by this driver. 39 | * 40 | * @return an array of supported operators' classes. 41 | */ 42 | public Class[] getSupported(); 43 | } 44 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/EditorDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | /** 30 | * Interface of objects to be used for value changing (editing). 31 | * 32 | * @author Alexandre Iline(alexandre.iline@oracle.com) 33 | */ 34 | public interface EditorDriver { 35 | 36 | /** 37 | * Changes value. 38 | * 39 | * @param oper Operator to change value for. 40 | * @param newValue a new value. 41 | */ 42 | public void enterNewValue(ComponentOperator oper, Object newValue); 43 | } 44 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/LightDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | /** 28 | * Implements "light" model of driver because does not require to load classes 29 | * for all supported operator types. 30 | * 31 | * @see Driver 32 | * 33 | * @author Alexandre Iline (alexandre.iline@oracle.com) 34 | */ 35 | public interface LightDriver { 36 | 37 | /** 38 | * Returns array of operator classes which are supported by this driver. 39 | * 40 | * @return an array of supported operator classes' names. 41 | */ 42 | public String[] getSupported(); 43 | } 44 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/OrderedListDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | /** 30 | * Defines how to work with lists allowing items reordering. 31 | */ 32 | public interface OrderedListDriver extends MultiSelListDriver { 33 | 34 | /** 35 | * Changes item index. 36 | * 37 | * @param oper List operator. 38 | * @param itemIndex Current item index. 39 | * @param newIndex Ne witem index. 40 | */ 41 | public void moveItem(ComponentOperator oper, int itemIndex, int newIndex); 42 | } 43 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/TimeoutExpiredException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | /** 28 | * 29 | * Exception is supposed to be used to notice that some waiting was expired. 30 | * 31 | * @author Alexandre Iline (alexandre.iline@oracle.com) 32 | */ 33 | public class TimeoutExpiredException extends JemmyException { 34 | 35 | private static final long serialVersionUID = 42L; 36 | 37 | /** 38 | * Constructor. 39 | * 40 | * @param description Waiting description. 41 | */ 42 | public TimeoutExpiredException(String description) { 43 | super(description); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/image/ImageLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.image; 26 | 27 | import java.awt.image.BufferedImage; 28 | import java.io.IOException; 29 | 30 | /** 31 | * Interface for all classes performing image loading. 32 | * 33 | * @author Alexandre Iline (alexandre.iline@oracle.com) 34 | */ 35 | public interface ImageLoader { 36 | 37 | /** 38 | * Loads an image from file. 39 | * 40 | * @param fileName a file to load image from. 41 | * @return a loaded image. 42 | * @throws IOException 43 | */ 44 | public BufferedImage load(String fileName) throws IOException; 45 | } 46 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/NoComponentUnderMouseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | /** 28 | * 29 | * Exception can be throwht as a result of attempt to produce a mouse pressing 30 | * when mouse is not over the java component. 31 | * 32 | * @author Alexandre Iline (alexandre.iline@oracle.com) 33 | */ 34 | public class NoComponentUnderMouseException extends RuntimeException { 35 | 36 | private static final long serialVersionUID = 42L; 37 | 38 | /** 39 | * Constructor. 40 | */ 41 | public NoComponentUnderMouseException() { 42 | super("No component under the mouse!"); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/image/ImageSaver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.image; 26 | 27 | import java.awt.image.BufferedImage; 28 | import java.io.IOException; 29 | 30 | /** 31 | * Interface for classes performing image saving. 32 | * 33 | * @author Alexandre Iline (alexandre.iline@oracle.com) 34 | */ 35 | public interface ImageSaver { 36 | 37 | /** 38 | * Should save image into file. 39 | * 40 | * @param image an image to be saved. 41 | * @param fileName a file to load image from. 42 | * @throws IOException 43 | */ 44 | public void save(BufferedImage image, String fileName) throws IOException; 45 | } 46 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/image/ImageComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.image; 26 | 27 | import java.awt.image.BufferedImage; 28 | 29 | /** 30 | * Interface for all classes performing image comparison. 31 | * 32 | * @author Alexandre Iline (alexandre.iline@oracle.com) 33 | */ 34 | public interface ImageComparator { 35 | 36 | /** 37 | * Should return true if images matches, false otherwise. 38 | * 39 | * @param image1 an image to compare. 40 | * @param image2 an image to compare. 41 | * @return true if images match each other. 42 | */ 43 | public boolean compare(BufferedImage image1, BufferedImage image2); 44 | } 45 | -------------------------------------------------------------------------------- /doc/samples/ActionsSample.java: -------------------------------------------------------------------------------- 1 | import org.netbeans.jemmy.*; 2 | import org.netbeans.jemmy.explorer.*; 3 | import org.netbeans.jemmy.operators.*; 4 | 5 | public class ActionsSample implements Scenario { 6 | public int runIt(Object param) { 7 | try { 8 | new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser").startApplication(); 9 | JFrameOperator mainFrame = new JFrameOperator("GUI Browser"); 10 | 11 | new JButtonOperator(mainFrame, "Reload In").push(); 12 | new JLabelOperator(mainFrame, "Reloaded"); 13 | 14 | JTreeOperator tree = new JTreeOperator(mainFrame); 15 | 16 | //click in the middle of the tree 17 | tree.clickMouse(); 18 | 19 | //collapse node 20 | tree.collapsePath(tree.findPath("", "|")); 21 | 22 | //expand node 23 | tree.expandPath(tree.findPath("", "|")); 24 | 25 | //select node 26 | tree.selectPath(tree.findPath("GUI Browser", "|")); 27 | 28 | JTextFieldOperator testField = new JTextFieldOperator(mainFrame); 29 | 30 | //type new value in the text field 31 | testField.clearText(); 32 | testField.typeText("3"); 33 | 34 | JTextAreaOperator testArea = new JTextAreaOperator(mainFrame); 35 | 36 | //select text in the text area 37 | testArea.selectText("toString"); 38 | 39 | //puch button 40 | new JButtonOperator(mainFrame, "Reload").push(); 41 | 42 | //wait "Reloaded" footer 43 | new JLabelOperator(mainFrame, "Reloaded"); 44 | 45 | } catch(Exception e) { 46 | e.printStackTrace(); 47 | return(1); 48 | } 49 | return(0); 50 | } 51 | public static void main(String[] argv) { 52 | String[] params = {"ActionsSample"}; 53 | org.netbeans.jemmy.Test.main(params); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/MenuDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | /** 30 | * Defines how to work with menus. 31 | * 32 | * @author Alexandre Iline (alexandre.iline@oracle.com) 33 | */ 34 | public interface MenuDriver { 35 | 36 | /** 37 | * Pushes menu. 38 | * 39 | * @param oper Menu operator. 40 | * @param chooser Object defining menupath. 41 | * @return a result of menu pushing. It could be last pushed menuitem or 42 | * anything else. 43 | */ 44 | public Object pushMenu(ComponentOperator oper, PathChooser chooser); 45 | } 46 | -------------------------------------------------------------------------------- /doc/samples/QueueUsingSample.java: -------------------------------------------------------------------------------- 1 | import org.netbeans.jemmy.*; 2 | import org.netbeans.jemmy.explorer.*; 3 | import org.netbeans.jemmy.operators.*; 4 | 5 | public class QueueUsingSample implements Scenario { 6 | public int runIt(Object param) { 7 | try { 8 | //start application 9 | new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser").startApplication(); 10 | //wait frame 11 | JFrameOperator mainFrame = new JFrameOperator("GUI Browser"); 12 | 13 | //wait tree in it 14 | JTreeOperator tree = new JTreeOperator(mainFrame); 15 | 16 | //get soumething to be shown 17 | new JButtonOperator(mainFrame, "Reload In").pushNoBlock(); 18 | 19 | //wait for the operation to be completed 20 | new QueueTool().waitEmpty(100); 21 | 22 | //since queue is empty, frame tree has already been loaded and displayed. 23 | //print number of lines. Should be 2 24 | System.out.println("Lines in the tree: " + tree.getRowCount()); 25 | 26 | //select something 27 | tree.selectRow(1); 28 | 29 | //push menu 30 | new JButtonOperator(mainFrame, "View").push(); 31 | 32 | //wait for queue to be empty 33 | new QueueTool().waitEmpty(100); 34 | 35 | //since queue is empty, frame has already been created and displayed. 36 | //find (not wait) second window using low-level functionality 37 | System.out.println("Second frame title: " + 38 | JFrameOperator.findJFrame(new JFrameOperator.FrameByTitleFinder(""), 1).getTitle()); 39 | } catch(Exception e) { 40 | e.printStackTrace(); 41 | return(1); 42 | } 43 | return(0); 44 | } 45 | public static void main(String[] argv) { 46 | String[] params = {"QueueUsingSample"}; 47 | org.netbeans.jemmy.Test.main(params); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/Waitable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | /** 28 | * 29 | * Defines criteria for waiting. 30 | * 31 | * @see org.netbeans.jemmy.Waiter 32 | * 33 | * @author Alexandre Iline (alexandre.iline@oracle.com) 34 | */ 35 | public interface Waitable { 36 | 37 | /** 38 | * Checks if wait criteria have been met. 39 | * 40 | * @param obj optional waiting parameter. 41 | * @return null is criteria have not been met. 42 | */ 43 | public R actionProduced(P obj); 44 | 45 | /** 46 | * Returns description. 47 | * 48 | * @return a description of the wait criteria. 49 | */ 50 | public String getDescription(); 51 | } 52 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/text/EndKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.text; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | class EndKey extends OffsetKey { 30 | 31 | TextKeyboardDriver cont; 32 | ComponentOperator oper; 33 | 34 | public EndKey(int keyCode, int mods, TextKeyboardDriver cont, ComponentOperator oper) { 35 | super(keyCode, mods); 36 | this.cont = cont; 37 | this.oper = oper; 38 | } 39 | 40 | @Override 41 | public int getDirection() { 42 | return 1; 43 | } 44 | 45 | @Override 46 | public int getExpectedPosition() { 47 | return cont.getText(oper).length(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/image/PNGImageLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.image; 26 | 27 | import java.awt.image.BufferedImage; 28 | import java.io.FileInputStream; 29 | import java.io.IOException; 30 | 31 | import org.netbeans.jemmy.util.PNGDecoder; 32 | 33 | /** 34 | * Allowes to process PNF image format. 35 | * 36 | * @author Alexandre Iline (alexandre.iline@oracle.com) 37 | */ 38 | public class PNGImageLoader implements ImageLoader { 39 | 40 | /** 41 | * Loads an image from a PNG image file. 42 | */ 43 | @Override 44 | public BufferedImage load(String fileName) throws IOException { 45 | return new PNGDecoder(new FileInputStream(fileName)).decode(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Drivers interfaces

27 | * Contains interfaces of "drivers".

28 | * Driver is a class which actually implements action reproducing. There are 29 | * different types of drivers (mouse driver, keyboard driver, button drivers, 30 | * ...), each of them represented by interface (button driver - by ButtonDriver 31 | * interface, ...)

32 | * Package also contains some classes allowing to manage driver set.

33 | * Subpackages contain driver implementations.

34 | * Drivers is low-level API: they are not supposed to be used directly from 35 | * test.
36 | * 37 | * @since 04/17/2002 38 | *
39 | */ 40 | package org.netbeans.jemmy.drivers; 41 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/ButtonDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | /** 30 | * Defines how to work with buttons. 31 | */ 32 | public interface ButtonDriver { 33 | 34 | /** 35 | * Presses a button. 36 | * 37 | * @param oper Button operator. 38 | */ 39 | public void press(ComponentOperator oper); 40 | 41 | /** 42 | * Releases a button. 43 | * 44 | * @param oper Button operator. 45 | */ 46 | public void release(ComponentOperator oper); 47 | 48 | /** 49 | * Pushes a button. 50 | * 51 | * @param oper Button operator. 52 | */ 53 | public void push(ComponentOperator oper); 54 | } 55 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/util/EmptyVisualizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.util; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | import org.netbeans.jemmy.operators.Operator; 29 | import org.netbeans.jemmy.operators.Operator.ComponentVisualizer; 30 | 31 | /** 32 | * 33 | * Being used bas visualizer does nothing. 34 | * 35 | * @see 36 | * org.netbeans.jemmy.operators.Operator#setVisualizer(Operator.ComponentVisualizer) 37 | * @see org.netbeans.jemmy.operators.Operator.ComponentVisualizer 38 | * 39 | * @author Alexandre Iline (alexandre.iline@oracle.com) 40 | * 41 | */ 42 | public class EmptyVisualizer implements ComponentVisualizer { 43 | 44 | @Override 45 | public void makeVisible(ComponentOperator compOper) { 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/ComponentIsNotVisibleException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | import java.awt.Component; 28 | 29 | /** 30 | * 31 | * Exception can be thrown as a result of attempt to produce a mouse operation 32 | * for a component which is not visible. 33 | * 34 | * @author Alexandre Iline (alexandre.iline@oracle.com) 35 | */ 36 | public class ComponentIsNotVisibleException extends JemmyInputException { 37 | 38 | private static final long serialVersionUID = 42L; 39 | 40 | /** 41 | * Constructs a ComponentIsNotVisibleException object. 42 | * 43 | * @param comp a Component. 44 | */ 45 | public ComponentIsNotVisibleException(Component comp) { 46 | super("Component is not visible", comp); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/ComponentIsNotFocusedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | import java.awt.Component; 28 | 29 | /** 30 | * 31 | * Exception can be thrown as a result of attempt to produce a key operation for 32 | * a component which does not have focus. 33 | * 34 | * @author Alexandre Iline (alexandre.iline@oracle.com) 35 | */ 36 | public class ComponentIsNotFocusedException extends JemmyInputException { 37 | 38 | private static final long serialVersionUID = 42L; 39 | 40 | /** 41 | * Constructs a ComponentIsNotFocusedException object. 42 | * 43 | * @param comp a Component. 44 | */ 45 | public ComponentIsNotFocusedException(Component comp) { 46 | super("Component do not have focus", comp); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /doc/samples/FindComponentsSample.java: -------------------------------------------------------------------------------- 1 | import java.io.FileNotFoundException; 2 | import org.netbeans.jemmy.*; 3 | import org.netbeans.jemmy.explorer.*; 4 | import org.netbeans.jemmy.operators.*; 5 | import org.netbeans.jemmy.util.Dumper; 6 | 7 | public class FindComponentsSample implements Scenario { 8 | public int runIt(Object param) { 9 | try { 10 | new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser").startApplication(); 11 | JFrameOperator mainFrame = new JFrameOperator("GUI Browser"); 12 | 13 | new JButtonOperator(mainFrame, "Reload in").push(); 14 | new JLabelOperator(mainFrame, "Reloaded"); 15 | 16 | //find JTree 17 | //we can find any: 18 | JTreeOperator tree = new JTreeOperator(mainFrame); 19 | 20 | //or by selected node: 21 | tree.selectPath(tree.findPath("GUI Browser", "|")); 22 | new JTreeOperator(mainFrame, "GUI Browser"); 23 | 24 | //and couple of text components: 25 | new JTextComponentOperator(mainFrame, "0"); 26 | new JTextComponentOperator(mainFrame, "toString"); 27 | 28 | //but one of them is a test field: 29 | new JTextFieldOperator(mainFrame); 30 | 31 | //and another one is a text area: 32 | new JTextAreaOperator(mainFrame); 33 | 34 | //it's good idea to search buttons by text: 35 | new AbstractButtonOperator(mainFrame, "View"); 36 | 37 | //but not necessarily 38 | new JButtonOperator(mainFrame); 39 | } catch(Exception e) { 40 | e.printStackTrace(); 41 | try { 42 | Dumper.dumpAll("/tmp/aaa.xml"); 43 | } catch (FileNotFoundException ex) { 44 | ex.printStackTrace(); 45 | } 46 | return(1); 47 | } 48 | return(0); 49 | } 50 | public static void main(String[] argv) { 51 | String[] params = {"FindComponentsSample"}; 52 | org.netbeans.jemmy.Test.main(params); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/Action.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | /** 28 | * 29 | * Defines an action to be executed by {@code ActionProducer} instance. 30 | * 31 | * @see org.netbeans.jemmy.ActionProducer 32 | * 33 | * @author Alexandre Iline (alexandre.iline@oracle.com) 34 | */ 35 | public interface Action { 36 | 37 | /** 38 | * Executes this action. 39 | * 40 | * @param obj action argument. This argument might be the method parameter 41 | * in an invocation of {@code ActionProducer.produceAction(Object)}. 42 | * @return action result. 43 | */ 44 | public R launch(P obj); 45 | 46 | /** 47 | * Returns the description value. 48 | * 49 | * @return Action description. 50 | */ 51 | public String getDescription(); 52 | } 53 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/PathChooser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | /** 28 | * Specifies an interface for objects defining path searching criteria. 29 | * 30 | * @author Alexandre Iline(alexandre.iline@oracle.com) 31 | */ 32 | public interface PathChooser { 33 | 34 | /** 35 | * Checks if {@code depth}'th path components fits the requirements. 36 | * 37 | * @param depth A depth of the component. 38 | * @param component A path component to be checked. 39 | * @return true if the component fits the requirements. 40 | */ 41 | public boolean checkPathComponent(int depth, Object component); 42 | 43 | /** 44 | * Return requiered depth of the path. 45 | * 46 | * @return depth. 47 | */ 48 | public int getDepth(); 49 | } 50 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/image/ImageFinder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.image; 26 | 27 | import java.awt.Point; 28 | import java.awt.image.BufferedImage; 29 | 30 | /** 31 | * Interface for all classes performing image lookup. 32 | * 33 | * @author Alexandre Iline (alexandre.iline@oracle.com) 34 | */ 35 | public interface ImageFinder { 36 | 37 | /** 38 | * Should return location if image lays inside an image represented by this 39 | * object. 40 | * 41 | * @param image an image to search. 42 | * @param index an ordinal image location index. If equal to 1, for example, 43 | * second appropriate location will be found. 44 | * @return Image location coordinates if image was found, null otherwise. 45 | */ 46 | public Point findImage(BufferedImage image, int index); 47 | } 48 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/TableDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | /** 30 | * Defines how to work with tables. 31 | */ 32 | public interface TableDriver { 33 | 34 | /** 35 | * Selects a cell. 36 | * 37 | * @param oper Table operator. 38 | * @param row Cell row index. 39 | * @param column Cell column index. 40 | */ 41 | public void selectCell(ComponentOperator oper, int row, int column); 42 | 43 | /** 44 | * Edits a cell. 45 | * 46 | * @param oper Table operator. 47 | * @param row Cell row index. 48 | * @param column Cell column index. 49 | * @param value New value. 50 | */ 51 | public void editCell(ComponentOperator oper, int row, int column, Object value); 52 | } 53 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/image/PNGImageSaver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.image; 26 | 27 | import java.awt.image.BufferedImage; 28 | import java.io.BufferedOutputStream; 29 | import java.io.FileOutputStream; 30 | import java.io.IOException; 31 | 32 | import org.netbeans.jemmy.util.PNGEncoder; 33 | 34 | /** 35 | * Allowes to process PNF image format. 36 | * 37 | * @author Alexandre Iline (alexandre.iline@oracle.com) 38 | */ 39 | public class PNGImageSaver implements ImageSaver { 40 | 41 | /** 42 | * Saves an image into a PNG image file. 43 | */ 44 | @Override 45 | public void save(BufferedImage image, String fileName) throws IOException { 46 | new PNGEncoder(new BufferedOutputStream(new FileOutputStream(fileName)), 47 | PNGEncoder.COLOR_MODE). 48 | encode(image); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/Timeoutable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | /** 28 | * 29 | * Any class which contains methods requiring waiting or sleeping should 30 | * implement this interface. Waiting and sleeping operations have time limits 31 | * that can be set or returned using the methods of this interface. 32 | * 33 | * @author Alexandre Iline (alexandre.iline@oracle.com) 34 | */ 35 | public interface Timeoutable { 36 | 37 | /** 38 | * Defines current timeouts. 39 | * 40 | * @param t A collection of timeout assignments. 41 | * @see #getTimeouts 42 | */ 43 | public void setTimeouts(Timeouts t); 44 | 45 | /** 46 | * Return current timeouts. 47 | * 48 | * @return the collection of current timeout assignments. 49 | * @see #setTimeouts 50 | */ 51 | public Timeouts getTimeouts(); 52 | } 53 | -------------------------------------------------------------------------------- /test/org/netbeans/jemmy/operators/TextComponentOperatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.operators; 26 | 27 | import org.testng.annotations.Test; 28 | 29 | import java.awt.TextComponent; 30 | import java.awt.TextField; 31 | 32 | import static org.testng.Assert.assertEquals; 33 | 34 | public class TextComponentOperatorTest { 35 | @Test 36 | public void selection() { 37 | TextComponent text = new TextField("0123456789"); 38 | TextComponentOperator textOper = new TextComponentOperator(text); 39 | assertEquals(textOper.getDump().get(TextComponentOperator.SELECTED_TEXT_DPROP), ""); 40 | text.select(1,1); 41 | assertEquals(textOper.getDump().get(TextComponentOperator.SELECTED_TEXT_DPROP), ""); 42 | text.select(1,2); 43 | assertEquals(textOper.getDump().get(TextComponentOperator.SELECTED_TEXT_DPROP), "1"); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/util/WindowJob.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.util; 26 | 27 | import java.awt.Component; 28 | 29 | import org.netbeans.jemmy.Action; 30 | import org.netbeans.jemmy.ComponentChooser; 31 | 32 | /** 33 | * 34 | * Supposed to be used to perform some periodical job. 35 | * 36 | * @see WindowManager 37 | * 38 | * @author Alexandre Iline (alexandre.iline@oracle.com) 39 | */ 40 | public interface WindowJob extends ComponentChooser, Action { 41 | 42 | /** 43 | * Perform necessary actions. 44 | */ 45 | @Override 46 | public R launch(P obj); 47 | 48 | /** 49 | * Checks if window is what we want to do something with. 50 | */ 51 | @Override 52 | public boolean checkComponent(Component comp); 53 | 54 | /** 55 | * Job description. 56 | */ 57 | @Override 58 | public String getDescription(); 59 | } 60 | -------------------------------------------------------------------------------- /test/org/netbeans/jemmy/operators/JTextComponentOperatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.operators; 26 | 27 | import org.testng.annotations.Test; 28 | 29 | import javax.swing.JTextField; 30 | import javax.swing.text.JTextComponent; 31 | 32 | import static org.testng.Assert.assertEquals; 33 | 34 | public class JTextComponentOperatorTest { 35 | @Test 36 | public void selection() { 37 | JTextComponent text = new JTextField("0123456789"); 38 | JTextComponentOperator textOper = new JTextComponentOperator(text); 39 | assertEquals(textOper.getDump().get(JTextComponentOperator.SELECTED_TEXT_DPROP), ""); 40 | text.select(1,1); 41 | assertEquals(textOper.getDump().get(JTextComponentOperator.SELECTED_TEXT_DPROP), ""); 42 | text.select(1,2); 43 | assertEquals(textOper.getDump().get(JTextComponentOperator.SELECTED_TEXT_DPROP), "1"); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/FrameDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | /** 30 | * Defines how to work with frames. 31 | */ 32 | public interface FrameDriver { 33 | 34 | /** 35 | * Iconifies a frame. 36 | * 37 | * @param oper Frame operator. 38 | */ 39 | public void iconify(ComponentOperator oper); 40 | 41 | /** 42 | * Deiconifies a frame. 43 | * 44 | * @param oper Frame operator. 45 | */ 46 | public void deiconify(ComponentOperator oper); 47 | 48 | /** 49 | * Maximizes a frame. 50 | * 51 | * @param oper Frame operator. 52 | */ 53 | public void maximize(ComponentOperator oper); 54 | 55 | /** 56 | * Demaximizes a frame. 57 | * 58 | * @param oper Frame operator. 59 | */ 60 | public void demaximize(ComponentOperator oper); 61 | } 62 | -------------------------------------------------------------------------------- /test/org/netbeans/jemmy/LookAndFeelProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package org.netbeans.jemmy; 27 | 28 | import javax.swing.UIManager; 29 | 30 | import org.testng.annotations.DataProvider; 31 | 32 | public class LookAndFeelProvider { 33 | 34 | /** 35 | * A DataProvider having the class name of all the available look and feels 36 | * 37 | * @return a 2d Object array containing the class name of all the available 38 | * look and feels 39 | */ 40 | @DataProvider(name = "availableLookAndFeels") 41 | public static Object[][] provideAvailableLookAndFeels() { 42 | UIManager.LookAndFeelInfo LookAndFeelInfos[] 43 | = UIManager.getInstalledLookAndFeels(); 44 | Object[][] lookAndFeels = new Object[LookAndFeelInfos.length][1]; 45 | for (int i = 0; i < LookAndFeelInfos.length; i++) { 46 | lookAndFeels[i][0] = LookAndFeelInfos[i].getClassName(); 47 | } 48 | return lookAndFeels; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/demo/DemoInterruptedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package org.netbeans.jemmy.demo; 27 | 28 | import java.io.PrintStream; 29 | 30 | import org.netbeans.jemmy.TestCompletedException; 31 | 32 | /** 33 | * 34 | * Exception is throught if test (demo) execution has been interrupted 35 | * (CommentWindow.isInterrupted() returned true). 36 | * 37 | * @author Alexandre Iline (alexandre.iline@oracle.com) 38 | * 39 | */ 40 | 41 | public class DemoInterruptedException extends TestCompletedException { 42 | 43 | /** 44 | * Constructs a DemoInterruptedException object. 45 | * @param description an exception descriptio. 46 | */ 47 | public DemoInterruptedException(String description) { 48 | super(100, description); 49 | } 50 | 51 | public void printStackTrace() { 52 | printStackTrace(System.out); 53 | } 54 | 55 | public void printStackTrace(PrintStream ps) { 56 | super.printStackTrace(ps); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/focus/APIFocusDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.focus; 26 | 27 | import java.awt.event.FocusEvent; 28 | 29 | import org.netbeans.jemmy.drivers.FocusDriver; 30 | import org.netbeans.jemmy.drivers.LightSupportiveDriver; 31 | import org.netbeans.jemmy.drivers.input.EventDriver; 32 | import org.netbeans.jemmy.operators.ComponentOperator; 33 | 34 | public class APIFocusDriver extends LightSupportiveDriver implements FocusDriver { 35 | 36 | EventDriver eDriver; 37 | 38 | public APIFocusDriver() { 39 | super(new String[]{"org.netbeans.jemmy.operators.ComponentOperator"}); 40 | eDriver = new EventDriver(); 41 | } 42 | 43 | @Override 44 | public void giveFocus(ComponentOperator operator) { 45 | operator.requestFocus(); 46 | eDriver.dispatchEvent(operator.getSource(), 47 | new FocusEvent(operator.getSource(), 48 | FocusEvent.FOCUS_GAINED)); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/Scenario.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | /** 28 | * 29 | * A test scenario. This interface provides a mechanism for putting something 30 | * into execution. The execution is conditioned in a very general way by passing 31 | * a {@code java.lang.Object} to it's {@code runIt} method. 32 | * 33 | * @see Test 34 | * 35 | * @author Alexandre Iline (alexandre.iline@oracle.com) 36 | */ 37 | public interface Scenario { 38 | 39 | /** 40 | * Defines a way to execute this test scenario. 41 | * 42 | * @param param An object passed to configure the test scenario execution. 43 | * For example, this parameter might be a java.lang.String[] object that lists the 44 | * command line arguments to the Java application corresponding 45 | * to a test. 46 | * @return an int that tells something about the execution. For, example, a 47 | * status code. 48 | */ 49 | public int runIt(Object param); 50 | } 51 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/Outputable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | /** 28 | * Communicate the identity of the output streams or writers used by the 29 | * application. Communicate the identity of the input stream, too. Any object 30 | * with methods that generates print output should implement this interface. 31 | * 32 | * @see org.netbeans.jemmy.TestOut 33 | * 34 | * @author Alexandre Iline (alexandre.iline@oracle.com) 35 | */ 36 | public interface Outputable { 37 | 38 | /** 39 | * Defines print output streams or writers. 40 | * 41 | * @param out Identify the streams or writers used for print output. 42 | * @see #getOutput 43 | */ 44 | public void setOutput(TestOut out); 45 | 46 | /** 47 | * Returns print output streams or writers. 48 | * 49 | * @return an object that contains references to objects for printing to 50 | * output and err streams. 51 | * @see #setOutput 52 | */ 53 | public TestOut getOutput(); 54 | } 55 | -------------------------------------------------------------------------------- /test/org/netbeans/jemmy/operators/ComponentChooserTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.operators; 26 | 27 | import static org.testng.Assert.assertEquals; 28 | 29 | import java.awt.Component; 30 | 31 | import org.netbeans.jemmy.ComponentChooser; 32 | import org.testng.annotations.Test; 33 | 34 | public class ComponentChooserTest { 35 | 36 | @Test 37 | public void testGetDescription() { 38 | String testString = "toString"; 39 | ComponentChooser componentChooser = new ComponentChooser() { 40 | 41 | @Override 42 | public boolean checkComponent(Component comp) { 43 | return false; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return testString; 49 | } 50 | }; 51 | assertEquals(componentChooser.getDescription(), testString, 52 | "Default value of getDescription() is not equal to return value of toString()"); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /test/org/netbeans/jemmy/operators/FileChooserApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.operators; 26 | 27 | import javax.swing.JFileChooser; 28 | import javax.swing.JFrame; 29 | import java.awt.Dimension; 30 | import java.io.File; 31 | 32 | public class FileChooserApp extends JFrame { 33 | public FileChooserApp(File path) { 34 | super("Sample File Chooser"); 35 | JFileChooser externalChooser = new JFileChooser(new File(".")); 36 | externalChooser.setCurrentDirectory(path); 37 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 38 | setPreferredSize(new Dimension(800, 600)); 39 | pack(); 40 | setLocationRelativeTo(null); 41 | getContentPane().add(externalChooser); 42 | } 43 | public static void main(String[] args) { 44 | show((args.length >= 1) ? new File(args[0]) : new File(System.getProperty("user.dir"))); 45 | } 46 | 47 | public static void show(File path) { 48 | new FileChooserApp(path).setVisible(true); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/ComponentChooser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | import java.awt.Component; 28 | 29 | /** 30 | * 31 | * This interface should be implemented to define the criteria used to search 32 | * for a component. 33 | * 34 | * @see org.netbeans.jemmy.ComponentSearcher 35 | * @see org.netbeans.jemmy.WindowWaiter 36 | * 37 | * @author Alexandre Iline (alexandre.iline@oracle.com) 38 | */ 39 | public interface ComponentChooser { 40 | 41 | /** 42 | * Check if the component argument meets the search criteria. 43 | * 44 | * @param comp Component to check. 45 | * @return {@code true} when the component conforms to the search 46 | * criteria; {@code false} otherwise. 47 | */ 48 | public boolean checkComponent(Component comp); 49 | 50 | /** 51 | * Returns searched component description. 52 | * 53 | * @return a String representing the description value 54 | */ 55 | public default String getDescription() { 56 | return toString(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/CharBindingMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | /** 28 | * 29 | * Defines char-to-key binding. The generation of a symbol will, in general, 30 | * require modifier keys to be pressed prior to pressing a primary key. Classes 31 | * that implement {@code CharBindingMap} communicate what modifiers and 32 | * primary key are required to generate a given symbol. 33 | * 34 | * @see org.netbeans.jemmy.DefaultCharBindingMap 35 | * 36 | * @author Alexandre Iline (alexandre.iline@oracle.com) 37 | */ 38 | public interface CharBindingMap { 39 | 40 | /** 41 | * Returns the code of the primary key used to type a symbol. 42 | * 43 | * @param c Symbol code. 44 | * @return a key code. 45 | * @see java.awt.event.InputEvent 46 | */ 47 | public int getCharKey(char c); 48 | 49 | /** 50 | * Returns the modifiers that should be pressed to type a symbol. 51 | * 52 | * @param c Symbol code. 53 | * @return a combination of InputEvent MASK fields. 54 | * @see java.awt.event.InputEvent 55 | */ 56 | public int getCharModifiers(char c); 57 | } 58 | -------------------------------------------------------------------------------- /make/jemmy-v2-ii/JemmyV2.iml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/accessibility/AccessibilityChooser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.accessibility; 26 | 27 | import java.awt.Component; 28 | 29 | import javax.accessibility.AccessibleContext; 30 | import javax.swing.JComponent; 31 | import javax.swing.JDialog; 32 | import javax.swing.JFrame; 33 | import javax.swing.JWindow; 34 | 35 | import org.netbeans.jemmy.ComponentChooser; 36 | 37 | public abstract class AccessibilityChooser implements ComponentChooser { 38 | 39 | @Override 40 | public final boolean checkComponent(Component comp) { 41 | if (comp instanceof JComponent) { 42 | return checkContext(comp.getAccessibleContext()); 43 | } else if (comp instanceof JDialog) { 44 | return checkContext(comp.getAccessibleContext()); 45 | } else if (comp instanceof JFrame) { 46 | return checkContext(comp.getAccessibleContext()); 47 | } else if (comp instanceof JWindow) { 48 | return checkContext(comp.getAccessibleContext()); 49 | } else { 50 | return false; 51 | } 52 | } 53 | 54 | public abstract boolean checkContext(AccessibleContext context); 55 | } 56 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/util/Platform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package org.netbeans.jemmy.util; 27 | 28 | /** 29 | * Class to provide platform related utility APIs 30 | */ 31 | public class Platform { 32 | 33 | private static final String osName = System.getProperty("os.name"); 34 | 35 | /** 36 | * Checking whether the platform is linux 37 | * @return 38 | */ 39 | public static boolean isLinux() { 40 | return isOs("linux"); 41 | } 42 | 43 | /** 44 | * Checking whether the platform is OSX 45 | * @return 46 | */ 47 | public static boolean isOSX() { 48 | return isOs("mac"); 49 | } 50 | 51 | /** 52 | * Checking whether the platform is Solaris 53 | * @return 54 | */ 55 | public static boolean isSolaris() { 56 | return isOs("sunos"); 57 | } 58 | 59 | /** 60 | * Checking whether the platform is Windows 61 | * @return 62 | */ 63 | public static boolean isWindows() { 64 | return isOs("win"); 65 | } 66 | 67 | private static boolean isOs(String osname) { 68 | return osName.toLowerCase().startsWith(osname.toLowerCase()); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/JemmyInputException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | import java.awt.Component; 28 | 29 | /** 30 | * 31 | * Exception can be thrown as a result of incorrect input operations. 32 | * 33 | * @author Alexandre Iline (alexandre.iline@oracle.com) 34 | */ 35 | public class JemmyInputException extends JemmyException { 36 | 37 | private static final long serialVersionUID = 42L; 38 | 39 | /** 40 | * Constructor. 41 | * 42 | * @param comp Component regarding which exception is thrown. 43 | */ 44 | public JemmyInputException(Component comp) { 45 | super("Input exception", comp); 46 | } 47 | 48 | /** 49 | * Constructor. 50 | * 51 | * @param message A descriptive message. 52 | * @param comp Component regarding which exception is thrown. 53 | */ 54 | public JemmyInputException(String message, Component comp) { 55 | super(message, comp); 56 | } 57 | 58 | /** 59 | * Returns component. 60 | * 61 | * @return the Component associated with the exception. 62 | */ 63 | public Component getComponent() { 64 | return (Component) getObject(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/ArrayDriverInstaller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | /** 28 | * Auxiliary class making driver registration easier. 29 | * 30 | * @author Alexandre Iline (alexandre.iline@oracle.com) 31 | */ 32 | public class ArrayDriverInstaller implements DriverInstaller { 33 | 34 | String[] ids; 35 | Object[] drivers; 36 | 37 | /** 38 | * Constructs an ArrayDriverInstaller object. Both parameter arrays mush 39 | * have same length, {@code drivers} must keep instances of 40 | * Driver or 41 | * LightDriver implementations. 42 | * 43 | * @param ids an array of driver IDs 44 | * @param drivers an array of drivers. 45 | */ 46 | public ArrayDriverInstaller(String[] ids, Object[] drivers) { 47 | this.ids = ids; 48 | this.drivers = drivers; 49 | } 50 | 51 | /** 52 | * Installs drivers from the array passed into constructor. 53 | */ 54 | @Override 55 | public void install() { 56 | for (int i = 0; i < ids.length; i++) { 57 | DriverManager.setDriver(ids[i], drivers[i]); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/operators/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | /** 26 | *

Operators package

27 | * Contains so called "operators".

28 | * Operator is a test-side representation for a component. Each 29 | * particular operator class provides all the functionality to work with one 30 | * component type. For example {@code JButtonOperator} covers 31 | * {@code javax.swing.JButton}.

32 | * Operators inheritance tree exactly matches component types inheritance: 33 | * {@code AbstractButton} extending {@code JComponent} means that 34 | * {@code AbstractBittonOperator} extends 35 | * {@code JComponentOperator}.

36 | * Every operator provides, basicly, all the methods to reproduce user actions 37 | * which can be performed on a component type covered by operator.

38 | * Every operator also provides mapping functionality: API to invoke 39 | * component method during the event queue. For example, 40 | * {@code AbstractButtonOperator} has {@code getText()} method which 41 | * simply invokes {@code AbstractButton.getText()} through the 42 | * queue.

43 | * 44 | * @since 23 Feb 2002 45 | *
46 | */ 47 | package org.netbeans.jemmy.operators; 48 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/accessibility/AccessibleNameChooser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.accessibility; 26 | 27 | import javax.accessibility.AccessibleContext; 28 | 29 | import org.netbeans.jemmy.operators.Operator; 30 | import org.netbeans.jemmy.operators.Operator.StringComparator; 31 | 32 | public class AccessibleNameChooser extends AccessibilityChooser { 33 | 34 | String name; 35 | StringComparator comparator; 36 | 37 | public AccessibleNameChooser(String name, StringComparator comparator) { 38 | this.name = name; 39 | this.comparator = comparator; 40 | } 41 | 42 | public AccessibleNameChooser(String name) { 43 | this(name, Operator.getDefaultStringComparator()); 44 | } 45 | 46 | @Override 47 | public final boolean checkContext(AccessibleContext context) { 48 | return comparator.equals(context.getAccessibleName(), name); 49 | } 50 | 51 | @Override 52 | public String getDescription() { 53 | return "JComponent with \"" + name + "\" accessible name"; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "AccessibleNameChooser{" + "name=" + name + ", comparator=" + comparator + '}'; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/UIStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | import org.netbeans.jemmy.operators.Operator; 28 | 29 | import java.awt.Point; 30 | import java.util.Arrays; 31 | 32 | public class UIStatus { 33 | /** 34 | * Indentifier for mouse location dump property. The mouse location is saved on last mouse move performed with 35 | * this operator. 36 | * @see org.netbeans.jemmy.util.Dumper#dumpAll(String) 37 | */ 38 | public static final String LAST_MOUSE_MOVE_DPROP = "Last mouse move location"; 39 | public static final String LAST_MOUSE_MOVE_OPERATOR_DPROP = "Last operator moved the mouse"; 40 | 41 | private static volatile Point lastMouseMove; 42 | private static volatile Operator lastMouseMoveOperator; 43 | public static void mouseMoved(Operator oper, Point location) { 44 | Arrays.stream(Thread.currentThread().getStackTrace()).forEach(System.out::println); 45 | lastMouseMoveOperator = oper; 46 | lastMouseMove = location; 47 | } 48 | 49 | public static Point lastMouseMove() { 50 | return lastMouseMove; 51 | } 52 | 53 | public static Operator lastMouseMoveOperator() { 54 | return lastMouseMoveOperator; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/scrolling/KeyboardJSliderScrollDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.scrolling; 26 | 27 | import java.awt.Adjustable; 28 | import java.awt.event.KeyEvent; 29 | import org.netbeans.jemmy.operators.ComponentOperator; 30 | 31 | /** 32 | * 33 | * @author shura 34 | */ 35 | public class KeyboardJSliderScrollDriver extends JSliderDriver { 36 | 37 | private static int getButton(int direction, int orientation) { 38 | if (direction == ScrollAdjuster.DECREASE_SCROLL_DIRECTION) { 39 | return (orientation == Adjustable.HORIZONTAL) ? KeyEvent.VK_LEFT : KeyEvent.VK_DOWN; 40 | } else { 41 | return (orientation == Adjustable.HORIZONTAL) ? KeyEvent.VK_RIGHT : KeyEvent.VK_UP; 42 | } 43 | } 44 | 45 | @Override 46 | protected boolean doPushAndWait(ComponentOperator oper, ScrollAdjuster adj, long freezeTimeout) { 47 | super.doPushAndWait(oper, adj, freezeTimeout); 48 | return true; 49 | } 50 | 51 | @Override 52 | protected void step(ComponentOperator oper, ScrollAdjuster adj) { 53 | oper.pushKey(getButton(adj.getScrollDirection(), adj.getScrollOrientation())); 54 | oper.getTimeouts().create("Waiter.TimeDelta").sleep(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/SupportiveDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | /** 30 | * Allows to declare supported operator classes. 31 | */ 32 | abstract public class SupportiveDriver implements Driver { 33 | 34 | private Class[] supported; 35 | 36 | /** 37 | * Creates an instance. 38 | * 39 | * @param supported Array of operator classes which are supported by this 40 | * driver. 41 | */ 42 | public SupportiveDriver(Class[] supported) { 43 | this.supported = supported; 44 | } 45 | 46 | /** 47 | * Throws {@code UnsupportedOperatorException} exception if parameter's 48 | * class is not in list of supported classes. 49 | * 50 | * @param oper Operator whose class should be checked. 51 | * @throws UnsupportedOperatorException 52 | */ 53 | public void checkSupported(ComponentOperator oper) { 54 | UnsupportedOperatorException.checkSupported(getClass(), supported, oper.getClass()); 55 | } 56 | 57 | /** 58 | * Returns array of operator classes which are supported by this driver. 59 | */ 60 | @Override 61 | public Class[] getSupported() { 62 | return supported; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/text/AWTTextAPIDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.text; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | import org.netbeans.jemmy.operators.TextComponentOperator; 29 | 30 | /** 31 | * TextDriver for AWT component types. Uses API calls. 32 | * 33 | * @author Alexandre Iline(alexandre.iline@oracle.com) 34 | */ 35 | public class AWTTextAPIDriver extends TextAPIDriver { 36 | 37 | /** 38 | * Constructs a AWTTextAPIDriver. 39 | */ 40 | public AWTTextAPIDriver() { 41 | super(new String[]{"org.netbeans.jemmy.operators.TextComponentOperator"}); 42 | } 43 | 44 | @Override 45 | public String getText(ComponentOperator oper) { 46 | return ((TextComponentOperator) oper).getText(); 47 | } 48 | 49 | @Override 50 | public int getCaretPosition(ComponentOperator oper) { 51 | return ((TextComponentOperator) oper).getCaretPosition(); 52 | } 53 | 54 | @Override 55 | public int getSelectionStart(ComponentOperator oper) { 56 | return ((TextComponentOperator) oper).getSelectionStart(); 57 | } 58 | 59 | @Override 60 | public int getSelectionEnd(ComponentOperator oper) { 61 | return ((TextComponentOperator) oper).getSelectionEnd(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/LightSupportiveDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | /** 30 | * Allows to declare supported operator classes. 31 | */ 32 | abstract public class LightSupportiveDriver implements LightDriver { 33 | 34 | private String[] supported; 35 | 36 | /** 37 | * Creates an instance. 38 | * 39 | * @param supported Array of operator classes which are supported by this 40 | * driver. 41 | */ 42 | public LightSupportiveDriver(String[] supported) { 43 | this.supported = supported; 44 | } 45 | 46 | /** 47 | * Throws {@code UnsupportedOperatorException} exception if parameter's 48 | * class is not in list of supported classes. 49 | * 50 | * @param oper Operator whose class should be checked. 51 | * @throws UnsupportedOperatorException 52 | */ 53 | public void checkSupported(ComponentOperator oper) { 54 | UnsupportedOperatorException.checkSupported(getClass(), supported, oper.getClass()); 55 | } 56 | 57 | /** 58 | * Returns array of operator classes which are supported by this driver. 59 | */ 60 | @Override 61 | public String[] getSupported() { 62 | return supported; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/text/SwingTextAPIDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.text; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | import org.netbeans.jemmy.operators.JTextComponentOperator; 29 | 30 | /** 31 | * TextDriver for swing component types. Uses API calls. 32 | * 33 | * @author Alexandre Iline(alexandre.iline@oracle.com) 34 | */ 35 | public class SwingTextAPIDriver extends TextAPIDriver { 36 | 37 | /** 38 | * Constructs a SwingTextAPIDriver. 39 | */ 40 | public SwingTextAPIDriver() { 41 | super(new String[]{"org.netbeans.jemmy.operators.JTextComponentOperator"}); 42 | } 43 | 44 | @Override 45 | public String getText(ComponentOperator oper) { 46 | return ((JTextComponentOperator) oper).getDisplayedText(); 47 | } 48 | 49 | @Override 50 | public int getCaretPosition(ComponentOperator oper) { 51 | return ((JTextComponentOperator) oper).getCaretPosition(); 52 | } 53 | 54 | @Override 55 | public int getSelectionStart(ComponentOperator oper) { 56 | return ((JTextComponentOperator) oper).getSelectionStart(); 57 | } 58 | 59 | @Override 60 | public int getSelectionEnd(ComponentOperator oper) { 61 | return ((JTextComponentOperator) oper).getSelectionEnd(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /test/org/netbeans/jemmy/scenario/TestFrame.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.scenario; 26 | 27 | import javax.swing.*; 28 | import java.awt.event.WindowEvent; 29 | import java.awt.event.WindowListener; 30 | 31 | /** 32 | * Created by shura on 6/30/17. 33 | */ 34 | public class TestFrame extends JFrame { 35 | public TestFrame(String title) { 36 | super(); 37 | setTitle(title); 38 | addDisposeListener(); 39 | } 40 | 41 | 42 | public void addDisposeListener() { 43 | addWindowListener(new WindowListener() { 44 | public void windowActivated(WindowEvent e) {} 45 | public void windowClosed(WindowEvent e) {} 46 | public void windowClosing(WindowEvent e) { 47 | dispose(); 48 | try { 49 | finalize(); 50 | } catch(Throwable ex) { 51 | ex.printStackTrace(); 52 | } 53 | } 54 | public void windowDeactivated(WindowEvent e) {} 55 | public void windowDeiconified(WindowEvent e) {} 56 | public void windowIconified(WindowEvent e) {} 57 | public void windowOpened(WindowEvent e) {} 58 | }); 59 | } 60 | 61 | public void display() { 62 | new Thread(() -> setVisible(true)).start(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/accessibility/AccessibleDescriptionChooser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.accessibility; 26 | 27 | import javax.accessibility.AccessibleContext; 28 | 29 | import org.netbeans.jemmy.operators.Operator; 30 | import org.netbeans.jemmy.operators.Operator.StringComparator; 31 | 32 | public class AccessibleDescriptionChooser extends AccessibilityChooser { 33 | 34 | private final String description; 35 | private final StringComparator comparator; 36 | 37 | public AccessibleDescriptionChooser(String description, StringComparator comparator) { 38 | this.description = description; 39 | this.comparator = comparator; 40 | } 41 | 42 | public AccessibleDescriptionChooser(String description) { 43 | this(description, Operator.getDefaultStringComparator()); 44 | } 45 | 46 | @Override 47 | public final boolean checkContext(AccessibleContext context) { 48 | return comparator.equals(context.getAccessibleDescription(), description); 49 | } 50 | 51 | @Override 52 | public String getDescription() { 53 | return "JComponent with \"" + description + "\" accessible description"; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "AccessibleDescriptionChooser{" + "description=" + description + ", comparator=" + comparator + '}'; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/scrolling/ScrollAdjuster.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.scrolling; 26 | 27 | /** 28 | * Specifies scrolling criteria. 29 | * 30 | * @author Alexandre Iline(alexandre.iline@oracle.com) 31 | */ 32 | public interface ScrollAdjuster { 33 | 34 | /** 35 | * Increase scroll direction. 36 | */ 37 | public static final int INCREASE_SCROLL_DIRECTION = 1; 38 | 39 | /** 40 | * Decrease scroll direction. 41 | */ 42 | public static final int DECREASE_SCROLL_DIRECTION = -1; 43 | 44 | /** 45 | * Specifies that necessary value has been reached.. 46 | */ 47 | public static final int DO_NOT_TOUCH_SCROLL_DIRECTION = 0; 48 | 49 | /** 50 | * Returns scroll direction to reach necessary scroller value. 51 | * 52 | * @return one of the values: INCREASE_SCROLL_DIRECTION, 53 | * DECREASE_SCROLL_DIRECTION or DO_NOT_TOUCH_SCROLL_DIRECTION. 54 | */ 55 | public int getScrollDirection(); 56 | 57 | /** 58 | * Returns scrolling orientation. 59 | * 60 | * @return one of the values: Adjustable.HORIZONTAL or Adjustable.VERTICAL. 61 | */ 62 | public int getScrollOrientation(); 63 | 64 | /** 65 | * Returns a printable scrolling description. 66 | * 67 | * @return a description. 68 | */ 69 | public String getDescription(); 70 | } 71 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/TreeDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.Timeout; 28 | import org.netbeans.jemmy.operators.ComponentOperator; 29 | 30 | /** 31 | * Defines how to work with trees. 32 | */ 33 | public interface TreeDriver extends MultiSelListDriver { 34 | 35 | /** 36 | * Expandes a node. 37 | * 38 | * @param oper Tree operator. 39 | * @param index Node index. 40 | */ 41 | public void expandItem(ComponentOperator oper, int index); 42 | 43 | /** 44 | * Collapses a node. 45 | * 46 | * @param oper Tree operator. 47 | * @param index Node index. 48 | */ 49 | public void collapseItem(ComponentOperator oper, int index); 50 | 51 | /** 52 | * Edits a node. 53 | * 54 | * @param oper Tree operator. 55 | * @param index Node index. 56 | * @param newValue New node value 57 | * @param waitEditorTime Time to wait node editor. 58 | */ 59 | public void editItem(ComponentOperator oper, int index, Object newValue, Timeout waitEditorTime); 60 | 61 | /** 62 | * Starts node editing. 63 | * 64 | * @param oper Tree operator. 65 | * @param index Node index. 66 | * @param waitEditorTime Time to wait node editor. 67 | */ 68 | public void startEditing(ComponentOperator oper, int index, Timeout waitEditorTime); 69 | } 70 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/ScrollDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.drivers.scrolling.ScrollAdjuster; 28 | import org.netbeans.jemmy.operators.ComponentOperator; 29 | 30 | /** 31 | * Defines how to work with scrollable components such as 32 | * {@code javax.swing.JScrollBar}, {@code javax.swing.JScrollPane}, 33 | * {@code javax.swing.JSlider}, ... 34 | * 35 | * @author Alexandre Iline (alexandre.iline@oracle.com) 36 | */ 37 | public interface ScrollDriver { 38 | 39 | /** 40 | * Changes value to a minimum. 41 | * 42 | * @param oper Scroller operator. 43 | * @param orientation {@code java.awt.Adjustable.HORIZONTAL} or 44 | * {@code java.awt.Adjustable.VERTICAL} 45 | */ 46 | public void scrollToMinimum(ComponentOperator oper, int orientation); 47 | 48 | /** 49 | * Changes value to a maximum. 50 | * 51 | * @param oper Scroller operator. 52 | * @param orientation {@code java.awt.Adjustable.HORIZONTAL} or 53 | * {@code java.awt.Adjustable.VERTICAL} 54 | */ 55 | public void scrollToMaximum(ComponentOperator oper, int orientation); 56 | 57 | /** 58 | * Changes value. 59 | * 60 | * @param oper Scroller operator. 61 | * @param adj Object defines scroll position. 62 | */ 63 | public void scroll(ComponentOperator oper, ScrollAdjuster adj); 64 | } 65 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/lists/JTabAPIDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.lists; 26 | 27 | import org.netbeans.jemmy.QueueTool; 28 | import org.netbeans.jemmy.drivers.LightSupportiveDriver; 29 | import org.netbeans.jemmy.drivers.ListDriver; 30 | import org.netbeans.jemmy.operators.ComponentOperator; 31 | import org.netbeans.jemmy.operators.JTabbedPaneOperator; 32 | 33 | /** 34 | * List driver for javax.swing.JTabbedPane component type. 35 | * 36 | * @author Alexandre Iline(alexandre.iline@oracle.com) 37 | */ 38 | public class JTabAPIDriver extends LightSupportiveDriver implements ListDriver { 39 | 40 | private QueueTool queueTool; 41 | 42 | /** 43 | * Constructs a JTabMouseDriver. 44 | */ 45 | public JTabAPIDriver() { 46 | super(new String[]{"org.netbeans.jemmy.operators.JTabbedPaneOperator"}); 47 | queueTool = new QueueTool(); 48 | } 49 | 50 | @Override 51 | public void selectItem(final ComponentOperator oper, final int index) { 52 | if (index != -1) { 53 | queueTool.invokeSmoothly(new QueueTool.QueueAction("Selecting tab " + index + " by setting selectedIndex") { 54 | @Override 55 | public Void launch() { 56 | ((JTabbedPaneOperator) oper).setSelectedIndex(index); 57 | return null; 58 | } 59 | }); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /test/org/netbeans/jemmy/stress/TimeoutsGetSetTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.stress; 26 | 27 | import org.netbeans.jemmy.Timeouts; 28 | import org.testng.annotations.Test; 29 | 30 | import java.util.concurrent.atomic.AtomicBoolean; 31 | 32 | import static java.lang.System.currentTimeMillis; 33 | 34 | public class TimeoutsGetSetTest { 35 | /** 36 | * Previously there was an NPE while getting a value from hashmap in setTimeout() 37 | * @throws InterruptedException 38 | */ 39 | @Test 40 | public void test() throws InterruptedException { 41 | Timeouts timeouts = new Timeouts(); 42 | String timeoutName = "timeout"; 43 | timeouts.setTimeout(timeoutName, 1); 44 | long start = currentTimeMillis(); 45 | AtomicBoolean stop = new AtomicBoolean(false); 46 | new Thread(() -> { 47 | while (!stop.get()) { 48 | timeouts.setTimeout(timeoutName, 1); 49 | } 50 | }).start(); 51 | new Thread(() -> { 52 | while (!stop.get()) { 53 | try { 54 | timeouts.getTimeout(timeoutName); 55 | } catch (NullPointerException e) { 56 | System.err.println("NPE in " + (currentTimeMillis() - start)); 57 | throw e; 58 | } 59 | } 60 | }).start(); 61 | Thread.sleep(10000); 62 | stop.set(true); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/lists/ListAPIDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers.lists; 26 | 27 | import org.netbeans.jemmy.drivers.LightSupportiveDriver; 28 | import org.netbeans.jemmy.drivers.MultiSelListDriver; 29 | import org.netbeans.jemmy.operators.ComponentOperator; 30 | import org.netbeans.jemmy.operators.ListOperator; 31 | 32 | /** 33 | * List driver for java.awt.List component type. Uses API calls. 34 | * 35 | * @author Alexandre Iline(alexandre.iline@oracle.com) 36 | */ 37 | public class ListAPIDriver extends LightSupportiveDriver implements MultiSelListDriver { 38 | 39 | /** 40 | * Constructs a ListAPIDriver. 41 | */ 42 | public ListAPIDriver() { 43 | super(new String[]{"org.netbeans.jemmy.operators.ListOperator"}); 44 | } 45 | 46 | @Override 47 | public void selectItem(ComponentOperator oper, int index) { 48 | ListOperator loper = (ListOperator) oper; 49 | clearSelection(loper); 50 | loper.select(index); 51 | } 52 | 53 | @Override 54 | public void selectItems(ComponentOperator oper, int[] indices) { 55 | ListOperator loper = (ListOperator) oper; 56 | clearSelection(loper); 57 | for (int indice : indices) { 58 | loper.select(indice); 59 | } 60 | } 61 | 62 | private void clearSelection(ListOperator loper) { 63 | for (int i = 0; i < loper.getItemCount(); i++) { 64 | loper.deselect(i); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/TestCompletedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy; 26 | 27 | /** 28 | * 29 | * Exception is throught as a result of test. either test failed or passed. 30 | * 31 | * @author Alexandre Iline (alexandre.iline@oracle.com) 32 | */ 33 | public class TestCompletedException extends JemmyException { 34 | 35 | private static final long serialVersionUID = 42L; 36 | 37 | private int status; 38 | 39 | /** 40 | * Constructor. 41 | * 42 | * @param st Exit status. 43 | * @param ex Exception provoked test failure. 44 | */ 45 | public TestCompletedException(int st, Exception ex) { 46 | super("Test " 47 | + ((st == 0) 48 | ? "passed" 49 | : "failed with status " + Integer.toString(st)), 50 | ex); 51 | status = st; 52 | } 53 | 54 | /** 55 | * Constructor. 56 | * 57 | * @param st Exit status. 58 | * @param description Failure reason 59 | */ 60 | public TestCompletedException(int st, String description) { 61 | super("Test " 62 | + ((st == 0) 63 | ? "passed" 64 | : "failed with status " + Integer.toString(st) 65 | + "\n" + description)); 66 | status = st; 67 | } 68 | 69 | /** 70 | * Returns status. 71 | * 72 | * @return test status 73 | */ 74 | public int getStatus() { 75 | return status; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /test/org/netbeans/jemmy/operators/AcessibleDumpPropertiesTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.operators; 26 | 27 | import org.testng.annotations.BeforeClass; 28 | import org.testng.annotations.Test; 29 | 30 | import javax.swing.JButton; 31 | 32 | import java.util.Hashtable; 33 | 34 | import static org.testng.Assert.assertEquals; 35 | import static org.testng.Assert.assertFalse; 36 | 37 | public class AcessibleDumpPropertiesTest { 38 | private JButtonOperator accessible_button; 39 | private JButtonOperator a_button; 40 | @BeforeClass 41 | public void setup() { 42 | accessible_button = new JButtonOperator(new JButton("text")); 43 | accessible_button.getSource().getAccessibleContext().setAccessibleName("name"); 44 | accessible_button.getSource().getAccessibleContext().setAccessibleDescription("description"); 45 | a_button = new JButtonOperator(new JButton("text")); 46 | } 47 | @Test 48 | public void testPropeties() { 49 | Hashtable dump = accessible_button.getDump(); 50 | assertEquals(dump.get(ComponentOperator.ACCESSIBLE_NAME_DPROP), "name"); 51 | assertEquals(dump.get(ComponentOperator.ACCESSIBLE_DESCRIPTION_DPROP), "description"); 52 | } 53 | @Test 54 | public void testNoPropeties() { 55 | Hashtable dump = a_button.getDump(); 56 | assertFalse(dump.contains(ComponentOperator.ACCESSIBLE_NAME_DPROP)); 57 | assertFalse(dump.contains(ComponentOperator.ACCESSIBLE_DESCRIPTION_DPROP)); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /test/org/netbeans/jemmy/util/DumpTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.util; 26 | 27 | import org.netbeans.jemmy.UIStatus; 28 | import org.netbeans.jemmy.operators.JFrameOperator; 29 | import org.netbeans.jemmy.scenario.ComboBoxesAndListApp; 30 | import org.netbeans.jemmy.scenario.Util; 31 | import org.testng.annotations.BeforeClass; 32 | import org.testng.annotations.Test; 33 | 34 | import java.awt.Point; 35 | import java.io.IOException; 36 | import java.io.PrintWriter; 37 | import java.io.StringWriter; 38 | import java.lang.reflect.InvocationTargetException; 39 | 40 | import static org.testng.Assert.assertTrue; 41 | 42 | public class DumpTest { 43 | private static JFrameOperator fo; 44 | 45 | @BeforeClass 46 | public static void setup() throws InvocationTargetException, NoSuchMethodException, IOException { 47 | Util.testInfraSetup(); 48 | new ComboBoxesAndListApp().display(); 49 | fo = new JFrameOperator("ComboBoxesAndListTest"); 50 | } 51 | 52 | @Test 53 | public void common() { 54 | StringWriter out = new StringWriter(); 55 | Point point = new Point(1, 2); 56 | UIStatus.mouseMoved(fo, point); 57 | Dumper.dumpAll(new PrintWriter(out)); 58 | assertTrue(out.toString() 59 | .contains("")); 60 | assertTrue(out.toString() 61 | .contains("")); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /test/org/netbeans/jemmy/operators/MenuApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.operators; 26 | 27 | import javax.swing.JFrame; 28 | import javax.swing.JLabel; 29 | import javax.swing.JMenu; 30 | import javax.swing.JMenuBar; 31 | import javax.swing.JMenuItem; 32 | import java.awt.Dimension; 33 | import java.awt.HeadlessException; 34 | 35 | public class MenuApp extends JFrame { 36 | 37 | public static final String FRAME_TITLE = "A menu app"; 38 | private final JLabel label; 39 | private final JMenuBar bar; 40 | 41 | public MenuApp() throws HeadlessException { 42 | super(FRAME_TITLE); 43 | label = new JLabel(); 44 | JMenuItem item = new JMenuItem("item"); 45 | item.addActionListener(e -> label.setText("menu pushed")); 46 | JMenu subsubmenu = new JMenu("subsubmenu"); 47 | subsubmenu.add(item); 48 | JMenu submenu = new JMenu("submenu"); 49 | submenu.add(subsubmenu); 50 | JMenu menu = new JMenu("menu"); 51 | menu.add(submenu); 52 | bar = new JMenuBar(); 53 | bar.add(menu); 54 | setJMenuBar(bar); 55 | getContentPane().add(label); 56 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 57 | setPreferredSize(new Dimension(600, 400)); 58 | pack(); 59 | setLocationRelativeTo(null); 60 | } 61 | 62 | public static void main(String[] args) { 63 | if(args[0].equals("native")) System.setProperty("apple.laf.useScreenMenuBar", "true"); 64 | new MenuApp().setVisible(true); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/image/StrictImageComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.image; 26 | 27 | import java.awt.image.BufferedImage; 28 | 29 | /** 30 | * Compares two images strictly (i.e. all the pixel colors should match). 31 | * 32 | * @author Alexandre Iline (alexandre.iline@oracle.com) 33 | */ 34 | public class StrictImageComparator implements ImageComparator { 35 | 36 | /** 37 | * Checks images sizes and pixels. Compares one pixel after another untill 38 | * one will be different. 39 | * 40 | * @param image1 an image to compare. 41 | * @param image2 an image to compare. 42 | * @return True if all the pixels match, false otherwise. 43 | */ 44 | @Override 45 | public boolean compare(BufferedImage image1, BufferedImage image2) { 46 | if (image1.getWidth() != image2.getWidth() 47 | || image1.getHeight() != image2.getHeight()) { 48 | return false; 49 | } 50 | for (int x = 0; x < image1.getWidth(); x++) { 51 | for (int y = 0; y < image1.getHeight(); y++) { 52 | if (!compareColors(image1.getRGB(x, y), image2.getRGB(x, y))) { 53 | return false; 54 | } 55 | } 56 | } 57 | return true; 58 | } 59 | 60 | /** 61 | * Could be used to override the way of comparing colors. 62 | * 63 | * @param rgb1 a color to compare. 64 | * @param rgb2 a color to compare. 65 | * @return true if colors are equal. 66 | */ 67 | protected boolean compareColors(int rgb1, int rgb2) { 68 | return rgb1 == rgb2; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/org/netbeans/jemmy/drivers/WindowDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package org.netbeans.jemmy.drivers; 26 | 27 | import org.netbeans.jemmy.operators.ComponentOperator; 28 | 29 | /** 30 | * Defines how to work with windows. 31 | */ 32 | public interface WindowDriver { 33 | 34 | /** 35 | * Activates a window. 36 | * 37 | * @param oper Window operator. 38 | */ 39 | public void activate(ComponentOperator oper); 40 | 41 | /** 42 | * Requests a window to close. 43 | * 44 | * @param oper Window operator. 45 | */ 46 | public void requestClose(ComponentOperator oper); 47 | 48 | /** 49 | * Closes a window by requesting it to close and then hiding it. 50 | * 51 | * @param oper Window operator. 52 | */ 53 | public void requestCloseAndThenHide(ComponentOperator oper); 54 | 55 | /** 56 | * Closes a window by requesting it to close and then hiding it. 57 | * 58 | * @param oper Window operator. 59 | * @deprecated Use requestClose(ComponentOperator) instead. 60 | */ 61 | @Deprecated 62 | public void close(ComponentOperator oper); 63 | 64 | /** 65 | * Change window location. 66 | * 67 | * @param oper Window operator. 68 | * @param x New x coordinate 69 | * @param y New y coordinate 70 | */ 71 | public void move(ComponentOperator oper, int x, int y); 72 | 73 | /** 74 | * Change window size. 75 | * 76 | * @param oper Window operator. 77 | * @param width New window width. 78 | * @param height New window height. 79 | */ 80 | public void resize(ComponentOperator oper, int width, int height); 81 | } 82 | --------------------------------------------------------------------------------