use of org.apache.jackrabbit.core.id.PropertyId in project jackrabbit by apache.
the class BundleBindingRandomizedTest method randomProperty.
private static PropertyEntry randomProperty(NodeId nodeId, Random r) {
PropertyEntry p = new PropertyEntry(new PropertyId(nodeId, randomName(r)));
int type = PropertyType.STRING;
if (r.nextInt(10) == 0) {
type = r.nextInt() + 15;
}
p.setType(type);
p.setModCount((short) randomSize(r));
boolean multiValued = r.nextBoolean();
p.setMultiValued(multiValued);
int size;
if (multiValued && r.nextInt(10) > 0) {
size = 1;
} else {
size = randomSize(r);
}
InternalValue[] values = new InternalValue[size];
for (int i = 0; i < size; i++) {
values[i] = randomValue(r);
}
p.setValues(values);
return p;
}
use of org.apache.jackrabbit.core.id.PropertyId in project jackrabbit by apache.
the class AccessManagerTest method testIsGrantedOnProperty.
public void testIsGrantedOnProperty() throws RepositoryException, NotExecutableException {
Session s = getHelper().getReadOnlySession();
try {
AccessManager acMgr = getAccessManager(s);
PropertyId id = (PropertyId) getItemId(testRootNode.getProperty(jcrPrimaryType));
assertTrue(acMgr.isGranted(id, AccessManager.READ));
assertFalse(acMgr.isGranted(id, AccessManager.WRITE));
assertFalse(acMgr.isGranted(id, AccessManager.WRITE | AccessManager.REMOVE));
} finally {
s.logout();
}
}
use of org.apache.jackrabbit.core.id.PropertyId in project jackrabbit by apache.
the class ChangeLogTest method testAddDelete.
/**
* Add an item state and then delete it. Make sure there is no
* entry in either the added nor the removed states
*/
public void testAddDelete() throws Exception {
PropertyId id = new PropertyId(NodeId.randomId(), factory.create("", "a"));
ItemState state = new PropertyState(id, ItemState.STATUS_NEW, false);
ChangeLog log = new ChangeLog();
log.added(state);
log.deleted(state);
assertFalse("State not in added collection", log.addedStates().iterator().hasNext());
assertFalse("State not in deleted collection", log.deletedStates().iterator().hasNext());
}
use of org.apache.jackrabbit.core.id.PropertyId in project jackrabbit by apache.
the class ChangeLogTest method testAddModify.
/**
* Add an item state and then modify it. Make sure the entry is still
* in the added states.
*/
public void testAddModify() throws Exception {
PropertyId id = new PropertyId(NodeId.randomId(), factory.create("", "a"));
ItemState state = new PropertyState(id, ItemState.STATUS_NEW, false);
ChangeLog log = new ChangeLog();
log.added(state);
log.modified(state);
assertTrue("State still in added collection", log.addedStates().iterator().hasNext());
assertFalse("State not in modified collection", log.modifiedStates().iterator().hasNext());
}
Aggregations