javax.sql.rowset.WebRowSet Java Examples

The following examples show how to use javax.sql.rowset.WebRowSet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommonWebRowSetTests.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0010(WebRowSet wrs1) throws Exception {
    FileInputStream fis = new FileInputStream(UPDATED_COFFEE_ROWS_XML);
    wrs1.readXml(fis);
    assertTrue(wrs1.size() == COFFEES_ROWS);
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    wrs1.beforeFirst();
    while (wrs1.next()) {
        if (wrs1.getInt(1) == 3) {
            assertTrue(wrs1.rowUpdated());
            assertTrue(wrs1.getInt(5) == 21 && wrs1.getInt(6) == 69);
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowInserted());
        } else {
            assertFalse(wrs1.rowUpdated());
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowInserted());
        }
    }
    wrs1.close();
}
 
Example #2
Source File: CommonWebRowSetTests.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0011(WebRowSet wrs1) throws Exception {
    int expectedSize = COFFEES_ROWS + 2;
    int addedRowPK = 15;
    int addedRowPK2 = 20;
    Object[] expected = Arrays.copyOf(COFFEES_PRIMARY_KEYS, expectedSize);
    expected[expectedSize - 2] = addedRowPK;
    expected[expectedSize - 1] = addedRowPK2;
    FileInputStream fis = new FileInputStream(INSERTED_COFFEE_ROWS_XML);
    wrs1.readXml(fis);
    assertTrue(wrs1.size() == expectedSize);
    assertEqualsNoOrder(getPrimaryKeys(wrs1), expected);
    wrs1.beforeFirst();
    while (wrs1.next()) {
        if (wrs1.getInt(1) == 15 || wrs1.getInt(1) == 20) {
            assertTrue(wrs1.rowInserted());
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowUpdated());
        } else {
            assertFalse(wrs1.rowInserted());
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowUpdated());
        }
    }
    wrs1.close();
}
 
Example #3
Source File: CommonWebRowSetTests.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0011(WebRowSet wrs1) throws Exception {
    int expectedSize = COFFEES_ROWS + 2;
    int addedRowPK = 15;
    int addedRowPK2 = 20;
    Object[] expected = Arrays.copyOf(COFFEES_PRIMARY_KEYS, expectedSize);
    expected[expectedSize - 2] = addedRowPK;
    expected[expectedSize - 1] = addedRowPK2;
    FileInputStream fis = new FileInputStream(INSERTED_COFFEE_ROWS_XML);
    wrs1.readXml(fis);
    assertTrue(wrs1.size() == expectedSize);
    assertEqualsNoOrder(getPrimaryKeys(wrs1), expected);
    wrs1.beforeFirst();
    while (wrs1.next()) {
        if (wrs1.getInt(1) == 15 || wrs1.getInt(1) == 20) {
            assertTrue(wrs1.rowInserted());
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowUpdated());
        } else {
            assertFalse(wrs1.rowInserted());
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowUpdated());
        }
    }
    wrs1.close();
}
 
Example #4
Source File: CommonWebRowSetTests.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0010(WebRowSet wrs1) throws Exception {
    FileInputStream fis = new FileInputStream(UPDATED_COFFEE_ROWS_XML);
    wrs1.readXml(fis);
    assertTrue(wrs1.size() == COFFEES_ROWS);
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    wrs1.beforeFirst();
    while (wrs1.next()) {
        if (wrs1.getInt(1) == 3) {
            assertTrue(wrs1.rowUpdated());
            assertTrue(wrs1.getInt(5) == 21 && wrs1.getInt(6) == 69);
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowInserted());
        } else {
            assertFalse(wrs1.rowUpdated());
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowInserted());
        }
    }
    wrs1.close();
}
 
Example #5
Source File: CommonWebRowSetTests.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0011(WebRowSet wrs1) throws Exception {
    int expectedSize = COFFEES_ROWS + 2;
    int addedRowPK = 15;
    int addedRowPK2 = 20;
    Object[] expected = Arrays.copyOf(COFFEES_PRIMARY_KEYS, expectedSize);
    expected[expectedSize - 2] = addedRowPK;
    expected[expectedSize - 1] = addedRowPK2;
    FileInputStream fis = new FileInputStream(INSERTED_COFFEE_ROWS_XML);
    wrs1.readXml(fis);
    assertTrue(wrs1.size() == expectedSize);
    assertEqualsNoOrder(getPrimaryKeys(wrs1), expected);
    wrs1.beforeFirst();
    while (wrs1.next()) {
        if (wrs1.getInt(1) == 15 || wrs1.getInt(1) == 20) {
            assertTrue(wrs1.rowInserted());
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowUpdated());
        } else {
            assertFalse(wrs1.rowInserted());
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowUpdated());
        }
    }
    wrs1.close();
}
 
