Java Doc for TestNewSetCurrent.java in  » 6.0-JDK-Modules » j2me » javax » microedition » lcdui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » javax.microedition.lcdui 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.midp.i3test.TestCase
      javax.microedition.lcdui.TestNewSetCurrent

TestNewSetCurrent
public class TestNewSetCurrent extends TestCase (Code)
Tests proper behavior of Display.setCurrent() for a single midlet in the foreground. Various combinations of "normal" (i.e., non-Alert) Displayable instances are tested with the one-arg and two-arg Alert forms of the setCurrent() method. The notation used to name tests is as follows. The operations initiated by the tests are: N setCurrent(normal [non-Alert] Displayable) A setCurrent(Alert) 2 setCurrent(Alert, Displayable) D dismiss the current Alert Codes for context or waits for event processing are: 0 tests Display's initial state (current == null) _ wait for a screen-change event to be processed s suffix indicating a displayable is the same as a previous one For example, testA_2 first calls setCurrent(alert1), waits for the alert to become current, then calls setCurrent(alert2, disp1). Note that this notation doesn't include an initial setCurrentWait() call that is typically used to establish the initial state for the test. In such cases the initial displayable will be numbered zero, that is, disp0 or cv0. This is in contrast to displayables and alerts that are used in the operations being tested, which are numbered starting at one. Quite often it is necessary to execute code atomically on the event thread, that is, ensuring that no events are processed within a group of statements. Code running on the test thread is arbitrarily interleaved with code running on the event thread. For example, suppose Displayable d0 is current. If the following code were executed on the test thread, dpy.setCurrent(d1); dpy.setCurrent(alert); there would be a race condition between d1 becoming current and the call to setCurrent(alert). Runnable blocks are used to group a set of statements to be executed atomically. Runnable blocks are used in two different ways: using callSerially() and using await(). In both cases the run() method is executed on the event thread. This prevents any other events from being dispatched in the midst of the code of the run() method. For example: dpy.callSerially( new Runnable() { public void run() { // (1) } }); scl.await( new Runnable() { public void run() { // (2) } }); The code (1) is executed atomically on the event thread, and the calling thread continues. The code (2) is executed atomically on the event thread immediately after the next screen change occurs. The calling thread is blocked until the screen change occurs and the run() method has completed.


Field Summary
 Displaydpy
    
 LiveTraceCallbackscl
    
 booleanthrown
    


Method Summary
 voidcheckCurrent(String s, LcduiTestCanvas cv, boolean isCurrent)
     Checks a variety of invariants on test canvas cv, depending upon whether the canvas should or should not be current.
 voidcheckCurrent(String s, Alert alert, boolean shouldBeCurrent)
     Checks a variety of invariants on an alert, depending upon whether the alert should or should not be current.
 voiddismiss(Alert alert)
     Simulates dismissing an alert from this display.
 voiddismissWait(Alert alert)
     Dismisses the alert and then waits for the resulting screen-change event to be processed.
 voidfini()
     Cleans up the test MIDlet.
 voidinit()
     Creates the test MIDlet and get its display.
 AlertmakeAlert(String title)
     Creates a new alert and sets its timeout to FOREVER so that it must be dismissed explicitly.
public  voidrunTests()
     Runs all tests.
 voidsetCurrentWait(Displayable d)
     Sets the Displayable to be current, waits for it to become visible, and returns.
 voidtest0A0A()
     Case: 0A0A.
 voidtest2()
     Case: 2.
 voidtest22()
     Case: 22.
 voidtest22s()
     Case 22s.
 voidtest2A()
     Case: 2A.
 voidtest2N()
     Case: 2N.
 voidtest2_2()
     Case: 2_2.
 voidtest2_2s()
     Case 2_2s.
 voidtest2_A()
     Case: 2_A.
 voidtest2_N()
     Case: 2_N.
 voidtestA()
     Case: A.
 voidtestA2()
     Case: A2.
 voidtestA2s()
     Case: A2s.
 voidtestAA()
     Case: AA.
 voidtestAAs()
     Case: AAs.
 voidtestAN()
     Case: AN.
 voidtestAND()
     Case: AND.
 voidtestA_2()
     Case: A_2.
 voidtestA_2s()
     Case: A_2s.
 voidtestA_A()
     Tests setCurrent(Alert) when an alert is already visible.
 voidtestA_As()
     Tests setCurrent on the same alert when it is already visible.
 voidtestA_N()
     Case: A_N.
 voidtestA_NA()
     Case: A_NA.
 voidtestAlertAlert()
     Tests setCurrent(alert, alert).
 voidtestInit()
     Tests whether the display has been initialized properly.
 voidtestN()
     Case: N.
 voidtestN2()
     Case: N2.
 voidtestNA()
     Case: NA.
 voidtestNN()
     Case: NN.
 voidtestNNsN()
     Case: NNsN.
 voidtestN_N()
     Case: N_N.
 voidtestN_NNs()
     Case: N_NNs.

Field Detail
dpy
Display dpy(Code)



scl
LiveTraceCallback scl(Code)



thrown
boolean thrown(Code)





Method Detail
checkCurrent
void checkCurrent(String s, LcduiTestCanvas cv, boolean isCurrent)(Code)
Checks a variety of invariants on test canvas cv, depending upon whether the canvas should or should not be current.



checkCurrent
void checkCurrent(String s, Alert alert, boolean shouldBeCurrent)(Code)
Checks a variety of invariants on an alert, depending upon whether the alert should or should not be current.



dismiss
void dismiss(Alert alert)(Code)
Simulates dismissing an alert from this display. The logic here mimics the logic of what occurs when the Alert times out and executes its default (DISMISS) command. This allows tests to set the alert timeout to FOREVER and to call this function in the right sequence, without having to deal with timing issues.



dismissWait
void dismissWait(Alert alert)(Code)
Dismisses the alert and then waits for the resulting screen-change event to be processed.



fini
void fini()(Code)
Cleans up the test MIDlet.



init
void init() throws Throwable(Code)
Creates the test MIDlet and get its display.



makeAlert
Alert makeAlert(String title)(Code)
Creates a new alert and sets its timeout to FOREVER so that it must be dismissed explicitly.



runTests
public void runTests() throws Throwable(Code)
Runs all tests.



setCurrentWait
void setCurrentWait(Displayable d)(Code)
Sets the Displayable to be current, waits for it to become visible, and returns.



test0A0A
void test0A0A()(Code)
Case: 0A0A. Tests whether the system returns to the original (null) state after an alert. Does so twice in order to ensure that the first setCurrent doesn't have any side effects. WARNING: this must be run on a fresh display.



test2
void test2()(Code)
Case: 2.



test22
void test22()(Code)
Case: 22.



test22s
void test22s()(Code)
Case 22s. Tests the behavior of two, two-arg setCurrent calls, where the alert in question is the same in both cases.



test2A
void test2A()(Code)
Case: 2A.



test2N
void test2N()(Code)
Case: 2N.



test2_2
void test2_2()(Code)
Case: 2_2.



test2_2s
void test2_2s()(Code)
Case 2_2s. Tests the behavior of two, two-arg setCurrent calls, where the alert in question is the same in both cases.



test2_A
void test2_A()(Code)
Case: 2_A.



test2_N
void test2_N()(Code)
Case: 2_N.



testA
void testA()(Code)
Case: A.



testA2
void testA2()(Code)
Case: A2.



testA2s
void testA2s()(Code)
Case: A2s.



testAA
void testAA()(Code)
Case: AA.



testAAs
void testAAs()(Code)
Case: AAs.



testAN
void testAN()(Code)
Case: AN.



testAND
void testAND()(Code)
Case: AND. Tests alert timeout while it's shown, while another screen change event is in the queue.



testA_2
void testA_2()(Code)
Case: A_2.



testA_2s
void testA_2s()(Code)
Case: A_2s.



testA_A
void testA_A()(Code)
Tests setCurrent(Alert) when an alert is already visible. Case: A_A.



testA_As
void testA_As()(Code)
Tests setCurrent on the same alert when it is already visible. Case: A_As.



testA_N
void testA_N()(Code)
Case: A_N.



testA_NA
void testA_NA()(Code)
Case: A_NA.



testAlertAlert
void testAlertAlert()(Code)
Tests setCurrent(alert, alert). This is basically an API test.



testInit
void testInit()(Code)
Tests whether the display has been initialized properly.



testN
void testN()(Code)
Case: N.



testN2
void testN2()(Code)
Case: N2.



testNA
void testNA()(Code)
Case: NA.



testNN
void testNN()(Code)
Case: NN.



testNNsN
void testNNsN()(Code)
Case: NNsN.



testN_N
void testN_N()(Code)
Case: N_N.



testN_NNs
void testN_NNs()(Code)
Case: N_NNs.



Methods inherited from com.sun.midp.i3test.TestCase
public void assertEquals(Object expected, Object actual)(Code)(Java Doc)
public void assertEquals(String message, Object expected, Object actual)(Code)(Java Doc)
public void assertEquals(int expected, int actual)(Code)(Java Doc)
public void assertEquals(String message, int expected, int actual)(Code)(Java Doc)
public void assertFalse(boolean condition)(Code)(Java Doc)
public void assertFalse(String message, boolean condition)(Code)(Java Doc)
public void assertNotNull(Object object)(Code)(Java Doc)
public void assertNotNull(String message, Object object)(Code)(Java Doc)
public void assertNotSame(Object expected, Object actual)(Code)(Java Doc)
public void assertNotSame(String message, Object expected, Object actual)(Code)(Java Doc)
public void assertNull(Object object)(Code)(Java Doc)
public void assertNull(String message, Object object)(Code)(Java Doc)
public void assertSame(Object expected, Object actual)(Code)(Java Doc)
public void assertSame(String message, Object expected, Object actual)(Code)(Java Doc)
public void assertTrue(String message, boolean condition)(Code)(Java Doc)
public void assertTrue(boolean condition)(Code)(Java Doc)
public void declare(String testName)(Code)(Java Doc)
public void fail()(Code)(Java Doc)
public void fail(String message)(Code)(Java Doc)
protected SecurityToken getSecurityToken()(Code)(Java Doc)
protected boolean getVerbose()(Code)(Java Doc)
public void info(String s)(Code)(Java Doc)
abstract public void runTests() throws Throwable(Code)(Java Doc)

Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.