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 Rick Hillegas <Ri...@Sun.COM> on 2005/12/06 19:18:06 UTC

patch to enable the BOOLEAN datatype

I've clipped to jira 499 a patch enabling the BOOLEAN datatype. I still 
owe this feature's changes to the user docs. In addition to adding the 
BOOLEAN type, this patch does the following:

o Centralizes product identifiers and DRDA datatypes in a single file of 
constants for use by both the DRDA client and server code.

o Adds a JUnit suite for language tests. Hopefully, over time we can 
migrate existing derbylang tests into this suite and wire in new 
language tests.

o Hopefully serves as a template for adding new datatypes (like XML) to 
our network layer.

Regards,
-Rick


Re: patch to enable the BOOLEAN datatype

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Dan,

I did it this way so that JUnit suites and standalone tests can share 
initialization code for running under the old test harness. There are 
other solutions to the problem: the shared code could go into a separate 
helper class or be factored into a superclass of DerbyJUnit. Each of 
these solutions is awkward in its own way. The solution I adopted seemed 
simplest to me, but, as you said, it raises this question of whether a 
set of tests should be considered to be a test itself.

Regards,
-Rick

Daniel John Debrunner wrote:

>>Daniel John Debrunner wrote:
>>    
>>
>
>  
>
>>>LangSuite extends DerbyJUnitTest, but it's not a test it's a suite, is
>>>this a requirement of Junit?
>>>      
>>>
>
>Any answer to this one? In my mind a suite is a set of tests, not a test
>so it should not inherit from DerbyJUnitTest.
>
>Dan.
>
>  
>


Re: patch to enable the BOOLEAN datatype

Posted by Daniel John Debrunner <dj...@debrunners.com>.
> Daniel John Debrunner wrote:

>> LangSuite extends DerbyJUnitTest, but it's not a test it's a suite, is
>> this a requirement of Junit?

Any answer to this one? In my mind a suite is a set of tests, not a test
so it should not inherit from DerbyJUnitTest.

Dan.


Re: patch to enable the BOOLEAN datatype

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Dan,

I don't have any strong religion about the class hierarchy here. It is 
conceivable that there might be some special logic, useful only to 
language tests, which we might want to put in LangSuite. That's really 
my only reason for making BooleanTest extend LangSuite. However, there 
is no such logic right now and I don't have any candidate logic in mind. 
If it's confusing Eclipse, I'm happy to make BooleanTest extend 
DerbyJUnitTest directly. If, someday, we need a place to hang 
language-specific test code, then we can revisit this issue.

Thanks,
-Rick

Daniel John Debrunner wrote:

>Rick Hillegas wrote:
>
>  
>
>>I've clipped to jira 499 a patch enabling the BOOLEAN datatype. 
>>    
>>
>
>Could you explain the type hierarchy of the LangSuite and BooleanTest?
>
>LangSuite extends DerbyJUnitTest, but it's not a test it's a suite, is
>this a requirement of Junit?
>
>BooleanTest extends LangSuite, but it's not a suite, it's a test. Why
>not just extend DerbyJUnitTest?
>
>In Eclipse I get red errors saying the hierarchy of these two classes is
>inconsistent, whatever that means. It does look wrong to me though.
>
>Dan
>
>  
>


Re: patch to enable the BOOLEAN datatype

Posted by Daniel John Debrunner <dj...@debrunners.com>.
Rick Hillegas wrote:

> I've clipped to jira 499 a patch enabling the BOOLEAN datatype. 

Could you explain the type hierarchy of the LangSuite and BooleanTest?

LangSuite extends DerbyJUnitTest, but it's not a test it's a suite, is
this a requirement of Junit?

BooleanTest extends LangSuite, but it's not a suite, it's a test. Why
not just extend DerbyJUnitTest?

In Eclipse I get red errors saying the hierarchy of these two classes is
inconsistent, whatever that means. It does look wrong to me though.

Dan


Re: patch to enable the BOOLEAN datatype

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Dan,

Thanks for looking at this patch. I like your suggestion that assertRow 
could do double duty, checking the primitive and object type of a 
returned column. I don't think it matters for this particular test case 
since all that's being checked is the correct casting of a boolean 
value--which is going to end up being a small integer: 1 or 0. Changing 
BooleanTest as you suggest would make it a better template for other 
engineers who might want to crib this pattern. I'll fold this change 
into my next submission of this patch.

Thanks,
-Rick

Daniel John Debrunner wrote:

>Rick Hillegas wrote:
>
>  
>
>>I've clipped to jira 499 a patch enabling the BOOLEAN datatype. 
>>    
>>
>
>In BooleanTest.java, at line 400, and elsewhere you use java.lang.Short
>as the value to be checked for a SMALLINT type in assertRow.
>
>JDBC defines that SMALLINT maps to java.lang.Integer as an object type,
>thus I wonder if tests should use Integer as well. This would mean that
>assertRow could potentially check the primitive and object view of a row
>from ResultSet. I haven't looked to see exactly what it does at the moment.
>
>Dan.
>
>  
>


Re: patch to enable the BOOLEAN datatype

Posted by Daniel John Debrunner <dj...@debrunners.com>.
Rick Hillegas wrote:

> I've clipped to jira 499 a patch enabling the BOOLEAN datatype. 

In BooleanTest.java, at line 400, and elsewhere you use java.lang.Short
as the value to be checked for a SMALLINT type in assertRow.

JDBC defines that SMALLINT maps to java.lang.Integer as an object type,
thus I wonder if tests should use Integer as well. This would mean that
assertRow could potentially check the primitive and object view of a row
from ResultSet. I haven't looked to see exactly what it does at the moment.

Dan.