Search in sources :

Example 1 with StubBaseRowSet

use of util.StubBaseRowSet in project jdk8u_jdk by JetBrains.

the class BaseRowSetTests method baseRowSetTest0011.

/*
     * Validate setNull specifying the supported type values
     */
@Test(dataProvider = "jdbcTypes")
public void baseRowSetTest0011(Integer type) throws Exception {
    brs = new StubBaseRowSet();
    brs.setNull(1, type);
    assertTrue(checkNullParam(1, type, null));
}
Also used : StubBaseRowSet(util.StubBaseRowSet) Test(org.testng.annotations.Test)

Example 2 with StubBaseRowSet

use of util.StubBaseRowSet in project jdk8u_jdk by JetBrains.

the class BaseRowSetTests method testAdvancedParameters.

/*
     * DataProvider used to set advanced parameters for types that are supported
     */
@DataProvider(name = "testAdvancedParameters")
private Object[][] testAdvancedParameters() throws SQLException {
    byte[] bytes = new byte[10];
    Ref aRef = new SerialRef(new StubRef("INTEGER", query));
    Array aArray = new SerialArray(new StubArray("INTEGER", new Object[1]));
    Blob aBlob = new SerialBlob(new StubBlob());
    Clob aClob = new SerialClob(new StubClob());
    Reader rdr = new StringReader(query);
    InputStream is = new StringBufferInputStream(query);
    ;
    brs = new StubBaseRowSet();
    brs.setBytes(1, bytes);
    brs.setAsciiStream(2, is, query.length());
    brs.setRef(3, aRef);
    brs.setArray(4, aArray);
    brs.setBlob(5, aBlob);
    brs.setClob(6, aClob);
    brs.setBinaryStream(7, is, query.length());
    brs.setUnicodeStream(8, is, query.length());
    brs.setCharacterStream(9, rdr, query.length());
    return new Object[][] { { 1, bytes }, { 2, is }, { 3, aRef }, { 4, aArray }, { 5, aBlob }, { 6, aClob }, { 7, is }, { 8, is }, { 9, rdr } };
}
Also used : SerialArray(javax.sql.rowset.serial.SerialArray) StubBlob(util.StubBlob) SerialBlob(javax.sql.rowset.serial.SerialBlob) Blob(java.sql.Blob) StringBufferInputStream(java.io.StringBufferInputStream) InputStream(java.io.InputStream) Reader(java.io.Reader) StringReader(java.io.StringReader) SerialBlob(javax.sql.rowset.serial.SerialBlob) StubClob(util.StubClob) StubBlob(util.StubBlob) SerialClob(javax.sql.rowset.serial.SerialClob) StubRef(util.StubRef) StubArray(util.StubArray) Array(java.sql.Array) SerialArray(javax.sql.rowset.serial.SerialArray) StubRef(util.StubRef) SerialRef(javax.sql.rowset.serial.SerialRef) Ref(java.sql.Ref) StringBufferInputStream(java.io.StringBufferInputStream) StringReader(java.io.StringReader) StubBaseRowSet(util.StubBaseRowSet) SerialRef(javax.sql.rowset.serial.SerialRef) Clob(java.sql.Clob) StubClob(util.StubClob) SerialClob(javax.sql.rowset.serial.SerialClob) StubArray(util.StubArray) DataProvider(org.testng.annotations.DataProvider)

Example 3 with StubBaseRowSet

use of util.StubBaseRowSet in project jdk8u_jdk by JetBrains.

the class BaseRowSetTests method testBaseParameters.

/*
     * DataProvider used to set parameters for basic types that are supported
     */
