diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2011-11-08 03:01:41 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2011-11-08 03:01:41 +0000 |
commit | eaccccc1358f9af0214a48ba93c05df5b759d091 (patch) | |
tree | 3c5464d0c77e54989bde3396d912445b7547b15f /test | |
parent | 651986878ed45d0bd0f868044c272654407eb598 (diff) | |
download | jackcess-eaccccc1358f9af0214a48ba93c05df5b759d091.tar.gz jackcess-eaccccc1358f9af0214a48ba93c05df5b759d091.zip |
implement complex value deletion
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@589 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test')
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/ComplexColumnTest.java | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/ComplexColumnTest.java b/test/src/java/com/healthmarketscience/jackcess/ComplexColumnTest.java index e4e8a26..f9f4445 100644 --- a/test/src/java/com/healthmarketscience/jackcess/ComplexColumnTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/ComplexColumnTest.java @@ -113,6 +113,38 @@ public class ComplexColumnTest extends TestCase } catch(UnsupportedOperationException expected) { // success } + + checkVersions(3, row3ValFk, "new-value", + "new-value", upTime, + "row3-memo-again", new Date(1315876965382L), + "row3-memo-revised", new Date(1315876953077L), + "row3-memo", new Date(1315876879126L)); + + try { + v.delete(); + fail("UnsupportedOperationException should have been thrown"); + } catch(UnsupportedOperationException expected) { + // success + } + + checkVersions(3, row3ValFk, "new-value", + "new-value", upTime, + "row3-memo-again", new Date(1315876965382L), + "row3-memo-revised", new Date(1315876953077L), + "row3-memo", new Date(1315876879126L)); + + try { + v.getComplexValueForeignKey().deleteAllValues(); + fail("UnsupportedOperationException should have been thrown"); + } catch(UnsupportedOperationException expected) { + // success + } + + checkVersions(3, row3ValFk, "new-value", + "new-value", upTime, + "row3-memo-again", new Date(1315876965382L), + "row3-memo-revised", new Date(1315876953077L), + "row3-memo", new Date(1315876879126L)); db.close(); } @@ -178,6 +210,17 @@ public class ComplexColumnTest extends TestCase assertEquals("xml", updated.getFileType()); assertEquals("some_data.xml", updated.getFileName()); assertTrue(Arrays.equals(newBytes, updated.getFileData())); + + updated.delete(); + checkAttachments(4, row4ValFk, "test_data2.txt"); + row4ValFk.getAttachments().get(0).delete(); + checkAttachments(4, row4ValFk); + + assertTrue(cursor.findRow(t1.getColumn("id"), "row2")); + ComplexValueForeignKey row2ValFk = (ComplexValueForeignKey) + cursor.getCurrentRowValue(col); + row2ValFk.deleteAllValues(); + checkAttachments(2, row2ValFk); db.close(); } @@ -235,6 +278,21 @@ public class ComplexColumnTest extends TestCase v.set("value5"); v.update(); checkMultiValues(2, row2ValFk, "value1", "value4", "value5", "value3"); + + v.delete(); + checkMultiValues(2, row2ValFk, "value1", "value4", "value3"); + row2ValFk.getMultiValues().get(0).delete(); + checkMultiValues(2, row2ValFk, "value4", "value3"); + row2ValFk.getMultiValues().get(1).delete(); + checkMultiValues(2, row2ValFk, "value4"); + row2ValFk.getMultiValues().get(0).delete(); + checkMultiValues(2, row2ValFk); + + assertTrue(cursor.findRow(t1.getColumn("id"), "row3")); + ComplexValueForeignKey row3ValFk = (ComplexValueForeignKey) + cursor.getCurrentRowValue(col); + row3ValFk.deleteAllValues(); + checkMultiValues(3, row3ValFk); db.close(); } |