use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class AccessControlImporterBaseTest method testImportWithRestrictionNodeInfo.
@Test
public void testImportWithRestrictionNodeInfo() 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));
importer.startChildInfo(restrInfo, ImmutableList.of(globInfo, ntNamesInfo, itemNamesInfo));
importer.endChildInfo();
importer.endChildInfo();
importer.end(aclTree);
assertImport(aclTree, principalName);
}
use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class AccessControlImporterBaseTest method testUnknownRestriction.
@Test(expected = ValueFormatException.class)
public void testUnknownRestriction() throws Exception {
init();
importer.start(aclTree);
importer.startChildInfo(aceGrantInfo, ImmutableList.of(principalInfo, privInfo));
PropInfo invalidRestrProp = new PropInfo("unknown", PropertyType.STRING, createTextValue("val"));
importer.startChildInfo(restrInfo, ImmutableList.of(invalidRestrProp));
importer.endChildInfo();
importer.endChildInfo();
importer.end(aclTree);
}
use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class AccessControlImporterIgnoreTest method testImportWithUnknownPrincipal.
@Test
public void testImportWithUnknownPrincipal() throws Exception {
init();
importer.start(aclTree);
PropInfo privs = new PropInfo(REP_PRIVILEGES, PropertyType.NAME, createTextValues(PrivilegeConstants.JCR_READ));
importer.startChildInfo(aceGrantInfo, ImmutableList.of(unknownPrincipalInfo, privs));
importer.endChildInfo();
importer.end(aclTree);
// ace with invalid principal is ignored with this behaviour => ace tree not imported
assertFalse(aclTree.getChildren().iterator().hasNext());
}
use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class UserImporterPasswordTreeTest method testNotRepPassword.
@Test
public void testNotRepPassword() throws Exception {
pwTree.setProperty(JCR_PRIMARYTYPE, NodeTypeConstants.NT_OAK_UNSTRUCTURED, Type.NAME);
PropInfo propInfo = mock(PropInfo.class);
PropertyDefinition propDef = mock(PropertyDefinition.class);
assertFalse(importer.handlePropInfo(pwTree, propInfo, propDef));
verify(propInfo, never()).getName();
verify(propDef, never()).getRequiredType();
}
use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class UserImporterPasswordTreeTest method testInvalidPropName2.
@Test
public void testInvalidPropName2() throws Exception {
PropInfo propInfo = createPropInfo(null, "value");
PropertyDefinition propDef = when(mock(PropertyDefinition.class).getName()).thenReturn(NodeTypeConstants.RESIDUAL_NAME).getMock();
assertFalse(importer.handlePropInfo(pwTree, propInfo, propDef));
}
Aggregations