You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Jayaram Subramanian <rs...@gmail.com> on 2011/01/05 04:48:03 UTC

Re: [jira] Updated: (DERBY-4785) Remove JCC tests and references to JCC in test code

Hi All,
I was analyzing the impact of removing the JDBCClient.isDB2Client()
and BaseJDBCTestCase.usingDB2Client() from JUnit test cases. Following
are some of the samples of usingDB2Client() references in the
souce.... Could you please guide me on how to approach these scenarios

With Regards
Jayaram


functionTests/tests/derbyNet/NSSecurityMechanismTest.java
==========================================================
private HashMap addRequiredAttributes(HashMap attrs)
    {
        String hostName = TestConfiguration.getCurrent().getHostName();
        int port = TestConfiguration.getCurrent().getPort();
        if (usingDB2Client())
        {
            //attrs.put("retrieveMessagesFromServerOnGetMessage","true");
            attrs.put("driverType","4");
            /**
             * As per the fix of derby-410 servername should
             * default to localhost, but for jcc it's still needed
             */
            attrs.put("serverName",hostName);
        }


functionTEsts/tests/jdbcapi/BlobClob4BlobTest.java
============================================================
private void checkException(String SQLState, SQLException se)
            throws Exception
    {
        if (!usingDB2Client()) {
            assertSQLState(SQLState, se);
        }
    }


jdbcapi/ConcurrencyTests.java
===============================================================
if (!usingDB2Client()) { // DB2 client does not support UR with Derby
                suite.addTest(new ConcurrencyTest ("testUpdatePurgedTuple2"));
                suite.addTest(new ConcurrencyTest("testUpdatePurgedTuple3"));
                suite.addTest(new ConcurrencyTest("testUpdatePurgedTuple4"));


jdbcapi/DriverTest.java
============================================================
if (usingDerbyNetClient())
            protocol = protocol + TestConfiguration.getCurrent().getHostName()
            + ":" + TestConfiguration.getCurrent().getPort() + "/";
        else if (usingDB2Client())
            protocol = protocol + "net:" +
            TestConfiguration.getCurrent().getHostName() + ":" +

tests/lang/TableFunctionTest.java
==============================================================
if (usingDerbyNetClient())
            protocol = protocol + TestConfiguration.getCurrent().getHostName()
            + ":" + TestConfiguration.getCurrent().getPort() + "/";
        else if (usingDB2Client())
            protocol = protocol + "net:" +
            TestConfiguration.getCurrent().getHostName() + ":" +




On Fri, Dec 31, 2010 at 12:19 PM, Kathey Marsden (JIRA) <ji...@apache.org> wrote:
>
>     [ https://issues.apache.org/jira/browse/DERBY-4785?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Kathey Marsden updated DERBY-4785:
> ----------------------------------
>
>    Issue & fix info:   (was: [Patch Available])
>
> Thanks Jayaram for the patch! I committed it to trunk with revision 1054146. Next I suggest at removing JCC from the JUnit tests per Knut's earlier comment.
> https://issues.apache.org/jira/browse/DERBY-4785?focusedCommentId=12925956&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12925956
>
> Happy New Year!
>
>
>> Remove JCC tests and references to JCC in test code
>> ---------------------------------------------------
>>
>>                 Key: DERBY-4785
>>                 URL: https://issues.apache.org/jira/browse/DERBY-4785
>>             Project: Derby
>>          Issue Type: Sub-task
>>          Components: Test
>>    Affects Versions: 10.5.1.1, 10.6.1.0
>>            Reporter: Kathey Marsden
>>            Assignee: Jayaram Subramanian
>>            Priority: Minor
>>         Attachments: JCC_Removal_DONOTCOMMIT_Dec29.txt, stat_Dec29_JCC.txt
>>
>>
>> I received a request to remove JCC testing from the derby suite. The user had a very old jcc version in their classpath 2.4 and 10.5 tests were failing with:
>> com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -1, SQLSTATE: XJ040, SQLERRMC: Failed to start database '/results/axxon/58712/laka10a-derby-m101-20100830-003810/derbyall/derbynetmats/DerbyNet/derbynetmats/dblook_test_net_territory//wombat', see the next exception for details.::SQLSTATE: XJ001Java exception: 'Access denied (java.util.PropertyPermission com.ibm.crypto.provider.FIPSMODE read): java.security.AccessControlException'.
>> at com.ibm.db2.jcc.c.o.a(o.java:3219)
>>       at com.ibm.db2.jcc.a.cb.q(cb.java:653)
>>       at com.ibm.db2.jcc.a.cb.p(cb.java:541)
>>       at com.ibm.db2.jcc.a.cb.l(cb.java:363)
>>       at com.ibm.db2.jcc.a.cb.d(cb.java:145)
>>       at com.ibm.db2.jcc.a.b.Sb(b.java:1274)
>>       at com.ibm.db2.jcc.a.b.a(b.java:1166)
>>       at com.ibm.db2.jcc.a.b.q(b.java:934)
>>       at com.ibm.db2.jcc.a.b.a(b.java:702)
>>       at com.ibm.db2.jcc.a.b.(b.java:305)
>>       at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:162)
>>       at java.sql.DriverManager.getConnection(DriverManager.java:322)
>>       at java.sql.DriverManager.getConnection(DriverManager.java:273)
>>       at org.apache.derby.tools.dblook.go(Unknown Source)
>>       at org.apache.derby.tools.dblook.(Unknown Source)
>>       at org.apache.derbyTesting.functionTests.tests.tools.dblook_test.lookThree(dblook_test.java:417)
>>       at org.apache.derbyTesting.functionTests.tests.tools.dblook_test.runTest(dblook_test.java:283)
>>       at org.apache.derbyTesting.functionTests.tests.derbynet.dblook_test_net_territory.doTest(dblook_test_net_territory.java:65)
>>       at org.apache.derbyTesting.functionTests.tests.derbynet.dblook_test_net_territory.main(dblook_test_net_territory.java:41)
>> Now that I look at it more closely, their actual problem might be on the server side and JCC just reporting it but good to get the JCC tests out of the mix when people accidentally have it in their classpath anyway.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

Re: (DERBY-4785) Remove JCC tests and references to JCC in test code

Posted by Knut Anders Hatlen <kn...@oracle.com>.
Jayaram Subramanian <rs...@gmail.com> writes:

> Thanks for the reply... I was able to make appropriate changes to all
> appropriate junit classes.. Now as a part of testing when i tried
> running suites.all, it seems to have following issues
>
> 1) After running for an hour the test automatically seems to have
> interrupted at this point as per the log
> testUnimplementedSQLObjectAttributes used 142 ms .
> testGetSchemasReadOnly used 7 ms .
> testGetSchemasModify used 629 ms .
> testGetTablesReadOnly used 1528 ms .
> testGetTablesModify
>
> 2) I got the following exceptions in the log outpout
> Caused by: java.sql.SQLException: Database at
> C:\java\Derby\source\trunk\system\wombat is at version 10.6 beta. Beta
> databases cannot be upgraded,
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:73)
> 	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:256)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2723)
> 	... 28 more
> Caused by: ERROR XSLAP: Database at
> C:\java\Derby\source\trunk\system\wombat is at version 10.6 beta. Beta
> databases cannot be upgraded,
> 	at java.lang.Throwable.<init>(Throwable.java:67)

