use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class DocumentBundlorTest method asPropertyState.
@Test
public void asPropertyState() throws Exception {
builder.setProperty(createProperty(PROP_PATTERN, asList("x", "x/y", "z"), STRINGS));
DocumentBundlor bundlor = DocumentBundlor.from(builder.getNodeState());
PropertyState ps = bundlor.asPropertyState();
assertNotNull(ps);
DocumentBundlor bundlor2 = DocumentBundlor.from(ps);
assertTrue(bundlor2.isBundled("x"));
assertTrue(bundlor2.isBundled("x/y"));
assertFalse(bundlor2.isBundled("m"));
}
use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class DocumentBundlingTest method journalDiffAndBundling.
@Test
public void journalDiffAndBundling() throws Exception {
NodeBuilder builder = store.getRoot().builder();
NodeBuilder fileNode = newNode("nt:file");
fileNode.child("jcr:content").setProperty("jcr:data", "foo");
builder.child("test").setChildNode("book.jpg", fileNode.getNodeState());
NodeState r1 = merge(builder);
builder = store.getRoot().builder();
childBuilder(builder, "/test/book.jpg/jcr:content").setProperty("fooContent", "bar");
childBuilder(builder, "/test/book.jpg").setProperty("fooBook", "bar");
NodeState r2 = merge(builder);
final List<String> addedPropertyNames = Lists.newArrayList();
r2.compareAgainstBaseState(r1, new DefaultNodeStateDiff() {
@Override
public boolean propertyAdded(PropertyState after) {
addedPropertyNames.add(after.getName());
return super.propertyAdded(after);
}
@Override
public boolean childNodeChanged(String name, NodeState before, NodeState after) {
return after.compareAgainstBaseState(before, this);
}
});
assertTrue("No change reported for /test/book.jpg", addedPropertyNames.contains("fooBook"));
assertTrue("No change reported for /test/book.jpg/jcr:content", addedPropertyNames.contains("fooContent"));
}
use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class AllPermissionsTest method testIsGranted.
@Test
public void testIsGranted() {
for (String path : paths) {
Tree tree = RootFactory.createReadOnlyRoot(root).getTree(path);
assertTrue(tree.exists());
assertTrue(all.isGranted(tree, null, Permissions.ALL));
for (PropertyState prop : tree.getProperties()) {
assertTrue(all.isGranted(tree, prop, Permissions.ALL));
}
for (Tree child : tree.getChildren()) {
assertTrue(all.isGranted(child, null, Permissions.ALL));
}
}
}
use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class EmptyCugTreePermissionTest method testIsGrantedProperty.
@Test
public void testIsGrantedProperty() {
PropertyState ps = PropertyStates.createProperty("prop", "val");
assertFalse(tp.isGranted(Permissions.ALL, ps));
assertFalse(tp.isGranted(Permissions.WRITE, ps));
assertFalse(tp.isGranted(Permissions.READ, ps));
}
use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class DocumentPropertyState method size.
@Override
public long size(int index) {
long size;
PropertyState parsed = parsed();
if (parsed.getType() == Type.BINARIES) {
size = parsed.getValue(Type.BINARY, index).length();
} else {
size = parsed.size(index);
}
return size;
}
Aggregations