チェンジセット 375
- コミット日時:
- 2008/12/26 17:30:31 (13 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
trunk/im-jssp/src/test/java/org/intra_mart/common/aid/jdk/java/util/ArchiverTest.java
r355 r375 10 10 import java.io.InputStream; 11 11 import java.io.OutputStream; 12 import java.io.UnsupportedEncodingException; 12 13 import java.net.URL; 14 import java.net.URLDecoder; 13 15 import java.util.zip.ZipException; 14 16 import java.util.zip.ZipInputStream; … … 34 36 // Mavenでは空のディレクトリが target/test-classes に作成されない。。。 35 37 URL url = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/dir_test/002_3_hierarchy/"); 36 File empty_dir = new File( url.getPath(), "empty_dir");38 File empty_dir = new File(getDecodePath(url), "empty_dir"); 37 39 empty_dir.mkdirs(); 38 40 … … 155 157 try{ 156 158 157 File src = new File( url.getPath());159 File src = new File(getDecodePath(url)); 158 160 File dest = new File(temp, "000_this_file_is_0KB.zip"); 159 161 FileFilter filter = null; … … 192 194 try{ 193 195 194 File src = new File( url.getPath());196 File src = new File(getDecodePath(url)); 195 197 File dest = new File(temp, "001_plain_text.zip"); 196 198 FileFilter filter = null; … … 288 290 try{ 289 291 290 File src = new File( url.getPath());292 File src = new File(getDecodePath(url)); 291 293 File dest = new File(temp, "001_1_hierarchy.zip"); 292 294 FileFilter filter = null; … … 343 345 try{ 344 346 345 File src = new File( url.getPath());347 File src = new File(getDecodePath(url)); 346 348 File dest = new File(temp, "002_3_hierarchy.zip"); 347 349 FileFilter filter = null; … … 502 504 try{ 503 505 504 File src = new File( url.getPath());506 File src = new File(getDecodePath(url)); 505 507 File dest = new File(temp, "002_3_hierarchy.zip");; 506 508 FileFilter filter = new FileFilter(){ … … 631 633 URL url = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/001_plain_text.zip"); 632 634 633 File src = new File( url.getPath());635 File src = new File(getDecodePath(url)); 634 636 File dest = null; 635 637 … … 671 673 URL url = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/001_plain_text.txt"); 672 674 673 File src = new File( url.getPath());675 File src = new File(getDecodePath(url)); 674 676 dest = new File(tempDir, "test_unzipFileFile_srcがZip形式ではない"); 675 677 assertFalse("前提:出力先ディレクトリが存在しない事", dest.exists()); … … 703 705 URL url = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/002_this_zipfile_is_0KB.zip"); 704 706 705 File src = new File( url.getPath());707 File src = new File(getDecodePath(url)); 706 708 dest = new File("target/test/test_unzipFileFile_srcが0KBのZIPファイル/"); 707 709 assertFalse("前提:出力先ディレクトリが存在しない事", dest.exists()); … … 733 735 URL url = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/001_plain_text.zip"); 734 736 735 File src = new File( url.getPath());737 File src = new File(getDecodePath(url)); 736 738 File dest = new File("target/test/test_unzipFileFile_srcが001_plain_text_zip/"); 737 739 … … 753 755 URL url = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/001_plain_text.zip"); 754 756 755 File src = new File( url.getPath());757 File src = new File(getDecodePath(url)); 756 758 InputStream is = new FileInputStream(src); 757 759 File dest = new File("target/test/test_unzipFileFile_srcが001_plain_text_zip/"); … … 773 775 URL url = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/001_plain_text.zip"); 774 776 775 File src = new File( url.getPath());777 File src = new File(getDecodePath(url)); 776 778 InputStream is = new FileInputStream(src); 777 779 ZipInputStream zis = new ZipInputStream(is); … … 795 797 URL url = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/001_plain_text.zip"); 796 798 797 File src = new File( url.getPath());799 File src = new File(getDecodePath(url)); 798 800 File dest = new File("target/test/test_unzipFileFile_srcが001_plain_text_zip/"); 799 801 … … 841 843 // 準備(開始) 842 844 URL url4pre = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/dir_test/002_3_hierarchy"); 843 copyDir(new File( url4pre.getPath()), new File(destBaseDir));845 copyDir(new File(getDecodePath(url4pre)), new File(destBaseDir)); 844 846 // 準備(終了) 845 847 846 848 URL url = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/dir_test/001_1_hierarchy.zip"); 847 849 848 File src = new File( url.getPath());850 File src = new File(getDecodePath(url)); 849 851 File dest = new File(destBaseDir + "/foo"); 850 852 … … 895 897 } 896 898 URL url4pre = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/dir_test/002_3_hierarchy"); 897 copyDir(new File( url4pre.getPath()), new File(destBaseDir));899 copyDir(new File(getDecodePath(url4pre)), new File(destBaseDir)); 898 900 // 準備(終了) 899 901 900 902 URL url = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/dir_test/002_3_hierarchy.zip"); 901 File src = new File( url.getPath());903 File src = new File(getDecodePath(url)); 902 904 File dest = new File(destBaseDir + "/foo/001_plain_text.txt"); 903 905 … … 1043 1045 1044 1046 URL url = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/dir_test/002_3_hierarchy.zip"); 1045 File src = new File( url.getPath());1047 File src = new File(getDecodePath(url)); 1046 1048 File dest = new File(destBaseDir + "/foo/bar"); 1047 1049 … … 1188 1190 URL url = this.getClass().getResource("/org/intra_mart/common/aid/jdk/java/util/ArchiverTest/dir_test/001_1_hierarchy.zip"); 1189 1191 1190 File src = new File( url.getPath());1192 File src = new File(getDecodePath(url)); 1191 1193 File dest = new File(destBaseDir + "/foo/bar"); 1192 1194 … … 1351 1353 } 1352 1354 1353 1355 /** 1356 * URLデコードされたpathを取得します. 1357 * 1358 * @param url url 1359 * @return URLデコードされたpath. 1360 * @throws IOException 1361 */ 1362 private String getDecodePath(URL url) throws IOException { 1363 return URLDecoder.decode(url.getPath(), "UTF-8"); 1364 } 1354 1365 } trunk/im-jssp/src/test/java/org/intra_mart/jssp/script/api/ArchiverObjectTest.java
r352 r375 9 9 import java.io.InputStream; 10 10 import java.net.URL; 11 import java.net.URLDecoder; 11 12 12 13 import junit.framework.TestCase; … … 49 50 // Mavenでは空のディレクトリが target/test-classes に作成されない。。。 50 51 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/dir_test/002_3_hierarchy/"); 51 File empty_dir = new File( url.getPath(), "empty_dir");52 File empty_dir = new File(getDecodePath(url), "empty_dir"); 52 53 empty_dir.mkdirs(); 53 54 54 File foo_empty_dir = new File( url.getPath(), "foo/empty_dir");55 File foo_empty_dir = new File(getDecodePath(url), "foo/empty_dir"); 55 56 foo_empty_dir.mkdirs(); 56 57 57 File foo_foo2_empty_dir = new File( url.getPath(), "foo/foo2/empty_dir");58 File foo_foo2_empty_dir = new File(getDecodePath(url), "foo/foo2/empty_dir"); 58 59 foo_foo2_empty_dir.mkdirs(); 59 60 } … … 235 236 public void test_zip_srcがFileAccessObject_0KBのファイル() throws Exception { 236 237 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/000_this_file_is_0KB.txt"); 237 Object[] args4src = { url.getPath()};238 Object[] args4src = {getDecodePath(url)}; 238 239 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 239 240 … … 284 285 public void test_zip_srcがFileAccessObject_54Bytesのファイル() throws Exception { 285 286 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/001_plain_text.txt"); 286 Object[] args4src = { url.getPath()};287 Object[] args4src = {getDecodePath(url)}; 287 288 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 288 289 … … 388 389 389 390 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/dir_test/001_1_hierarchy/"); 390 Object[] args4src = { url.getPath()};391 Object[] args4src = {getDecodePath(url)}; 391 392 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 392 393 … … 454 455 public void test_zip_srcがFileAccessObject_ディレクトリ_3階層() throws Exception { 455 456 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/dir_test/002_3_hierarchy/"); 456 Object[] args4src = { url.getPath()};457 Object[] args4src = {getDecodePath(url)}; 457 458 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 458 459 … … 650 651 public void test_zip_srcとdestがFileAccessObject_0KBのファイル() throws Exception { 651 652 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/000_this_file_is_0KB.txt"); 652 Object[] args4src = { url.getPath()};653 Object[] args4src = {getDecodePath(url)}; 653 654 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 654 655 … … 706 707 public void test_zip_srcとdestがFileAccessObject_54Bytesのファイル() throws Exception { 707 708 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/001_plain_text.txt"); 708 Object[] args4src = { url.getPath()};709 Object[] args4src = {getDecodePath(url)}; 709 710 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 710 711 … … 833 834 public void test_zip_srcとdestがFileAccessObject_ディレクトリ_1階層() throws Exception { 834 835 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/dir_test/001_1_hierarchy/"); 835 Object[] args4src = { url.getPath()};836 Object[] args4src = {getDecodePath(url)}; 836 837 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 837 838 … … 909 910 public void test_zip_srcとdestがFileAccessObject_ディレクトリ_3階層() throws Exception { 910 911 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/dir_test/002_3_hierarchy/"); 911 Object[] args4src = { url.getPath()};912 Object[] args4src = {getDecodePath(url)}; 912 913 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 913 914 … … 1123 1124 1124 1125 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/dir_test/002_3_hierarchy/"); 1125 Object[] args4src = { url.getPath()};1126 Object[] args4src = {getDecodePath(url)}; 1126 1127 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 1127 1128 … … 1446 1447 public void test_unzip_srcがFileAccessObject_0KBのZIPファイル() throws Exception { 1447 1448 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/002_this_zipfile_is_0KB.zip"); 1448 Object[] args4src = { url.getPath()};1449 Object[] args4src = {getDecodePath(url)}; 1449 1450 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 1450 1451 … … 1480 1481 public void test_unzip_srcがFileAccessObject_001_plain_text_zip() throws Exception { 1481 1482 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/001_plain_text.zip"); 1482 Object[] args4src = { url.getPath()};1483 Object[] args4src = {getDecodePath(url)}; 1483 1484 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 1484 1485 … … 1593 1594 // 準備(開始) 1594 1595 URL url4pre = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/dir_test/002_3_hierarchy"); 1595 copyDir(new File( url4pre.getPath()), new File(destBaseDir));1596 copyDir(new File(getDecodePath(url4pre)), new File(destBaseDir)); 1596 1597 // 準備(終了) 1597 1598 1598 1599 1599 1600 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/dir_test/001_1_hierarchy.zip"); 1600 Object[] args4src = { url.getPath()};1601 Object[] args4src = {getDecodePath(url)}; 1601 1602 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 1602 1603 … … 1661 1662 } 1662 1663 URL url4pre = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/dir_test/002_3_hierarchy"); 1663 copyDir(new File( url4pre.getPath()), new File(destBaseDir));1664 copyDir(new File(getDecodePath(url4pre)), new File(destBaseDir)); 1664 1665 // 準備(終了) 1665 1666 1666 1667 1667 1668 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/dir_test/002_3_hierarchy.zip"); 1668 Object[] args4src = { url.getPath()};1669 Object[] args4src = {getDecodePath(url)}; 1669 1670 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 1670 1671 … … 1830 1831 1831 1832 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/dir_test/002_3_hierarchy.zip"); 1832 Object[] args4src = { url.getPath()};1833 Object[] args4src = {getDecodePath(url)}; 1833 1834 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 1834 1835 … … 1997 1998 1998 1999 URL url = this.getClass().getResource("/org/intra_mart/jssp/script/api/ArchiverObjectTest/dir_test/001_1_hierarchy.zip"); 1999 Object[] args4src = { url.getPath()};2000 Object[] args4src = {getDecodePath(url)}; 2000 2001 FileAccessObject src = (FileAccessObject)FileAccessObject.jsConstructor(cxMadeInSetup, args4src, null, true); 2001 2002 … … 2183 2184 } 2184 2185 2185 2186 /** 2187 * URLデコードされたpathを取得します. 2188 * 2189 * @param url url 2190 * @return URLデコードされたpath. 2191 * @throws IOException 2192 */ 2193 private String getDecodePath(URL url) throws IOException { 2194 return URLDecoder.decode(url.getPath(), "UTF-8"); 2195 } 2186 2196 }