summaryrefslogtreecommitdiffstats
path: root/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp
blob: eb219e4cef15c6d11c9e2957491a7d5c74e7c3f6 (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<%--/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.    
 */
 --%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%--
 * SCATestService.java
 * written by Chris Ortiz
 * interface class for basic test service  
 * version .1     9/22/2006
 *
 *
 --%>


<HTML>
<HEAD>
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
             pageEncoding="ISO-8859-1" session="true" autoFlush="true"
             isThreadSafe="true" isErrorPage="false"
             import="org.apache.tuscany.sca.itest.SCATestToolService"
             import="java.io.PrintWriter"
             import="java.io.StringWriter"
             import="org.osoa.sca.CurrentCompositeContext"
             import="org.osoa.sca.CompositeContext"
            %>
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <META name="GENERATOR" content="IBM Software Development Platform">
    <TITLE>SCA FVT Test Service Driver</TITLE>
</HEAD>

<BODY bgcolor="#c8d8f8">
<H2>SCA FVT Test Tool Client</H2>

<form action="SCATestTool.jsp" method="get"><HR><BR>Choose Binding type:<BR><BR>
	&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="radio" name="bind" value="WS"> WS Binding
	&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="radio" name="bind" value="EJB"> EJB Binding
	&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="radio" name="bind" value="SCA" checked> Default Binding<BR><BR><HR>
        <BR>Check Tests to run:<BR><BR>
	&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Ping First Composite" checked> Ping First Composite
	&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Ping Second Composite"> Ping Second Composite<BR><BR>
	&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Data Type Test"> Data Type Test<BR><BR>
	&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Async One Way"> Async One Way&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Async Callback"> Async Call Back<BR><BR>


    <BR>
    <INPUT type="submit" value="Run Test"></FORM>
<BR>

    <%

        String bindingchoice = request.getParameter("bind");
        String[] selected = request.getParameterValues("test");
       
       try {
           SCATestToolService scaTestTool;
           if (bindingchoice.equals("WS")) {
               CompositeContext compositeContext = CurrentCompositeContext.getContext();
               scaTestTool = (SCATestToolService) compositeContext.locateService(SCATestToolService.class, "SCATestToolWSReference");
           } else if (bindingchoice.equals("EJB")) {
               CompositeContext compositeContext = CurrentCompositeContext.getContext();
               scaTestTool = (SCATestToolService) compositeContext.locateService(SCATestToolService.class, "SCATestToolEJBReference");
           } else {
             // assume default binding
               CompositeContext compositeContext = CurrentCompositeContext.getContext();
               scaTestTool = (SCATestToolService) compositeContext.locateService(SCATestToolService.class, "SCATestToolSCAReference");
           }
           if (selected != null && selected.length != 0) {
               for (int i = 0; i < selected.length; i++) {
                   String value = null;
        	   if (null != selected[i] && selected[i].equals("Ping First Composite")) {
                       value = scaTestTool.doOneHopPing("brio");
                   } else if (null != selected[i] && selected[i].equals("Ping Second Composite")){
                       value = scaTestTool.doTwoHopPing("brio");
                   } else if (null != selected[i] && selected[i].equals("Data Type Test")){
                       value = scaTestTool.doDataTypeTest("brio");
                   } else if (null != selected[i] && selected[i].equals("Async One Way")){
                       value = "Ut Oh! Test tool not complete for oneway testing";
                   } else if (null != selected[i] && selected[i].equals("Async Callback")){
                       value = "Ut Oh! Test tool not complete for async testing";
                   } else {
                       value = "Ut Oh! unknown test";
                   }

%>

<HR>
Results from <%=selected[i]%> test with <%=bindingchoice%> binding:
<P><%=value%>
    <%
               } //for
           } //if

       }catch(Exception e){
                  e.printStackTrace();
                  StringWriter sw= new StringWriter();
				  PrintWriter pw= new PrintWriter(sw);

				  e.printStackTrace(pw);
				  pw.flush();
				
%>
    Whoops!<BR clear="all">
<PRE>
    Exception &quot;<%=e.getClass().getName()%>&quot; Exception message: &quot;<%=e.getMessage()%>&quot;<BR clear="all">
    <%=sw.toString() %>
</PRE>
<%        }   //catch
  
%>

</BODY>
</HTML>