You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2010/05/24 16:47:25 UTC
svn commit: r947656 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java
Author: rhillegas
Date: Mon May 24 14:47:24 2010
New Revision: 947656
URL: http://svn.apache.org/viewvc?rev=947656&view=rev
Log:
DERBY-4674: Re-enable the BooleanValuesTest on jdk 1.4: simply disable the xml part of the test on that platform.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java?rev=947656&r1=947655&r2=947656&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java Mon May 24 14:47:24 2010
@@ -57,6 +57,8 @@ public class BooleanValuesTest extends
//
///////////////////////////////////////////////////////////////////////////////////
+ private boolean _supportsXML;
+
///////////////////////////////////////////////////////////////////////////////////
//
// CONSTRUCTOR
@@ -71,6 +73,8 @@ public class BooleanValuesTest extends
public BooleanValuesTest(String name)
{
super(name);
+
+ _supportsXML = XML.classpathMeetsXMLReqs();
}
///////////////////////////////////////////////////////////////////////////////////
@@ -85,16 +89,9 @@ public class BooleanValuesTest extends
*/
public static Test suite()
{
- TestSuite suite = new TestSuite("BooleanValuesTest");
-
- // The test uses XML columns, so it should only run if we have the
- // required libraries.
- if (XML.classpathMeetsXMLReqs()) {
- suite.addTest(
- TestConfiguration.defaultSuite(BooleanValuesTest.class));
- }
+ Test result = (TestSuite) TestConfiguration.defaultSuite(BooleanValuesTest.class);
- return suite;
+ return result;
}
protected void setUp()
@@ -116,9 +113,14 @@ public class BooleanValuesTest extends
}
if ( !tableExists( conn, "ALL_TYPES" ) )
{
- goodStatement
+ StringBuffer buffer;
+
+ //
+ // create table
+ //
+ buffer = new StringBuffer();
+ buffer.append
(
- conn,
"create table all_types\n" +
"(\n" +
" key_col int,\n" +
@@ -139,14 +141,21 @@ public class BooleanValuesTest extends
" time_col TIME,\n" +
" timestamp_col TIMESTAMP,\n" +
" varchar_col VARCHAR(10),\n" +
- " varchar_for_bit_data_col VARCHAR (10) FOR BIT DATA,\n" +
- " xml_col xml\n" +
- ")\n"
+ " varchar_for_bit_data_col VARCHAR (10) FOR BIT DATA\n"
);
-
- goodStatement
+ if ( _supportsXML )
+ {
+ buffer.append( " ,xml_col xml\n" );
+ }
+ buffer.append( ")\n" );
+ goodStatement( conn, buffer.toString() );
+
+ //
+ // populate table
+ //
+ buffer = new StringBuffer();
+ buffer.append
(
- conn,
"insert into all_types\n" +
"(\n" +
" key_col,\n" +
@@ -167,8 +176,14 @@ public class BooleanValuesTest extends
" time_col,\n" +
" timestamp_col,\n" +
" varchar_col,\n" +
- " varchar_for_bit_data_col,\n" +
- " xml_col\n" +
+ " varchar_for_bit_data_col\n"
+ );
+ if ( _supportsXML )
+ {
+ buffer.append( " ,xml_col\n" );
+ }
+ buffer.append
+ (
")\n" +
"values\n" +
"(\n" +
@@ -190,8 +205,14 @@ public class BooleanValuesTest extends
" time('15:09:02'),\n" +
" timestamp('1962-09-23 03:23:34.234'),\n" +
" '0',\n" +
- " X'DE',\n" +
- " xmlparse( document '<?xml version=\"1.0\" encoding=\"UTF-8\"?> <html/>' preserve whitespace )\n" +
+ " X'DE'\n"
+ );
+ if ( _supportsXML )
+ {
+ buffer.append( " , xmlparse( document '<?xml version=\"1.0\" encoding=\"UTF-8\"?> <html/>' preserve whitespace )\n" );
+ }
+ buffer.append
+ (
"),\n" +
"(\n" +
" 1,\n" +
@@ -212,8 +233,14 @@ public class BooleanValuesTest extends
" time('15:09:02'),\n" +
" timestamp('1962-09-23 03:23:34.234'),\n" +
" '1',\n" +
- " X'DE',\n" +
- " xmlparse( document '<?xml version=\"1.0\" encoding=\"UTF-8\"?> <html/>' preserve whitespace )\n" +
+ " X'DE'\n"
+ );
+ if ( _supportsXML )
+ {
+ buffer.append( " , xmlparse( document '<?xml version=\"1.0\" encoding=\"UTF-8\"?> <html/>' preserve whitespace )\n" );
+ }
+ buffer.append
+ (
"),\n" +
"(\n" +
" 2,\n" +
@@ -234,8 +261,14 @@ public class BooleanValuesTest extends
" time('15:09:02'),\n" +
" timestamp('1962-09-23 03:23:34.234'),\n" +
" '2',\n" +
- " X'DE',\n" +
- " xmlparse( document '<?xml version=\"1.0\" encoding=\"UTF-8\"?> <html/>' preserve whitespace )\n" +
+ " X'DE'\n"
+ );
+ if ( _supportsXML )
+ {
+ buffer.append( " , xmlparse( document '<?xml version=\"1.0\" encoding=\"UTF-8\"?> <html/>' preserve whitespace )\n" );
+ }
+ buffer.append
+ (
"),\n" +
"(\n" +
" 3,\n" +
@@ -256,13 +289,21 @@ public class BooleanValuesTest extends
" time('15:09:02'),\n" +
" timestamp('1962-09-23 03:23:34.234'),\n" +
" 'baffle',\n" +
- " X'DE',\n" +
- " xmlparse( document '<?xml version=\"1.0\" encoding=\"UTF-8\"?> <html/>' preserve whitespace )\n" +
+ " X'DE'\n"
+ );
+ if ( _supportsXML )
+ {
+ buffer.append( " , xmlparse( document '<?xml version=\"1.0\" encoding=\"UTF-8\"?> <html/>' preserve whitespace )\n" );
+ }
+ buffer.append
+ (
")\n"
);
+ goodStatement( conn, buffer.toString() );
}
}
+
///////////////////////////////////////////////////////////////////////////////////
//
// TESTS
@@ -354,11 +395,18 @@ public class BooleanValuesTest extends
*/
public void test_05_undefinedIllegalOutliers() throws Exception
{
- expectCompilationError
- (
- ILLEGAL_XML_SELECTION,
- makeQuery( "XML_COL" )
- );
+ //
+ // We don't test the XML datatype on JDK 1.4 because the Xalan
+ // packages are in the wrong location there.
+ //
+ if ( _supportsXML )
+ {
+ expectCompilationError
+ (
+ ILLEGAL_XML_SELECTION,
+ makeQuery( "XML_COL" )
+ );
+ }
}
/**
* <p>