Author: mreutegg
Date: Fri Feb 21 22:16:08 2014
New Revision: 1570725
URL: http://svn.apache.org/r1570725
Log:
OAK-1461: Merge DocumentNodeState with Node
- remove obsolete Node interface
Removed:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Node.java
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MeasureMemory.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDocumentStoreTest.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/SimpleTest.java
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java?rev=1570725&r1=1570724&r2=1570725&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
Fri Feb 21 22:16:08 2014
@@ -109,7 +109,7 @@ public class Commit {
return baseRevision;
}
- void addNodeDiff(Node n) {
+ void addNodeDiff(DocumentNodeState n) {
diff.tag('+').key(n.getPath());
diff.object();
n.append(diff, false);
@@ -134,7 +134,7 @@ public class Commit {
op.setMapEntry(key, revision, value);
}
- void addNode(Node n) {
+ void addNode(DocumentNodeState n) {
String path = n.getPath();
if (operations.containsKey(path)) {
String msg = "Node already added: " + path;
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java?rev=1570725&r1=1570724&r2=1570725&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
Fri Feb 21 22:16:08 2014
@@ -39,7 +39,7 @@ import org.apache.jackrabbit.oak.cache.C
import org.apache.jackrabbit.oak.cache.CacheValue;
import org.apache.jackrabbit.oak.cache.EmpiricalWeigher;
import org.apache.jackrabbit.oak.commons.PathUtils;
-import org.apache.jackrabbit.oak.plugins.document.Node.Children;
+import org.apache.jackrabbit.oak.plugins.document.DocumentNodeState.Children;
import org.apache.jackrabbit.oak.plugins.document.mongo.MongoBlobStore;
import org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore;
import org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentStore;
@@ -171,7 +171,7 @@ public class DocumentMK implements Micro
}
revisionId = revisionId != null ? revisionId :
nodeStore.getHeadRevision().toString();
Revision rev = Revision.fromString(revisionId);
- Node n = nodeStore.getNode(path, rev);
+ DocumentNodeState n = nodeStore.getNode(path, rev);
return n != null;
}
@@ -191,7 +191,7 @@ public class DocumentMK implements Micro
}
revisionId = revisionId != null ? revisionId :
nodeStore.getHeadRevision().toString();
Revision rev = Revision.fromString(revisionId);
- Node n = nodeStore.getNode(path, rev);
+ DocumentNodeState n = nodeStore.getNode(path, rev);
if (n == null) {
return null;
}
@@ -355,7 +355,7 @@ public class DocumentMK implements Micro
parseAddNode(commit, t, path);
break;
case '-':
- Node toRemove = nodeStore.getNode(path,
commit.getBaseRevision());
+ DocumentNodeState toRemove = nodeStore.getNode(path,
commit.getBaseRevision());
if (toRemove == null) {
throw new MicroKernelException("Node not found: " +
path + " in revision " + baseRevId);
}
@@ -383,7 +383,7 @@ public class DocumentMK implements Micro
if (!PathUtils.isAbsolute(targetPath)) {
targetPath = PathUtils.concat(rootPath, targetPath);
}
- Node source = nodeStore.getNode(path, baseRev);
+ DocumentNodeState source = nodeStore.getNode(path,
baseRev);
if (source == null) {
throw new MicroKernelException("Node not found: " +
path + " in revision " + baseRevId);
} else if (nodeExists(targetPath, baseRevId)) {
@@ -400,7 +400,7 @@ public class DocumentMK implements Micro
if (!PathUtils.isAbsolute(targetPath)) {
targetPath = PathUtils.concat(rootPath, targetPath);
}
- Node source = nodeStore.getNode(path, baseRev);
+ DocumentNodeState source = nodeStore.getNode(path,
baseRev);
if (source == null) {
throw new MicroKernelException("Node not found: " +
path + " in revision " + baseRevId);
} else if (nodeExists(targetPath, baseRevId)) {
@@ -417,7 +417,7 @@ public class DocumentMK implements Micro
}
private void parseAddNode(Commit commit, JsopReader t, String path) {
- Node n = new DocumentNodeState(nodeStore, path, commit.getRevision());
+ DocumentNodeState n = new DocumentNodeState(nodeStore, path,
commit.getRevision());
if (!t.matches('}')) {
do {
String key = t.readString();
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java?rev=1570725&r1=1570724&r2=1570725&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
Fri Feb 21 22:16:08 2014
@@ -16,6 +16,7 @@
*/
package org.apache.jackrabbit.oak.plugins.document;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;
@@ -26,6 +27,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.cache.CacheValue;
import org.apache.jackrabbit.oak.commons.json.JsopBuilder;
import org.apache.jackrabbit.oak.commons.json.JsopReader;
import org.apache.jackrabbit.oak.commons.json.JsopTokenizer;
@@ -55,7 +57,9 @@ import static org.apache.jackrabbit.oak.
/**
* A {@link NodeState} implementation for the {@link DocumentNodeStore}.
*/
-class DocumentNodeState extends AbstractNodeState implements Node {
+class DocumentNodeState extends AbstractNodeState implements CacheValue {
+
+ public static final Children NO_CHILDREN = new Children();
/**
* The number of child nodes to fetch initially.
@@ -193,7 +197,7 @@ class DocumentNodeState extends Abstract
// count all
return Iterators.size(new ChildNodeEntryIterator());
}
- Node.Children c = store.getChildren(this, null, (int) max);
+ Children c = store.getChildren(this, null, (int) max);
if (c.hasMore) {
return Long.MAX_VALUE;
} else {
@@ -253,10 +257,7 @@ class DocumentNodeState extends Abstract
return super.compareAgainstBaseState(base, diff);
}
- //----------------------------< Node
>--------------------------------------
-
- @Override
- public void setProperty(String propertyName, String value) {
+ void setProperty(String propertyName, String value) {
if (value == null) {
properties.remove(propertyName);
} else {
@@ -265,13 +266,11 @@ class DocumentNodeState extends Abstract
}
}
- @Override
- public void setProperty(PropertyState property) {
+ void setProperty(PropertyState property) {
properties.put(property.getName(), property);
}
- @Override
- public String getPropertyAsString(String propertyName) {
+ String getPropertyAsString(String propertyName) {
PropertyState prop = properties.get(propertyName);
if (prop == null) {
return null;
@@ -281,20 +280,15 @@ class DocumentNodeState extends Abstract
return builder.toString();
}
- @Override
- public Set<String> getPropertyNames() {
+ Set<String> getPropertyNames() {
return properties.keySet();
}
- @Override
- public void copyTo(Node newNode) {
- for (Map.Entry<String, PropertyState> entry : properties.entrySet()) {
- newNode.setProperty(entry.getValue());
- }
+ void copyTo(DocumentNodeState newNode) {
+ newNode.properties.putAll(properties);
}
- @Override
- public boolean hasNoChildren() {
+ boolean hasNoChildren() {
return !hasChildren;
}
@@ -311,8 +305,7 @@ class DocumentNodeState extends Abstract
/**
* Create an add node operation for this node.
*/
- @Override
- public UpdateOp asOperation(boolean isNew) {
+ UpdateOp asOperation(boolean isNew) {
String id = Utils.getIdFromPath(path);
UpdateOp op = new UpdateOp(id, isNew);
op.set(Document.ID, id);
@@ -325,18 +318,15 @@ class DocumentNodeState extends Abstract
return op;
}
- @Override
- public String getPath() {
+ String getPath() {
return path;
}
- @Override
- public String getId() {
+ String getId() {
return path + "@" + lastRevision;
}
- @Override
- public void append(JsopWriter json, boolean includeId) {
+ void append(JsopWriter json, boolean includeId) {
if (includeId) {
json.key(":id").value(getId());
}
@@ -345,13 +335,11 @@ class DocumentNodeState extends Abstract
}
}
- @Override
- public void setLastRevision(Revision lastRevision) {
+ void setLastRevision(Revision lastRevision) {
this.lastRevision = lastRevision;
}
- @Override
- public Revision getLastRevision() {
+ Revision getLastRevision() {
return lastRevision;
}
@@ -490,6 +478,29 @@ class DocumentNodeState extends Abstract
});
}
+ /**
+ * A list of children for a node.
+ */
+ public static class Children implements CacheValue {
+
+ final ArrayList<String> children = new ArrayList<String>();
+ boolean hasMore;
+
+ @Override
+ public int getMemory() {
+ int size = 114;
+ for (String c : children) {
+ size += c.length() * 2 + 56;
+ }
+ return size;
+ }
+
+ @Override
+ public String toString() {
+ return children.toString();
+ }
+ }
+
private class ChildNodeEntryIterator implements Iterator<ChildNodeEntry> {
private String previousName;
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java?rev=1570725&r1=1570724&r2=1570725&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
Fri Feb 21 22:16:08 2014
@@ -234,7 +234,7 @@ public final class DocumentNodeStore
*
* Key: PathRev, value: Children
*/
- private final Cache<CacheValue, Node.Children> nodeChildrenCache;
+ private final Cache<CacheValue, DocumentNodeState.Children>
nodeChildrenCache;
private final CacheStats nodeChildrenCacheStats;
/**
@@ -315,19 +315,19 @@ public final class DocumentNodeStore
//TODO Make stats collection configurable as it add slight overhead
nodeCache = builder.buildCache(builder.getNodeCacheSize());
- nodeCacheStats = new CacheStats(nodeCache, "DocumentMk-Node",
+ nodeCacheStats = new CacheStats(nodeCache, "Document-NodeState",
builder.getWeigher(), builder.getNodeCacheSize());
nodeChildrenCache = builder.buildCache(builder.getChildrenCacheSize());
- nodeChildrenCacheStats = new CacheStats(nodeChildrenCache,
"DocumentMk-NodeChildren",
+ nodeChildrenCacheStats = new CacheStats(nodeChildrenCache,
"Document-NodeChildren",
builder.getWeigher(), builder.getChildrenCacheSize());
docChildrenCache =
builder.buildCache(builder.getDocChildrenCacheSize());
- docChildrenCacheStats = new CacheStats(docChildrenCache,
"DocumentMk-DocChildren",
+ docChildrenCacheStats = new CacheStats(docChildrenCache,
"Document-DocChildren",
builder.getWeigher(), builder.getDocChildrenCacheSize());
diffCache = builder.buildCache(builder.getDiffCacheSize());
- diffCacheStats = new CacheStats(diffCache, "DocumentMk-DiffCache",
+ diffCacheStats = new CacheStats(diffCache, "Document-Diff",
builder.getWeigher(), builder.getDiffCacheSize());
// check if root node exists
@@ -335,7 +335,7 @@ public final class DocumentNodeStore
// root node is missing: repository is not initialized
Revision head = newRevision();
Commit commit = new Commit(this, null, head);
- Node n = new DocumentNodeState(this, "/", head);
+ DocumentNodeState n = new DocumentNodeState(this, "/", head);
commit.addNode(n);
commit.applyToDocumentStore();
// use dummy Revision as before
@@ -552,21 +552,21 @@ public final class DocumentNodeStore
splitCandidates.put(id, id);
}
- void copyNode(Node source, String targetPath, Commit commit) {
+ void copyNode(DocumentNodeState source, String targetPath, Commit commit) {
moveOrCopyNode(false, source, targetPath, commit);
}
- void moveNode(Node source, String targetPath, Commit commit) {
+ void moveNode(DocumentNodeState source, String targetPath, Commit commit) {
moveOrCopyNode(true, source, targetPath, commit);
}
- void markAsDeleted(Node node, Commit commit, boolean subTreeAlso) {
+ void markAsDeleted(DocumentNodeState node, Commit commit, boolean
subTreeAlso) {
commit.removeNode(node.getPath());
if (subTreeAlso) {
// recurse down the tree
// TODO causes issue with large number of children
- for (Node child : getChildNodes(node, null, Integer.MAX_VALUE)) {
+ for (DocumentNodeState child : getChildNodes(node, null,
Integer.MAX_VALUE)) {
markAsDeleted(child, commit, true);
}
}
@@ -602,22 +602,22 @@ public final class DocumentNodeStore
}
}
- Node.Children getChildren(@Nonnull final Node parent,
+ DocumentNodeState.Children getChildren(@Nonnull final DocumentNodeState
parent,
@Nullable final String name,
final int limit)
throws MicroKernelException {
if (checkNotNull(parent).hasNoChildren()) {
- return Node.NO_CHILDREN;
+ return DocumentNodeState.NO_CHILDREN;
}
final String path = checkNotNull(parent).getPath();
final Revision readRevision = parent.getLastRevision();
PathRev key = childNodeCacheKey(path, readRevision, name);
- Node.Children children;
+ DocumentNodeState.Children children;
for (;;) {
try {
- children = nodeChildrenCache.get(key, new
Callable<Node.Children>() {
+ children = nodeChildrenCache.get(key, new
Callable<DocumentNodeState.Children>() {
@Override
- public Node.Children call() throws Exception {
+ public DocumentNodeState.Children call() throws Exception {
return readChildren(parent, name, limit);
}
});
@@ -639,14 +639,14 @@ public final class DocumentNodeStore
return children;
}
- Node.Children readChildren(Node parent, String name, int limit) {
+ DocumentNodeState.Children readChildren(DocumentNodeState parent, String
name, int limit) {
// TODO use offset, to avoid O(n^2) and running out of memory
// to do that, use the *name* of the last entry of the previous batch
of children
// as the starting point
String path = parent.getPath();
Revision rev = parent.getLastRevision();
Iterable<NodeDocument> docs;
- Node.Children c = new Node.Children();
+ DocumentNodeState.Children c = new DocumentNodeState.Children();
// add one to the requested limit for the raw limit
// this gives us a chance to detect whether there are more
// child nodes than requested.
@@ -659,7 +659,7 @@ public final class DocumentNodeStore
numReturned++;
// filter out deleted children
String p = Utils.getPathFromId(doc.getId());
- Node child = getNode(p, rev);
+ DocumentNodeState child = getNode(p, rev);
if (child == null) {
continue;
}
@@ -767,7 +767,7 @@ public final class DocumentNodeStore
* @return the child nodes.
*/
@Nonnull
- Iterable<DocumentNodeState> getChildNodes(final @Nonnull Node parent,
+ Iterable<DocumentNodeState> getChildNodes(final @Nonnull DocumentNodeState
parent,
final @Nullable String name,
final int limit) {
// Preemptive check. If we know there are no children then
@@ -827,7 +827,7 @@ public final class DocumentNodeStore
}
if (isNew) {
CacheValue key = childNodeCacheKey(path, rev, null);
- Node.Children c = new Node.Children();
+ DocumentNodeState.Children c = new DocumentNodeState.Children();
Set<String> set = Sets.newTreeSet(added);
set.removeAll(removed);
for (String p : added) {
@@ -1424,7 +1424,7 @@ public final class DocumentNodeStore
// TODO this does not work well for large child node lists
// use a document store index instead
int max = MANY_CHILDREN_THRESHOLD;
- Node.Children fromChildren, toChildren;
+ DocumentNodeState.Children fromChildren, toChildren;
fromChildren = getChildren(from, null, max);
toChildren = getChildren(to, null, max);
if (!fromChildren.hasMore && !toChildren.hasMore) {
@@ -1467,8 +1467,8 @@ public final class DocumentNodeStore
}
}
for (String p : paths) {
- Node fromNode = getNode(p, fromRev);
- Node toNode = getNode(p, toRev);
+ DocumentNodeState fromNode = getNode(p, fromRev);
+ DocumentNodeState toNode = getNode(p, toRev);
if (fromNode != null) {
// exists in fromRev
if (toNode != null) {
@@ -1509,14 +1509,14 @@ public final class DocumentNodeStore
}
}
- private void diffFewChildren(JsopWriter w, Node.Children fromChildren,
Revision fromRev, Node.Children toChildren, Revision toRev) {
+ private void diffFewChildren(JsopWriter w, DocumentNodeState.Children
fromChildren, Revision fromRev, DocumentNodeState.Children toChildren, Revision
toRev) {
Set<String> childrenSet = Sets.newHashSet(toChildren.children);
for (String n : fromChildren.children) {
if (!childrenSet.contains(n)) {
w.tag('-').value(n).newline();
} else {
- Node n1 = getNode(n, fromRev);
- Node n2 = getNode(n, toRev);
+ DocumentNodeState n1 = getNode(n, fromRev);
+ DocumentNodeState n2 = getNode(n, toRev);
// this is not fully correct:
// a change is detected if the node changed recently,
// even if the revisions are well in the past
@@ -1558,7 +1558,7 @@ public final class DocumentNodeStore
}
private void moveOrCopyNode(boolean move,
- Node source,
+ DocumentNodeState source,
String targetPath,
Commit commit) {
// TODO Optimize - Move logic would not work well with very move of
very large subtrees
@@ -1569,14 +1569,14 @@ public final class DocumentNodeStore
// of this commit i.e. transient nodes. If its required it would need
to be looked
// into
- Node newNode = new DocumentNodeState(this, targetPath,
commit.getRevision());
+ DocumentNodeState newNode = new DocumentNodeState(this, targetPath,
commit.getRevision());
source.copyTo(newNode);
commit.addNode(newNode);
if (move) {
markAsDeleted(source, commit, false);
}
- for (Node child : getChildNodes(source, null, Integer.MAX_VALUE)) {
+ for (DocumentNodeState child : getChildNodes(source, null,
Integer.MAX_VALUE)) {
String childName = PathUtils.getName(child.getPath());
String destChildPath = PathUtils.concat(targetPath, childName);
moveOrCopyNode(move, child, destChildPath, commit);
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java?rev=1570725&r1=1570724&r2=1570725&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java
Fri Feb 21 22:16:08 2014
@@ -99,7 +99,7 @@ public class DocumentNodeStoreBranch
protected DocumentNodeState copy(final String source,
final String target,
DocumentNodeState base) {
- final Node src = store.getNode(source, base.getRevision());
+ final DocumentNodeState src = store.getNode(source,
base.getRevision());
checkState(src != null, "Source node %s@%s does not exist",
source, base.getRevision());
return persist(new Changes() {
@@ -114,7 +114,7 @@ public class DocumentNodeStoreBranch
protected DocumentNodeState move(final String source,
final String target,
DocumentNodeState base) {
- final Node src = store.getNode(source, base.getRevision());
+ final DocumentNodeState src = store.getNode(source,
base.getRevision());
checkState(src != null, "Source node %s@%s does not exist",
source, base.getRevision());
return persist(new Changes() {
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java?rev=1570725&r1=1570724&r2=1570725&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
Fri Feb 21 22:16:08 2014
@@ -131,7 +131,7 @@ public class MongoDocumentStore implemen
nodesCache = builder.buildCache(builder.getDocumentCacheSize());
}
- cacheStats = new CacheStats(nodesCache, "DocumentMk-Documents",
builder.getWeigher(),
+ cacheStats = new CacheStats(nodesCache, "Document-Documents",
builder.getWeigher(),
builder.getDocumentCacheSize());
}
Modified:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java?rev=1570725&r1=1570724&r2=1570725&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
Fri Feb 21 22:16:08 2014
@@ -104,7 +104,7 @@ public class DocumentSplitTest extends B
|| doc.getCommitRootPath(rev) != null);
assertTrue(doc.isCommitted(rev));
}
- Node node = ns.getNode("/foo", Revision.fromString(head));
+ DocumentNodeState node = ns.getNode("/foo", Revision.fromString(head));
// check status of node
if (create) {
assertNull(node);
@@ -260,7 +260,7 @@ public class DocumentSplitTest extends B
assertNotNull(doc);
Revision head = ns.getHeadRevision();
Revision lastRev = ns.getPendingModifications().get("/test");
- Node n = doc.getNodeAtRevision(mk.getNodeStore(), head, lastRev);
+ DocumentNodeState n = doc.getNodeAtRevision(mk.getNodeStore(),
head, lastRev);
assertNotNull(n);
String value = n.getPropertyAsString(name);
// set or increment
Modified:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MeasureMemory.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MeasureMemory.java?rev=1570725&r1=1570724&r2=1570725&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MeasureMemory.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MeasureMemory.java
Fri Feb 21 22:16:08 2014
@@ -16,7 +16,7 @@
*/
package org.apache.jackrabbit.oak.plugins.document;
-import static org.apache.jackrabbit.oak.plugins.document.Node.Children;
+import static
org.apache.jackrabbit.oak.plugins.document.DocumentNodeState.Children;
import static org.junit.Assert.fail;
import java.util.LinkedList;
@@ -54,7 +54,7 @@ public class MeasureMemory {
measureMemory(new Callable<Object[]>() {
@Override
public Object[] call() {
- Node n = generateNode(5);
+ DocumentNodeState n = generateNode(5);
return new Object[]{n, n.getMemory() + OVERHEAD};
}
});
@@ -65,7 +65,7 @@ public class MeasureMemory {
measureMemory(new Callable<Object[]>() {
@Override
public Object[] call() {
- Node n = generateNode(0);
+ DocumentNodeState n = generateNode(0);
return new Object[]{n, n.getMemory() + OVERHEAD};
}
});
@@ -152,8 +152,8 @@ public class MeasureMemory {
list.clear();
}
- static Node generateNode(int propertyCount) {
- Node n = new DocumentNodeState(STORE, new String("/hello/world"),
+ static DocumentNodeState generateNode(int propertyCount) {
+ DocumentNodeState n = new DocumentNodeState(STORE, new
String("/hello/world"),
new Revision(1, 2, 3));
for (int i = 0; i < propertyCount; i++) {
n.setProperty("property" + i, "\"values " + i + "\"");
Modified:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDocumentStoreTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDocumentStoreTest.java?rev=1570725&r1=1570724&r2=1570725&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDocumentStoreTest.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDocumentStoreTest.java
Fri Feb 21 22:16:08 2014
@@ -195,7 +195,7 @@ public class MongoDocumentStoreTest {
Revision rev = Revision.newRevision(0);
List<UpdateOp> inserts = new ArrayList<UpdateOp>();
for (int i = 0; i < DocumentMK.MANY_CHILDREN_THRESHOLD * 2; i++) {
- Node n = new DocumentNodeState(store, "/node-" + i, rev);
+ DocumentNodeState n = new DocumentNodeState(store, "/node-" + i,
rev);
inserts.add(n.asOperation(true));
}
docStore.create(Collection.NODES, inserts);
Modified:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/SimpleTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/SimpleTest.java?rev=1570725&r1=1570724&r2=1570725&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/SimpleTest.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/SimpleTest.java
Fri Feb 21 22:16:08 2014
@@ -29,7 +29,7 @@ import org.apache.jackrabbit.mk.api.Micr
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.commons.json.JsopBuilder;
-import org.apache.jackrabbit.oak.plugins.document.Node.Children;
+import org.apache.jackrabbit.oak.plugins.document.DocumentNodeState.Children;
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
import org.junit.Test;
@@ -249,7 +249,7 @@ public class SimpleTest {
String r0 = mk.commit("/test", "+\"a\":{\"name\": \"World\"}", null,
null);
String r1 = mk.commit("/test", "+\"b\":{\"name\": \"!\"}", null, null);
test = mk.getNodes("/test", r0, 0, 0, Integer.MAX_VALUE, null);
- Node n = ns.getNode("/", Revision.fromString(r0));
+ DocumentNodeState n = ns.getNode("/", Revision.fromString(r0));
assertNotNull(n);
Children c = ns.getChildren(n, null, Integer.MAX_VALUE);
assertEquals("[/test]", c.toString());
@@ -276,7 +276,7 @@ public class SimpleTest {
mk.commit("/testDel", "+\"b\":{\"name\": \"!\"}", null, null);
String r1 = mk.commit("/testDel", "+\"c\":{\"name\": \"!\"}", null,
null);
- Node n = ns.getNode("/testDel", Revision.fromString(r1));
+ DocumentNodeState n = ns.getNode("/testDel", Revision.fromString(r1));
assertNotNull(n);
Children c = ns.getChildren(n, null, Integer.MAX_VALUE);
assertEquals(3, c.children.size());