Search in sources :

Example 1 with SQLInputImpl

use of javax.sql.rowset.serial.SQLInputImpl in project jdk8u_jdk by JetBrains.

the class SQLInputImplTests method test09.

/*
     * Validate a Ref can be read
     */
@Test(enabled = true)
public void test09() throws Exception {
    Ref ref = new StubRef(sqlType, hero);
    Object[] values = { ref };
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Ref ref2 = sqli.readRef();
    assertTrue(ref.getObject().equals(ref2.getObject()));
    assertTrue(ref.getBaseTypeName().equals(ref2.getBaseTypeName()));
}
Also used : StubRef(util.StubRef) StubRef(util.StubRef) Ref(java.sql.Ref) SQLInputImpl(javax.sql.rowset.serial.SQLInputImpl) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 2 with SQLInputImpl

use of javax.sql.rowset.serial.SQLInputImpl in project jdk8u_jdk by JetBrains.

the class SQLInputImplTests method test11.

/*
     * Validate that readObject returns the correct value when a Struct is
     * next on the stream
     */
@Test()
public void test11() throws Exception {
    Object[] attributes = new Object[] { "Bruce", "Wayne", 1939, "Batman" };
    map.put(sqlType, Class.forName("util.SuperHero"));
    Struct struct = new StubStruct(sqlType, attributes);
    Object[] values = { struct };
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Object o = sqli.readObject();
    assertTrue(hero.equals(o));
}
Also used : SQLInputImpl(javax.sql.rowset.serial.SQLInputImpl) StubStruct(util.StubStruct) StubStruct(util.StubStruct) Struct(java.sql.Struct) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 3 with SQLInputImpl

use of javax.sql.rowset.serial.SQLInputImpl in project jdk8u_jdk by JetBrains.

the class SQLInputImplTests method test03.

/*
     * Read in the various datatypes via readSQL (which will exercise the
     * various readXXX methods and validate that results are as expected
     */
@Test()
public void test03() throws Exception {
    impl.readSQL(new SQLInputImpl(typeValues, map), "misc");
    assertTrue(Arrays.equals(impl.toArray(), typeValues));
    // Null out a field and make sure the arrays do not match
    typeValues[2] = null;
    assertFalse(Arrays.equals(impl.toArray(), typeValues));
}
Also used : SQLInputImpl(javax.sql.rowset.serial.SQLInputImpl) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 4 with SQLInputImpl

use of javax.sql.rowset.serial.SQLInputImpl in project jdk8u_jdk by JetBrains.

the class SQLInputImplTests method test04.

/*
     * Validate that wasNull indicates if a null was read in
     */
@Test()
public void test04() throws Exception {
    Object[] values = { "Hello", null, 1 };
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    String s = sqli.readString();
    assertFalse(sqli.wasNull());
    s = sqli.readString();
    assertTrue(sqli.wasNull());
    int i = sqli.readInt();
    assertFalse(sqli.wasNull());
}
Also used : SQLInputImpl(javax.sql.rowset.serial.SQLInputImpl) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 5 with SQLInputImpl

use of javax.sql.rowset.serial.SQLInputImpl in project jdk8u_jdk by JetBrains.

the class SQLInputImplTests method test05.

/*
     * Validate that readObject returns the correct value
     */
@Test()
public void test05() throws Exception {
    Object[] values = { hero };
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Object o = sqli.readObject();
    assertTrue(hero.equals(o));
}
Also used : SQLInputImpl(javax.sql.rowset.serial.SQLInputImpl) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Aggregations

SQLInputImpl (javax.sql.rowset.serial.SQLInputImpl)11 Test (org.testng.annotations.Test)10 BaseTest (util.BaseTest)10 URL (java.net.URL)1 Array (java.sql.Array)1 Blob (java.sql.Blob)1 Clob (java.sql.Clob)1 Ref (java.sql.Ref)1 Struct (java.sql.Struct)1 SerialArray (javax.sql.rowset.serial.SerialArray)1 SerialBlob (javax.sql.rowset.serial.SerialBlob)1 SerialClob (javax.sql.rowset.serial.SerialClob)1 SerialStruct (javax.sql.rowset.serial.SerialStruct)1 StubArray (util.StubArray)1 StubBlob (util.StubBlob)1 StubClob (util.StubClob)1 StubRef (util.StubRef)1 StubStruct (util.StubStruct)1