Example #6
Source File: CommonWebRowSetTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0010(WebRowSet wrs1) throws Exception {
    FileInputStream fis = new FileInputStream(UPDATED_COFFEE_ROWS_XML);
    wrs1.readXml(fis);
    assertTrue(wrs1.size() == COFFEES_ROWS);
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    wrs1.beforeFirst();
    while (wrs1.next()) {
        if (wrs1.getInt(1) == 3) {
            assertTrue(wrs1.rowUpdated());
            assertTrue(wrs1.getInt(5) == 21 && wrs1.getInt(6) == 69);
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowInserted());
        } else {
            assertFalse(wrs1.rowUpdated());
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowInserted());
        }
    }
    wrs1.close();
}
 
Example #7
Source File: CommonWebRowSetTests.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0010(WebRowSet wrs1) throws Exception {
    FileInputStream fis = new FileInputStream(UPDATED_COFFEE_ROWS_XML);
    wrs1.readXml(fis);
    assertTrue(wrs1.size() == COFFEES_ROWS);
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    wrs1.beforeFirst();
    while (wrs1.next()) {
        if (wrs1.getInt(1) == 3) {
            assertTrue(wrs1.rowUpdated());
            assertTrue(wrs1.getInt(5) == 21 && wrs1.getInt(6) == 69);
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowInserted());
        } else {
            assertFalse(wrs1.rowUpdated());
            assertFalse(wrs1.rowDeleted());
            assertFalse(wrs1.rowInserted());
        }
    }
    wrs1.close();
}
 
Example #8
Source File: CommonWebRowSetTests.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected WebRowSet readWebRowSetWithOInputStream(ByteArrayOutputStream baos) throws Exception {
    WebRowSet wrs1 = rsf.createWebRowSet();
    try (ObjectInputStream ois
            = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
        wrs1.readXml(ois);
    }
    return wrs1;
}
 
Example #9
Source File: CommonWebRowSetTests.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected ByteArrayOutputStream writeWebRowSetWithOutputStream(ResultSet rs) throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
        WebRowSet wrs = rsf.createWebRowSet();
        wrs.writeXml(rs, oos);
    }
    return baos;
}
 
Example #10
Source File: CommonWebRowSetTests.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0001(WebRowSet wrs1) throws Exception {

    try (FileReader fr = new FileReader(COFFEE_ROWS_XML)) {
        wrs1.readXml(fr);
    }
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    assertEquals(wrs1.size(), COFFEES_ROWS);
    wrs1.close();

}
 
Example #11
Source File: CommonWebRowSetTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected ByteArrayOutputStream writeWebRowSetWithOutputStream(WebRowSet rs) throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
        rs.writeXml(oos);
    }
    return baos;
}
 
Example #12
Source File: CommonWebRowSetTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0001(WebRowSet wrs1) throws Exception {

    try (FileReader fr = new FileReader(COFFEE_ROWS_XML)) {
        wrs1.readXml(fr);
    }
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    assertEquals(wrs1.size(), COFFEES_ROWS);
    wrs1.close();

}
 
Example #13
Source File: CommonWebRowSetTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowsetUsingCoffees")
public void WebRowSetTest0003(WebRowSet wrs) throws Exception {
    ByteArrayOutputStream baos = writeWebRowSetWithOutputStream(wrs);
    try (WebRowSet wrs1 = readWebRowSetWithOInputStream(baos)) {
        assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
        assertEquals(wrs1.size(), COFFEES_ROWS);
    }
}
 
Example #14
Source File: CommonWebRowSetTests.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowsetUsingCoffees")
public void WebRowSetTest0006(WebRowSet wrs) throws Exception {
    ResultSet rs = wrs;
    rs.beforeFirst();
    ByteArrayOutputStream baos = writeWebRowSetWithOutputStreamWithWriter(rs);
    try (WebRowSet wrs1 = readWebRowSetWithOInputStreamWithReader(baos)) {
        assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
        assertEquals(wrs1.size(), COFFEES_ROWS);
    }
}
 
