Author: reschke
Date: Mon Mar 24 13:46:51 2014
New Revision: 1580852
URL: http://svn.apache.org/r1580852
Log:
OAK-1590 - DocumentStore-specific test framework (WIP)
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=1580852&r1=1580851&r2=1580852&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 Mar 24 13:46:51 2014
@@ -53,7 +53,7 @@ public class BasicDocumentStoreTest exte
@Test
public void testAddAndRemove() {
- String id = this.getClass().getName() + "-foobar";
+ String id = this.getClass().getName() + ".testAddAndRemove";
// remove if present
NodeDocument nd = super.ds.find(Collection.NODES, id);
@@ -96,10 +96,38 @@ public class BasicDocumentStoreTest exte
LOG.info("max id length for " + super.dsname + " was " + test);
}
+ @Test
+ public void testMaxProperty() {
+ int min = 0;
+ int max = 1024 * 1024 * 4; // 32M
+ int test = 0;
+
+ while (max - min >= 256) {
+ test = (max + min) / 2;
+ String id = this.getClass().getName() + ".testMaxProperty-" + test;
+ String pval = generateId(test);
+ UpdateOp up = new UpdateOp(id, true);
+ up.set("_id", id);
+ up.set("foo", pval);
+ boolean success = super.ds.create(Collection.NODES,
Collections.singletonList(up));
+ if (success) {
+ // check that we really can read it
+ NodeDocument findme = super.ds.find(Collection.NODES, id, 0);
+ assertNotNull("failed to retrieve previously stored document",
findme);
+ super.ds.remove(Collection.NODES, id);
+ min = test;
+ } else {
+ max = test;
+ }
+ }
+
+ LOG.info("max prop length for " + super.dsname + " was " + test);
+ }
+
private static String generateId(int length) {
StringBuffer buf = new StringBuffer();
while (length-- > 0) {
- buf.append('0' + (length % 10));
+ buf.append('A' + ((int)(26 * Math.random())));
}
return buf.toString();
}