1 19 package org.netbeans.modules.j2ee.sun.share.customizer; 20 21 import junit.framework.*; 22 import junit.extensions.abbot.*; 24 import abbot.tester.*; 25 26 import org.netbeans.modules.j2ee.sun.share.configbean.CmpJar; 27 32 public class CmpJarPanelBot extends ComponentTestFixture { 34 public CmpJarPanelBot(java.lang.String testName) { 35 super(testName); 36 } 37 38 42 private ComponentTester tester; 44 protected void setUp() { 45 tester = ComponentTester.getTester(CmpJarPanel.class); 46 } 47 48 public void testFocusTraversal() { 49 CmpJarPanel pane = new CmpJarPanel(); 50 51 CmpJar bean = new CmpJar(); 53 try { 54 bean.setJndiName("tip-"); 55 bean.setPrincipalName("hip-"); 56 } 57 catch (Throwable t) { 58 assertTrue("set did not get vetoed",false); 59 } 60 pane.setObject(bean); 61 showFrame(pane); 62 try { 63 Thread.sleep(2000); 64 } 65 catch(Throwable t) { 66 } 67 68 tester.actionKeyPress("VK_END"); 69 tester.actionKeyRelease("VK_END"); 70 tester.actionKeyPress("VK_T"); 71 tester.actionKeyRelease("VK_T"); 72 tester.actionKeyPress("VK_O"); 73 tester.actionKeyRelease("VK_O"); 74 tester.actionKeyPress("VK_P"); 75 tester.actionKeyRelease("VK_P"); 76 assertEquals("keystroke did not propigate", "tip-top", bean.getJndiName()); 77 tester.actionKeyPress("VK_TAB"); 78 tester.actionKeyRelease("VK_TAB"); 79 tester.actionKeyPress("VK_END"); 80 tester.actionKeyRelease("VK_END"); 81 tester.actionKeyPress("VK_H"); 82 tester.actionKeyRelease("VK_H"); 83 tester.actionKeyPress("VK_O"); 84 tester.actionKeyRelease("VK_O"); 85 tester.actionKeyPress("VK_P"); 86 tester.actionKeyRelease("VK_P"); 87 assertEquals("keystroke did not propigate", "hip-hop", bean.getPrincipalName()); 89 tester.actionKeyPress("VK_TAB"); 90 tester.actionKeyRelease("VK_TAB"); 91 tester.actionKeyPress("VK_END"); 92 tester.actionKeyRelease("VK_END"); 93 tester.actionKeyPress("VK_H"); 94 tester.actionKeyRelease("VK_H"); 95 tester.actionKeyPress("VK_O"); 96 tester.actionKeyRelease("VK_O"); 97 tester.actionKeyPress("VK_P"); 98 tester.actionKeyRelease("VK_P"); 99 assertEquals("keystroke did not propigate", "hop", bean.getPrincipalPassword()); 100 tester.actionKeyPress("VK_SHIFT"); 101 tester.actionKeyPress("VK_TAB"); 102 tester.actionKeyRelease("VK_TAB"); 103 tester.actionKeyRelease("VK_SHIFT"); 104 tester.actionKeyPress("VK_END"); 105 tester.actionKeyRelease("VK_END"); 106 System.out.println("about to do the clear test"); 107 tester.actionKeyPress("VK_BACK_SPACE"); 108 tester.actionKeyRelease("VK_BACK_SPACE"); 109 114 tester.actionKeyPress("VK_BACK_SPACE"); 115 tester.actionKeyRelease("VK_BACK_SPACE"); 116 tester.actionKeyPress("VK_BACK_SPACE"); 117 tester.actionKeyRelease("VK_BACK_SPACE"); 118 tester.actionKeyPress("VK_BACK_SPACE"); 119 tester.actionKeyRelease("VK_BACK_SPACE"); 120 tester.actionKeyPress("VK_BACK_SPACE"); 121 tester.actionKeyRelease("VK_BACK_SPACE"); 122 tester.actionKeyPress("VK_BACK_SPACE"); 123 tester.actionKeyRelease("VK_BACK_SPACE"); 124 tester.actionKeyPress("VK_BACK_SPACE"); 125 tester.actionKeyRelease("VK_BACK_SPACE"); 126 System.out.println("about to hit tab"); 127 tester.actionKeyPress("VK_TAB"); 128 tester.actionKeyRelease("VK_TAB"); 129 System.out.println("have hit tab"); 130 131 assertEquals("bug in password clearer", "", bean.getPrincipalPassword()); 132 133 } 134 135 } 136 | Popular Tags |