use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class PrincipalPolicyImporterTest method testHandlePropInfoOakDeclaringNtName.
@Test
public void testHandlePropInfoOakDeclaringNtName() throws Exception {
init(false, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING);
Tree tree = mockTree(REP_PRINCIPAL_POLICY, NT_REP_PRINCIPAL_POLICY, true);
PropInfo propInfo = mockPropInfo(getJcrName(REP_PRINCIPAL_NAME));
PropertyDefinition def = mockPropertyDefinition(NT_REP_PRINCIPAL_POLICY);
assertFalse(importer.handlePropInfo(tree, propInfo, def));
}
use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class PrincipalPolicyImporterTest method testHandlePropInfoDefinitionMultiple.
@Test
public void testHandlePropInfoDefinitionMultiple() throws Exception {
init(false, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING);
Tree tree = mockTree(REP_PRINCIPAL_POLICY, NT_REP_PRINCIPAL_POLICY, true);
PropInfo propInfo = mockPropInfo(getJcrName(REP_PRINCIPAL_NAME));
PropertyDefinition def = when(mock(PropertyDefinition.class).isMultiple()).thenReturn(true).getMock();
assertFalse(importer.handlePropInfo(tree, propInfo, def));
}
use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class PrincipalPolicyImporterTest method testStartChildInfoUnsupportedProperty.
@Test(expected = ConstraintViolationException.class)
public void testStartChildInfoUnsupportedProperty() throws Exception {
init(true, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING);
User user = getTestSystemUser();
Tree policyTree = createPolicyTree(user);
importer.handlePropInfo(policyTree, mockPropInfo(user.getPrincipal()), mockPropertyDefinition(getJcrName(NT_REP_PRINCIPAL_POLICY)));
List<PropInfo> propInfos = mockPropInfos("/effective/path", PrivilegeConstants.JCR_REMOVE_CHILD_NODES);
propInfos.add(mockPropInfo("unsupportedProperty"));
importer.startChildInfo(mockNodeInfo("entry", getJcrName(NT_REP_PRINCIPAL_ENTRY)), propInfos);
}
use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class PrincipalPolicyImporterTest method mockPropInfo.
private PropInfo mockPropInfo(@NotNull Principal principal) throws RepositoryException {
TextValue tx = when(mock(TextValue.class).getString()).thenReturn(principal.getName()).getMock();
PropInfo propInfo = mockPropInfo(getJcrName(REP_PRINCIPAL_NAME));
when(propInfo.getTextValue()).thenReturn(tx);
return propInfo;
}
use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class AccessControlImporterBaseTest method testImportWithRestrictions.
@Test
public void testImportWithRestrictions() throws Exception {
// single value restriction
PropInfo globInfo = new PropInfo(REP_GLOB, PropertyType.STRING, createTextValue("/*"));
// mv restriction
PropInfo ntNamesInfo = new PropInfo(REP_NT_NAMES, PropertyType.NAME, createTextValues(NodeTypeConstants.NT_OAK_RESOURCE, NodeTypeConstants.NT_OAK_RESOURCE));
// mv restriction with singular value
PropInfo itemNamesInfo = new PropInfo(REP_ITEM_NAMES, PropertyType.NAME, createTextValue("itemName"));
init();
importer.start(aclTree);
importer.startChildInfo(aceGrantInfo, ImmutableList.of(principalInfo, privInfo, globInfo, ntNamesInfo, itemNamesInfo));
importer.endChildInfo();
importer.end(aclTree);
assertImport(aclTree, principalName);
}
Aggregations