diff --git a/src/coverage_PoliceUp.sh b/src/coverage_PoliceUp.sh index 9219cb4..70d0b42 100644 --- a/src/coverage_PoliceUp.sh +++ b/src/coverage_PoliceUp.sh @@ -4,6 +4,7 @@ pwd ls -l rm -rf tilePolice?.tgz +rm -rf tilePolice?z.tgz curl --user yuu:yuu8844 -O http://192.168.0.26:8080/job/osmCoverage_PoliceTile/lastSuccessfulBuild/artifact/tilePoslice2.tgz ls -l diff --git a/test/osm/jp/coverage/busstop/AllTest.java b/test/osm/jp/coverage/busstop/AllTest.java index e5a616e..70a3b8e 100644 --- a/test/osm/jp/coverage/busstop/AllTest.java +++ b/test/osm/jp/coverage/busstop/AllTest.java @@ -9,9 +9,9 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ - osm.jp.coverage.busstop.DbExistBusstopTest.class, - osm.jp.coverage.busstop.DbBusstopTest.class, - osm.jp.coverage.busstop.BusstopTest.class, + DbExistBusstopTest.class, + DbBusstopTest.class, + BusstopTest.class, ToPostgisTest.class, CoverageTest.class }) diff --git a/test/osm/jp/coverage/busstop/BusstopTest.java b/test/osm/jp/coverage/busstop/BusstopTest.java index 9357cbe..cb8b05f 100644 --- a/test/osm/jp/coverage/busstop/BusstopTest.java +++ b/test/osm/jp/coverage/busstop/BusstopTest.java @@ -33,13 +33,13 @@ } @Test - public void test00_Fuel_main() { + public void test00Busstop_main() { String[] args = new String[0]; Busstop.main(args); } @Test - public void test01_dataread() { + public void test01Busstop_dataread() { Connection hsqldb = null; try { hsqldb = DatabaseTool.openDb("database"); @@ -68,90 +68,7 @@ } @Test - public void test03_dataread() { - Connection hsqldb = null; - try { - hsqldb = DatabaseTool.openDb("database"); - String sqlStr1 = "SELECT idref,lat,lon,score,name FROM "+ HttpPOST.TABLE_NAME; - String sqlStr2 = "SELECT gmlid,lat,lon,fixed,fixed1,area,name FROM "+ DbBusstop.TABLE_NAME +" WHERE (lat > ?) and (lat < ?) and (lon > ?) and (lon < ?)"; - String sqlStr3 = "UPDATE "+ DbBusstop.TABLE_NAME +" SET fixed1=? WHERE gmlid=? and area=?"; - System.out.println(sqlStr1); - try ( PreparedStatement ps2 = hsqldb.prepareStatement(sqlStr2); - PreparedStatement ps1 = hsqldb.prepareStatement(sqlStr1); - PreparedStatement ps3 = hsqldb.prepareStatement(sqlStr3);) - { - try (ResultSet rset1 = ps1.executeQuery()) { - while (rset1.next()) { - double lat = rset1.getDouble("lat"); - double lon = rset1.getDouble("lon"); - int score = rset1.getInt("score"); - String name = rset1.getString("name"); - if ((name != null) && !name.trim().isEmpty()) { - score = 50; - } - String gmlid = null; - int area = 0; - int fixed1 = 0; - - // 指定の緯度経度を中心とする半径200x2m四方の矩形領域 - RectArea rect = new RectArea(lat, lon, NEER*2); // 600m 四方 - System.out.println(sqlStr2 +"["+ rect.minlat +", "+ rect.maxlat +", "+ rect.minlon +", "+ rect.maxlon +"]"); - ps2.setDouble(1, rect.minlat); - ps2.setDouble(2, rect.maxlat); - ps2.setDouble(3, rect.minlon); - ps2.setDouble(4, rect.maxlon); - try (ResultSet rset2 = ps2.executeQuery()) { - while (rset2.next()) { - System.out.print("{"); - gmlid = rset2.getString("gmlid"); - System.out.print("gmlid:"+gmlid +", "); - area = rset2.getInt("area"); - System.out.print("area:"+area +", "); - fixed1 = rset2.getInt("fixed1"); - fixed1 += score; - System.out.print("fixed1:"+fixed1 +", "); - String ksjName = rset2.getString("name"); - System.out.print("ksjName:"+ksjName +", "); - double lat2 = rset2.getDouble("lat"); - System.out.print("lat2:"+lat2 +", "); - double lon2 = rset2.getDouble("lon"); - System.out.print("lon2:"+lon2 +", "); - - double dd = Japan.distanceKm(lat,lon,lat2,lon2); - System.out.print("dd:"+dd +" "); - System.out.println("}"); - - - System.out.println("distance() -> "+ dd +"(km)"); - if ( ((dd * 1000.0D) < NEER) - || (((dd * 1000.0D) < NEER*2) && (name != null) && (name.equals(ksjName)))) - { - System.out.println(sqlStr3 +" ["+ fixed1 +", "+ gmlid +", "+ area +"]"); - ps3.setInt(1, fixed1); - ps3.setString(2, gmlid); - ps3.setInt(3, area); - //ps3.executeUpdate(); - } - } - } - } - - } - } - - } catch (ClassNotFoundException ex) { - Logger.getLogger(BusstopTest.class.getName()).log(Level.SEVERE, null, ex); - } catch (SQLException ex) { - Logger.getLogger(BusstopTest.class.getName()).log(Level.SEVERE, null, ex); - } catch (IOException ex) { - Logger.getLogger(BusstopTest.class.getName()).log(Level.SEVERE, null, ex); - } finally { - DatabaseTool.closeDb(hsqldb); - } - } - - @Test - public void test02_busstop() { + public void test02Busstop_busstop() { try { String[] args = new String[0]; Busstop.main(args); @@ -257,4 +174,87 @@ } } + @Test + public void test03Busstop_dataread() { + Connection hsqldb = null; + try { + hsqldb = DatabaseTool.openDb("database"); + String sqlStr1 = "SELECT idref,lat,lon,score,name FROM "+ HttpPOST.TABLE_NAME; + String sqlStr2 = "SELECT gmlid,lat,lon,fixed,fixed1,area,name FROM "+ DbBusstop.TABLE_NAME +" WHERE (lat > ?) and (lat < ?) and (lon > ?) and (lon < ?)"; + String sqlStr3 = "UPDATE "+ DbBusstop.TABLE_NAME +" SET fixed1=? WHERE gmlid=? and area=?"; + System.out.println(sqlStr1); + try ( PreparedStatement ps2 = hsqldb.prepareStatement(sqlStr2); + PreparedStatement ps1 = hsqldb.prepareStatement(sqlStr1); + PreparedStatement ps3 = hsqldb.prepareStatement(sqlStr3);) + { + try (ResultSet rset1 = ps1.executeQuery()) { + while (rset1.next()) { + double lat = rset1.getDouble("lat"); + double lon = rset1.getDouble("lon"); + int score = rset1.getInt("score"); + String name = rset1.getString("name"); + if ((name != null) && !name.trim().isEmpty()) { + score = 50; + } + String gmlid = null; + int area = 0; + int fixed1 = 0; + + // 指定の緯度経度を中心とする半径200x2m四方の矩形領域 + RectArea rect = new RectArea(lat, lon, NEER*2); // 600m 四方 + System.out.println(sqlStr2 +"["+ rect.minlat +", "+ rect.maxlat +", "+ rect.minlon +", "+ rect.maxlon +"]"); + ps2.setDouble(1, rect.minlat); + ps2.setDouble(2, rect.maxlat); + ps2.setDouble(3, rect.minlon); + ps2.setDouble(4, rect.maxlon); + try (ResultSet rset2 = ps2.executeQuery()) { + while (rset2.next()) { + System.out.print("{"); + gmlid = rset2.getString("gmlid"); + System.out.print("gmlid:"+gmlid +", "); + area = rset2.getInt("area"); + System.out.print("area:"+area +", "); + fixed1 = rset2.getInt("fixed1"); + fixed1 += score; + System.out.print("fixed1:"+fixed1 +", "); + String ksjName = rset2.getString("name"); + System.out.print("ksjName:"+ksjName +", "); + double lat2 = rset2.getDouble("lat"); + System.out.print("lat2:"+lat2 +", "); + double lon2 = rset2.getDouble("lon"); + System.out.print("lon2:"+lon2 +", "); + + double dd = Japan.distanceKm(lat,lon,lat2,lon2); + System.out.print("dd:"+dd +" "); + System.out.println("}"); + + + System.out.println("distance() -> "+ dd +"(km)"); + if ( ((dd * 1000.0D) < NEER) + || (((dd * 1000.0D) < NEER*2) && (name != null) && (name.equals(ksjName)))) + { + System.out.println(sqlStr3 +" ["+ fixed1 +", "+ gmlid +", "+ area +"]"); + ps3.setInt(1, fixed1); + ps3.setString(2, gmlid); + ps3.setInt(3, area); + //ps3.executeUpdate(); + } + } + } + } + + } + } + + } catch (ClassNotFoundException ex) { + Logger.getLogger(BusstopTest.class.getName()).log(Level.SEVERE, null, ex); + } catch (SQLException ex) { + Logger.getLogger(BusstopTest.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(BusstopTest.class.getName()).log(Level.SEVERE, null, ex); + } finally { + DatabaseTool.closeDb(hsqldb); + } + } + } diff --git a/test/osm/jp/coverage/busstop/CoverageTest.java b/test/osm/jp/coverage/busstop/CoverageTest.java index 69b431a..4352c00 100644 --- a/test/osm/jp/coverage/busstop/CoverageTest.java +++ b/test/osm/jp/coverage/busstop/CoverageTest.java @@ -11,14 +11,15 @@ public class CoverageTest { @Test - public void testMain() { + public void testBusstopCoverage_main() { + System.out.println("testBusstopCoverage_main"); try { - System.out.println("main"); String[] args = new String[]{"outputfile.csv"}; Coverage.main(args); } catch (IOException | ClassNotFoundException | SQLException | ParserConfigurationException | TransformerException | SAXException e) { - fail("The test case is a prototype."); + e.printStackTrace(); + fail(); } } diff --git a/test/osm/jp/coverage/busstop/DbBusstopTest.java b/test/osm/jp/coverage/busstop/DbBusstopTest.java index 4b4b521..22b6f17 100644 --- a/test/osm/jp/coverage/busstop/DbBusstopTest.java +++ b/test/osm/jp/coverage/busstop/DbBusstopTest.java @@ -1,48 +1,20 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ package osm.jp.coverage.busstop; import java.io.FileNotFoundException; import java.io.IOException; import java.sql.SQLException; import javax.xml.parsers.ParserConfigurationException; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.junit.experimental.runners.Enclosed; -import org.junit.runner.RunWith; import org.xml.sax.SAXException; /** * * @author yuu */ -@RunWith(Enclosed.class) public class DbBusstopTest { - @BeforeClass - public static void setUpClass() throws Exception { - } - - @AfterClass - public static void tearDownClass() throws Exception { - } - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - @Test - public void mainTest() throws ClassNotFoundException, IOException, FileNotFoundException, SQLException, ParserConfigurationException, SAXException { + public void testDbBusstop_main() throws ClassNotFoundException, IOException, FileNotFoundException, SQLException, ParserConfigurationException, SAXException { String[] args = new String[0]; DbBusstop.main(args); } diff --git a/test/osm/jp/coverage/busstop/DbExistBusstopTest.java b/test/osm/jp/coverage/busstop/DbExistBusstopTest.java index 34d2b2c..0934bff 100644 --- a/test/osm/jp/coverage/busstop/DbExistBusstopTest.java +++ b/test/osm/jp/coverage/busstop/DbExistBusstopTest.java @@ -49,7 +49,7 @@ } @Test - public void test01_hsqldbの生成確認() { + public void test01DbExistBusstopTest_hsqldbの生成確認() { File dir = new File("database"); assertTrue(dir.exists()); @@ -93,7 +93,7 @@ } @Test - public void test02_busstop() { + public void test02DbExistBusstopTest_busstop() { try { String[] args = new String[0]; DbExistBusstop.main(args); diff --git a/test/osm/jp/coverage/busstop/ToPostgisTest.java b/test/osm/jp/coverage/busstop/ToPostgisTest.java index 77baf0c..a1609f7 100644 --- a/test/osm/jp/coverage/busstop/ToPostgisTest.java +++ b/test/osm/jp/coverage/busstop/ToPostgisTest.java @@ -6,14 +6,15 @@ public class ToPostgisTest { @Test - public void testMain() { - System.out.println("main"); + public void testBusstopToPostgis_main() { + System.out.println("busstop.ToPostgisTest.class"); try { String[] argv = new String[0]; - osm.jp.coverage.fuel.ToPostgis.main(argv); + ToPostgis.main(argv); } catch (Exception e) { - fail("The test case is a prototype."); + e.printStackTrace(); + fail(); } }