pass: Busstop AllTest
1 parent 34fcb74 commit a15d9e28d6df30a37252289d6cdf2934c243e3ce
@hayashi hayashi authored on 4 May 2018
Showing 7 changed files
View
1
■■■■
src/coverage_PoliceUp.sh
 
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
rm -rf tilePolice2
View
6
test/osm/jp/coverage/busstop/AllTest.java
import org.junit.runners.Suite;
 
@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
})
public class AllTest {
View
327
test/osm/jp/coverage/busstop/BusstopTest.java
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);
}
}
}
View
9
test/osm/jp/coverage/busstop/CoverageTest.java
 
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();
}
}
 
}
View
30
test/osm/jp/coverage/busstop/DbBusstopTest.java
/*
* 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);
}
View
4
test/osm/jp/coverage/busstop/DbExistBusstopTest.java
public void tearDown() throws Exception {
}
@Test
public void test01_hsqldbの生成確認() {
public void test01DbExistBusstopTest_hsqldbの生成確認() {
 
File dir = new File("database");
assertTrue(dir.exists());
assertTrue(dir.isDirectory());
}
}
 
@Test
public void test02_busstop() {
public void test02DbExistBusstopTest_busstop() {
try {
String[] args = new String[0];
DbExistBusstop.main(args);
}
View
10
test/osm/jp/coverage/busstop/ToPostgisTest.java
 
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();
}
}
 
}