use of org.apache.jackrabbit.oak.api.Type in project jackrabbit-oak by apache.
the class ValidatorNoProtectionTest method testRepExternalIdType.
@Override
@Test
public void testRepExternalIdType() throws Exception {
Root systemRoot = getSystemRoot();
Tree userTree = systemRoot.getTree(testUserPath);
Map<Type, Object> valMap = ImmutableMap.<Type, Object>of(Type.BOOLEAN, Boolean.TRUE, Type.LONG, new Long(1234), Type.NAME, "id");
for (Type t : valMap.keySet()) {
Object val = valMap.get(t);
try {
userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_ID, val, t);
systemRoot.commit();
} finally {
systemRoot.refresh();
}
}
}
use of org.apache.jackrabbit.oak.api.Type in project jackrabbit-oak by apache.
the class ExternalIdentityValidatorTest method testRepExternalIdType.
@Test
public void testRepExternalIdType() throws Exception {
Root systemRoot = getSystemRoot();
Tree userTree = systemRoot.getTree(testUserPath);
java.util.Map<Type, Object> valMap = ImmutableMap.<Type, Object>of(Type.BOOLEAN, Boolean.TRUE, Type.LONG, new Long(1234), Type.NAME, "id");
for (Type t : valMap.keySet()) {
Object val = valMap.get(t);
try {
userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_ID, val, t);
systemRoot.commit();
fail("Creating rep:externalId with type " + t + " must be detected.");
} catch (CommitFailedException e) {
// success
assertEquals(75, e.getCode());
} finally {
systemRoot.refresh();
}
}
}
use of org.apache.jackrabbit.oak.api.Type in project jackrabbit-oak by apache.
the class ExternalIdentityValidatorTest method testExternalPrincipalNamesType.
@Test
public void testExternalPrincipalNamesType() throws Exception {
Root systemRoot = getSystemRoot();
Tree userTree = systemRoot.getTree(testUserPath);
java.util.Map<Type, Object> valMap = ImmutableMap.<Type, Object>of(Type.BOOLEANS, ImmutableSet.of(Boolean.TRUE), Type.LONGS, ImmutableSet.of(new Long(1234)), Type.NAMES, ImmutableSet.of("id", "id2"));
for (Type t : valMap.keySet()) {
Object val = valMap.get(t);
try {
userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES, val, t);
systemRoot.commit();
fail("Creating rep:externalPrincipalNames with type " + t + " must be detected.");
} catch (CommitFailedException e) {
// success
assertEquals(71, e.getCode());
} finally {
systemRoot.refresh();
}
}
}
Aggregations