Example #15
Source File: CommonWebRowSetTests.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0012(WebRowSet wrs1) throws Exception {
    int expectedSize = COFFEES_ROWS + 1;
    int addedRowPK = 100;
    Object[] expected = Arrays.copyOf(COFFEES_PRIMARY_KEYS, expectedSize);
    expected[expectedSize - 1] = addedRowPK;
    FileInputStream fis = new FileInputStream(UPDATED_INSERTED_COFFEE_ROWS_XML);
    wrs1.readXml(fis);
    assertTrue(wrs1.size() == expectedSize);
    assertEquals(getPrimaryKeys(wrs1), expected);
    wrs1.beforeFirst();
    while (wrs1.next()) {
        if (wrs1.getInt(1) == addedRowPK) {
            // Row that was inserted and updated
            assertTrue(wrs1.rowUpdated());
            assertTrue(
                    wrs1.getBigDecimal(4).equals(BigDecimal.valueOf(12.99))
                    && wrs1.getInt(6) == 125);
            assertFalse(wrs1.rowDeleted());
            assertTrue(wrs1.rowInserted());
        } else {
            // Remaining rows should only be inserted
            assertFalse(wrs1.rowUpdated());
            assertFalse(wrs1.rowDeleted());
            assertTrue(wrs1.rowInserted());
        }
    }
    wrs1.close();
}
 
Example #16
Source File: CommonWebRowSetTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0008(WebRowSet wrs1) throws Exception {
    FileInputStream fis = new FileInputStream(COFFEE_ROWS_XML);
    wrs1.readXml(fis);
    assertTrue(wrs1.size() == COFFEES_ROWS);
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    // Validate that the rows are not marked as deleted, inserted or updated
    wrs1.beforeFirst();
    while (wrs1.next()) {
        assertFalse(wrs1.rowDeleted());
        assertFalse(wrs1.rowInserted());
        assertFalse(wrs1.rowUpdated());
    }
    wrs1.close();
}
 
Example #17
Source File: CommonWebRowSetTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0008(WebRowSet wrs1) throws Exception {
    FileInputStream fis = new FileInputStream(COFFEE_ROWS_XML);
    wrs1.readXml(fis);
    assertTrue(wrs1.size() == COFFEES_ROWS);
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    // Validate that the rows are not marked as deleted, inserted or updated
    wrs1.beforeFirst();
    while (wrs1.next()) {
        assertFalse(wrs1.rowDeleted());
        assertFalse(wrs1.rowInserted());
        assertFalse(wrs1.rowUpdated());
    }
    wrs1.close();
}
 
Example #18
Source File: CommonWebRowSetTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected ByteArrayOutputStream writeWebRowSetWithOutputStream(ResultSet rs) throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
        WebRowSet wrs = rsf.createWebRowSet();
        wrs.writeXml(rs, oos);
    }
    return baos;
}
 
Example #19
Source File: CommonWebRowSetTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected ByteArrayOutputStream writeWebRowSetWithOutputStreamWithWriter(ResultSet rs) throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    OutputStreamWriter osw = new OutputStreamWriter(baos);
    WebRowSet wrs = rsf.createWebRowSet();
    wrs.writeXml(rs, osw);
    return baos;
}
 
Example #20
Source File: CommonWebRowSetTests.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0002(WebRowSet wrs1) throws Exception {
    try (FileInputStream fis = new FileInputStream(COFFEE_ROWS_XML)) {
        wrs1.readXml(fis);
    }
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    assertEquals(wrs1.size(), COFFEES_ROWS);
    wrs1.close();
}
 
Example #21
Source File: CommonWebRowSetTests.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0001(WebRowSet wrs1) throws Exception {

    try (FileReader fr = new FileReader(COFFEE_ROWS_XML)) {
        wrs1.readXml(fr);
    }
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    assertEquals(wrs1.size(), COFFEES_ROWS);
    wrs1.close();

}
 
Example #22
Source File: CommonWebRowSetTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowsetUsingCoffees")
public void WebRowSetTest0003(WebRowSet wrs) throws Exception {
    ByteArrayOutputStream baos = writeWebRowSetWithOutputStream(wrs);
    try (WebRowSet wrs1 = readWebRowSetWithOInputStream(baos)) {
        assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
        assertEquals(wrs1.size(), COFFEES_ROWS);
    }
}
 
