OSDN Git Service

test clear develop release_2017-05-20
authorhayashi <hayashi.yuu@gmail.com>
Sat, 20 May 2017 11:08:44 +0000 (20:08 +0900)
committerhayashi <hayashi.yuu@gmail.com>
Sat, 20 May 2017 11:08:44 +0000 (20:08 +0900)
importPicture/AdjustTime.ini
importPicture/AdjustTime.ini.org
importPicture/src/osm/jp/gpx/ImportPicture.java
importPicture/test/osm/jp/gpx/ImportPictureTest.java

index aa065f2..ad911f6 100644 (file)
@@ -1,5 +1,5 @@
-#defuilt settings
-#Fri May 19 08:14:19 JST 2017
+#by AdjustTime
+#Sat May 20 20:05:59 JST 2017
 GPX.BASETIME=FILE_UPDATE
 IMG.OUTPUT_EXIF=true
 GPX.OUTPUT_WPT=false
@@ -8,10 +8,10 @@ IMG.OUTPUT_ALL=false
 GPX.noFirstNode=true
 IMG.OUTPUT=true
 GPX.gpxSplit=true
-GPX.REUSE=false
+IMG.TIME=2017-05-18T09\:20\:30
 GPX.OVERWRITE_MAGVAR=false
-IMG.TIME=2017-05-17T10\:02\:51
-IMG.BASE_FILE=DSC05105.JPG
-IMG.SOURCE_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/cameradata/10070517/10070517
-GPX.SOURCE_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/cameradata/10070517/10070517/20170517.gpx
-IMG.OUTPUT_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/cameradata/
+GPX.REUSE=false
+IMG.BASE_FILE=20170518_092031A.jpg
+IMG.SOURCE_FOLDER=./testdata/cameradata
+GPX.SOURCE_FOLDER=./testdata/cameradata/20170518.gpx
+IMG.OUTPUT_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/output
index 67c1cc9..0ca8258 100644 (file)
@@ -1,5 +1,5 @@
 #by AdjustTime
-#Sat May 20 17:54:15 JST 2017
+#Sat May 20 20:05:52 JST 2017
 GPX.BASETIME=FILE_UPDATE
 IMG.OUTPUT_EXIF=true
 GPX.OUTPUT_WPT=false
@@ -8,10 +8,10 @@ IMG.OUTPUT_ALL=true
 GPX.noFirstNode=true
 IMG.OUTPUT=true
 GPX.gpxSplit=true
-GPX.REUSE=false
+IMG.TIME=2017-05-18T09\:20\:30
 GPX.OVERWRITE_MAGVAR=false
-IMG.TIME=2017-05-18T09\:16\:48
-IMG.BASE_FILE=DSC05183.JPG
-IMG.SOURCE_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/cameradata/10170518
-GPX.SOURCE_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/cameradata/10170518/20170518.gpx
+GPX.REUSE=false
+IMG.BASE_FILE=20170518_092031A.jpg
+IMG.SOURCE_FOLDER=./testdata/cameradata
+GPX.SOURCE_FOLDER=./testdata/cameradata/20170518.gpx
 IMG.OUTPUT_FOLDER=/home/yuu/workspace/AdjustTime/importPicture/testdata/output
