• R/O
  • HTTP
  • SSH
  • HTTPS

importpicture: Commit


Commit MetaInfo

Revisión74d6d8b51c0c7db79e4133a9551b699ccdc07c85 (tree)
Tiempo2017-05-20 20:08:44
Autorhayashi <hayashi.yuu@gmai...>
Commiterhayashi

Log Message

test clear

Cambiar Resumen

Diferencia incremental

--- a/importPicture/AdjustTime.ini
+++ b/importPicture/AdjustTime.ini
@@ -1,5 +1,5 @@
1-#defuilt settings
2-#Fri May 19 08:14:19 JST 2017
1+#by AdjustTime
2+#Sat May 20 20:05:59 JST 2017
33 GPX.BASETIME=FILE_UPDATE
44 IMG.OUTPUT_EXIF=true
55 GPX.OUTPUT_WPT=false
@@ -8,10 +8,10 @@ IMG.OUTPUT_ALL=false
88 GPX.noFirstNode=true
99 IMG.OUTPUT=true
1010 GPX.gpxSplit=true
11-GPX.REUSE=false
11+IMG.TIME=2017-05-18T09\:20\:30
1212 GPX.OVERWRITE_MAGVAR=false
13-IMG.TIME=2017-05-17T10\:02\:51
14-IMG.BASE_FILE=DSC05105.JPG
15-IMG.SOURCE_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/cameradata/10070517/10070517
16-GPX.SOURCE_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/cameradata/10070517/10070517/20170517.gpx
17-IMG.OUTPUT_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/cameradata/
13+GPX.REUSE=false
14+IMG.BASE_FILE=20170518_092031A.jpg
15+IMG.SOURCE_FOLDER=./testdata/cameradata
16+GPX.SOURCE_FOLDER=./testdata/cameradata/20170518.gpx
17+IMG.OUTPUT_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/output
--- a/importPicture/AdjustTime.ini.org
+++ b/importPicture/AdjustTime.ini.org
@@ -1,5 +1,5 @@
11 #by AdjustTime
2-#Sat May 20 17:54:15 JST 2017
2+#Sat May 20 20:05:52 JST 2017
33 GPX.BASETIME=FILE_UPDATE
44 IMG.OUTPUT_EXIF=true
55 GPX.OUTPUT_WPT=false
@@ -8,10 +8,10 @@ IMG.OUTPUT_ALL=true
88 GPX.noFirstNode=true
99 IMG.OUTPUT=true
1010 GPX.gpxSplit=true
11-GPX.REUSE=false
11+IMG.TIME=2017-05-18T09\:20\:30
1212 GPX.OVERWRITE_MAGVAR=false
13-IMG.TIME=2017-05-18T09\:16\:48
14-IMG.BASE_FILE=DSC05183.JPG
15-IMG.SOURCE_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/cameradata/10170518
16-GPX.SOURCE_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/cameradata/10170518/20170518.gpx
13+GPX.REUSE=false
14+IMG.BASE_FILE=20170518_092031A.jpg
15+IMG.SOURCE_FOLDER=./testdata/cameradata
16+GPX.SOURCE_FOLDER=./testdata/cameradata/20170518.gpx
1717 IMG.OUTPUT_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/output
--- a/importPicture/src/osm/jp/gpx/ImportPicture.java
+++ b/importPicture/src/osm/jp/gpx/ImportPicture.java
@@ -533,7 +533,9 @@ public class ImportPicture extends Thread {
533533 System.out.print(String.format("%20s|", dfjp.format(uktime)));
534534 if ((uktime.getTime() < gpxStartTime) || (uktime.getTime() > gpxEndTime)) {
535535 System.out.println(String.format("%20s ", "out of time."));
536- continue;
536+ if (!this.param_ImgOutputAll) {
537+ continue;
538+ }
537539 }
538540
539541 // 時刻uktimeにおける<magver>をtrkptに追加する
--- a/importPicture/test/osm/jp/gpx/ImportPictureTest.java
+++ b/importPicture/test/osm/jp/gpx/ImportPictureTest.java
@@ -73,20 +73,10 @@ public class ImportPictureTest {
7373 params.store();
7474
7575 // 実行する
76- try {
77- String[] argv = {
78- "./testdata/cameradata/10170518",
79- "DSC05183.JPG",
80- "2017-05-18T09:16:48",
81- "./testdata/output",
82- "./testdata/cameradata/10170518"
83- };
84- ImportPicture.main(argv);
85- }
86- catch (Exception e) {
87- fail("Exceptionが発生した。");
88- }
76+ testdo();
8977
78+ File gpxfile = new File("./testdata/output/10170518", "20170518_.gpx");
79+ assertThat(gpxfile.exists(), is(true));
9080 File file0 = new File("./testdata/output/10170518", "DSC05183.JPG");
9181 assertThat(file0.exists(), is(false));
9282 File file1 = new File("./testdata/output/10170518", "DSC05184.JPG");
@@ -107,6 +97,27 @@ public class ImportPictureTest {
10797 params.store();
10898
10999 // 実行する
100+ testdo();
101+
102+ File gpxfile = new File("./testdata/output/10170518", "20170518_.gpx");
103+ assertThat(gpxfile.exists(), is(true));
104+ File file0 = new File("./testdata/output/10170518", "DSC05183.JPG");
105+ assertThat(file0.exists(), is(true));
106+ File file1 = new File("./testdata/output/10170518", "DSC05184.JPG");
107+ assertThat(file1.exists(), is(true));
108+ File file2 = new File("./testdata/output/10170518", "DSC05196.JPG");
109+ assertThat(file2.exists(), is(true));
110+ File file3 = new File("./testdata/output/10170518", "DSC05204.JPG");
111+ assertThat(file3.exists(), is(true));
112+ File file4 = new File("./testdata/output/10170518", "DSC05205.JPG");
113+ assertThat(file4.exists(), is(true));
114+ }
115+
116+ /**
117+ * 実行する
118+ * @throws Exception
119+ */
120+ public void testdo() {
110121 try {
111122 String[] argv = {
112123 "./testdata/cameradata/10170518",
@@ -120,18 +131,124 @@ public class ImportPictureTest {
120131 catch (Exception e) {
121132 fail("Exceptionが発生した。");
122133 }
134+ }
135+ }
123136
124- File file0 = new File("./testdata/output/10170518", "DSC05183.JPG");
137+ public static class WiMiUSのカメラの場合 {
138+
139+ @Before
140+ public void setUp() throws Exception {
141+ // カメラディレクトリを削除する
142+ File dir = new File("testdata/cameradata");
143+ if (dir.exists()) {
144+ DeleteDir.delete(dir);
145+ }
146+ File outDir = new File("testdata/output");
147+ if (outDir.exists()) {
148+ DeleteDir.delete(outDir);
149+ }
150+ outDir.mkdir();
151+
152+ // カメラディレクトリを作成する
153+ TarGz.uncompress(new File("testdata", "WiMiUS20170518.tar.gz"), dir);
154+
155+ // GPXファイルをセット
156+ try ( FileInputStream inStream = new FileInputStream(new File("testdata", "20170518.gpx"));
157+ FileOutputStream outStream = new FileOutputStream(new File("testdata/cameradata/20170518.gpx"));
158+ FileChannel inChannel = inStream.getChannel();
159+ FileChannel outChannel = outStream.getChannel(); )
160+ {
161+ inChannel.transferTo(0, inChannel.size(), outChannel);
162+ }
163+
164+ // プロパティファイルを設定
165+ File iniFile = new File("AdjustTime.ini");
166+ File orgFile = new File("AdjustTime.ini.org");
167+ File testFile = new File("testdata", "AdjustTime.20170518.ini");
168+ if (orgFile.exists()) {
169+ orgFile.delete();
170+ }
171+ if (iniFile.exists()) {
172+ iniFile.renameTo(orgFile);
173+ }
174+ try ( FileInputStream inStream = new FileInputStream(testFile);
175+ FileOutputStream outStream = new FileOutputStream(new File("AdjustTime.ini"));
176+ FileChannel inChannel = inStream.getChannel();
177+ FileChannel outChannel = outStream.getChannel(); )
178+ {
179+ inChannel.transferTo(0, inChannel.size(),outChannel);
180+ }
181+
182+ AppParameters params = new AppParameters();
183+ params.setProperty(AppParameters.IMG_TIME, "2017-05-18T09:20:30");
184+ params.setProperty(AppParameters.IMG_BASE_FILE, "20170518_092031A.jpg");
185+ params.setProperty(AppParameters.IMG_SOURCE_FOLDER, "./testdata/cameradata");
186+ params.setProperty(AppParameters.GPX_SOURCE_FOLDER, "./testdata/cameradata/20170518.gpx");
187+ params.store();
188+ }
189+
190+ @Test
191+ public void FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時() throws Exception {
192+ AppParameters params = new AppParameters();
193+ params.setProperty(AppParameters.GPX_BASETIME, "FILE_UPDATE");
194+ params.setProperty(AppParameters.IMG_OUTPUT_ALL, "false");
195+ params.store();
196+
197+ // 実行する
198+ testdo();
199+
200+ File gpxfile = new File("./testdata/output/cameradata", "20170518_.gpx");
201+ assertThat(gpxfile.exists(), is(true));
202+ File file0 = new File("./testdata/output/cameradata", "20170518_092031A.jpg");
203+ assertThat(file0.exists(), is(false));
204+ File file1 = new File("./testdata/output/cameradata", "20170518_094226A_snap.jpg");
205+ assertThat(file1.exists(), is(true));
206+ File file3 = new File("./testdata/output/cameradata", "20170518_094737A.jpg");
207+ assertThat(file3.exists(), is(true));
208+ File file4 = new File("./testdata/output/cameradata", "20170518_094827A.jpg");
209+ assertThat(file4.exists(), is(false));
210+ }
211+
212+ @Test
213+ public void FILE_UPDATE時間を基準にして時間外のファイルもコピーする時() throws Exception {
214+ AppParameters params = new AppParameters();
215+ params.setProperty(AppParameters.GPX_BASETIME, "FILE_UPDATE");
216+ params.setProperty(AppParameters.IMG_OUTPUT_ALL, "true");
217+ params.store();
218+
219+ // 実行する
220+ testdo();
221+
222+ File gpxfile = new File("./testdata/output/cameradata", "20170518_.gpx");
223+ assertThat(gpxfile.exists(), is(true));
224+ File file0 = new File("./testdata/output/cameradata", "20170518_092031A.jpg");
125225 assertThat(file0.exists(), is(true));
126- File file1 = new File("./testdata/output/10170518", "DSC05184.JPG");
226+ File file1 = new File("./testdata/output/cameradata", "20170518_094226A_snap.jpg");
127227 assertThat(file1.exists(), is(true));
128- File file2 = new File("./testdata/output/10170518", "DSC05196.JPG");
129- assertThat(file2.exists(), is(true));
130- File file3 = new File("./testdata/output/10170518", "DSC05204.JPG");
228+ File file3 = new File("./testdata/output/cameradata", "20170518_094737A.jpg");
131229 assertThat(file3.exists(), is(true));
132- File file4 = new File("./testdata/output/10170518", "DSC05205.JPG");
230+ File file4 = new File("./testdata/output/cameradata", "20170518_094827A.jpg");
133231 assertThat(file4.exists(), is(true));
134232 }
233+
234+ /**
235+ * 実行する
236+ * @throws Exception
237+ */
238+ public void testdo() {
239+ try {
240+ String[] argv = {
241+ "./testdata/cameradata",
242+ "20170518_092031A.jpg",
243+ "2017-05-18T09:20:30",
244+ "./testdata/output",
245+ "./testdata/cameradata"
246+ };
247+ ImportPicture.main(argv);
248+ }
249+ catch (Exception e) {
250+ fail("Exceptionが発生した。");
251+ }
252+ }
135253 }
136-
137254 }
Show on old repository browser