author | sundar |
Mon, 16 May 2016 14:50:43 +0530 | |
changeset 37951 | ce2744a0f1a7 |
parent 24497 | d51dff0b4aaf |
permissions | -rw-r--r-- |
24497
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
1 |
/* |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
4 |
* |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
8 |
* |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
13 |
* accompanied this code). |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
14 |
* |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
18 |
* |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
21 |
* questions. |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
22 |
*/ |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
23 |
package util; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
24 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
25 |
import java.io.ByteArrayOutputStream; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
26 |
import java.io.IOException; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
27 |
import java.io.InputStream; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
28 |
import java.io.ObjectOutputStream; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
29 |
import java.io.OutputStream; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
30 |
import java.io.Reader; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
31 |
import java.io.StringReader; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
32 |
import java.io.StringWriter; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
33 |
import java.io.Writer; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
34 |
import java.sql.Clob; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
35 |
import java.sql.SQLException; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
36 |
import java.util.logging.Level; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
37 |
import java.util.logging.Logger; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
38 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
39 |
public class StubClob implements Clob { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
40 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
41 |
public String buf = "The test string 0123456789"; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
42 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
43 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
44 |
public String getSubString(long pos, int length) throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
45 |
return buf; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
46 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
47 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
48 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
49 |
public long length() throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
50 |
return buf.length(); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
51 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
52 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
53 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
54 |
public Reader getCharacterStream() throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
55 |
return new StringReader(buf); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
56 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
57 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
58 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
59 |
public InputStream getAsciiStream() throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
60 |
return new java.io.StringBufferInputStream(buf); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
61 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
62 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
63 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
64 |
public int setString(long pos, String str) throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
65 |
return str.length(); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
66 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
67 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
68 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
69 |
public int setString(long pos, String str, int offset, int len) throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
70 |
return len; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
71 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
72 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
73 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
74 |
public long position(String searchstr, long start) throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
75 |
throw new UnsupportedOperationException("Not supported yet."); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
76 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
77 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
78 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
79 |
public long position(Clob searchstr, long start) throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
80 |
throw new UnsupportedOperationException("Not supported yet."); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
81 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
82 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
83 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
84 |
public OutputStream setAsciiStream(long pos) throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
85 |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
86 |
ObjectOutputStream oos = null; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
87 |
try { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
88 |
oos = new ObjectOutputStream(baos); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
89 |
} catch (IOException ex) { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
90 |
Logger.getLogger(StubBlob.class.getName()).log(Level.SEVERE, null, ex); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
91 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
92 |
return oos; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
93 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
94 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
95 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
96 |
public Writer setCharacterStream(long pos) throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
97 |
return new StringWriter(); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
98 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
99 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
100 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
101 |
public void truncate(long len) throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
102 |
throw new UnsupportedOperationException("Not supported yet."); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
103 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
104 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
105 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
106 |
public void free() throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
107 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
108 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
109 |
@Override |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
110 |
public Reader getCharacterStream(long pos, long length) throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
111 |
throw new UnsupportedOperationException("Not supported yet."); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
112 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
113 |
} |