Search in sources :

Example 6 with SQLInputImpl

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

the class SQLOutputImplTests 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");
    impl.writeSQL(outImpl);
    assertTrue(Arrays.equals(results.toArray(), typeValues));
    // Null out a field and make sure the arrays do not match
    typeValues[2] = null;
    assertFalse(Arrays.equals(results.toArray(), typeValues));
}
Also used : SQLInputImpl(javax.sql.rowset.serial.SQLInputImpl) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 7 with SQLInputImpl

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

the class SQLInputImplTests method test06.

/*
     * Validate a Array can be read
     */
@Test(enabled = true)
public void test06() throws Exception {
    Object[] coffees = new Object[] { "Espresso", "Colombian", "French Roast", "Cappuccino" };
    Array a = new StubArray("VARCHAR", coffees);
    Object[] values = { a };
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Array a2 = sqli.readArray();
    assertTrue(Arrays.equals((Object[]) a2.getArray(), (Object[]) a.getArray()));
    assertTrue(a.getBaseTypeName().equals(a2.getBaseTypeName()));
}
Also used : StubArray(util.StubArray) Array(java.sql.Array) SQLInputImpl(javax.sql.rowset.serial.SQLInputImpl) StubArray(util.StubArray) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 8 with SQLInputImpl

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

the class SQLInputImplTests method test08.

/*
     * Validate a Clob can be read
     */
@Test(enabled = true)
public void test08() throws Exception {
    Clob c = new StubClob();
    Object[] values = { c };
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Clob c2 = sqli.readClob();
    assertTrue(c.getSubString(1, (int) c.length()).equals(c2.getSubString(1, (int) c2.length())));
}
Also used : SQLInputImpl(javax.sql.rowset.serial.SQLInputImpl) StubClob(util.StubClob) StubClob(util.StubClob) Clob(java.sql.Clob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 9 with SQLInputImpl

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

the class SQLInputImplTests method test07.

/*
     * Validate a Blob can be read
     */
@Test(enabled = true)
public void test07() throws Exception {
    Blob b = new StubBlob();
    Object[] values = { b };
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Blob b2 = sqli.readBlob();
    assertTrue(Arrays.equals(b.getBytes(1, (int) b.length()), b2.getBytes(1, (int) b2.length())));
}
Also used : StubBlob(util.StubBlob) Blob(java.sql.Blob) SQLInputImpl(javax.sql.rowset.serial.SQLInputImpl) StubBlob(util.StubBlob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 10 with SQLInputImpl

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

the class SQLInputImplTests method test10.

/*
     * Validate a URL can be read
     */
@Test(enabled = true)
public void test10() throws Exception {
    URL u = new URL("http://www.oracle.com/");
    ;
    Object[] values = { u };
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    URL u2 = sqli.readURL();
    assertTrue(u2.equals(u));
    assertTrue(u2.sameFile(u));
}
Also used : SQLInputImpl(javax.sql.rowset.serial.SQLInputImpl) URL(java.net.URL) 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