MD-XMLTEST.jsp 3.91 KB
Newer Older
Thitichaipun Wutthisak committed
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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
<%@ page import="mondrian.olap.Util,
		 org.w3c.dom.Element,
                 org.eigenbase.xom.XMLUtil,
                 java.io.PrintWriter,
                 java.io.StringWriter,
                 mondrian.xmla.test.XmlaTestContext,
                 mondrian.xmla.XmlaUtil,
                 java.util.Map,
                 java.util.Arrays,
                 org.apache.log4j.Logger"%>
<%@ page language="java" %>
<%--
// $Id: //open/mondrian/webapp/MD-XMLTEST.jsp#10 $
// This software is subject to the terms of the Common Public License
// Agreement, available at the following URL:
// http://www.opensource.org/licenses/cpl.html.
// (C) Copyright 2003-2006 Julian Hyde
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
//
// Julian Hyde, 3 June, 2003
--%>
<%!

    private static final Logger LOGGER = Logger.getLogger("mondrian.jsp.xmlaTest");

    /**
     * XML-encodes a string.
     */
    private static String wrap(String s) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        XMLUtil.stringEncodeXML(s, pw);
        pw.flush();
        return sw.toString();
    }
%>
<html>
<head>
<title>Mondrian XML for Analysis Tester</title>
<style>
.{
font-family:"verdana";
}

.resulttable {
background-color:#AAAAAA;
}

.slicer {
background-color:#DDDDDD;
font-size:10pt;
}

.columnheading {
background-color:#DDDDDD;
font-size:10pt;
}

.rowheading {
background-color:#DDDDDD;
font-size:10pt;
}

.cell {
font-family:"courier";
background-color:#FFFFFF;
font-size:10pt;
text-align:right;
}

</style>
</head>
<body>

<a href=".">back to index</a><p/>

<%
    
    XmlaTestContext context = new XmlaTestContext(application);
    
    Object[] requestResponses = context.defaultRequestResponsePairs();

    int whichRequest = 0;
    if (request.getParameter("whichrequest") != null) {
        whichRequest = Integer.valueOf(request.getParameter("whichrequest")).intValue();
    }
    if (whichRequest >= requestResponses.length) {
        whichRequest = requestResponses.length - 1;
    }
    Object[] defaultRequestResponse = (Object[]) requestResponses[whichRequest];
    Element requestElem = (Element) defaultRequestResponse[1];
    String defaultRequest = XmlaUtil.element2Text(requestElem);
    String postURL = request.getParameter("postURL");
    if (postURL == null) {
        postURL = "MD-XMLA.jsp";
    }
%>

<form id='requestChooser' method='POST' action='MD-XMLTEST.jsp'>
  <input type='hidden' name='postURL' value='<%= postURL %>'/>
  <table>
    <tr>
      <td>
        <select name="whichrequest"><%

    for (int i = 0; i < requestResponses.length; i++) {
	  Object[] thisRequestResponse = (Object[]) requestResponses[i];
	  String fileName = (String) thisRequestResponse[0];
      %>
      <option <%= whichRequest == i ? " selected" : "" %>
      value="<%= i%>"><%= i %>. <%= fileName.substring(0,fileName.length() - 4) %>
      </option>
      <%
    }
      %>

        </select>
      </td>
    </tr>

    <tr>
      <td>
        <input type="submit" value="show request">
      </td>
    </tr>
  </table>
</form>


<form id='form' method='POST' action='<%= postURL %>'>
  <input type='hidden' name='postURL' value='<%= postURL %>'/>
  <table>
    <tr>
      <td>Request</td>
      <td>
        <textarea rows='25' cols='120' name='SOAPRequest' id='SOAPRequest' style='font-size: 9pt'>
<%= wrap(defaultRequest) %>
        </textarea>
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type='submit' value='Run'/></td>
    </tr>
  </table>
</form>

<p>&nbsp;</p>

<form id='postForm' method='POST' action='MD-XMLTEST.jsp'>
  <table border='1'>
    <tr>
      <td>Target URL:</td>
      <td><%= postURL %></td>
    </tr>
    <tr>
      <td>New target URL:</td>
      <td><input size='55' name='postURL' value='<%= postURL %>'/><br/>
          <input type='submit' value='Change'/>
      </td>
    </tr>
  </table>
</form>

<a href=".">back to index</a><p/>

</body>
</html>