[ 
https://issues.apache.org/jira/browse/DERBY-2087?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470248
 ] 

Daniel John Debrunner commented on DERBY-2087:
----------------------------------------------

dan> how do you see an open method with connection attributes being used by a 
test?
kristian> ...a strong focus on the inputs specified by the user as connection 
attributes? 

In this case the focus of the test would be setting JDBC connection attributes 
or JDBC DataSource properties.
I think in this case it's clearer code if the test directly goes aganst the 
Derby api, ie. manufactures JDBC URLs,
Properties for DriverManager.getConnection(), or Java bean properties for a 
DataSource.

I think the utility methods in the infrastructure are there to reduce the 
amount of code in a test class/fixture so that the focus of the code is the 
item being tested. This means in some cases the utility methods are not the 
best approach, e.g. in this case the openConnection() methods are probably not 
the best, in a test of CallableStatement the prepareCall() utility method is 
probably not the best approach.

Such an open method would have (at least) two underlying mechanisms to open a 
connection, one through JDBC URLs and one through DataSource properties. This 
leads (I think) to two issues:
  A) code in the test harness to decode the connection attributes as a 
different breakout might be needed for DataSource properties. Thus how would 
negative tests be handled, which piece of code is catching the error, the 
harness or the driver?
  B) tests being written against the test api and not Derby's api.



> Clean up of a database server directory after running junit tests.
> ------------------------------------------------------------------
>
>                 Key: DERBY-2087
>                 URL: https://issues.apache.org/jira/browse/DERBY-2087
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>    Affects Versions: 10.3.0.0
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>            Priority: Minor
>             Fix For: 10.3.0.0
>
>         Attachments: d2087.diff, d2087.stat, d2087_round2.diff, 
> d2087_round2.stat, d2087_round2_try2.diff, d2087_round2_try2.stat, 
> d2087_try2.diff, d2087_try2.stat
>
>
> If I create a test using multiple connections using code like this 
>       DataSource ds1 = JDBCDataSource.getDataSource("FIRSTDB1");
>       JDBCDataSource.setBeanProperty(ds1, "connectionAttributes", 
> "create=true");
>       Connection conn1 = ds1.getConnection();
> the files created on a server does not get cleaned.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to