< prev index next >

src/com/sun/javatest/servlets/ResultBrowser.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


 100         out.println("<li><a href=\"#output\">Test Output</a>");
 101         out.println("<ul>");
 102         for (int i = 0; i < tr.getSectionCount(); i++) {
 103             try {
 104                 TestResult.Section s = tr.getSection(i);
 105                 out.println("<li><a href=\"#output-" + s.getTitle() + "\">" + s.getTitle() + "</a>");
 106             }
 107             catch (TestResult.Fault f) {
 108                 out.println("The following exception occurred while trying to determine the test description: " + f.getLocalizedMessage());
 109             }
 110         }
 111         out.println("</ul>");
 112         out.println("</ul>");
 113         out.println("<p><hr>");
 114 
 115         // test description properties
 116         out.println("<h2><a name=td>Test Description properties</a></h2>");
 117         try {
 118             TestDescription td = tr.getDescription();
 119             out.println("<table>");
 120             for (Iterator iter = td.getParameterKeys(); iter.hasNext(); ) {
 121                 String key = (String) (iter.next());
 122                 String value = td.getParameter(key);
 123                 if (key.equals("$root") || key.equals("$file") || key.equals("testsuite") || key.equals("file"))
 124                     out.println("<tr><td align=top>" + key + "<td><a href=\"" + value + "\">" + filter(value, false) + "</a>");
 125                 else if (key.equals("source")) {
 126                     out.println("<tr><td align=top>" + key + "<td>");
 127                     String[] srcs = StringArray.split(value);
 128                     if (srcs != null) {
 129                         File tdFile = td.getFile();
 130                         String tdFilePath = (tdFile == null ? null : tdFile.getPath());
 131                         String tdDir = (tdFilePath == null ? null : tdFilePath.substring(0, tdFilePath.lastIndexOf('/') + 1)); // File.separator?
 132                         for (int i = 0; i < srcs.length; i++) {
 133                             if (tdDir == null)
 134                                 out.println(srcs[i]);
 135                             else
 136                                 out.println("<a href=\"" + tdDir + srcs[i] + "\">" + srcs[i] + "</a>");
 137                         }
 138                     }
 139                 }
 140                 else
 141                     out.println("<tr><td align=top>" + key + "<td>" + filter(value, true));
 142             }
 143             out.println("</table>");
 144         }
 145         catch (TestResult.Fault e) {
 146             out.println("The following exception occurred while trying to determine the test description: " + e.getLocalizedMessage());
 147         }
 148         out.println("<p><hr>");
 149 
 150         // test result properties
 151         out.println("<h2><a name=tr>Test Result properties</a></h2>");
 152         try {
 153             out.println("<table>");
 154             for (Enumeration e = tr.getPropertyNames(); e.hasMoreElements(); ) {
 155                 String key = (String)(e.nextElement());
 156                 out.println("<tr><td>" + key + "<td>" + filter(tr.getProperty(key), true));
 157             }
 158         }
 159         catch (TestResult.Fault e) {
 160             out.println("The following exception occurred while trying to determine the test result properties: " + e.getLocalizedMessage());
 161         }
 162         finally {
 163             out.println("</table>");
 164         }
 165         out.println("<p><hr>");
 166 
 167         // test environment
 168         out.println("<h2><a name=env>Test Environment</a></h2>");
 169         try {
 170             Map env = tr.getEnvironment();
 171             if (env.size() == 0) {
 172                 out.println("<tr><td>No environment details found");
 173             }
 174             else {
 175                 out.println("<table>");
 176                 for (Iterator i = env.entrySet().iterator(); i.hasNext(); ) {
 177                     Map.Entry e = (Map.Entry) (i.next());
 178                     String key = (String) (e.getKey());
 179                     String value = (String) (e.getValue());
 180                     out.println("<tr><td>" + key + "<td>" + filter(value, true));
 181                 }
 182                 out.println("</table>");
 183             }
 184         }
 185         catch (TestResult.Fault e) {
 186             out.println("The following exception occurred while trying to determine the test environment: " + e.getLocalizedMessage());
 187         }
 188         out.println("<p><hr>");
 189 
 190         // output
 191         out.println("<h2><a name=output>Test Output</a></h2>");
 192 
 193         if (tr.getSectionCount() == 0)
 194             out.println("No output recorded.");
 195         else {
 196             try {
 197                 for (int i = 0; i < tr.getSectionCount(); i++) {
 198                     TestResult.Section s = tr.getSection(i);
 199                     if (i > 0)




 100         out.println("<li><a href=\"#output\">Test Output</a>");
 101         out.println("<ul>");
 102         for (int i = 0; i < tr.getSectionCount(); i++) {
 103             try {
 104                 TestResult.Section s = tr.getSection(i);
 105                 out.println("<li><a href=\"#output-" + s.getTitle() + "\">" + s.getTitle() + "</a>");
 106             }
 107             catch (TestResult.Fault f) {
 108                 out.println("The following exception occurred while trying to determine the test description: " + f.getLocalizedMessage());
 109             }
 110         }
 111         out.println("</ul>");
 112         out.println("</ul>");
 113         out.println("<p><hr>");
 114 
 115         // test description properties
 116         out.println("<h2><a name=td>Test Description properties</a></h2>");
 117         try {
 118             TestDescription td = tr.getDescription();
 119             out.println("<table>");
 120             for (Iterator<String> iter = td.getParameterKeys(); iter.hasNext(); ) {
 121                 String key = (iter.next());
 122                 String value = td.getParameter(key);
 123                 if (key.equals("$root") || key.equals("$file") || key.equals("testsuite") || key.equals("file"))
 124                     out.println("<tr><td align=top>" + key + "<td><a href=\"" + value + "\">" + filter(value, false) + "</a>");
 125                 else if (key.equals("source")) {
 126                     out.println("<tr><td align=top>" + key + "<td>");
 127                     String[] srcs = StringArray.split(value);
 128                     if (srcs != null) {
 129                         File tdFile = td.getFile();
 130                         String tdFilePath = (tdFile == null ? null : tdFile.getPath());
 131                         String tdDir = (tdFilePath == null ? null : tdFilePath.substring(0, tdFilePath.lastIndexOf('/') + 1)); // File.separator?
 132                         for (int i = 0; i < srcs.length; i++) {
 133                             if (tdDir == null)
 134                                 out.println(srcs[i]);
 135                             else
 136                                 out.println("<a href=\"" + tdDir + srcs[i] + "\">" + srcs[i] + "</a>");
 137                         }
 138                     }
 139                 }
 140                 else
 141                     out.println("<tr><td align=top>" + key + "<td>" + filter(value, true));
 142             }
 143             out.println("</table>");
 144         }
 145         catch (TestResult.Fault e) {
 146             out.println("The following exception occurred while trying to determine the test description: " + e.getLocalizedMessage());
 147         }
 148         out.println("<p><hr>");
 149 
 150         // test result properties
 151         out.println("<h2><a name=tr>Test Result properties</a></h2>");
 152         try {
 153             out.println("<table>");
 154             for (Enumeration<String> e = tr.getPropertyNames(); e.hasMoreElements(); ) {
 155                 String key = (e.nextElement());
 156                 out.println("<tr><td>" + key + "<td>" + filter(tr.getProperty(key), true));
 157             }
 158         }
 159         catch (TestResult.Fault e) {
 160             out.println("The following exception occurred while trying to determine the test result properties: " + e.getLocalizedMessage());
 161         }
 162         finally {
 163             out.println("</table>");
 164         }
 165         out.println("<p><hr>");
 166 
 167         // test environment
 168         out.println("<h2><a name=env>Test Environment</a></h2>");
 169         try {
 170             Map<String, String> env = tr.getEnvironment();
 171             if (env.size() == 0) {
 172                 out.println("<tr><td>No environment details found");
 173             }
 174             else {
 175                 out.println("<table>");
 176                 for (Iterator<Map.Entry<String, String>> i = env.entrySet().iterator(); i.hasNext(); ) {
 177                     Map.Entry<String, String> e = (i.next());
 178                     String key = (e.getKey());
 179                     String value = (e.getValue());
 180                     out.println("<tr><td>" + key + "<td>" + filter(value, true));
 181                 }
 182                 out.println("</table>");
 183             }
 184         }
 185         catch (TestResult.Fault e) {
 186             out.println("The following exception occurred while trying to determine the test environment: " + e.getLocalizedMessage());
 187         }
 188         out.println("<p><hr>");
 189 
 190         // output
 191         out.println("<h2><a name=output>Test Output</a></h2>");
 192 
 193         if (tr.getSectionCount() == 0)
 194             out.println("No output recorded.");
 195         else {
 196             try {
 197                 for (int i = 0; i < tr.getSectionCount(); i++) {
 198                     TestResult.Section s = tr.getSection(i);
 199                     if (i > 0)


< prev index next >