Revisión | 0be9484d47741b1feea5202852ea73a09dd788aa (tree) |
---|---|
Tiempo | 2017-06-11 12:05:33 |
Autor | ![]() |
Commiter | hayashi |
test green: GerminGPX のログ形式に対応
@@ -1,5 +1,5 @@ | ||
1 | 1 | #by AdjustTime |
2 | -#Sun Jun 04 14:08:04 JST 2017 | |
2 | +#Sun Jun 11 12:00:43 JST 2017 | |
3 | 3 | GPX.BASETIME=FILE_UPDATE |
4 | 4 | IMG.OUTPUT_EXIF=true |
5 | 5 | GPX.OUTPUT_WPT=false |
@@ -1,6 +1,6 @@ | ||
1 | 1 | #by AdjustTime |
2 | -#Sun Jun 04 14:07:56 JST 2017 | |
3 | -GPX.BASETIME=EXIF_TIME | |
2 | +#Sun Jun 11 12:00:31 JST 2017 | |
3 | +GPX.BASETIME=FILE_UPDATE | |
4 | 4 | IMG.OUTPUT_EXIF=true |
5 | 5 | GPX.OUTPUT_WPT=false |
6 | 6 | GPX.OUTPUT_SPEED=true |
@@ -41,6 +41,11 @@ import org.w3c.dom.*; | ||
41 | 41 | import org.xml.sax.SAXException; |
42 | 42 | |
43 | 43 | public class ImportPicture extends Thread { |
44 | + /** | |
45 | + * 実行中に発生したExceptionを保持する場所 | |
46 | + */ | |
47 | + public Exception ex = null; | |
48 | + | |
44 | 49 | /** |
45 | 50 | * ログ設定プロパティファイルのファイル内容 |
46 | 51 | */ |
@@ -107,6 +112,7 @@ public class ImportPicture extends Thread { | ||
107 | 112 | Date jptime; |
108 | 113 | |
109 | 114 | ImportPicture obj = new ImportPicture(); |
115 | + obj.ex = null; | |
110 | 116 | |
111 | 117 | if (argv.length > 0) { |
112 | 118 | obj.imgDir = new File(argv[0]); |
@@ -268,8 +274,11 @@ public class ImportPicture extends Thread { | ||
268 | 274 | System.out.println(" - param: "+ AppParameters.GPX_OUTPUT_SPEED +"="+ Complementation.param_GpxOutputSpeed); |
269 | 275 | obj.start(); |
270 | 276 | try { |
271 | - obj.join(); | |
277 | + obj.join(); | |
272 | 278 | } catch(InterruptedException end) {} |
279 | + if (obj.ex != null) { | |
280 | + throw obj.ex; | |
281 | + } | |
273 | 282 | } |
274 | 283 | |
275 | 284 | public File gpxDir; |
@@ -320,6 +329,7 @@ public class ImportPicture extends Thread { | ||
320 | 329 | } |
321 | 330 | catch(ParserConfigurationException | DOMException | SAXException | IOException | ParseException | ImageReadException | ImageWriteException | IllegalArgumentException | TransformerException e) { |
322 | 331 | e.printStackTrace(); |
332 | + this.ex = new Exception(e); | |
323 | 333 | } |
324 | 334 | } |
325 | 335 |
@@ -18,6 +18,9 @@ import org.junit.Before; | ||
18 | 18 | import org.junit.Test; |
19 | 19 | import org.junit.runner.*; |
20 | 20 | import org.junit.experimental.runners.Enclosed; |
21 | +import org.junit.experimental.theories.DataPoint; | |
22 | +import org.junit.experimental.theories.Theories; | |
23 | +import org.junit.experimental.theories.Theory; | |
21 | 24 | |
22 | 25 | import hayashi.tools.files.DeleteDir; |
23 | 26 | import osm.jp.gpx.utils.TarGz; |
@@ -259,7 +262,12 @@ public class ImportPictureTest { | ||
259 | 262 | } |
260 | 263 | } |
261 | 264 | |
265 | + @RunWith(Theories.class) | |
262 | 266 | public static class GPXが複数のTRKSEGに分割している場合 { |
267 | + @DataPoint | |
268 | + public static String GPX_MUILTI_TRK = new String("muiltiTRK.GarminColorado.gpx.xml"); | |
269 | + @DataPoint | |
270 | + public static String GPX_Muilti_TRKSEG = new String("multiTRKSEG.eTrex_20J.gpx.xml"); | |
263 | 271 | |
264 | 272 | @Before |
265 | 273 | public void setUp() throws Exception { |
@@ -277,14 +285,6 @@ public class ImportPictureTest { | ||
277 | 285 | // カメラディレクトリを作成する |
278 | 286 | TarGz.uncompress(new File("testdata", "separate.tar.gz"), dir); |
279 | 287 | |
280 | - // GPXファイルをセット | |
281 | - try ( FileInputStream inStream = new FileInputStream(new File("testdata", "separate.gpx")); | |
282 | - FileOutputStream outStream = new FileOutputStream(new File("testdata/cameradata/separate.gpx")); | |
283 | - FileChannel inChannel = inStream.getChannel(); | |
284 | - FileChannel outChannel = outStream.getChannel(); ) | |
285 | - { | |
286 | - inChannel.transferTo(0, inChannel.size(), outChannel); | |
287 | - } | |
288 | 288 | |
289 | 289 | // プロパティファイルを設定 |
290 | 290 | File iniFile = new File("AdjustTime.ini"); |
@@ -312,15 +312,29 @@ public class ImportPictureTest { | ||
312 | 312 | params.store(); |
313 | 313 | } |
314 | 314 | |
315 | - @Test | |
316 | - public void FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時() throws Exception { | |
315 | + @Theory | |
316 | + public void FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時(String gpxFileName) throws Exception { | |
317 | + // GPXファイルをセット | |
318 | + try ( FileInputStream inStream = new FileInputStream(new File("testdata", gpxFileName)); | |
319 | + FileOutputStream outStream = new FileOutputStream(new File("testdata/cameradata/separate.gpx")); | |
320 | + FileChannel inChannel = inStream.getChannel(); | |
321 | + FileChannel outChannel = outStream.getChannel(); ) | |
322 | + { | |
323 | + inChannel.transferTo(0, inChannel.size(), outChannel); | |
324 | + } | |
325 | + | |
317 | 326 | AppParameters params = new AppParameters(); |
318 | 327 | params.setProperty(AppParameters.GPX_BASETIME, "FILE_UPDATE"); |
319 | 328 | params.setProperty(AppParameters.IMG_OUTPUT_ALL, "false"); |
320 | 329 | params.store(); |
321 | 330 | |
322 | 331 | // 実行する |
323 | - testdo(); | |
332 | + try { | |
333 | + testdo(); | |
334 | + } | |
335 | + catch (Exception e) { | |
336 | + fail(); | |
337 | + } | |
324 | 338 | |
325 | 339 | boolean exists; |
326 | 340 | File gpxfile = new File("./testdata/output/separate", "separate_.gpx"); |
@@ -345,15 +359,29 @@ public class ImportPictureTest { | ||
345 | 359 | assertThat(exists, is(true)); |
346 | 360 | } |
347 | 361 | |
348 | - @Test | |
349 | - public void EXIF時間を基準にして時間外のファイルはコピー対象外の時() throws Exception { | |
362 | + @Theory | |
363 | + public void EXIF時間を基準にして時間外のファイルはコピー対象外の時(String gpxFileName) throws Exception { | |
364 | + // GPXファイルをセット | |
365 | + try ( FileInputStream inStream = new FileInputStream(new File("testdata", gpxFileName)); | |
366 | + FileOutputStream outStream = new FileOutputStream(new File("testdata/cameradata/separate.gpx")); | |
367 | + FileChannel inChannel = inStream.getChannel(); | |
368 | + FileChannel outChannel = outStream.getChannel(); ) | |
369 | + { | |
370 | + inChannel.transferTo(0, inChannel.size(), outChannel); | |
371 | + } | |
372 | + | |
350 | 373 | AppParameters params = new AppParameters(); |
351 | 374 | params.setProperty(AppParameters.GPX_BASETIME, "EXIF_TIME"); |
352 | 375 | params.setProperty(AppParameters.IMG_OUTPUT_ALL, "false"); |
353 | 376 | params.store(); |
354 | 377 | |
355 | 378 | // 実行する |
356 | - testdo(); | |
379 | + try { | |
380 | + testdo(); | |
381 | + } | |
382 | + catch (Exception e) { | |
383 | + fail(); | |
384 | + } | |
357 | 385 | |
358 | 386 | File gpxfile = new File("./testdata/output/separate", "separate_.gpx"); |
359 | 387 | assertThat(gpxfile.exists(), is(true)); |
@@ -388,7 +416,7 @@ public class ImportPictureTest { | ||
388 | 416 | } |
389 | 417 | } |
390 | 418 | } |
391 | - | |
419 | + | |
392 | 420 | /** |
393 | 421 | * *.tar.gz解凍 |
394 | 422 | * ファイル更新日時をオリジナルと同じにします。 |