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 Mamta Satoor <ms...@gmail.com> on 2011/04/21 22:59:00 UTC

JBC 4 testing : not getting feature not implemented for Connection.setTypeMap

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)

Re: JBC 4 testing : not getting feature not implemented for Connection.setTypeMap

Posted by Mamta Satoor <ms...@gmail.com>.
I added a very simple test case in jdbc4/ConnectionTest.java. Knut,
didn't see your email before I committed that test.

thanks,
Mamta

On Sun, Apr 24, 2011 at 12:00 AM, Knut Anders Hatlen
<kn...@oracle.com> wrote:
> Rick Hillegas <ri...@oracle.com> writes:
>
>> 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).
>
> I think the test case for DERBY-33 in J2EEDataSourceTest covers (2).
>
> --
> Knut Anders
>

Re: JBC 4 testing : not getting feature not implemented for Connection.setTypeMap

Posted by Knut Anders Hatlen <kn...@oracle.com>.
Rick Hillegas <ri...@oracle.com> writes:

> 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).

I think the test case for DERBY-33 in J2EEDataSourceTest covers (2).

-- 
Knut Anders

Re: JBC 4 testing : not getting feature not implemented for Connection.setTypeMap

Posted by Rick Hillegas <ri...@oracle.com>.
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<ri...@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)
>>>
>>


Re: JBC 4 testing : not getting feature not implemented for Connection.setTypeMap

Posted by Mamta Satoor <ms...@gmail.com>.
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 <ri...@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)
>>
>
>

Re: JBC 4 testing : not getting feature not implemented for Connection.setTypeMap

Posted by Rick Hillegas <ri...@oracle.com>.
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)
>