db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r508639 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: tests/lang/TriggerTest.java util/streams/ReadOnceByteArrayInputStream.java util/streams/StringReaderWithLength.java
Date Fri, 16 Feb 2007 22:58:07 GMT
Author: djd
Date: Fri Feb 16 14:58:07 2007
New Revision: 508639

URL: http://svn.apache.org/viewvc?view=rev&rev=508639
Log:
DERBY-1102 Add missing classes for TriggerTest and latest version of test with reference to
DEBRY-2350.

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/streams/ReadOnceByteArrayInputStream.java
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/streams/StringReaderWithLength.java
  (with props)
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TriggerTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TriggerTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TriggerTest.java?view=diff&rev=508639&r1=508638&r2=508639
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TriggerTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TriggerTest.java
Fri Feb 16 14:58:07 2007
@@ -181,9 +181,9 @@
         int jdbcType = DatabaseMetaDataTest.getJDBCType(type);
         int precision = DatabaseMetaDataTest.getPrecision(jdbcType, type);
 
-        // Can't directly insert into XML columns from JDBC.
+        // BUG DERBY-2350  - remove this check & return to see the issue.      
         if (jdbcType == JDBC.SQLXML)
-            return; // temp
+            return;
         
         // BUG DERBY-2349 - remove this check & return to see the issue.
         if (jdbcType == Types.BLOB)
@@ -194,6 +194,17 @@
         String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)";
         String ins3 = "INSERT INTO T_MAIN(V) VALUES (?), (?), (?)";
         
+        // Can't directly insert into XML columns from JDBC.
+        if (jdbcType == JDBC.SQLXML)
+        {
+            ins1 = "INSERT INTO T_MAIN(V) VALUES " +
+                    "XMLPARSE (DOCUMENT CAST (? AS CLOB) PRESERVE WHITESPACE)";
+            ins3 = "INSERT INTO T_MAIN(V) VALUES " +
+                    "XMLPARSE (DOCUMENT CAST (? AS CLOB) PRESERVE WHITESPACE)," +
+                    "XMLPARSE (DOCUMENT CAST (? AS CLOB) PRESERVE WHITESPACE)," +
+                    "XMLPARSE (DOCUMENT CAST (? AS CLOB) PRESERVE WHITESPACE)";
+        }
+        
         PreparedStatement ps;
         ps = prepareStatement(ins1);
         setRandomValue(r, ps, 1, jdbcType, precision);
@@ -365,6 +376,12 @@
                 precision = 256*1024;
             return new ReadOnceByteArrayInputStream(
                     randomBinary(r, r.nextInt(precision)));
+            
+        case JDBC.SQLXML:
+            // Not random yet, but was blocked by DEBRY-2350
+            // so just didn't put effort into generating 
+            // a random size XML document.
+            return new StringReaderWithLength("<a><b>text</b></a>");
             
              
        }

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/streams/ReadOnceByteArrayInputStream.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/streams/ReadOnceByteArrayInputStream.java?view=auto&rev=508639
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/streams/ReadOnceByteArrayInputStream.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/streams/ReadOnceByteArrayInputStream.java
Fri Feb 16 14:58:07 2007
@@ -0,0 +1,45 @@
+package org.apache.derbyTesting.functionTests.util.streams;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+public class ReadOnceByteArrayInputStream extends ByteArrayInputStream {
+
+    private boolean isClosed;
+    
+    public ReadOnceByteArrayInputStream(byte[] arg0) {
+        super(arg0);
+    }
+
+    public ReadOnceByteArrayInputStream(byte[] arg0, int arg1, int arg2) {
+        super(arg0, arg1, arg2);
+    }
+    
+    public boolean markSupported()
+    {
+        return false;
+    }
+    
+    public void close() throws IOException
+    {
+        isClosed = true;
+        super.close();
+    }
+    
+    public int read(byte[] b,
+            int off,
+            int len)
+    {
+        if (isClosed)
+            return -1;
+        return super.read(b, off, len);
+    }
+    
+    public int read()
+    {
+        if (isClosed)
+            return -1;
+        return super.read();
+    }
+
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/streams/ReadOnceByteArrayInputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/streams/StringReaderWithLength.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/streams/StringReaderWithLength.java?view=auto&rev=508639
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/streams/StringReaderWithLength.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/streams/StringReaderWithLength.java
Fri Feb 16 14:58:07 2007
@@ -0,0 +1,22 @@
+package org.apache.derbyTesting.functionTests.util.streams;
+
+import java.io.StringReader;
+
+public class StringReaderWithLength extends StringReader {
+
+    private final int length;
+    
+    public StringReaderWithLength(String arg0) {
+        super(arg0);
+        this.length = arg0.length();
+    }
+    
+    public boolean markSupported() {
+        return false;
+    }
+
+    public int getLength()
+    {
+        return length;
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/streams/StringReaderWithLength.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message