@DataProvider(name = "testBaseParameters")
private Object[][] testBaseParameters() throws SQLException {
    Integer aInt = 1;
    Long aLong = Long.MAX_VALUE;
    Short aShort = Short.MIN_VALUE;
    BigDecimal bd = BigDecimal.ONE;
    Double aDouble = Double.MAX_VALUE;
    Date aDate = Date.valueOf(LocalDate.now());
    Time aTime = Time.valueOf(LocalTime.now());
    Timestamp aTimeStamp = Timestamp.valueOf(LocalDateTime.now());
    Calendar cal = Calendar.getInstance();
    Boolean aBoolean = true;
    Float aFloat = 1.5f;
    Byte aByte = 1;
    brs = new StubBaseRowSet();
    brs.setInt(1, aInt);
    brs.setString(2, query);
    brs.setLong(3, aLong);
    brs.setBoolean(4, aBoolean);
    brs.setShort(5, aShort);
    brs.setDouble(6, aDouble);
    brs.setBigDecimal(7, bd);
    brs.setFloat(8, aFloat);
    brs.setByte(9, aByte);
    brs.setDate(10, aDate);
    brs.setTime(11, aTime);
    brs.setTimestamp(12, aTimeStamp);
    brs.setDate(13, aDate, cal);
    brs.setTime(14, aTime, cal);
    brs.setTimestamp(15, aTimeStamp);
    brs.setObject(16, query);
    brs.setObject(17, query, Types.CHAR);
    brs.setObject(18, query, Types.CHAR, 0);
    return new Object[][] { { 1, aInt }, { 2, query }, { 3, aLong }, { 4, aBoolean }, { 5, aShort }, { 6, aDouble }, { 7, bd }, { 8, aFloat }, { 9, aByte }, { 10, aDate }, { 11, aTime }, { 12, aTimeStamp }, { 13, aDate }, { 14, aTime }, { 15, aTimeStamp }, { 16, query }, { 17, query }, { 18, query } };
}
Also used : Calendar(java.util.Calendar) Time(java.sql.Time) LocalDateTime(java.time.LocalDateTime) LocalTime(java.time.LocalTime) Timestamp(java.sql.Timestamp) BigDecimal(java.math.BigDecimal) Date(java.sql.Date) LocalDate(java.time.LocalDate) StubBaseRowSet(util.StubBaseRowSet) DataProvider(org.testng.annotations.DataProvider)

Example 4 with StubBaseRowSet

use of util.StubBaseRowSet in project jdk8u_jdk by JetBrains.

the class BaseRowSetTests method baseRowSetTest0013.

/*
     *  Validate that setDate sets the specified Calendar internally
     */
@Test()
public void baseRowSetTest0013() throws Exception {
    Calendar cal = Calendar.getInstance();
    brs = new StubBaseRowSet();
    brs.setDate(1, Date.valueOf(LocalDate.now()), cal);
    assertTrue(checkCalendarParam(1, cal));
}
Also used : Calendar(java.util.Calendar) StubBaseRowSet(util.StubBaseRowSet) Test(org.testng.annotations.Test)

Example 5 with StubBaseRowSet

use of util.StubBaseRowSet in project jdk8u_jdk by JetBrains.

the class BaseRowSetTests method baseRowSetTest0015.

/*
     *  Validate that setTimestamp sets the specified Calendar internally
     */
@Test()
public void baseRowSetTest0015() throws Exception {
    Calendar cal = Calendar.getInstance();
    brs = new StubBaseRowSet();
    brs.setTimestamp(1, Timestamp.valueOf(LocalDateTime.now()), cal);
    assertTrue(checkCalendarParam(1, cal));
}
Also used : Calendar(java.util.Calendar) StubBaseRowSet(util.StubBaseRowSet) Test(org.testng.annotations.Test)

Aggregations

StubBaseRowSet (util.StubBaseRowSet)7 Test (org.testng.annotations.Test)5 Calendar (java.util.Calendar)4 DataProvider (org.testng.annotations.DataProvider)2 InputStream (java.io.InputStream)1 Reader (java.io.Reader)1 StringBufferInputStream (java.io.StringBufferInputStream)1 StringReader (java.io.StringReader)1 BigDecimal (java.math.BigDecimal)1 Array (java.sql.Array)1 Blob (java.sql.Blob)1 Clob (java.sql.Clob)1 Date (java.sql.Date)1 Ref (java.sql.Ref)1 Time (java.sql.Time)1 Timestamp (java.sql.Timestamp)1 LocalDate (java.time.LocalDate)1 LocalDateTime (java.time.LocalDateTime)1 LocalTime (java.time.LocalTime)1 SerialArray (javax.sql.rowset.serial.SerialArray)1