diff --git a/pom.xml b/pom.xml
index a44bf94..b79e749 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,6 +12,10 @@
HEAD
+
+ ReStamp
+ http://surveyor.mydns.jp/gitbucket/yuu/Restamp/wiki
+
MIT License
@@ -34,10 +38,6 @@
${java.version}
-
- ReStamp
- http://surveyor.mydns.jp/gitbucket/yuu/Restamp/wiki
-
@@ -70,6 +70,13 @@
jar
+ org.apache.commons
+ commons-compress
+ 1.14
+ test
+ jar
+
+
commons-codec
commons-codec
1.14
diff --git a/src/main/java/osm/surveyor/matchtime/Restamp.java b/src/main/java/osm/surveyor/matchtime/Restamp.java
index 5054428..e9cd184 100644
--- a/src/main/java/osm/surveyor/matchtime/Restamp.java
+++ b/src/main/java/osm/surveyor/matchtime/Restamp.java
@@ -57,8 +57,7 @@
*
* 2. ファイルの更新日付を書き換える
* ```
- * $ cd /home/yuu/Desktop/workspace/AdjustTime/importPicture/dist
- * $ java -cp .:AdjustTime2.jar osm.jp.gpx.Restamp /home/yuu/Desktop/OSM/20180325_横浜新道/img 000033.jpg 2018-03-25_12:20:32 003600.jpg 2018-03-25_13:20:09
+ * $ java -cp .:ReStamp.jar osm.jp.gpx.Restamp /home/yuu/Desktop/OSM/20180325_横浜新道/img 000033.jpg 2018-03-25_12:20:32 003600.jpg 2018-03-25_13:20:09
* ```
*
* exp) $ java -jar Restamp.jar argv[0] argv[1] argv[2] argv[3] argv[4]
@@ -67,9 +66,9 @@
* @param argv
* argv[0] = 画像ファイルが格納されているディレクトリ --> imgDir
* argv[1] = 時刻補正の基準とする画像ファイル --> baseFile1
- * argv[2] = 基準画像ファイルの精確な撮影日時 "yyyy-MM-dd HH:mm:ss z" --> baseTime1
+ * argv[2] = 基準画像ファイルの精確な撮影日時 "yyyy-MM-dd HH:mm:ss JST" --> baseTime1
* argv[3] = 時刻補正の基準とする画像ファイル --> baseFile2
- * argv[4] = 基準画像ファイルの精確な撮影日時 "yyyy-MM-dd HH:mm:ss z" --> baseTime2
+ * argv[4] = 基準画像ファイルの精確な撮影日時 "yyyy-MM-dd HH:mm:ss JST" --> baseTime2
* argv[5] = (option)変換済み画像ファイルの出力フォルダ.省略した場合は元画像を直接上書きする --> outputDir
* @throws ImageReadException
*/
diff --git a/src/test/java/osm/surveyor/matchtime/Fixture.java b/src/test/java/osm/surveyor/matchtime/Fixture.java
new file mode 100644
index 0000000..8470050
--- /dev/null
+++ b/src/test/java/osm/surveyor/matchtime/Fixture.java
@@ -0,0 +1,254 @@
+package osm.surveyor.matchtime;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+
+import org.apache.commons.codec.digest.DigestUtils;
+import org.junit.experimental.theories.DataPoints;
+
+public class Fixture {
+ String[] args;
+ String[] ans;
+ HashMap before;
+
+ public Fixture(
+ String[] args,
+ String[] ans
+ ) {
+ this.args = args;
+ this.ans = ans;
+ this.before = new HashMap<>();
+ }
+
+ /**
+ * フォルダ内のファイルとファイルのMD5リストを作成
+ * @param dir
+ * @return
+ */
+ public void setUp() throws IOException {
+ if (args.length > 0) {
+ String dirPath = args[0];
+ File[] files = Paths.get(dirPath).toFile().listFiles();
+ for (File f : files) {
+ FileInputStream fis = new FileInputStream(f);
+ this.before.put(DigestUtils.md5Hex(fis), f);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param imgDir
+ * @param ans
+ */
+ public void check() {
+ if (args.length > 5) {
+ String dirPath = args[0];
+ File imgDir = Paths.get(dirPath).toFile();
+ if (this.args.length >= 6) {
+ imgDir = Paths.get(args[5]).toFile();
+ }
+
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
+
+ File[] files = imgDir.listFiles();
+ assertThat(files.length, is(ans.length));
+
+ java.util.Arrays.sort(files, (File file1, File file2) -> file1.getName().compareTo(file2.getName()));
+
+ int i = 0;
+ for (File jpgFile : files) {
+ long msec = jpgFile.lastModified();
+ String lastModifiedStr = df.format(new Date(msec));
+ assertThat(lastModifiedStr, is(ans[i]));
+ i++;
+ }
+ }
+ }
+
+ /**
+ *
+ * @param map
+ * @param dir
+ */
+ public void checkUnchanged() {
+ if (this.args.length < 6) {
+ return;
+ }
+ String outStr = args[5];
+ Path dir = Paths.get(outStr);
+ assertThat(Files.isDirectory(dir), is(true));
+ try {
+ File[] files = dir.toFile().listFiles();
+ assertThat(files.length, is(this.before.size()));
+
+ for (String key : this.before.keySet()) {
+ File sfile = this.before.get(key);
+ Path ofile = Paths.get(dir.toString(), sfile.getName());
+ assertNotNull(ofile);
+
+ FileInputStream fis = new FileInputStream(ofile.toFile());
+ String md5 = DigestUtils.md5Hex(fis);
+ assertThat(key, is(md5));
+ }
+ }
+ catch (Exception e) {
+ fail();
+ }
+ }
+
+
+ @Override
+ public String toString() {
+ String msg = "テストパターン";
+ for (String arg : args) {
+ msg += String.format("\n%s", arg);
+ }
+ return msg;
+ }
+
+
+ @DataPoints
+ public static Fixture[] datas = {
+ new Fixture(
+ new String[]{},
+ new String[] {}
+ ),
+ new Fixture(
+ new String[]{
+ "./target/test-classes/images"
+ },
+ new String[] {
+ "2019-09-01 16:26:51 JST",
+ "2019-09-01 16:26:56 JST",
+ "2019-09-01 16:27:01 JST",
+ "2019-09-01 16:27:06 JST",
+ "2019-09-01 16:27:11 JST",
+ "2019-09-01 16:27:16 JST",
+ "2019-09-01 16:27:21 JST",
+ "2019-09-01 16:27:26 JST",
+ "2019-09-01 16:27:31 JST"
+ }
+ ),
+ new Fixture(
+ new String[]{
+ "./target/test-classes/images",
+ "00001.jpg",
+ "2019-09-01 16:26:51 JST",
+ "00003.jpg",
+ "2019-09-01 16:27:01 JST",
+ "./target/test-classes/out"
+ },
+ new String[] {
+ "2019-09-01 16:26:51 JST",
+ "2019-09-01 16:26:56 JST",
+ "2019-09-01 16:27:01 JST",
+ "2019-09-01 16:27:06 JST",
+ "2019-09-01 16:27:11 JST",
+ "2019-09-01 16:27:16 JST",
+ "2019-09-01 16:27:21 JST",
+ "2019-09-01 16:27:26 JST",
+ "2019-09-01 16:27:31 JST",
+ }
+ ),
+ new Fixture(
+ new String[]{
+ "./target/test-classes/images",
+ "00002.jpg",
+ "2019-09-02 16:26:56 JST",
+ "00004.jpg",
+ "2019-09-02 16:27:01 JST"
+ },
+ new String[] {
+ "2019-09-02 16:26:53 JST", // 0.0 sec
+ "2019-09-02 16:26:56 JST", // 3.0 sec
+ "2019-09-02 16:26:58 JST", // 2.0 sec
+ "2019-09-02 16:27:01 JST", // 3.0 sec
+ "2019-09-02 16:27:03 JST", // 2.0 sec
+ "2019-09-02 16:27:06 JST", // 3.0 sec
+ "2019-09-02 16:27:08 JST", // 2.0 sec
+ "2019-09-02 16:27:11 JST", // 3.0 sec
+ "2019-09-02 16:27:13 JST", // 2.0 sec
+ }
+ ),
+ new Fixture(
+ new String[]{
+ "./target/test-classes/images",
+ "00001.jpg",
+ "2019-09-03 16:26:53 JST",
+ "00003.jpg",
+ "2019-09-03 16:26:58 JST"
+ },
+ new String[] {
+ "2019-09-03 16:26:53 JST", // 0.0
+ "2019-09-03 16:26:55 JST", // 2.0
+ "2019-09-03 16:26:58 JST", // 3.0
+ "2019-09-03 16:27:00 JST", // 2.0
+ "2019-09-03 16:27:03 JST", // 3.0
+ "2019-09-03 16:27:05 JST", // 2.0
+ "2019-09-03 16:27:08 JST", // 3.0
+ "2019-09-03 16:27:10 JST", // 2.0
+ "2019-09-03 16:27:13 JST", // 3.0
+ }
+ ),
+
+ // 4
+ new Fixture(
+ new String[]{
+ "./target/test-classes/images",
+ "00003.jpg",
+ "2019-09-04 16:26:58 JST",
+ "00005.jpg",
+ "2019-09-04 16:27:03 JST"
+ },
+ new String[] {
+ "2019-09-04 16:26:53 JST", // 0.0
+ "2019-09-04 16:26:55 JST", // 2.0
+ "2019-09-04 16:26:58 JST", // 3.0
+ "2019-09-04 16:27:00 JST", // 2.0
+ "2019-09-04 16:27:03 JST", // 3.0
+ "2019-09-04 16:27:05 JST", // 2.0
+ "2019-09-04 16:27:08 JST", // 3.0
+ "2019-09-04 16:27:10 JST", // 2.0
+ "2019-09-04 16:27:13 JST", // 3.0
+ }
+ ),
+
+ // 5
+ new Fixture(
+ new String[]{
+ "./target/test-classes/images",
+ "00003.jpg",
+ "2019-09-04 16:26:58 JST",
+ "00005.jpg",
+ "2019-09-04 16:27:03 JST",
+ "./target/test-classes/out"
+ },
+ new String[] {
+ "2019-09-04 16:26:53 JST", // 0.0
+ "2019-09-04 16:26:55 JST", // 2.0
+ "2019-09-04 16:26:58 JST", // 3.0
+ "2019-09-04 16:27:00 JST", // 2.0
+ "2019-09-04 16:27:03 JST", // 3.0
+ "2019-09-04 16:27:05 JST", // 2.0
+ "2019-09-04 16:27:08 JST", // 3.0
+ "2019-09-04 16:27:10 JST", // 2.0
+ "2019-09-04 16:27:13 JST", // 3.0
+ }
+ ),
+ };
+
+}
diff --git a/src/test/java/osm/surveyor/matchtime/RestampTest.java b/src/test/java/osm/surveyor/matchtime/RestampTest.java
index 1cc812b..ea3a9cc 100644
--- a/src/test/java/osm/surveyor/matchtime/RestampTest.java
+++ b/src/test/java/osm/surveyor/matchtime/RestampTest.java
@@ -1,288 +1,63 @@
package osm.surveyor.matchtime;
-import java.util.*;
-import java.io.*;
-import java.nio.file.*;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import static org.hamcrest.CoreMatchers.is;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.apache.commons.codec.digest.DigestUtils;
import static org.junit.Assert.*;
-/**
- *
- * @author yuu
- */
+import java.io.*;
+import org.junit.experimental.theories.DataPoints;
+import org.junit.experimental.theories.Theories;
+import org.junit.experimental.theories.Theory;
+import org.junit.runner.RunWith;
+
+@RunWith(Theories.class)
public class RestampTest {
- public RestampTest() {
- }
-
- @BeforeClass
- public static void setUpClass() {
- }
-
- @AfterClass
- public static void tearDownClass() {
- }
-
- @Before
- public void setUp() {
- dirPath = "./target/test-classes/data/images";
- outPath = "./target/test-classes/out";
- Path dir = Paths.get(outPath);
- if (Files.exists(dir) && Files.isDirectory(dir) && Files.isWritable(dir)) {
- try {
- Files.delete(dir);
- }
- catch(Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- @After
- public void tearDown() {
- try {
- Path dir = Paths.get(outPath);
- if (Files.exists(dir) && Files.isDirectory(dir) && Files.isWritable(dir)) {
- Files.list(dir).forEach(f -> delFile(f));
- Files.delete(dir);
- }
- }
- catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- public void delFile(Path p) {
- try {
- Files.delete(p);
- }
- catch(IOException e) {
- e.printStackTrace();
- };
- }
-
String dirPath;
String outPath;
- @Test
- public void testMain() {
- String[] ans = {
- "2019-09-01 16:26:51 JST",
- "2019-09-01 16:26:56 JST",
- "2019-09-01 16:27:01 JST",
- "2019-09-01 16:27:06 JST",
- "2019-09-01 16:27:11 JST",
- "2019-09-01 16:27:16 JST",
- "2019-09-01 16:27:21 JST",
- "2019-09-01 16:27:26 JST",
- "2019-09-01 16:27:31 JST",
- };
-
- try {
- String[] argv = new String[]{
- dirPath,
- "00001.jpg",
- "2019-09-01 16:26:51 JST",
- "00003.jpg",
- "2019-09-01 16:27:01 JST",
- outPath
- };
- HashMap before = getMd5(Paths.get(dirPath));
- Restamp.main(argv);
- check(new File(outPath), ans);
- checkUnchanged(before, Paths.get(dirPath));
- }
- catch (Exception e) {
- fail();
- }
- }
-
- @Test
- public void testMain_2() {
- String[] ans = {
- "2019-09-02 16:26:53 JST", // 0.0 sec
- "2019-09-02 16:26:56 JST", // 3.0 sec
- "2019-09-02 16:26:58 JST", // 2.0 sec
- "2019-09-02 16:27:01 JST", // 3.0 sec
- "2019-09-02 16:27:03 JST", // 2.0 sec
- "2019-09-02 16:27:06 JST", // 3.0 sec
- "2019-09-02 16:27:08 JST", // 2.0 sec
- "2019-09-02 16:27:11 JST", // 3.0 sec
- "2019-09-02 16:27:13 JST", // 2.0 sec
- };
-
- try {
- String[] argv = new String[]{
- dirPath,
- "00002.jpg",
- "2019-09-02 16:26:56 JST",
- "00004.jpg",
- "2019-09-02 16:27:01 JST"
- };
- Restamp.main(argv);
- check(new File(dirPath), ans);
- }
- catch (Exception e) {
- fail();
- }
- }
-
- @Test
- public void testMain_3() {
- String[] ans = {
- "2019-09-03 16:26:53 JST", // 0.0
- "2019-09-03 16:26:55 JST", // 2.0
- "2019-09-03 16:26:58 JST", // 3.0
- "2019-09-03 16:27:00 JST", // 2.0
- "2019-09-03 16:27:03 JST", // 3.0
- "2019-09-03 16:27:05 JST", // 2.0
- "2019-09-03 16:27:08 JST", // 3.0
- "2019-09-03 16:27:10 JST", // 2.0
- "2019-09-03 16:27:13 JST", // 3.0
- };
-
- try {
- String[] argv = new String[]{
- dirPath,
- "00001.jpg",
- "2019-09-03 16:26:53 JST",
- "00003.jpg",
- "2019-09-03 16:26:58 JST"
- };
- Restamp.main(argv);
- check(new File(dirPath), ans);
- }
- catch (Exception e) {
- fail();
- }
- }
-
- @Test
- public void testMain_4() {
- String[] ans = {
- "2019-09-04 16:26:53 JST", // 0.0
- "2019-09-04 16:26:55 JST", // 2.0
- "2019-09-04 16:26:58 JST", // 3.0
- "2019-09-04 16:27:00 JST", // 2.0
- "2019-09-04 16:27:03 JST", // 3.0
- "2019-09-04 16:27:05 JST", // 2.0
- "2019-09-04 16:27:08 JST", // 3.0
- "2019-09-04 16:27:10 JST", // 2.0
- "2019-09-04 16:27:13 JST", // 3.0
- };
-
- try {
- String[] argv = new String[]{
- dirPath,
- "00003.jpg",
- "2019-09-04 16:26:58 JST",
- "00005.jpg",
- "2019-09-04 16:27:03 JST"
- };
- Restamp.main(argv);
- check(new File(dirPath), ans);
- }
- catch (Exception e) {
- fail();
- }
- }
-
- @Test
- public void testMain_5() {
- String[] ans = {
- "2019-09-04 16:26:53 JST", // 0.0
- "2019-09-04 16:26:55 JST", // 2.0
- "2019-09-04 16:26:58 JST", // 3.0
- "2019-09-04 16:27:00 JST", // 2.0
- "2019-09-04 16:27:03 JST", // 3.0
- "2019-09-04 16:27:05 JST", // 2.0
- "2019-09-04 16:27:08 JST", // 3.0
- "2019-09-04 16:27:10 JST", // 2.0
- "2019-09-04 16:27:13 JST", // 3.0
- };
-
- try {
- String[] argv = new String[]{
- dirPath,
- "00003.jpg",
- "2019-09-04 16:26:58 JST",
- "00005.jpg",
- "2019-09-04 16:27:03 JST",
- outPath
- };
- Restamp.main(argv);
- check(new File(outPath), ans);
- }
- catch (Exception e) {
- fail();
- }
- }
-
- void check(File imgDir, String[] ans) {
- DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
+ @DataPoints
+ public static Fixture[] datas = Fixture.datas;
- File[] files = imgDir.listFiles();
- assertThat(files.length, is(ans.length));
-
- java.util.Arrays.sort(files, (File file1, File file2) -> file1.getName().compareTo(file2.getName()));
-
- int i = 0;
- for (File jpgFile : files) {
- long msec = jpgFile.lastModified();
- String lastModifiedStr = df.format(new Date(msec));
- assertThat(lastModifiedStr, is(ans[i]));
- i++;
- }
+ @Theory
+ public void パラメータテスト(Fixture dataset) {
+ try {
+ System.out.println(dataset.toString());
+ RestampTest.setUp();
+ dataset.setUp();
+ Restamp.main(dataset.args);
+ dataset.check();
+ dataset.checkUnchanged();
+ RestampTest.tearDown();
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ fail("Exceptionが発生した。");
+ }
}
- void checkUnchanged(HashMap map, Path dir) {
- assertThat(Files.isDirectory(dir), is(true));
- try {
- File[] files = dir.toFile().listFiles();
- assertThat(files.length, is(map.size()));
-
- for (String key : map.keySet()) {
- File sfile = map.get(key);
- Path ofile = Paths.get(dir.toString(), sfile.getName());
- assertNotNull(ofile);
-
- FileInputStream fis = new FileInputStream(ofile.toFile());
- String md5 = DigestUtils.md5Hex(fis);
- assertThat(key, is(md5));
- }
- }
- catch (Exception e) {
- fail();
- }
- }
-
- /**
- * フォルダ内のファイルとファイルのMD5リストを作成
- * @param dir
- * @return
- */
- HashMap getMd5(Path dir) {
- HashMap map = new HashMap<>();
- try {
- File[] files = dir.toFile().listFiles();
- for (File f : files) {
- FileInputStream fis = new FileInputStream(f);
- map.put(DigestUtils.md5Hex(fis), f);
- }
- }
- catch (Exception e) {
- fail();
- }
- return map;
- }
+ static void setUp() throws IOException {
+ tearDown();
+
+ // カメラディレクトリを作成する
+ UnZip.uncompress(new File("./target/test-classes/data/images.tar.gz"), new File("./target/test-classes/"));
+ // OUTディレクトリを作成する
+ File outDir = new File("target/test-classes/out");
+ outDir.mkdir();
+ }
+
+ static void tearDown() throws IOException {
+ // IMGディレクトリを削除する
+ File dir = new File("target/test-classes/images");
+ if (dir.exists()) {
+ UnZip.delete(dir);
+ }
+
+ // OUTディレクトリを削除する
+ File outDir = new File("target/test-classes/out");
+ if (outDir.exists()) {
+ UnZip.delete(outDir);
+ }
+ }
+
+
}
diff --git a/src/test/java/osm/surveyor/matchtime/UnZip.java b/src/test/java/osm/surveyor/matchtime/UnZip.java
new file mode 100644
index 0000000..37e9d47
--- /dev/null
+++ b/src/test/java/osm/surveyor/matchtime/UnZip.java
@@ -0,0 +1,139 @@
+package osm.surveyor.matchtime;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
+import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
+import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
+
+public class UnZip {
+
+ /**
+ * *.tar.gz解凍
+ * ファイル更新日時をオリジナルと同じにします。
+ * @param tazFile 解凍する*.tar.gzファイル
+ * @param dest 解凍先フォルダ
+ * @throws IOException
+ */
+ public static void uncompress(File tazFile, File dest) throws IOException {
+ dest.mkdir();
+
+ try (TarArchiveInputStream tarIn = new TarArchiveInputStream(new GzipCompressorInputStream(new BufferedInputStream(new FileInputStream(tazFile))))) {
+ TarArchiveEntry tarEntry = tarIn.getNextTarEntry();
+ while (tarEntry != null) {
+ File destPath = new File(dest, tarEntry.getName());
+ //System.out.println("uncompress: " + destPath.getCanonicalPath());
+ if (tarEntry.isDirectory()) {
+ destPath.mkdirs();
+ }
+ else {
+ File dir = new File(destPath.getParent());
+ if (!dir.exists()) {
+ dir.mkdirs();
+ }
+ destPath.createNewFile();
+ byte[] btoRead = new byte[1024];
+ try (BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(destPath))) {
+ int len;
+ while ((len = tarIn.read(btoRead)) != -1) {
+ bout.write(btoRead, 0, len);
+ }
+ }
+ destPath.setLastModified(tarEntry.getLastModifiedDate().getTime());
+ }
+ tarEntry = tarIn.getNextTarEntry();
+ }
+ }
+ }
+
+ /**
+ * Zipファイルを展開します
+ * @param aZipFile zipファイル
+ * @param aOutDir 出力先ディレクトリ
+ * @throws java.io.IOException
+ */
+ public static void decode(File aZipFile, String aOutDir) throws IOException {
+ FileInputStream fileIn = null;
+ FileOutputStream fileOut = null;
+ ZipInputStream zipIn = null;
+
+ try {
+ File outDir = new File(aOutDir);
+ outDir.mkdirs();
+
+ fileIn = new FileInputStream(aZipFile);
+ zipIn = new ZipInputStream(fileIn);
+
+ ZipEntry entry = null;
+ while ((entry = zipIn.getNextEntry()) != null) {
+ if (entry.isDirectory()) {
+ String relativePath = entry.getName();
+ outDir = new File(outDir, relativePath);
+ outDir.mkdirs();
+ }
+ else {
+ String relativePath = entry.getName();
+ File outFile = new File( outDir, relativePath );
+
+ File parentFile = outFile.getParentFile();
+ parentFile.mkdirs();
+
+ fileOut = new FileOutputStream( outFile );
+
+ byte[] buf = new byte[ 256 ];
+ int size = 0;
+ while ((size = zipIn.read(buf)) > 0){
+ fileOut.write(buf, 0, size);
+ }
+ fileOut.close();
+ fileOut = null;
+ }
+ zipIn.closeEntry();
+ }
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ finally {
+ if (fileIn != null) {
+ try {
+ fileIn.close();
+ }
+ catch (IOException e) {}
+ }
+ if (fileOut != null) {
+ try {
+ fileOut.close();
+ }
+ catch(IOException e) {}
+ }
+ zipIn.close();
+ }
+ }
+
+
+ public static void delete(File file) throws IOException {
+ if (!file.exists()) {
+ System.out.println("ERROR: ファイルまたはディレクトリが見つかりませんでした。");
+ throw new IOException("File not found.");
+ }
+
+ if (file.isDirectory()) {
+ File files[] = file.listFiles();
+ if (files != null) {
+ for (File file1 : files) {
+ delete(file1); // 再帰呼び出し
+ }
+ }
+ }
+ if (!file.delete()) {
+ System.out.println("ERROR: ファイルは削除できませんでした。 '" + file.getAbsolutePath() +"'");
+ }
+ }
+}
diff --git a/src/test/resources/data/images/00001.jpg b/src/test/resources/data/images/00001.jpg
deleted file mode 100644
index 250b249..0000000
--- a/src/test/resources/data/images/00001.jpg
+++ /dev/null
Binary files differ
diff --git a/src/test/resources/data/images/00002.jpg b/src/test/resources/data/images/00002.jpg
deleted file mode 100644
index 8938854..0000000
--- a/src/test/resources/data/images/00002.jpg
+++ /dev/null
Binary files differ
diff --git a/src/test/resources/data/images/00003.jpg b/src/test/resources/data/images/00003.jpg
deleted file mode 100644
index ee8642f..0000000
--- a/src/test/resources/data/images/00003.jpg
+++ /dev/null
Binary files differ
diff --git a/src/test/resources/data/images/00004.jpg b/src/test/resources/data/images/00004.jpg
deleted file mode 100755
index 4e457b9..0000000
--- a/src/test/resources/data/images/00004.jpg
+++ /dev/null
Binary files differ
diff --git a/src/test/resources/data/images/00005.jpg b/src/test/resources/data/images/00005.jpg
deleted file mode 100755
index 6cd9dfc..0000000
--- a/src/test/resources/data/images/00005.jpg
+++ /dev/null
Binary files differ
diff --git a/src/test/resources/data/images/IMG_0092.JPG b/src/test/resources/data/images/IMG_0092.JPG
deleted file mode 100755
index 6ec147f..0000000
--- a/src/test/resources/data/images/IMG_0092.JPG
+++ /dev/null
Binary files differ
diff --git a/src/test/resources/data/images/IMG_0093.JPG b/src/test/resources/data/images/IMG_0093.JPG
deleted file mode 100755
index 64699c6..0000000
--- a/src/test/resources/data/images/IMG_0093.JPG
+++ /dev/null
Binary files differ
diff --git a/src/test/resources/data/images/IMG_0097.JPG b/src/test/resources/data/images/IMG_0097.JPG
deleted file mode 100755
index 50795b1..0000000
--- a/src/test/resources/data/images/IMG_0097.JPG
+++ /dev/null
Binary files differ
diff --git a/src/test/resources/data/images/IMG_0291.JPG b/src/test/resources/data/images/IMG_0291.JPG
deleted file mode 100755
index baf8ac2..0000000
--- a/src/test/resources/data/images/IMG_0291.JPG
+++ /dev/null
Binary files differ
diff --git a/src/test/resources/props/ReStamp.nosource.properties b/src/test/resources/props/ReStamp.nosource.properties
deleted file mode 100644
index 26cf283..0000000
--- a/src/test/resources/props/ReStamp.nosource.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-#defuilt settings
-#Tue May 16 15:59:01 JST 2017