@@ -20,81 +20,87 @@ func getDSNWithUser(t *testing.T, dataSourceUrl string, username string, passwor
2020 return adapter .GetDataSourceName (dataSource )
2121}
2222
23- func TestMySQLDataSourceNameAdapter_GetDataSourceNameWithPort (t * testing.T ) {
23+ func TestMsSQLDataSourceNameAdapter_GetDataSourceNameWithPort (t * testing.T ) {
2424 dsn , err := getDSN (t , "gdbc:sqlserver://username:password@localhost:3000?param1=value¶m2=value" )
2525 assert .Nil (t , err )
2626 assert .Contains (t , dsn , "sqlserver://username:password@localhost:3000" )
2727 assert .Contains (t , dsn , "param1=value" )
2828 assert .Contains (t , dsn , "param2=value" )
2929}
3030
31- func TestMySQLDataSourceNameAdapter_GetDataSourceNameWithPortAndWithoutPassword (t * testing.T ) {
31+ func TestMsSQLDataSourceNameAdapter_GetDataSourceNameWithPortAndWithoutPassword (t * testing.T ) {
3232 dsn , err := getDSN (t , "gdbc:sqlserver://username@localhost:3000?param1=value¶m2=value" )
3333 assert .Nil (t , err )
3434 assert .Contains (t , dsn , "sqlserver://username@localhost:3000" )
3535 assert .Contains (t , dsn , "param1=value" )
3636 assert .Contains (t , dsn , "param2=value" )
3737}
3838
39- func TestMySQLDataSourceNameAdapter_GetDataSourceNameWithInstance (t * testing.T ) {
39+ func TestMsSQLDataSourceNameAdapter_GetDataSourceNameWithInstance (t * testing.T ) {
4040 dsn , err := getDSN (t , "gdbc:sqlserver://username:password@localhost/instanceName?param1=value¶m2=value" )
4141 assert .Nil (t , err )
4242 assert .Contains (t , dsn , "sqlserver://username:password@localhost/instanceName" )
4343 assert .Contains (t , dsn , "param1=value" )
4444 assert .Contains (t , dsn , "param2=value" )
4545}
4646
47- func TestMySQLDataSourceNameAdapter_GetDataSourceNameWithWrongInstance (t * testing.T ) {
47+ func TestMsSQLDataSourceNameAdapter_GetDataSourceNameWithWrongInstance (t * testing.T ) {
4848 dsn , err := getDSN (t , "gdbc:sqlserver://username:password@localhost/instanceName/test?param1=value¶m2=value" )
4949 assert .NotNil (t , err )
5050 assert .Equal (t , "instance format is wrong : instanceName/test" , err .Error ())
5151 assert .Empty (t , dsn )
5252}
5353
54- func TestMySQLDataSourceNameAdapter_GetDataSourceNameWithInstanceAndWithoutPassword (t * testing.T ) {
54+ func TestMsSQLDataSourceNameAdapter_GetDataSourceNameWithInstanceAndWithoutPassword (t * testing.T ) {
5555 dsn , err := getDSN (t , "gdbc:sqlserver://username@localhost/instanceName?param1=value¶m2=value" )
5656 assert .Nil (t , err )
5757 assert .Contains (t , dsn , "sqlserver://username@localhost/instanceName" )
5858 assert .Contains (t , dsn , "param1=value" )
5959 assert .Contains (t , dsn , "param2=value" )
6060}
6161
62- func TestMySQLDataSourceNameAdapter_GetDataSourceNameWithPortAndWithoutArguments (t * testing.T ) {
62+ func TestMsSQLDataSourceNameAdapter_GetDataSourceNameWithPortAndWithoutArguments (t * testing.T ) {
6363 dsn , err := getDSN (t , "gdbc:sqlserver://username:password@localhost:3000" )
6464 assert .Nil (t , err )
6565 assert .Equal (t , dsn , "sqlserver://username:password@localhost:3000" )
6666}
6767
68- func TestMySQLDataSourceNameAdapter_GetDataSourceNameWithInstancePortAndWithoutArguments (t * testing.T ) {
68+ func TestMsSQLDataSourceNameAdapter_GetDataSourceNameWithInstancePortAndWithoutArguments (t * testing.T ) {
6969 dsn , err := getDSN (t , "gdbc:sqlserver://username@localhost/instanceName" )
7070 assert .Nil (t , err )
7171 assert .Equal (t , dsn , "sqlserver://username@localhost/instanceName" )
7272}
7373
74- func TestMySQLDataSourceNameAdapter_GetDataSourceNameWithoutInstanceAndPort (t * testing.T ) {
74+ func TestMsSQLDataSourceNameAdapter_GetDataSourceNameWithoutInstanceAndPort (t * testing.T ) {
7575 dsn , err := getDSN (t , "gdbc:sqlserver://username@localhost" )
7676 assert .NotNil (t , err )
7777 assert .Equal (t , "you need specify port or instance" , err .Error ())
7878 assert .Empty (t , dsn )
7979}
8080
81- func TestMySQLDataSourceNameAdapter_GetDataSourceNameWithInstanceAndPort (t * testing.T ) {
81+ func TestMsSQLDataSourceNameAdapter_GetDataSourceNameWithInstanceAndPort (t * testing.T ) {
8282 dsn , err := getDSN (t , "gdbc:sqlserver://username@localhost:3000/instance" )
8383 assert .NotNil (t , err )
8484 assert .Equal (t , "you need only specify port or instance" , err .Error ())
8585 assert .Empty (t , dsn )
8686}
8787
88- func TestMySQLDataSourceNameAdapter_GetDataSourceNameWithoutHost (t * testing.T ) {
88+ func TestMsSQLDataSourceNameAdapter_GetDataSourceNameWithoutHost (t * testing.T ) {
8989 dsn , err := getDSN (t , "gdbc:sqlserver://" )
9090 assert .NotNil (t , err )
9191 assert .Equal (t , "host cannot be empty" , err .Error ())
9292 assert .Empty (t , dsn )
9393}
9494
95- func TestMySQLDataSourceNameAdapter_GetDataSourceNameWithoutUser (t * testing.T ) {
95+ func TestMsSQLDataSourceNameAdapter_GetDataSourceNameWithoutUser (t * testing.T ) {
9696 dsn , err := getDSN (t , "gdbc:sqlserver://localhost:3000" )
9797 assert .NotNil (t , err )
9898 assert .Equal (t , "user cannot be empty" , err .Error ())
9999 assert .Empty (t , dsn )
100100}
101+
102+ func TestMsSQLDataSourceNameAdapter_GetDataSourceNameWithUserAndPassword (t * testing.T ) {
103+ dsn , err := getDSNWithUser (t , "gdbc:sqlserver://localhost:3000" , "username" , "password" )
104+ assert .Nil (t , err )
105+ assert .Equal (t , dsn , "sqlserver://username:password@localhost:3000" )
106+ }
0 commit comments