1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
package org.litesoft.GWT.client.testplan;
import com.google.gwt.core.client.*;
import com.google.gwt.user.client.rpc.*;
import org.litesoft.GWT.client.*;
import org.litesoft.GWT.shared.service.*;
import org.litesoft.core.util.*;
import org.litesoft.logger.*;
import org.litesoft.testplan.*;
public class TestPlanServiceFacade
{
public static final Logger LOGGER = LoggerFactory.getLogger( TestPlanServiceFacade.class );
private static TestPlanServiceAsync sServiceInstance = null;
private static int sStep = 0;
private static TestPlanServiceAsync getServiceInstance()
{
if ( sServiceInstance == null )
{
sServiceInstance = GWT.create( TestPlanService.class );
}
return sServiceInstance;
}
public static void nextStep( final TestPlanStepCallback pCallback )
{
LOGGER.warn.log( "Test Plan Request Step: ", sStep );
getServiceInstance().get( new TestPlanStepRequest( sStep++ ), new AsyncCallback<TestPlanStepResponse>()
{
public void onSuccess( TestPlanStepResponse pResult )
{
if ( pResult == null )
{
LOGGER.warn.log( "Test Plan Response - No Result" );
}
else
{
UtilsGwt.trywindowOpenWithHtml( "TestPlanMonitor", UtilsGwt.CHROMELESS_SCROLLED, //
createHTML( pResult.getStep(), pResult.getSection(), pResult.getInstructions(), //
pResult.getNextStep(), pResult.getNextSection(), pResult.getNextInstructions() ) );
TestPlanAction zAction = pResult.getAction();
if ( zAction == null )
{
LOGGER.warn.log( "Test Plan Response - No Action" );
}
else
{
LOGGER.warn.log( "Test Plan Response - Action: ", zAction );
pCallback.handleAction( zAction );
}
}
}
public void onFailure( Throwable pCaught )
{
AlertManager.alert( "TestPlanServiceFacade", "Test Plan Service Problem", //
"Unexpected Error from Test Plan Service\n" + //
"of\n" + //
pCaught.getMessage(), pCaught );
}
} );
}
private static String createHTML( String pCurStep, String pCurSection, String pCurInstructions, //
String pNextStep, String pNextSection, String pNextInstructions )
{
String zCurPreText = createInstructionsText( pCurStep, pCurSection, "Post Instructions", pCurInstructions );
String zNextPreText = createInstructionsText( pNextStep, pNextSection, "Pre Instructions", pNextInstructions );
return "<html><body><table width='100%' height='100%'>" + //
"<tr><td align='left' valign='top' height='50%'>" + //
zCurPreText + "</td></tr>" + //
"<tr><td align='left' valign='top' height='50%' style='border-top:1px solid #666666;'>" + //
zNextPreText + "</td></tr>" + //
"</table></body></html>";
}
private static String createInstructionsText( String pStep, String pSection, String pWhat, String pInstructions )
{
if ( UtilsCommon.isNullOrEmpty( pSection ) )
{
return "";
}
if ( pInstructions == null )
{
pInstructions = "";
}
else
{
// Process...
}
return "<h3>Step " + pStep + " of " + pSection + "</h3>" + //
"<h5>" + pWhat + "</h5>" + //
"<pre>" + pInstructions + "</pre>";
}
}
|