You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2014/10/06 16:21:13 UTC
svn commit: r1629670 -
/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java
Author: reschke
Date: Mon Oct 6 14:21:13 2014
New Revision: 1629670
URL: http://svn.apache.org/r1629670
Log:
OAK-1941 - add test that checks that interesting characters round-trip in property values
Modified:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java?rev=1629670&r1=1629669&r2=1629670&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java Mon Oct 6 14:21:13 2014
@@ -157,6 +157,34 @@ public class BasicDocumentStoreTest exte
}
@Test
+ public void testInterestingStrings() {
+ // TODO see OAK-1913
+ Assume.assumeTrue(!(super.dsname.equals("RDB-MySQL")));
+
+ String[] tests = new String[] {
+ "simple:foo", "cr:a\n\b", "dquote:a\"b", "bs:a\\b", "euro:a\u201c", "gclef:\uD834\uDD1E", "tab:a\tb", "nul:a\u0000b"
+ };
+
+ for (String t : tests) {
+ int pos = t.indexOf(":");
+ String testname = t.substring(0, pos);
+ String test = t.substring(pos + 1);
+ String id = this.getClass().getName() + ".testInterestingStrings-" + testname;
+ UpdateOp up = new UpdateOp(id, true);
+ up.set("_id", id);
+ up.set("foo", test);
+ super.ds.remove(Collection.NODES, id);
+ boolean success = super.ds.create(Collection.NODES, Collections.singletonList(up));
+ assertTrue("failed to insert a document with property value of " + test + " in " + super.dsname, success);
+ // re-read from persistence
+ super.ds.invalidateCache();
+ NodeDocument nd = super.ds.find(Collection.NODES, id);
+ assertEquals("failure to round-trip " + testname + " through " + super.dsname, test, nd.get("foo"));
+ super.ds.remove(Collection.NODES, id);
+ }
+ }
+
+ @Test
public void testDeleteNonExisting() {
String id = this.getClass().getName() + ".testDeleteNonExisting-" + UUID.randomUUID();
// delete is best effort