db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <rick.hille...@oracle.com>
Subject Re: JBC 4 testing : not getting feature not implemented for Connection.setTypeMap
Date Fri, 22 Apr 2011 19:08:35 GMT
Hi Mamta,

I think that there is a catch-all test for Connection which calls all of 
the methods on a closed Connection to verify that you get the "No 
current connection" exception. So (4) is probably covered too. I don't 
know about case (2).

Thanks,
-Rick

On 4/22/11 11:57 AM, Mamta Satoor wrote:
> Thanks, Rick. I was just wondering if we have tests for these 4
> scenarios. I think I have definitely seen tests for 1) and 3).
>
> thanks,
> Mamta
>
> On Fri, Apr 22, 2011 at 5:58 AM, Rick Hillegas<rick.hillegas@oracle.com>  wrote:
>> Hi Mamta,
>>
>> The method behaves as follows:
>>
>> 1) If you pass in a null, you get an "Invalid value" exception.
>>
>> 2) If you pass in an empty Map, the method does nothing because the Map is
>> empty. This is the test you ran.
>>
>> 3) If you pass in a non-empty Map, the method raises a
>> SQLFeatureNotSupportedException.
>>
>> 4) If the Connection is closed, you get a "No current connection" exception.
>>
>> Hope this helps,
>> -Rick
>>
>> On 4/21/11 1:59 PM, Mamta Satoor wrote:
>>> Hello,
>>>
>>> I am trying to test Connection.setTypeMap and expected to get feature
>>> not supported but do not get that error. Here is the real simple test
>>> code.
>>> import java.sql.*;
>>> import java.lang.*;
>>>
>>> public  class TestSetTypeMap
>>> {
>>>      public  static  void    main( String... args )  throws Exception
>>>      {
>>>          String connectionURL = "jdbc:derby:db;create=true";
>>>
>>>          Class.forName( "org.apache.derby.jdbc.EmbeddedDriver" );
>>>          Connection  conn = DriverManager.getConnection( connectionURL );
>>>
>>>          conn.getTypeMap();
>>>          java.util.Map<String,Class<?>>    map = new
>>> java.util.HashMap<String,Class<?>>();
>>>          conn.setTypeMap(map);
>>>          System.out.println("did settype map");
>>>      }
>>>
>>> }
>>>
>>>
>>> I tried the test case with Sun's jdk1.7. Maybe I am doing something wrong?
>>> $ java -version
>>> java version "1.7.0-ea"
>>> Java(TM) SE Runtime Environment (build 1.7.0-ea-b138)
>>> Java HotSpot(TM) Client VM (build 21.0-b08, mixed mode)
>>>
>>


Mime
View raw message