Not sure what's causing the first issue, but the second issue seems to
be because there's a database from an old test run in the directory
where you run the tests. Removing the system directory should fix that,
I think.

-- 
Knut Anders

Re: (DERBY-4785) Remove JCC tests and references to JCC in test code

Posted by Jayaram Subramanian <rs...@gmail.com>.
Thanks for the reply... I was able to make appropriate changes to all
appropriate junit classes.. Now as a part of testing when i tried
running suites.all, it seems to have following issues

1) After running for an hour the test automatically seems to have
interrupted at this point as per the log
testUnimplementedSQLObjectAttributes used 142 ms .
testGetSchemasReadOnly used 7 ms .
testGetSchemasModify used 629 ms .
testGetTablesReadOnly used 1528 ms .
testGetTablesModify

2) I got the following exceptions in the log outpout
Caused by: java.sql.SQLException: Database at
C:\java\Derby\source\trunk\system\wombat is at version 10.6 beta. Beta
databases cannot be upgraded,
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:73)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:256)
	at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2723)
	... 28 more
Caused by: ERROR XSLAP: Database at
C:\java\Derby\source\trunk\system\wombat is at version 10.6 beta. Beta
databases cannot be upgraded,
	at java.lang.Throwable.<init>(Throwable.java:67)


On Wed, Jan 5, 2011 at 5:32 AM, Knut Anders Hatlen
<kn...@oracle.com> wrote:
> Jayaram Subramanian <rs...@gmail.com> writes:
>
>> Hi All,
>> I was analyzing the impact of removing the JDBCClient.isDB2Client()
>> and BaseJDBCTestCase.usingDB2Client() from JUnit test cases. Following
>> are some of the samples of usingDB2Client() references in the
>> souce.... Could you please guide me on how to approach these scenarios
>
> Hi Jayaram,
>
> Here are my suggestions for how to handle these cases:
>
>> functionTests/tests/derbyNet/NSSecurityMechanismTest.java
>> ==========================================================
>> private HashMap addRequiredAttributes(HashMap attrs)
>>     {
>>         String hostName = TestConfiguration.getCurrent().getHostName();
>>         int port = TestConfiguration.getCurrent().getPort();
>>         if (usingDB2Client())
>>         {
>>             //attrs.put("retrieveMessagesFromServerOnGetMessage","true");
>>             attrs.put("driverType","4");
>>             /**
>>              * As per the fix of derby-410 servername should
>>              * default to localhost, but for jcc it's still needed
>>              */
>>             attrs.put("serverName",hostName);
>>         }
>
> Remove the entire if statement. This test doesn't run against the DB2
> client anymore, so it should be safe to remove that code.
>
>> functionTEsts/tests/jdbcapi/BlobClob4BlobTest.java
>> ============================================================
>> private void checkException(String SQLState, SQLException se)
>>             throws Exception
>>     {
>>         if (!usingDB2Client()) {
>>             assertSQLState(SQLState, se);
>>         }
>>     }
>
> Here I think we should remove the checkException() method altogether and
> change the callers to use assertSQLState() directly.
>
>> jdbcapi/ConcurrencyTests.java
>> ===============================================================
>> if (!usingDB2Client()) { // DB2 client does not support UR with Derby
>>                 suite.addTest(new ConcurrencyTest ("testUpdatePurgedTuple2"));
>>                 suite.addTest(new ConcurrencyTest("testUpdatePurgedTuple3"));
>>                 suite.addTest(new ConcurrencyTest("testUpdatePurgedTuple4"));
>
> Always add these test cases without checking usingDB2Client() now that
> we don't run this test against the DB2 client anymore.
>
>> jdbcapi/DriverTest.java
>> ============================================================
>> if (usingDerbyNetClient())
>>             protocol = protocol + TestConfiguration.getCurrent().getHostName()
>>             + ":" + TestConfiguration.getCurrent().getPort() + "/";
>>         else if (usingDB2Client())
>>             protocol = protocol + "net:" +
>>             TestConfiguration.getCurrent().getHostName() + ":" +
>
> Remove the entire else if branch.
>
>> tests/lang/TableFunctionTest.java
>> ==============================================================
>> if (usingDerbyNetClient())
>>             protocol = protocol + TestConfiguration.getCurrent().getHostName()
>>             + ":" + TestConfiguration.getCurrent().getPort() + "/";
>>         else if (usingDB2Client())
>>             protocol = protocol + "net:" +
>>             TestConfiguration.getCurrent().getHostName() + ":" +
>
> Same here. Remove the entire else if branch.
>
> Hope this helps,
>
> --
> Knut Anders
>

Re: (DERBY-4785) Remove JCC tests and references to JCC in test code

Posted by Knut Anders Hatlen <kn...@oracle.com>.
Jayaram Subramanian <rs...@gmail.com> writes:

> Hi All,
> I was analyzing the impact of removing the JDBCClient.isDB2Client()
> and BaseJDBCTestCase.usingDB2Client() from JUnit test cases. Following
> are some of the samples of usingDB2Client() references in the
> souce.... Could you please guide me on how to approach these scenarios

Hi Jayaram,

Here are my suggestions for how to handle these cases:

> functionTests/tests/derbyNet/NSSecurityMechanismTest.java
> ==========================================================
> private HashMap addRequiredAttributes(HashMap attrs)
>     {
>         String hostName = TestConfiguration.getCurrent().getHostName();
>         int port = TestConfiguration.getCurrent().getPort();
>         if (usingDB2Client())
>         {
>             //attrs.put("retrieveMessagesFromServerOnGetMessage","true");
>             attrs.put("driverType","4");
>             /**
>              * As per the fix of derby-410 servername should
>              * default to localhost, but for jcc it's still needed
>              */
>             attrs.put("serverName",hostName);
>         }

Remove the entire if statement. This test doesn't run against the DB2
client anymore, so it should be safe to remove that code.

> functionTEsts/tests/jdbcapi/BlobClob4BlobTest.java
> ============================================================
> private void checkException(String SQLState, SQLException se)
>             throws Exception
>     {
>         if (!usingDB2Client()) {
>             assertSQLState(SQLState, se);
>         }
>     }

Here I think we should remove the checkException() method altogether and
change the callers to use assertSQLState() directly.

> jdbcapi/ConcurrencyTests.java
> ===============================================================
> if (!usingDB2Client()) { // DB2 client does not support UR with Derby
>                 suite.addTest(new ConcurrencyTest ("testUpdatePurgedTuple2"));
>                 suite.addTest(new ConcurrencyTest("testUpdatePurgedTuple3"));
>                 suite.addTest(new ConcurrencyTest("testUpdatePurgedTuple4"));

Always add these test cases without checking usingDB2Client() now that
we don't run this test against the DB2 client anymore.

> jdbcapi/DriverTest.java
> ============================================================
> if (usingDerbyNetClient())
>             protocol = protocol + TestConfiguration.getCurrent().getHostName()
>             + ":" + TestConfiguration.getCurrent().getPort() + "/";
>         else if (usingDB2Client())
>             protocol = protocol + "net:" +
>             TestConfiguration.getCurrent().getHostName() + ":" +

Remove the entire else if branch.

> tests/lang/TableFunctionTest.java
> ==============================================================
> if (usingDerbyNetClient())
>             protocol = protocol + TestConfiguration.getCurrent().getHostName()
>             + ":" + TestConfiguration.getCurrent().getPort() + "/";
>         else if (usingDB2Client())
>             protocol = protocol + "net:" +
>             TestConfiguration.getCurrent().getHostName() + ":" +

Same here. Remove the entire else if branch.

Hope this helps,

-- 
Knut Anders