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.sql.Blob; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
31 |
import java.sql.SQLException; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
32 |
import java.util.Arrays; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
33 |
import java.util.logging.Level; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
34 |
import java.util.logging.Logger; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
35 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
36 |
public class StubBlob implements Blob { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
37 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
38 |
private byte[] bytes; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
39 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
40 |
public StubBlob() { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
41 |
bytes = new byte[]{2, 4, 6, 8}; |
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 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
44 |
public long length() throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
45 |
return bytes.length; |
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 |
public byte[] getBytes(long pos, int length) |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
49 |
throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
50 |
return Arrays.copyOfRange(bytes, (int) pos - 1, 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 |
public InputStream getBinaryStream() |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
54 |
throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
55 |
return null; |
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 |
public long position(byte[] pattern, long start) |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
59 |
throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
60 |
return 0; |
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 |
public long position(Blob pattern, long start) |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
64 |
throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
65 |
return 0; |
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 |
public int setBytes(long pos, byte[] bytes) |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
69 |
throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
70 |
return 0; |
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 |
public int setBytes(long pos, byte[] bytes, int offset, int len) |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
74 |
throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
75 |
return 0; |
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 |
public OutputStream setBinaryStream(long pos) |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
79 |
throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
80 |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
81 |
ObjectOutputStream oos = null; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
82 |
try { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
83 |
oos = new ObjectOutputStream(baos); |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
84 |
} catch (IOException ex) { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
85 |
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
|
86 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
87 |
return oos; |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
88 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
89 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
90 |
public void truncate(long len) |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
91 |
throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
92 |
} |
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 |
public void free() throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
95 |
} |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
96 |
|
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
97 |
public InputStream getBinaryStream(long pos, long length) throws SQLException { |
d51dff0b4aaf
8043278: Add initial unit tests for javax.sql.rowset.serial
lancea
parents:
diff
changeset
|
98 |
return null; |
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 |
} |