Search in sources :

Example 1 with StubStruct

use of util.StubStruct 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 2 with StubStruct

use of util.StubStruct in project jdk8u_jdk by JetBrains.

the class SerialStructTests method setUpMethod.

@BeforeMethod
public void setUpMethod() throws Exception {
    attributes = new Object[] { "Bruce", "Wayne", 1939, "Batman" };
    map.put(sqlType, Class.forName("util.SuperHero"));
    struct = new StubStruct(sqlType, attributes);
    hero = new SuperHero(sqlType, "Bruce", "Wayne", 1939, "Batman");
}
Also used : SuperHero(util.SuperHero) StubStruct(util.StubStruct) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 3 with StubStruct

use of util.StubStruct in project jdk8u_jdk by JetBrains.

the class SQLOutputImplTests method test08.

/*
     * Validate a Struct can be written and returned
     */
@Test(enabled = true)
public void test08() throws Exception {
    Object[] attributes = new Object[] { "Bruce", "Wayne", 1939, "Batman" };
    Struct s = new StubStruct(sqlType, attributes);
    outImpl.writeStruct(s);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
Also used : StubStruct(util.StubStruct) StubStruct(util.StubStruct) Struct(java.sql.Struct) SerialStruct(javax.sql.rowset.serial.SerialStruct) SerialStruct(javax.sql.rowset.serial.SerialStruct) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Aggregations

StubStruct (util.StubStruct)3 Struct (java.sql.Struct)2 Test (org.testng.annotations.Test)2 BaseTest (util.BaseTest)2 SQLInputImpl (javax.sql.rowset.serial.SQLInputImpl)1 SerialStruct (javax.sql.rowset.serial.SerialStruct)1 BeforeMethod (org.testng.annotations.BeforeMethod)1 SuperHero (util.SuperHero)1