| | package osm.jp.coverage; |
---|
| | |
---|
| | import java.io.File; |
---|
| | import java.sql.Connection; |
---|
| | import jp.co.areaweb.tools.database.DatabaseTool; |
---|
| | import static org.hamcrest.CoreMatchers.is; |
---|
| | import org.junit.After; |
---|
| | import org.junit.AfterClass; |
---|
| | import static org.junit.Assert.assertNotNull; |
---|
| | import static org.junit.Assert.assertThat; |
---|
| | import static org.junit.Assert.fail; |
---|
| | import org.junit.Before; |
---|
| | import org.junit.BeforeClass; |
---|
| | import org.junit.Test; |
---|
| | |
---|
| | /** |
---|
| | * database connect test. |
---|
| | * `database.properties` hsqldb |
---|
| | */ |
---|
| | public class PostgresqlTest { |
---|
| | |
---|
| | @BeforeClass |
---|
| | public static void setUpClass() { |
---|
| | } |
---|
| | |
---|
| | @AfterClass |
---|
| | public static void tearDownClass() { |
---|
| | } |
---|
| | |
---|
| | @Before |
---|
| | public void setUp() { |
---|
| | } |
---|
| | |
---|
| | @After |
---|
| | public void tearDown() { |
---|
| | } |
---|
| | |
---|
| | /** |
---|
| | * postgresql `postgis.properties` |
---|
| | */ |
---|
| | @Test |
---|
| | public void connectTest_postgis() { |
---|
| | connect("postgis"); |
---|
| | } |
---|
| | |
---|
| | /** |
---|
| | * postgresql `osmdb.properties` |
---|
| | * ``` |
---|
| | * docker run --name=postgis -d |
---|
| | * -e POSTGRES_USER=alex |
---|
| | * -e POSTGRES_PASS=password |
---|
| | * -e POSTGRES_DBNAME=gis |
---|
| | * -e ALLOW_IP_RANGE=0.0.0.0/0 |
---|
| | * -p 5432:5432 |
---|
| | * -v pg_data:/var/lib/postgresql |
---|
| | * --restart=always |
---|
| | * kartoza/postgis:9.6-2.4 |
---|
| | * ``` |
---|
| | */ |
---|
| | @Test |
---|
| | public void connectTest_osmdb() { |
---|
| | connect("osmdb"); |
---|
| | } |
---|
| | |
---|
| | void connect(String dbname) { |
---|
| | try (Connection postgresql = DatabaseTool.openDb(dbname)) { |
---|
| | assertNotNull(postgresql); |
---|
| | } |
---|
| | catch (Exception ex) { |
---|
| | fail(ex.toString()); |
---|
| | } |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | |