Skip to content

Commit

Permalink
Register net.postgis.jdbc.DriverWrapper via java.sql.Driver servi…
Browse files Browse the repository at this point in the history
…ce (postgis#100)
  • Loading branch information
soc authored Jun 12, 2021
1 parent 0dfc7e6 commit a15fdbf
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
net.postgis.jdbc.DriverWrapper
net.postgis.jdbc.DriverWrapperAutoprobe
net.postgis.jdbc.DriverWrapperLW
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
package net.postgis.jdbc;


import net.postgis.jdbc.PGgeometry;
import org.testng.Assert;
import org.testng.annotations.Test;

Expand Down
34 changes: 34 additions & 0 deletions postgis-jdbc/src/test/java/net/postgis/jdbc/ServiceTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package net.postgis.jdbc;

import org.junit.Assert;
import org.junit.Test;

import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
* Tests to ensure that the drivers that are registered as services in META-INF/services/java.sql.Driver are resolved
* correctly.
*/
public class ServiceTest {

@Test
public void testWrapperService() throws SQLException {
Driver driver = DriverManager.getDriver("jdbc:postgresql_postGIS:/");
Assert.assertEquals(DriverWrapper.class, driver.getClass());
}

@Test
public void testWrapperAutoprobeService() throws SQLException {
Driver driver = DriverManager.getDriver("jdbc:postgresql_autogis:/");
Assert.assertEquals(DriverWrapperAutoprobe.class, driver.getClass());
}

@Test
public void testWrapperLWService() throws SQLException {
Driver driver = DriverManager.getDriver("jdbc:postgresql_lwgis:/");
Assert.assertEquals(DriverWrapperLW.class, driver.getClass());
}

}

0 comments on commit a15fdbf

Please sign in to comment.