[jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
[ https://issues.apache.org/jira/browse/DERBY-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12580433#action_12580433 ] Dyre Tjeldvoll commented on DERBY-2658: --- rev 572662 merged to 10.3 in revision 638919. Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit - Key: DERBY-2658 URL: https://issues.apache.org/jira/browse/DERBY-2658 Project: Derby Issue Type: Test Components: Test Affects Versions: 10.3.1.4 Reporter: Ramin Moazeni Assignee: Ramin Moazeni Fix For: 10.3.2.2, 10.4.0.0 Attachments: DERBY-2658.diff, DERBY-2658.diff-060807, DERBY-2658.diff-061307, DERBY-2658.stat-060807, DERBY-2658_061807.diff, DERBY-2658_061807.stat, DERBY-2658v4.diff Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
[ https://issues.apache.org/jira/browse/DERBY-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507454 ] A B commented on DERBY-2658: Filed DERBY-2862 for the weme6.1 failure since I haven't heard anything back on this... Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit - Key: DERBY-2658 URL: https://issues.apache.org/jira/browse/DERBY-2658 Project: Derby Issue Type: Test Components: Test Affects Versions: 10.3.0.0 Reporter: Ramin Moazeni Assignee: Ramin Moazeni Attachments: DERBY-2658.diff, DERBY-2658.diff-060807, DERBY-2658.diff-061307, DERBY-2658.stat-060807, DERBY-2658_061807.diff, DERBY-2658_061807.stat Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
[ https://issues.apache.org/jira/browse/DERBY-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506320 ] A B commented on DERBY-2658: As of svn # 547349 for this issue, suites.All has been failing when run with weme6.1. It turns out the that new ParameterMetaDataJdbc30Test fails with the following error: Failed to invoke suite():java.lang.NoClassDefFoundError: java.sql.ParameterMetaData There's no stack trace or logging so I don't have any more than that... Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit - Key: DERBY-2658 URL: https://issues.apache.org/jira/browse/DERBY-2658 Project: Derby Issue Type: Test Components: Test Affects Versions: 10.3.0.0 Reporter: Ramin Moazeni Assignee: Ramin Moazeni Attachments: DERBY-2658.diff, DERBY-2658.diff-060807, DERBY-2658.diff-061307, DERBY-2658.stat-060807, DERBY-2658_061807.diff, DERBY-2658_061807.stat Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
[ https://issues.apache.org/jira/browse/DERBY-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505886 ] Ramin Moazeni commented on DERBY-2658: -- Hi Kathey I have added javadoc comments to the test. The patch is attached. As for the following comment, // TODO: Some of the OUT params are getting reported as IN_OUT for embedded. // Network server reports it correctly. I was not able to reproduce it and therefore, I removed the comment. Please note that derbyall and suites.All both passed without any errors. Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit - Key: DERBY-2658 URL: https://issues.apache.org/jira/browse/DERBY-2658 Project: Derby Issue Type: Test Components: Test Affects Versions: 10.3.0.0 Reporter: Ramin Moazeni Assignee: Ramin Moazeni Attachments: DERBY-2658.diff, DERBY-2658.diff-060807, DERBY-2658.diff-061307, DERBY-2658.stat-060807 Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
[ https://issues.apache.org/jira/browse/DERBY-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505076 ] Knut Anders Hatlen commented on DERBY-2658: --- JDBCHarnessJavaTest started failing with ClassNotFoundException after this commit. Fixed in revision 547567. Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit - Key: DERBY-2658 URL: https://issues.apache.org/jira/browse/DERBY-2658 Project: Derby Issue Type: Test Components: Test Affects Versions: 10.3.0.0 Reporter: Ramin Moazeni Assignee: Ramin Moazeni Attachments: DERBY-2658.diff, DERBY-2658.diff-060807, DERBY-2658.diff-061307, DERBY-2658.stat-060807 Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
[ https://issues.apache.org/jira/browse/DERBY-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504867 ] Kathey Marsden commented on DERBY-2658: --- Thanks Ramin for the patch. I committed it with revision New Revision: 547349 URL: http://svn.apache.org/viewvc?view=revrev=547349 It would be good to add some javadoc comments and I did have this question. There is a comment // TODO: Some of the OUT params are getting reported as IN_OUT for embedded. // Network server reports it correctly. but I don't see any test showing this behavior. Do we need a new test and Jira entry for this or is it no longer an issue? Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit - Key: DERBY-2658 URL: https://issues.apache.org/jira/browse/DERBY-2658 Project: Derby Issue Type: Test Components: Test Affects Versions: 10.3.0.0 Reporter: Ramin Moazeni Assignee: Ramin Moazeni Attachments: DERBY-2658.diff, DERBY-2658.diff-060807, DERBY-2658.diff-061307, DERBY-2658.stat-060807 Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
[ https://issues.apache.org/jira/browse/DERBY-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502879 ] Kathey Marsden commented on DERBY-2658: --- Hi Ramin, I think we are still in a situation where we are not testing everything the original test tested. In the old test for each parameter it would print the following information: parameters count for callable statement is 4 Parameter number : 1 parameter isNullable PARAMETER_NULLABLE parameter isSigned true parameter getPrecision 10 parameter getScale 0 parameter getParameterType 4 parameter getParameterTypeName INTEGER parameter getParameterClassName java.lang.Integer parameter getParameterMode PARAMETER_MODE_IN That means that you will need to add assertions for each of these calls for each of the parameters in order to test the same thing. Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit - Key: DERBY-2658 URL: https://issues.apache.org/jira/browse/DERBY-2658 Project: Derby Issue Type: Test Components: Test Affects Versions: 10.3.0.0 Reporter: Ramin Moazeni Assignee: Ramin Moazeni Attachments: DERBY-2658.diff, DERBY-2658.diff-060807, DERBY-2658.stat-060807 Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: [jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
Regarding the testParameterMetadataWithXXXParameters () fixtures that do test the parameterMetaData, I am proposing to modify testParameterMetadataWithXXXParameters () to include parameterMetaData tests as follows. Feedback is appreciated. /** * test ParameterMetaData for Java procedures with INTEGER parameters */ public void testParameterMetadataWithINTParameters () throws SQLException { if(!usingDerbyNetClient()) { Statement stmt = createStatement(); stmt.execute(CREATE PROCEDURE PMDI(IN pmdI_1 INTEGER, IN pmdI_2 INTEGER, INOUT pmdI_3 INTEGER, OUT pmdI_4 INTEGER) language java parameter style java external name 'org.apache.derbyTesting.functionTests.tests.jdbcapi.parameterMetaDataJdbc30.dummyint'); CallableStatement cs = prepareCall(CALL PMDI(?, ?, ?, ?)); // parameters 1 and 2 are input only cs.setInt(1,1); cs.setInt(2,1); // parameter 3 is input and output Object x = new Integer(1); cs.setObject(3,x, Types.INTEGER); cs.registerOutParameter(3,Types.INTEGER); //parameter 4 is output only cs.registerOutParameter(4,Types.INTEGER); //verify the meta data for the parameters ParameterMetaData paramMetaData = cs.getParameterMetaData(); assertEquals(Unexpected parameter count, 4, paramMetaData.getParameterCount()); cs.close(); stmt.execute(DROP PROCEDURE PMDI); } } /** * test ParameterMetaData for Java procedures with CHAR parameters */ public void testParameterMetadataWithCHARParameters () throws SQLException { if(!usingDerbyNetClient()) { Statement stmt = createStatement(); stmt.execute(CREATE PROCEDURE PMDC(IN pmdI_1 CHAR(10), IN pmdI_2 VARCHAR(25), INOUT pmdI_3 CHAR(19), OUT pmdI_4 VARCHAR(32)) language java parameter style java external name 'org.apache.derbyTesting.functionTests.tests.jdbcapi.parameterMetaDataJdbc30.dummyString'); CallableStatement cs = prepareCall(CALL PMDC(?, ?, ?, ?)); // parameters 1 and 2 are input only cs.setString(1, TEST0); cs.setString(2, TEST1); // parameter 3 is input and output Object x = new String(TEST); cs.setObject(3,x, Types.CHAR); cs.registerOutParameter(3,Types.CHAR); //parameter 4 is output only cs.registerOutParameter(4,Types.CHAR); //verify the meta data for the parameters ParameterMetaData paramMetaData = cs.getParameterMetaData(); assertEquals(Unexpected parameter count, 4, paramMetaData.getParameterCount()); cs.close(); stmt.execute(DROP PROCEDURE PMDC); } } /** * test ParameterMetaData for Java procedures with DECIMAL parameters */ public void testParameterMetadataWithDECIMALParameters () throws SQLException { if(!usingDerbyNetClient()) { Statement stmt = createStatement(); stmt.execute(CREATE PROCEDURE PMDD(IN pmdI_1 DECIMAL(5,3), IN pmdI_2 DECIMAL(4,2), INOUT pmdI_3 DECIMAL(9,0), OUT pmdI_4 DECIMAL(10,2)) language java parameter style java external name 'org.apache.derbyTesting.functionTests.tests.jdbcapi.parameterMetaDataJdbc30.dummyDecimal'); CallableStatement cs = prepareCall(CALL PMDD(?, ?, ?, ?)); // parameters 1 and 2 are input only cs.setBigDecimal(1,new BigDecimal(1));; cs.setBigDecimal(2,new BigDecimal(1));; // parameter 3 is input and output Object x = new BigDecimal(1.1); cs.setObject(3,x, Types.DECIMAL); cs.registerOutParameter(3,Types.DECIMAL); //parameter 4 is output only cs.registerOutParameter(4,Types.DECIMAL); //verify the meta data for the parameters ParameterMetaData paramMetaData = cs.getParameterMetaData(); assertEquals(Unexpected parameter count, 4, paramMetaData.getParameterCount()); cs.close(); } } /** * test ParameterMetaData for Java procedures with some literal parameters */ public void
Re: [jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
Hi I need to confirm that for converting the System.out's from the old tests into assertions for example System.out.println(parameters count for callable statement is: + paramMetaData.getParameterCount()); I have to look up the expected value in the functionTests/master/parameterMetaDataJdbc30.out when I translate this to assertEquals? Thanks Ramin On 5/30/07, Kathey Marsden (JIRA) [EMAIL PROTECTED] wrote: [ https://issues.apache.org/jira/browse/DERBY-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500234 ] Kathey Marsden commented on DERBY-2658: --- Thanks Ramin for looking at this test conversion. The main thing I think is that we really need to make sure that we are testing everything the old test tested. Below are some specific comments, but it would be good to do a close review comparing the old and new test to make sure that we have assertions for all of the cases that were tested by canon comparison before. Anyway, here are some comments Typically the test class name for the junit tests starts with a capital letter. e.g. ParameterMetaDataJdbc30Test parameterMetaDataJdbc30_app.properties and master/parameterMetaDataJdbc30.out should be deleted. Attach the output of svn stat to your next patch. When I run the test all the tests fail with parameterMetaDataJdbc30Test)java.sql.SQLException: Schema 'SAMPLE' does not exist This is I think because setUp attempts to drop the table that is not there. I think you would be better off using CleanDatabaseSetup and the decorateSQL method to create your table and function, rather than creating it with each fixture. There are lots of examples of CleanDatabaseSetup usage in other tests. The dumpExpectedSQLExceptions method only checks an SQLException's sqlstate against itself, so would always pass. Instead of calls to dumpExpectedSQLExceptions you should have assertSQLState(X,e) where is the hardcoded expected SQLState. You can see the expected states by looking at the canon in functionTests/master/parameterMetaDataJdbc30.out or just temporarily printing SQLState to see what it is. Calls like assertTrue (Jira 44 failed., 22019.equals(e.getSQLState()) can be replaced by assertSQLState The System.out's in the old test need to be translated into assertions. e.g. //System.out.println(parameters count for callable statement is: + paramMetaData.getParameterCount()); should be replaced with an assertEquals call. dumpParameterMetaDataNegative doesn't look quite right to me. It seems like it would always fail. Instead of try { fail(parameter isNullable + paramMetaData.isNullable(-1)); } catch (SQLException e) { dumpExpectedSQLExceptions(e); } I would expect something like. try { parameterMetaData.isNullable(-1); fail(parameterMetaData.isNullable(-1) should have failed); } catch (SQLException se) { assertSQLState(XCL13,se.getSQLState()); } For the code where we have if(!usingDerbyNetClient()) there should be an explanation of why we don't run with client with a Jira reference. If there is a bug and it is not filed, file one. The fixtures testParameterMetadataWithXXXParameters () doesn't actually seem to test the parameterMetaData. I don't know if that is an artifact of the old test but we should add in some testing. Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit - Key: DERBY-2658 URL: https://issues.apache.org/jira/browse/DERBY-2658 Project: Derby Issue Type: Test Components: Test Affects Versions: 10.3.0.0 Reporter: Ramin Moazeni Assignee: Ramin Moazeni Fix For: 10.3.0.0 Attachments: DERBY-2658.diff Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: [jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
Ramin Moazeni wrote: Hi I need to confirm that for converting the System.out's from the old tests into assertions for example System.out.println(parameters count for callable statement is: + paramMetaData.getParameterCount()); I have to look up the expected value in the functionTests/master/parameterMetaDataJdbc30.out when I translate this to assertEquals? You can do it one of two ways. You can find out the expected value a couple different ways that I can think of. 1) Look at the test and see how many parameters there are. For example you have 4 parameters like in cs = con.prepareCall(CALL dummyint(?,?,?,?)), the expected value is 4. 2) Look at the canon (.out file) and see what the value was. Regardless you will end up with an assertion like: assertEquals(Unexpected parameter count, x, paramMetaData.getParameterCount()) where x is the expected value. I hope that answers your question. Kathey
[jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
[ https://issues.apache.org/jira/browse/DERBY-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500234 ] Kathey Marsden commented on DERBY-2658: --- Thanks Ramin for looking at this test conversion. The main thing I think is that we really need to make sure that we are testing everything the old test tested. Below are some specific comments, but it would be good to do a close review comparing the old and new test to make sure that we have assertions for all of the cases that were tested by canon comparison before. Anyway, here are some comments Typically the test class name for the junit tests starts with a capital letter. e.g. ParameterMetaDataJdbc30Test parameterMetaDataJdbc30_app.properties and master/parameterMetaDataJdbc30.out should be deleted. Attach the output of svn stat to your next patch. When I run the test all the tests fail with parameterMetaDataJdbc30Test)java.sql.SQLException: Schema 'SAMPLE' does not exist This is I think because setUp attempts to drop the table that is not there. I think you would be better off using CleanDatabaseSetup and the decorateSQL method to create your table and function, rather than creating it with each fixture. There are lots of examples of CleanDatabaseSetup usage in other tests. The dumpExpectedSQLExceptions method only checks an SQLException's sqlstate against itself, so would always pass. Instead of calls to dumpExpectedSQLExceptions you should have assertSQLState(X,e) where is the hardcoded expected SQLState. You can see the expected states by looking at the canon in functionTests/master/parameterMetaDataJdbc30.out or just temporarily printing SQLState to see what it is. Calls like assertTrue (Jira 44 failed., 22019.equals(e.getSQLState()) can be replaced by assertSQLState The System.out's in the old test need to be translated into assertions. e.g. //System.out.println(parameters count for callable statement is: + paramMetaData.getParameterCount()); should be replaced with an assertEquals call. dumpParameterMetaDataNegative doesn't look quite right to me. It seems like it would always fail. Instead of try { fail(parameter isNullable + paramMetaData.isNullable(-1)); } catch (SQLException e) { dumpExpectedSQLExceptions(e); } I would expect something like. try { parameterMetaData.isNullable(-1); fail(parameterMetaData.isNullable(-1) should have failed); } catch (SQLException se) { assertSQLState(XCL13,se.getSQLState()); } For the code where we have if(!usingDerbyNetClient()) there should be an explanation of why we don't run with client with a Jira reference. If there is a bug and it is not filed, file one. The fixtures testParameterMetadataWithXXXParameters () doesn't actually seem to test the parameterMetaData. I don't know if that is an artifact of the old test but we should add in some testing. Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit - Key: DERBY-2658 URL: https://issues.apache.org/jira/browse/DERBY-2658 Project: Derby Issue Type: Test Components: Test Affects Versions: 10.3.0.0 Reporter: Ramin Moazeni Assignee: Ramin Moazeni Fix For: 10.3.0.0 Attachments: DERBY-2658.diff Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.