• R/O
  • HTTP
  • SSH
  • HTTPS

importpicture: Commit


Commit MetaInfo

Revisión0be9484d47741b1feea5202852ea73a09dd788aa (tree)
Tiempo2017-06-11 12:05:33
Autorhayashi <hayashi.yuu@gmai...>
Commiterhayashi

Log Message

test green: GerminGPX のログ形式に対応

Cambiar Resumen

Diferencia incremental

--- a/importPicture/AdjustTime.ini
+++ b/importPicture/AdjustTime.ini
@@ -1,5 +1,5 @@
11 #by AdjustTime
2-#Sun Jun 04 14:08:04 JST 2017
2+#Sun Jun 11 12:00:43 JST 2017
33 GPX.BASETIME=FILE_UPDATE
44 IMG.OUTPUT_EXIF=true
55 GPX.OUTPUT_WPT=false
--- a/importPicture/AdjustTime.ini.org
+++ b/importPicture/AdjustTime.ini.org
@@ -1,6 +1,6 @@
11 #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
44 IMG.OUTPUT_EXIF=true
55 GPX.OUTPUT_WPT=false
66 GPX.OUTPUT_SPEED=true
--- a/importPicture/src/osm/jp/gpx/ImportPicture.java
+++ b/importPicture/src/osm/jp/gpx/ImportPicture.java
@@ -41,6 +41,11 @@ import org.w3c.dom.*;
4141 import org.xml.sax.SAXException;
4242
4343 public class ImportPicture extends Thread {
44+ /**
45+ * 実行中に発生したExceptionを保持する場所
46+ */
47+ public Exception ex = null;
48+
4449 /**
4550 * ログ設定プロパティファイルのファイル内容
4651 */
@@ -107,6 +112,7 @@ public class ImportPicture extends Thread {
107112 Date jptime;
108113
109114 ImportPicture obj = new ImportPicture();
115+ obj.ex = null;
110116
111117 if (argv.length > 0) {
112118 obj.imgDir = new File(argv[0]);
@@ -268,8 +274,11 @@ public class ImportPicture extends Thread {
268274 System.out.println(" - param: "+ AppParameters.GPX_OUTPUT_SPEED +"="+ Complementation.param_GpxOutputSpeed);
269275 obj.start();
270276 try {
271- obj.join();
277+ obj.join();
272278 } catch(InterruptedException end) {}
279+ if (obj.ex != null) {
280+ throw obj.ex;
281+ }
273282 }
274283
275284 public File gpxDir;
@@ -320,6 +329,7 @@ public class ImportPicture extends Thread {
320329 }
321330 catch(ParserConfigurationException | DOMException | SAXException | IOException | ParseException | ImageReadException | ImageWriteException | IllegalArgumentException | TransformerException e) {
322331 e.printStackTrace();
332+ this.ex = new Exception(e);
323333 }
324334 }
325335
--- a/importPicture/test/osm/jp/gpx/ImportPictureTest.java
+++ b/importPicture/test/osm/jp/gpx/ImportPictureTest.java
@@ -18,6 +18,9 @@ import org.junit.Before;
1818 import org.junit.Test;
1919 import org.junit.runner.*;
2020 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;
2124
2225 import hayashi.tools.files.DeleteDir;
2326 import osm.jp.gpx.utils.TarGz;
@@ -259,7 +262,12 @@ public class ImportPictureTest {
259262 }
260263 }
261264
265+ @RunWith(Theories.class)
262266 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");
263271
264272 @Before
265273 public void setUp() throws Exception {
@@ -277,14 +285,6 @@ public class ImportPictureTest {
277285 // カメラディレクトリを作成する
278286 TarGz.uncompress(new File("testdata", "separate.tar.gz"), dir);
279287
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- }
288288
289289 // プロパティファイルを設定
290290 File iniFile = new File("AdjustTime.ini");
@@ -312,15 +312,29 @@ public class ImportPictureTest {
312312 params.store();
313313 }
314314
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+
317326 AppParameters params = new AppParameters();
318327 params.setProperty(AppParameters.GPX_BASETIME, "FILE_UPDATE");
319328 params.setProperty(AppParameters.IMG_OUTPUT_ALL, "false");
320329 params.store();
321330
322331 // 実行する
323- testdo();
332+ try {
333+ testdo();
334+ }
335+ catch (Exception e) {
336+ fail();
337+ }
324338
325339 boolean exists;
326340 File gpxfile = new File("./testdata/output/separate", "separate_.gpx");
@@ -345,15 +359,29 @@ public class ImportPictureTest {
345359 assertThat(exists, is(true));
346360 }
347361
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+
350373 AppParameters params = new AppParameters();
351374 params.setProperty(AppParameters.GPX_BASETIME, "EXIF_TIME");
352375 params.setProperty(AppParameters.IMG_OUTPUT_ALL, "false");
353376 params.store();
354377
355378 // 実行する
356- testdo();
379+ try {
380+ testdo();
381+ }
382+ catch (Exception e) {
383+ fail();
384+ }
357385
358386 File gpxfile = new File("./testdata/output/separate", "separate_.gpx");
359387 assertThat(gpxfile.exists(), is(true));
@@ -388,7 +416,7 @@ public class ImportPictureTest {
388416 }
389417 }
390418 }
391-
419+
392420 /**
393421 * *.tar.gz解凍
394422 * ファイル更新日時をオリジナルと同じにします。
Show on old repository browser