Example #23
Source File: CommonWebRowSetTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0002(WebRowSet wrs1) throws Exception {
    try (FileInputStream fis = new FileInputStream(COFFEE_ROWS_XML)) {
        wrs1.readXml(fis);
    }
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    assertEquals(wrs1.size(), COFFEES_ROWS);
    wrs1.close();
}
 
Example #24
Source File: CommonWebRowSetTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0012(WebRowSet wrs1) throws Exception {
    int expectedSize = COFFEES_ROWS + 1;
    int addedRowPK = 100;
    Object[] expected = Arrays.copyOf(COFFEES_PRIMARY_KEYS, expectedSize);
    expected[expectedSize - 1] = addedRowPK;
    FileInputStream fis = new FileInputStream(UPDATED_INSERTED_COFFEE_ROWS_XML);
    wrs1.readXml(fis);
    assertTrue(wrs1.size() == expectedSize);
    assertEquals(getPrimaryKeys(wrs1), expected);
    wrs1.beforeFirst();
    while (wrs1.next()) {
        if (wrs1.getInt(1) == addedRowPK) {
            // Row that was inserted and updated
            assertTrue(wrs1.rowUpdated());
            assertTrue(
                    wrs1.getBigDecimal(4).equals(BigDecimal.valueOf(12.99))
                    && wrs1.getInt(6) == 125);
            assertFalse(wrs1.rowDeleted());
            assertTrue(wrs1.rowInserted());
        } else {
            // Remaining rows should only be inserted
            assertFalse(wrs1.rowUpdated());
            assertFalse(wrs1.rowDeleted());
            assertTrue(wrs1.rowInserted());
        }
    }
    wrs1.close();
}
 
Example #25
Source File: CommonWebRowSetTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected ByteArrayOutputStream writeWebRowSetWithOutputStream(ResultSet rs) throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
        WebRowSet wrs = rsf.createWebRowSet();
        wrs.writeXml(rs, oos);
    }
    return baos;
}
 
Example #26
Source File: CommonWebRowSetTests.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0008(WebRowSet wrs1) throws Exception {
    FileInputStream fis = new FileInputStream(COFFEE_ROWS_XML);
    wrs1.readXml(fis);
    assertTrue(wrs1.size() == COFFEES_ROWS);
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    // Validate that the rows are not marked as deleted, inserted or updated
    wrs1.beforeFirst();
    while (wrs1.next()) {
        assertFalse(wrs1.rowDeleted());
        assertFalse(wrs1.rowInserted());
        assertFalse(wrs1.rowUpdated());
    }
    wrs1.close();
}
 
Example #27
Source File: CommonWebRowSetTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected ByteArrayOutputStream writeWebRowSetWithOutputStream(ResultSet rs) throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
        WebRowSet wrs = rsf.createWebRowSet();
        wrs.writeXml(rs, oos);
    }
    return baos;
}
 
Example #28
Source File: CommonWebRowSetTests.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowsetUsingCoffees")
public void WebRowSetTest0005(WebRowSet wrs) throws Exception {
    ByteArrayOutputStream baos = writeWebRowSetWithOutputStreamWithWriter(wrs);
    try (WebRowSet wrs1 = readWebRowSetWithOInputStreamWithReader(baos)) {
        assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
        assertEquals(wrs1.size(), COFFEES_ROWS);
    }
}
 
Example #29
Source File: CommonWebRowSetTests.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowsetUsingCoffees")
public void WebRowSetTest0005(WebRowSet wrs) throws Exception {
    ByteArrayOutputStream baos = writeWebRowSetWithOutputStreamWithWriter(wrs);
    try (WebRowSet wrs1 = readWebRowSetWithOInputStreamWithReader(baos)) {
        assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
        assertEquals(wrs1.size(), COFFEES_ROWS);
    }
}
 
Example #30
Source File: CommonWebRowSetTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "rowSetType")
public void WebRowSetTest0002(WebRowSet wrs1) throws Exception {
    try (FileInputStream fis = new FileInputStream(COFFEE_ROWS_XML)) {
        wrs1.readXml(fis);
    }
    assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
    assertEquals(wrs1.size(), COFFEES_ROWS);
    wrs1.close();
}