forked from postgis/postgis-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Register
net.postgis.jdbc.DriverWrapper
via java.sql.Driver
servi…
…ce (postgis#100)
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
postgis-jdbc/src/main/resources/META-INF/services/java.sql.Driver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
postgis-jdbc/src/test/java/net/postgis/jdbc/ServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
|
||
} |