KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbunit > ext > oracle > OracleDataTypeFactoryTest


1 /*
2  *
3  * The DbUnit Database Testing Framework
4  * Copyright (C)2002-2004, DbUnit.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */

21 package org.dbunit.ext.oracle;
22
23 import org.dbunit.dataset.datatype.AbstractDataTypeFactoryTest;
24 import org.dbunit.dataset.datatype.DataType;
25 import org.dbunit.dataset.datatype.IDataTypeFactory;
26
27 import java.sql.Types JavaDoc;
28
29 /**
30  * @author Manuel Laflamme
31  * @since Aug 13, 2003
32  * @version $Revision: 1.9 $
33  */

34 public class OracleDataTypeFactoryTest extends AbstractDataTypeFactoryTest
35 {
36     public OracleDataTypeFactoryTest(String JavaDoc s)
37     {
38         super(s);
39     }
40
41     public IDataTypeFactory createFactory() throws Exception JavaDoc
42     {
43         return new OracleDataTypeFactory();
44     }
45
46     public void testCreateBlobDataType() throws Exception JavaDoc
47     {
48         int sqlType = Types.OTHER;
49         String JavaDoc sqlTypeName = "BLOB";
50
51         DataType expected = OracleDataTypeFactory.ORACLE_BLOB;
52         DataType actual = createFactory().createDataType(sqlType, sqlTypeName);
53         assertSame("type", expected, actual);
54     }
55
56     public void testCreateClobDataType() throws Exception JavaDoc
57     {
58         int sqlType = Types.OTHER;
59         String JavaDoc sqlTypeName = "CLOB";
60
61         DataType expected = OracleDataTypeFactory.ORACLE_CLOB;
62         DataType actual = createFactory().createDataType(sqlType, sqlTypeName);
63         assertSame("type", expected, actual);
64     }
65
66     public void testCreateNClobDataType() throws Exception JavaDoc
67     {
68         int sqlType = Types.OTHER;
69         String JavaDoc sqlTypeName = "NCLOB";
70
71         DataType expected = OracleDataTypeFactory.ORACLE_CLOB;
72         DataType actual = createFactory().createDataType(sqlType, sqlTypeName);
73         assertSame("type", expected, actual);
74     }
75
76     public void testCreateLongRawDataType() throws Exception JavaDoc
77     {
78         int sqlType = Types.LONGVARBINARY;
79         String JavaDoc sqlTypeName = "LONG RAW";
80
81         DataType expected = OracleDataTypeFactory.LONG_RAW;
82         DataType actual = createFactory().createDataType(sqlType, sqlTypeName);
83         assertSame("type", expected, actual);
84     }
85
86     public void testCreateTimestampDataType() throws Exception JavaDoc
87     {
88         int sqlType = Types.OTHER;
89         String JavaDoc sqlTypeName = "TIMESTAMP(6)";
90
91         DataType expected = DataType.TIMESTAMP;
92         DataType actual = createFactory().createDataType(sqlType, sqlTypeName);
93         assertSame("type", expected, actual);
94     }
95
96     public void testCreateDateDataType() throws Exception JavaDoc
97     {
98         int sqlType = Types.DATE;
99         String JavaDoc sqlTypeName = "DATE";
100
101         DataType expected = DataType.TIMESTAMP;
102         DataType actual = createFactory().createDataType(sqlType, sqlTypeName);
103         assertSame("type", expected, actual);
104     }
105
106     public void testCreateNChar2DataType() throws Exception JavaDoc
107     {
108         int sqlType = Types.OTHER;
109         String JavaDoc sqlTypeName = "NCHAR2";
110
111         DataType expected = DataType.CHAR;
112         DataType actual = createFactory().createDataType(sqlType, sqlTypeName);
113         assertSame("type", expected, actual);
114     }
115
116     public void testCreateNVarChar2DataType() throws Exception JavaDoc
117     {
118         int sqlType = Types.OTHER;
119         String JavaDoc sqlTypeName = "NVARCHAR2";
120
121         DataType expected = DataType.VARCHAR;
122         DataType actual = createFactory().createDataType(sqlType, sqlTypeName);
123         assertSame("type", expected, actual);
124     }
125
126     public void testCreateFloatDataType() throws Exception JavaDoc
127     {
128         int sqlType = Types.OTHER;
129         String JavaDoc sqlTypeName = "FLOAT";
130
131         DataType expected = DataType.FLOAT;
132         DataType actual = createFactory().createDataType(sqlType, sqlTypeName);
133         assertSame("type", expected, actual);
134     }
135
136 }
137
Popular Tags