@@ -457,15 +457,20 @@ public void oracle() throws Exception {
457457 @ Test
458458 public void pgsql () throws Exception {
459459 Config config = ConfigFactory .parseResources (getClass (), "jdbc.conf" );
460+ String url = "jdbc:pgsql://server/database" ;
460461 Config dbconf = config .withValue ("db" ,
461- ConfigValueFactory .fromAnyRef ("jdbc:pgsql://server/database" ));
462+ ConfigValueFactory .fromAnyRef (url ));
462463
463464 new MockUnit (Env .class , Config .class , Binder .class )
464- .expect (props ("com.impossibl.postgres.jdbc.PGDataSource " , "jdbc:pgsql://server/database" ,
465+ .expect (props ("" , "jdbc:pgsql://server/database" ,
465466 "pgsql.database" , null , "" , false ))
466467 .expect (hikariConfig ())
467468 .expect (hikariDataSource ())
468469 .expect (serviceKey ("database" ))
470+ .expect (unit -> {
471+ Properties props = unit .get (Properties .class );
472+ expect (props .put ("jdbcUrl" , url )).andReturn (null );
473+ })
469474 .expect (onStop )
470475 .run (unit -> {
471476 new Jdbc ().configure (unit .get (Env .class ), dbconf , unit .get (Binder .class ));
@@ -475,15 +480,20 @@ public void pgsql() throws Exception {
475480 @ Test
476481 public void postgresql () throws Exception {
477482 Config config = ConfigFactory .parseResources (getClass (), "jdbc.conf" );
483+ String url = "jdbc:postgresql://server/database" ;
478484 Config dbconf = config .withValue ("db" ,
479- ConfigValueFactory .fromAnyRef ("jdbc:postgresql://server/database" ));
485+ ConfigValueFactory .fromAnyRef (url ));
480486
481487 new MockUnit (Env .class , Config .class , Binder .class )
482- .expect (props ("org.postgresql.ds.PGSimpleDataSource " , "jdbc:postgresql://server/database" ,
488+ .expect (props ("" , "jdbc:postgresql://server/database" ,
483489 "postgresql.database" , null , "" , false ))
484490 .expect (hikariConfig ())
485491 .expect (hikariDataSource ())
486492 .expect (serviceKey ("database" ))
493+ .expect (unit -> {
494+ Properties props = unit .get (Properties .class );
495+ expect (props .put ("jdbcUrl" , url )).andReturn (null );
496+ })
487497 .expect (onStop )
488498 .run (unit -> {
489499 new Jdbc ().configure (unit .get (Env .class ), dbconf , unit .get (Binder .class ));
@@ -628,8 +638,10 @@ private Block props(final String dataSourceClassName, final String url, final St
628638 .andReturn (null );
629639 }
630640
631- expect (properties .containsKey ("dataSourceClassName" )).andReturn (hasDataSourceClassName );
632- if (!hasDataSourceClassName ) {
641+ if (hasDataSourceClassName ) {
642+ expect (properties .getProperty ("dataSourceClassName" )).andReturn (dataSourceClassName );
643+ } else {
644+ expect (properties .getProperty ("dataSourceClassName" )).andReturn (null );
633645 expect (properties .getProperty ("dataSource.dataSourceClassName" ))
634646 .andReturn (dataSourceClassName );
635647 expect (properties .setProperty ("dataSourceClassName" , dataSourceClassName )).andReturn (null );
0 commit comments