Java Code Examples for javax.sql.rowset.WebRowSet#readXml()

The following examples show how to use javax.sql.rowset.WebRowSet#readXml() . 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 jdk8u60 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 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 4
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 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 5
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 6
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 7
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 8
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 9
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 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 10
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 11
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 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 12
Source File: CommonWebRowSetTests.java    From dragonwell8_jdk 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 13
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 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 14
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 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 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 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 16
Source File: CommonWebRowSetTests.java    From dragonwell8_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 17
Source File: CommonWebRowSetTests.java    From dragonwell8_jdk 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 18
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 19
Source File: CommonWebRowSetTests.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected WebRowSet readWebRowSetWithOInputStreamWithReader(ByteArrayOutputStream baos) throws Exception {
    WebRowSet wrs1 = rsf.createWebRowSet();
    InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(baos.toByteArray()));
    wrs1.readXml(isr);
    return wrs1;
}
 
Example 20
Source File: CommonWebRowSetTests.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected WebRowSet readWebRowSetWithOInputStreamWithReader(ByteArrayOutputStream baos) throws Exception {
    WebRowSet wrs1 = rsf.createWebRowSet();
    InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(baos.toByteArray()));
    wrs1.readXml(isr);
    return wrs1;
}