import org.xml.sax.SAXException;\r
\r
public class ImportPicture extends Thread {\r
+ /**\r
+ * 実行中に発生したExceptionを保持する場所\r
+ */\r
+ public Exception ex = null;\r
+ \r
/**\r
* ログ設定プロパティファイルのファイル内容\r
*/\r
Date jptime;\r
\r
ImportPicture obj = new ImportPicture();\r
+ obj.ex = null;\r
\r
if (argv.length > 0) {\r
obj.imgDir = new File(argv[0]);\r
System.out.println(" - param: "+ AppParameters.GPX_OUTPUT_SPEED +"="+ Complementation.param_GpxOutputSpeed);\r
obj.start();\r
try {\r
- obj.join(); \r
+ obj.join();\r
} catch(InterruptedException end) {}\r
+ if (obj.ex != null) {\r
+ throw obj.ex;\r
+ }\r
}\r
\r
public File gpxDir;\r
}\r
catch(ParserConfigurationException | DOMException | SAXException | IOException | ParseException | ImageReadException | ImageWriteException | IllegalArgumentException | TransformerException e) {\r
e.printStackTrace();\r
+ this.ex = new Exception(e);\r
}\r
}\r
\r
import org.junit.Test;
import org.junit.runner.*;
import org.junit.experimental.runners.Enclosed;
+import org.junit.experimental.theories.DataPoint;
+import org.junit.experimental.theories.Theories;
+import org.junit.experimental.theories.Theory;
import hayashi.tools.files.DeleteDir;
import osm.jp.gpx.utils.TarGz;
}
}
+ @RunWith(Theories.class)
public static class GPXが複数のTRKSEGに分割している場合 {
+ @DataPoint
+ public static String GPX_MUILTI_TRK = new String("muiltiTRK.GarminColorado.gpx.xml");
+ @DataPoint
+ public static String GPX_Muilti_TRKSEG = new String("multiTRKSEG.eTrex_20J.gpx.xml");
@Before
public void setUp() throws Exception {
// カメラディレクトリを作成する
TarGz.uncompress(new File("testdata", "separate.tar.gz"), dir);
- // GPXファイルをセット
- try ( FileInputStream inStream = new FileInputStream(new File("testdata", "separate.gpx"));
- FileOutputStream outStream = new FileOutputStream(new File("testdata/cameradata/separate.gpx"));
- FileChannel inChannel = inStream.getChannel();
- FileChannel outChannel = outStream.getChannel(); )
- {
- inChannel.transferTo(0, inChannel.size(), outChannel);
- }
// プロパティファイルを設定
File iniFile = new File("AdjustTime.ini");
params.store();
}
- @Test
- public void FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時() throws Exception {
+ @Theory
+ public void FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時(String gpxFileName) throws Exception {
+ // GPXファイルをセット
+ try ( FileInputStream inStream = new FileInputStream(new File("testdata", gpxFileName));
+ FileOutputStream outStream = new FileOutputStream(new File("testdata/cameradata/separate.gpx"));
+ FileChannel inChannel = inStream.getChannel();
+ FileChannel outChannel = outStream.getChannel(); )
+ {
+ inChannel.transferTo(0, inChannel.size(), outChannel);
+ }
+
AppParameters params = new AppParameters();
params.setProperty(AppParameters.GPX_BASETIME, "FILE_UPDATE");
params.setProperty(AppParameters.IMG_OUTPUT_ALL, "false");
params.store();
// 実行する
- testdo();
+ try {
+ testdo();
+ }
+ catch (Exception e) {
+ fail();
+ }
boolean exists;
File gpxfile = new File("./testdata/output/separate", "separate_.gpx");
assertThat(exists, is(true));
}
- @Test
- public void EXIF時間を基準にして時間外のファイルはコピー対象外の時() throws Exception {
+ @Theory
+ public void EXIF時間を基準にして時間外のファイルはコピー対象外の時(String gpxFileName) throws Exception {
+ // GPXファイルをセット
+ try ( FileInputStream inStream = new FileInputStream(new File("testdata", gpxFileName));
+ FileOutputStream outStream = new FileOutputStream(new File("testdata/cameradata/separate.gpx"));
+ FileChannel inChannel = inStream.getChannel();
+ FileChannel outChannel = outStream.getChannel(); )
+ {
+ inChannel.transferTo(0, inChannel.size(), outChannel);
+ }
+
AppParameters params = new AppParameters();
params.setProperty(AppParameters.GPX_BASETIME, "EXIF_TIME");
params.setProperty(AppParameters.IMG_OUTPUT_ALL, "false");
params.store();
// 実行する
- testdo();
+ try {
+ testdo();
+ }
+ catch (Exception e) {
+ fail();
+ }
File gpxfile = new File("./testdata/output/separate", "separate_.gpx");
assertThat(gpxfile.exists(), is(true));
}
}
}
-
+
/**
* *.tar.gz解凍
* ファイル更新日時をオリジナルと同じにします。