| |
---|
| | public void tearDown() throws Exception { |
---|
| | } |
---|
| | |
---|
| | @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"); |
---|
| | String sql = "SELECT gmlid,lat,lon,fixed,fixed1,area,name FROM "+ DbBusstop.TABLE_NAME +" WHERE (lat > '34.69161765717579') and (lat < '34.697025680375795') and (lon > '135.79486712544522') and (lon < '135.80144696784524')"; |
---|
| |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | @Test |
---|
| | public void test03_dataread() { |
---|
| | public void test02Busstop_busstop() { |
---|
| | try { |
---|
| | String[] args = new String[0]; |
---|
| | Busstop.main(args); |
---|
| | } |
---|
| | catch (Exception ex) { |
---|
| | fail(ex.toString()); |
---|
| | } |
---|
| | |
---|
| | File dir = new File("database"); |
---|
| | assertTrue(dir.exists()); |
---|
| | assertTrue(dir.isDirectory()); |
---|
| | |
---|
| | Connection hsqldb = null; |
---|
| | try { |
---|
| | hsqldb = DatabaseTool.openDb("database"); |
---|
| | |
---|
| | PreparedStatement ps1 = hsqldb.prepareStatement("SELECT count(*) FROM OSM_EXIST"); |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | if (rset1.next()) { |
---|
| | long cnt = rset1.getLong(1); |
---|
| | assertThat((cnt > 0), is(true)); |
---|
| | } |
---|
| | else { |
---|
| | fail(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | // ノード: 八幡前 (3152604023) 場所: 33.9808001, 133.3123441 fixme有り |
---|
| | ps1 = hsqldb.prepareStatement("SELECT * FROM BUS_STOP where name='八幡前' and area=38"); |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | boolean ari = false; |
---|
| | while (rset1.next()) { |
---|
| | // fixme有り |
---|
| | ari = true; |
---|
| | String gmlid = rset1.getString("gmlid"); |
---|
| | String name = rset1.getString("name"); |
---|
| | int fixed = rset1.getInt("fixed"); |
---|
| | int fixed1 = rset1.getInt("fixed1"); |
---|
| | System.out.println(MessageFormat.format("gmlid: '{0}', name: '{1}', fixed: {2}, fixed1: {3}", gmlid, name, fixed, fixed1)); |
---|
| | assertTrue(fixed < 50); |
---|
| | } |
---|
| | if (!ari) { |
---|
| | fail(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | // ノード: 4940018338 場所: 35.5909251, 139.1498642 highway=bus_stop, name=null, bus=null,public_transport=platform |
---|
| | ps1 = hsqldb.prepareStatement("SELECT score,name,lat,lon FROM OSM_EXIST where idref='4940018338'"); |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | if (rset1.next()) { |
---|
| | // nameなし |
---|
| | assertThat(rset1.getInt("score"), is(1)); |
---|
| | assertThat(checkRenge(rset1, "35.5909251", "139.1498642"), is(true)); |
---|
| | } |
---|
| | else { |
---|
| | fail(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | // ノード: 海老名高校前 (2043102034) 場所: 35.4435042, 139.3878934 highway=bus_stop |
---|
| | ps1 = hsqldb.prepareStatement("SELECT score,name,lat,lon FROM OSM_EXIST where idref='2043102034'"); |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | if (rset1.next()) { |
---|
| | assertThat(rset1.getInt("score"), is(50)); |
---|
| | assertThat(checkRenge(rset1, "35.4435042", "139.3878934"), is(true)); |
---|
| | } |
---|
| | else { |
---|
| | fail(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | // ノード: 厚木ナイロン (1995040609) 場所: 35.4433312, 139.3932098 public_transport=stop_position,bus=yes |
---|
| | ps1 = hsqldb.prepareStatement("SELECT score,name,lat,lon FROM OSM_EXIST where idref='1995040609'"); |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | if (rset1.next()) { |
---|
| | assertThat(rset1.getInt("score"), is(50)); |
---|
| | assertThat(checkRenge(rset1, "35.4433312", "139.3932098"), is(true)); |
---|
| | } |
---|
| | else { |
---|
| | fail(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | // ウェイ: 国分寺台第12 (154659062) bus_station |
---|
| | ps1 = hsqldb.prepareStatement("SELECT score,name,lat,lon FROM OSM_EXIST where idref='154659062'"); |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | if (rset1.next()) { |
---|
| | assertThat(rset1.getInt("score"), is(50)); |
---|
| | } |
---|
| | else { |
---|
| | fail(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | } 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 test03Busstop_dataread() { |
---|
| | Connection hsqldb = null; |
---|
| | try { |
---|
| | hsqldb = DatabaseTool.openDb("database"); |
---|
| | String sqlStr1 = "SELECT idref,lat,lon,score,name FROM "+ HttpPOST.TABLE_NAME; |
---|
| |
---|
| | DatabaseTool.closeDb(hsqldb); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | @Test |
---|
| | public void test02_busstop() { |
---|
| | try { |
---|
| | String[] args = new String[0]; |
---|
| | Busstop.main(args); |
---|
| | } |
---|
| | catch (Exception ex) { |
---|
| | fail(ex.toString()); |
---|
| | } |
---|
| | |
---|
| | File dir = new File("database"); |
---|
| | assertTrue(dir.exists()); |
---|
| | assertTrue(dir.isDirectory()); |
---|
| | |
---|
| | Connection hsqldb = null; |
---|
| | try { |
---|
| | hsqldb = DatabaseTool.openDb("database"); |
---|
| | |
---|
| | PreparedStatement ps1 = hsqldb.prepareStatement("SELECT count(*) FROM OSM_EXIST"); |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | if (rset1.next()) { |
---|
| | long cnt = rset1.getLong(1); |
---|
| | assertThat((cnt > 0), is(true)); |
---|
| | } |
---|
| | else { |
---|
| | fail(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | // ノード: 八幡前 (3152604023) 場所: 33.9808001, 133.3123441 fixme有り |
---|
| | ps1 = hsqldb.prepareStatement("SELECT * FROM BUS_STOP where name='八幡前' and area=38"); |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | boolean ari = false; |
---|
| | while (rset1.next()) { |
---|
| | // fixme有り |
---|
| | ari = true; |
---|
| | String gmlid = rset1.getString("gmlid"); |
---|
| | String name = rset1.getString("name"); |
---|
| | int fixed = rset1.getInt("fixed"); |
---|
| | int fixed1 = rset1.getInt("fixed1"); |
---|
| | System.out.println(MessageFormat.format("gmlid: '{0}', name: '{1}', fixed: {2}, fixed1: {3}", gmlid, name, fixed, fixed1)); |
---|
| | assertTrue(fixed < 50); |
---|
| | } |
---|
| | if (!ari) { |
---|
| | fail(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | // ノード: 4940018338 場所: 35.5909251, 139.1498642 highway=bus_stop, name=null, bus=null,public_transport=platform |
---|
| | ps1 = hsqldb.prepareStatement("SELECT score,name,lat,lon FROM OSM_EXIST where idref='4940018338'"); |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | if (rset1.next()) { |
---|
| | // nameなし |
---|
| | assertThat(rset1.getInt("score"), is(1)); |
---|
| | assertThat(checkRenge(rset1, "35.5909251", "139.1498642"), is(true)); |
---|
| | } |
---|
| | else { |
---|
| | fail(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | // ノード: 海老名高校前 (2043102034) 場所: 35.4435042, 139.3878934 highway=bus_stop |
---|
| | ps1 = hsqldb.prepareStatement("SELECT score,name,lat,lon FROM OSM_EXIST where idref='2043102034'"); |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | if (rset1.next()) { |
---|
| | assertThat(rset1.getInt("score"), is(50)); |
---|
| | assertThat(checkRenge(rset1, "35.4435042", "139.3878934"), is(true)); |
---|
| | } |
---|
| | else { |
---|
| | fail(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | // ノード: 厚木ナイロン (1995040609) 場所: 35.4433312, 139.3932098 public_transport=stop_position,bus=yes |
---|
| | ps1 = hsqldb.prepareStatement("SELECT score,name,lat,lon FROM OSM_EXIST where idref='1995040609'"); |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | if (rset1.next()) { |
---|
| | assertThat(rset1.getInt("score"), is(50)); |
---|
| | assertThat(checkRenge(rset1, "35.4433312", "139.3932098"), is(true)); |
---|
| | } |
---|
| | else { |
---|
| | fail(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | // ウェイ: 国分寺台第12 (154659062) bus_station |
---|
| | ps1 = hsqldb.prepareStatement("SELECT score,name,lat,lon FROM OSM_EXIST where idref='154659062'"); |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | if (rset1.next()) { |
---|
| | assertThat(rset1.getInt("score"), is(50)); |
---|
| | } |
---|
| | else { |
---|
| | fail(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | } 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); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | } |
---|
| | |
---|
| | |