チェンジセット 331
- コミット日時:
- 2008/10/01 18:33:27 (14 年前)
- ファイル:
-
- trunk/im-jssp/src/main/java/org/intra_mart/jssp/script/api/dom/XMLDocumentObject.java (更新) (9 diffs)
- trunk/im-jssp/src/main/java/org/intra_mart/jssp/script/api/dom/XMLParserObject.java (更新) (11 diffs)
- trunk/im-jssp/src/test/js/JsUnitを利用したテストに関する注意点.txt (更新) (1 diff)
- trunk/im-jssp/src/test/js/jssp/script/api/XMLDocumentTest.js (追加)
- trunk/im-jssp/src/test/js/jssp/script/api/XMLParserTest.js (追加)
- trunk/im-jssp/src/test/js/jsspUnitTestExecute.js (更新) (1 diff)
- trunk/im-jssp/src/test/resources/conf/jssp-config-temp.xml (更新) (1 diff)
- trunk/im-jssp/src/test/resources/org/intra_mart/resources (追加)
- trunk/im-jssp/src/test/resources/org/intra_mart/resources/charset (追加)
- trunk/im-jssp/src/test/resources/org/intra_mart/resources/charset/encoding (追加)
- trunk/im-jssp/src/test/resources/org/intra_mart/resources/charset/encoding/entity (追加)
- trunk/im-jssp/src/test/resources/org/intra_mart/resources/charset/encoding/entity/mapping4ascii.xml (追加)
- trunk/im-jssp/src/test/resources/org/intra_mart/resources/charset/encoding/entity/mapping4euc_jp.xml (追加)
- trunk/im-jssp/src/test/resources/org/intra_mart/resources/charset/encoding/entity/mapping4jis.xml (追加)
- trunk/im-jssp/src/test/resources/org/intra_mart/resources/charset/encoding/entity/mapping4ms932.xml (追加)
- trunk/im-jssp/src/test/resources/org/intra_mart/resources/charset/encoding/entity/mapping4utf.xml (追加)
- trunk/im-jssp/src/test/resources/org/intra_mart/resources/charset/encoding/mapping.xml (追加)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
trunk/im-jssp/src/main/java/org/intra_mart/jssp/script/api/dom/XMLDocumentObject.java
r70 r331 63 63 public class XMLDocumentObject extends DOMNodeObject implements Serializable{ 64 64 65 private static final String PROP_NAME_4_JAVA_EXCEPTION = "javaException"; 65 66 private Document document; 66 67 private boolean error = false; 67 68 private String errorMessage = null; 69 70 68 71 /** 69 72 * @param src … … 78 81 } 79 82 catch(SAXException saxe){ 83 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, saxe); 80 84 this.error = true; 85 this.errorMessage = saxe.getMessage(); 81 86 } 82 87 catch(IOException ioe){ 88 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, ioe); 83 89 this.error = true; 84 } 85 catch(NullPointerException npe){ 90 this.errorMessage = ioe.getMessage(); 91 } 92 catch(NullPointerException npe){ 93 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, npe); 86 94 this.error = true; 95 this.errorMessage = npe.getMessage(); 87 96 } 88 97 catch(Exception e){ 98 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, e); 89 99 this.error = true; 100 this.errorMessage = e.getMessage(); 90 101 } 91 102 } … … 149 160 return outputStream.toString(); 150 161 } catch (TransformerConfigurationException e) { 162 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, e); 151 163 return null; 152 164 } catch (TransformerException e) { 165 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, e); 153 166 return null; 154 167 } … … 187 200 } 188 201 catch(NullPointerException npe){ 202 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, npe); 189 203 return null; 190 204 } … … 211 225 } 212 226 catch(NullPointerException npe){ 227 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, npe); 213 228 return null; 214 229 } … … 227 242 } 228 243 catch(DOMException dome){ 229 return null; 230 } 231 catch(NullPointerException npe){ 244 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, dome); 245 return null; 246 } 247 catch(NullPointerException npe){ 248 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, npe); 232 249 return null; 233 250 } … … 246 263 } 247 264 catch(NullPointerException npe){ 265 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, npe); 248 266 return null; 249 267 } … … 261 279 } 262 280 catch(NullPointerException npe){ 281 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, npe); 263 282 return null; 264 283 } … … 275 294 return this.error; 276 295 } 277 296 297 /** 298 * エラーメッセージの取得を行います。<br/> 299 * <br/> 300 * XML ソースを解析中にエラーが発生していた場合、そのエラーメッセージを返します。<br/> 301 * 302 * @scope public 303 * @return String エラーメッセージ 304 */ 305 public String jsFunction_getErrorMessage(){ 306 return this.errorMessage; 307 } 308 278 309 } trunk/im-jssp/src/main/java/org/intra_mart/jssp/script/api/dom/XMLParserObject.java
r56 r331 30 30 public class XMLParserObject extends ScriptableObject implements Serializable{ 31 31 32 private static final String PROP_NAME_4_JAVA_EXCEPTION = "javaException"; 32 33 private boolean error = true; 33 34 private String errorMessage = null; … … 122 123 } 123 124 catch(SAXException saxe){ 125 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, saxe); 126 124 127 this.error = true; 125 128 this.errorMessage = saxe.getMessage(); … … 127 130 } 128 131 catch(IOException ioe){ 132 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, ioe); 133 129 134 this.error = true; 130 135 this.errorMessage = ioe.getMessage(); … … 132 137 } 133 138 catch (ParserConfigurationException pce) { 139 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, pce); 140 134 141 this.error = true; 135 142 this.errorMessage = pce.getMessage(); … … 137 144 } 138 145 catch(NullPointerException npe){ 146 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, npe); 147 139 148 this.error = true; 140 149 this.errorMessage = npe.getClass().getName() + " : " + npe.getMessage(); … … 142 151 } 143 152 catch(Exception e){ 153 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, e); 154 144 155 this.error = true; 145 156 this.errorMessage = e.getClass().getName() + " : " + e.getMessage(); … … 231 242 } 232 243 catch(SAXException saxe){ 244 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, saxe); 245 233 246 this.error = true; 234 247 this.errorMessage = saxe.getMessage(); … … 236 249 } 237 250 catch(IOException ioe){ 251 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, ioe); 252 238 253 this.error = true; 239 254 this.errorMessage = ioe.getMessage(); … … 241 256 } 242 257 catch (ParserConfigurationException pce) { 258 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, pce); 259 243 260 this.error = true; 244 261 this.errorMessage = pce.getMessage(); … … 246 263 } 247 264 catch(NullPointerException npe){ 265 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, npe); 266 248 267 this.error = true; 249 268 this.errorMessage = npe.getClass().getName() + " : " + npe.getMessage(); … … 251 270 } 252 271 catch(Exception e){ 272 this.put(PROP_NAME_4_JAVA_EXCEPTION, this, e); 273 253 274 this.error = true; 254 275 this.errorMessage = e.getClass().getName() + " : " + e.getMessage(); trunk/im-jssp/src/test/js/JsUnitを利用したテストに関する注意点.txt
r313 r331 16 16 テスト実行時には、「im-jssp/src/test/js」ディレクトリをJSSPのソースディレクトリとして登録してください。 17 17 18 上記ディレクトリを imart.xmlの19 「intra-mart/ platform/service/resource/jssp/source-path/general/directory」タグに追加してください。18 上記ディレクトリを WEB-INF/classes/conf/jssp-config.xmlの 19 「intra-mart/jssp/source-path/general/directory」タグに追加してください。 20 20 21 21 - jssp-config-XXXX.xmlの設定例 trunk/im-jssp/src/test/js/jsspUnitTestExecute.js
r313 r331 1 var resultDirName = "target/JsspUnitTestResult/"; 2 var resultFileName = "result_for_jsspUnitTestExecute.xml"; 3 4 var logger = Logger.getLogger(); 5 1 6 function init(request){ 2 Debug.print("テストを開始します");7 var testSrc = "jsspUnitTestExecute"; 3 8 4 var result = JsUnit.execute("jsspUnitTestExecute", "xsl/jsunit/im_jsunit.xsl"); 9 logger.info("テスト開始: {}", testSrc); 10 var testResult = JsUnit.execute(testSrc, "xsl/jsunit/im_jsunit.xsl"); 5 11 6 var response = Web.getHTTPResponse(); 7 response.setContentType("text/xml; charset=utf-8"); 8 response.sendMessageBodyString(result); 12 try{ 13 var response = Web.getHTTPResponse(); 14 response.setContentType("text/xml; charset=utf-8"); 15 response.sendMessageBodyString(testResult); 16 } 17 catch(ex){ 18 logger.trace("WebコンテナからJSSPを起動していない(=JVMだけで起動している)", ex); 19 20 var dir = new File(resultDirName); 21 dir.makeDirectories(); 22 23 var file = new File(dir.path(), resultFileName); 24 var result = file.write(testResult); 25 26 if(result){ 27 logger.info("テスト結果を出力しました: {}", file.path()); 28 } 29 else{ 30 logger.info("テスト結果の出力に失敗しました: {}", file.path()); 31 } 32 33 } 9 34 } 10 35 11 36 function defineTestSuite() { 12 37 var suite = new JsTestSuite("All Test"); 13 14 suite.addTest("サーバサイドのImJSONテスト","jssp/script/api/im_json_test"); 15 38 suite.addTest("サーバサイドのImJSONテスト", "jssp/script/api/im_json_test"); 39 suite.addTest("URLオブジェクトのテスト", "jssp/script/api/URLTest"); 40 suite.addTest("XMLDocumentオブジェクトのテスト", "jssp/script/api/XMLDocumentTest"); 41 suite.addTest("XMLParserオブジェクトのテスト", "jssp/script/api/XMLParserTest"); 16 42 return suite; 17 43 } trunk/im-jssp/src/test/resources/conf/jssp-config-temp.xml
r310 r331 46 46 <application> 47 47 <initializer-script>setup</initializer-script> 48 <initializer-script>jsspUnitTestExecute</initializer-script> 49 <!-- 48 50 <initializer-script>sample/web_service/invoke_sample</initializer-script> 51 --> 49 52 </application> 50 53 </initializer>