index 2b85272..5fe635e 100644 (file)
@@ -533,7 +533,9 @@ public class ImportPicture extends Thread {
             System.out.print(String.format("%20s|", dfjp.format(uktime)));\r
             if ((uktime.getTime() < gpxStartTime) || (uktime.getTime() > gpxEndTime)) {\r
                 System.out.println(String.format("%20s ", "out of time."));\r
-               continue;\r
+                if (!this.param_ImgOutputAll) {\r
+                       continue;\r
+                }\r
             }\r
 \r
                // 時刻uktimeにおける<magver>をtrkptに追加する\r
index 3ee1024..5eb6292 100644 (file)
@@ -73,20 +73,10 @@ public class ImportPictureTest {
                        params.store();
                
                // 実行する
-               try {
-                       String[] argv = {
-                                       "./testdata/cameradata/10170518",
-                                       "DSC05183.JPG",
-                                       "2017-05-18T09:16:48",
-                                       "./testdata/output",
-                                       "./testdata/cameradata/10170518"
-                       };
-                       ImportPicture.main(argv);
-                       }
-                       catch (Exception e) {
-                               fail("Exceptionが発生した。");
-                       }
+                       testdo();
 
+               File gpxfile = new File("./testdata/output/10170518", "20170518_.gpx");
+               assertThat(gpxfile.exists(), is(true));
                File file0 = new File("./testdata/output/10170518", "DSC05183.JPG");
                assertThat(file0.exists(), is(false));
                File file1 = new File("./testdata/output/10170518", "DSC05184.JPG");
@@ -107,6 +97,27 @@ public class ImportPictureTest {
                        params.store();
                
                // 実行する
+                       testdo();
+
+               File gpxfile = new File("./testdata/output/10170518", "20170518_.gpx");
+               assertThat(gpxfile.exists(), is(true));
+               File file0 = new File("./testdata/output/10170518", "DSC05183.JPG");
+               assertThat(file0.exists(), is(true));
+               File file1 = new File("./testdata/output/10170518", "DSC05184.JPG");
+               assertThat(file1.exists(), is(true));
+               File file2 = new File("./testdata/output/10170518", "DSC05196.JPG");
+               assertThat(file2.exists(), is(true));
+               File file3 = new File("./testdata/output/10170518", "DSC05204.JPG");
+               assertThat(file3.exists(), is(true));
+               File file4 = new File("./testdata/output/10170518", "DSC05205.JPG");
+               assertThat(file4.exists(), is(true));
+               }
+               
+               /**
+                * 実行する
+                * @throws Exception
+                */
+               public void testdo() {
                try {
                        String[] argv = {
                                        "./testdata/cameradata/10170518",
@@ -120,18 +131,124 @@ public class ImportPictureTest {
                        catch (Exception e) {
                                fail("Exceptionが発生した。");
                        }
+               }
+       }
 
-               File file0 = new File("./testdata/output/10170518", "DSC05183.JPG");
+       public static class WiMiUSのカメラの場合 {
+               
+               @Before
+               public void setUp() throws Exception {
+                       // カメラディレクトリを削除する
+                       File dir = new File("testdata/cameradata");
+                       if (dir.exists()) {
+                               DeleteDir.delete(dir);
+                       }
+                       File outDir = new File("testdata/output");
+                       if (outDir.exists()) {
+                               DeleteDir.delete(outDir);
+                       }
+                       outDir.mkdir();
+                       
+                       // カメラディレクトリを作成する
+                       TarGz.uncompress(new File("testdata", "WiMiUS20170518.tar.gz"), dir);
+                       
+                       // GPXファイルをセット
+               try (   FileInputStream inStream = new FileInputStream(new File("testdata", "20170518.gpx"));
+                               FileOutputStream outStream = new FileOutputStream(new File("testdata/cameradata/20170518.gpx"));
+                       FileChannel inChannel = inStream.getChannel();
+                       FileChannel outChannel = outStream.getChannel();        )
+               {
+                   inChannel.transferTo(0, inChannel.size(), outChannel);
+               }
+               
+               // プロパティファイルを設定
+                       File iniFile = new File("AdjustTime.ini");
+                       File orgFile = new File("AdjustTime.ini.org");
+                       File testFile = new File("testdata", "AdjustTime.20170518.ini");
+                       if (orgFile.exists()) {
+                               orgFile.delete();
+                       }
+                       if (iniFile.exists()) {
+                               iniFile.renameTo(orgFile);
+                       }
+               try (   FileInputStream inStream = new FileInputStream(testFile);
+                               FileOutputStream outStream = new FileOutputStream(new File("AdjustTime.ini"));
+                               FileChannel inChannel = inStream.getChannel();
+                               FileChannel outChannel = outStream.getChannel();        )
+               {
+                   inChannel.transferTo(0, inChannel.size(),outChannel);
+               }
+
+                       AppParameters params = new AppParameters();
+                       params.setProperty(AppParameters.IMG_TIME, "2017-05-18T09:20:30");
+                       params.setProperty(AppParameters.IMG_BASE_FILE, "20170518_092031A.jpg");
+                       params.setProperty(AppParameters.IMG_SOURCE_FOLDER, "./testdata/cameradata");
+                       params.setProperty(AppParameters.GPX_SOURCE_FOLDER, "./testdata/cameradata/20170518.gpx");
+                       params.store();
+               }
+
+               @Test
+               public void FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時() throws Exception {
+                       AppParameters params = new AppParameters();
+                       params.setProperty(AppParameters.GPX_BASETIME, "FILE_UPDATE");
+                       params.setProperty(AppParameters.IMG_OUTPUT_ALL, "false");
+                       params.store();
+               
+               // 実行する
+                       testdo();
+
+               File gpxfile = new File("./testdata/output/cameradata", "20170518_.gpx");
+               assertThat(gpxfile.exists(), is(true));
+               File file0 = new File("./testdata/output/cameradata", "20170518_092031A.jpg");
+               assertThat(file0.exists(), is(false));
+               File file1 = new File("./testdata/output/cameradata", "20170518_094226A_snap.jpg");
+               assertThat(file1.exists(), is(true));
+               File file3 = new File("./testdata/output/cameradata", "20170518_094737A.jpg");
+               assertThat(file3.exists(), is(true));
+               File file4 = new File("./testdata/output/cameradata", "20170518_094827A.jpg");
+               assertThat(file4.exists(), is(false));
+               }
+               
+               @Test
+               public void FILE_UPDATE時間を基準にして時間外のファイルもコピーする時() throws Exception {
+                       AppParameters params = new AppParameters();
+                       params.setProperty(AppParameters.GPX_BASETIME, "FILE_UPDATE");
+                       params.setProperty(AppParameters.IMG_OUTPUT_ALL, "true");
+                       params.store();
+               
+               // 実行する
+                       testdo();
+
+               File gpxfile = new File("./testdata/output/cameradata", "20170518_.gpx");
+               assertThat(gpxfile.exists(), is(true));
+               File file0 = new File("./testdata/output/cameradata", "20170518_092031A.jpg");
                assertThat(file0.exists(), is(true));
-               File file1 = new File("./testdata/output/10170518", "DSC05184.JPG");
+               File file1 = new File("./testdata/output/cameradata", "20170518_094226A_snap.jpg");
                assertThat(file1.exists(), is(true));
-               File file2 = new File("./testdata/output/10170518", "DSC05196.JPG");
-               assertThat(file2.exists(), is(true));
-               File file3 = new File("./testdata/output/10170518", "DSC05204.JPG");
+               File file3 = new File("./testdata/output/cameradata", "20170518_094737A.jpg");
                assertThat(file3.exists(), is(true));
-               File file4 = new File("./testdata/output/10170518", "DSC05205.JPG");
+               File file4 = new File("./testdata/output/cameradata", "20170518_094827A.jpg");
                assertThat(file4.exists(), is(true));
                }
+               
+               /**
+                * 実行する
+                * @throws Exception
+                */
+               public void testdo() {
+               try {
+                       String[] argv = {
+                                       "./testdata/cameradata",
+                                       "20170518_092031A.jpg",
+                                       "2017-05-18T09:20:30",
+                                       "./testdata/output",
+                                       "./testdata/cameradata"
+                       };
+                       ImportPicture.main(argv);
+                       }
+                       catch (Exception e) {
+                               fail("Exceptionが発生した。");
+                       }
+               }
        }
-
 }