/** * @deprecated Use {@link UUIDUtils#generateUUID(String)} */ @Nonnull public static String generateUUID(String hint) { return UUIDUtils.generateUUID(hint); }
/** * @deprecated Use {@link UUIDUtils#generateUUID()} */ @NotNull public static String generateUUID() { return UUIDUtils.generateUUID(); }
/** * @deprecated Use {@link UUIDUtils#generateUUID(String)} */ @NotNull public static String generateUUID(String hint) { return UUIDUtils.generateUUID(hint); }
/** * @deprecated Use {@link UUIDUtils#generateUUID(String)} */ @NotNull public static String generateUUID(String hint) { return UUIDUtils.generateUUID(hint); }
/** * @deprecated Use {@link UUIDUtils#generateUUID()} */ @Nonnull public static String generateUUID() { return UUIDUtils.generateUUID(); }
/** * @deprecated Use {@link UUIDUtils#generateUUID()} */ @NotNull public static String generateUUID() { return UUIDUtils.generateUUID(); }
private String getContentID(String authorizableId, boolean usercaseMappedProfile) { String s = authorizableId.toLowerCase(); if (usercaseMappedProfile) { s = java.text.Normalizer.normalize(s, java.text.Normalizer.Form.NFKC); } return UUIDUtils.generateUUID(s); }
@NotNull String getContentID(@NotNull String authorizableId) { String s = authorizableId.toLowerCase(); if (usercaseMappedProfile) { s = java.text.Normalizer.normalize(s, java.text.Normalizer.Form.NFKC); } return UUIDUtils.generateUUID(s); } }
@NotNull String getContentID(@NotNull String authorizableId) { String s = authorizableId.toLowerCase(); if (usercaseMappedProfile) { s = java.text.Normalizer.normalize(s, java.text.Normalizer.Form.NFKC); } return UUIDUtils.generateUUID(s); } }
@Nonnull String getContentID(@Nonnull String authorizableId) { String s = authorizableId.toLowerCase(); if (usercaseMappedProfile) { s = java.text.Normalizer.normalize(s, java.text.Normalizer.Form.NFKC); } return UUIDUtils.generateUUID(s); } }
@Test public void multipleUuidsMiss() { UuidPredicate p = new UuidPredicate( new String[] {UUIDUtils.generateUUID(), UUIDUtils.generateUUID(), UUIDUtils.generateUUID()}); NodeState tree = createNodeWithUuid(UUIDUtils.generateUUID()); assertFalse(p.apply(tree)); }
@Test public void multipleUuidsMatch() { String uuid = UUIDUtils.generateUUID(); UuidPredicate p = new UuidPredicate( new String[] {UUIDUtils.generateUUID(), UUIDUtils.generateUUID(), uuid}); NodeState tree = createNodeWithUuid(uuid); assertTrue(p.apply(tree)); }
@Test public void testInvalidIdentifierPath() { String uuid = UUIDUtils.generateUUID(); List<String> invalid = new ArrayList<String>(); invalid.add('[' + uuid + "]abc"); invalid.add('[' + uuid + "]/a/b/c"); for (String jcrPath : invalid) { assertNull(npMapper.getOakPath(jcrPath)); } }
@Test public void singleUuidMiss() { UuidPredicate p = new UuidPredicate(new String[] {UUIDUtils.generateUUID()}); NodeState tree = createNodeWithUuid(UUIDUtils.generateUUID()); assertFalse(p.apply(tree)); }
@Test public void emptyUuidList() { UuidPredicate p = new UuidPredicate(new String[] {}); NodeState tree = createNodeWithUuid(UUIDUtils.generateUUID()); assertFalse(p.apply(tree)); }
@Test public void singleUuidMatch() { String uuid = UUIDUtils.generateUUID(); UuidPredicate p = new UuidPredicate(new String[] {uuid}); NodeState tree = createNodeWithUuid(uuid); assertTrue(p.apply(tree)); }
private void waitForReindexing(ContentSession session) throws CommitFailedException, ParseException { String tmpUuid = UUIDUtils.generateUUID(); Root root = session.getLatestRoot(); root.getTree("/").addChild("tmp").setProperty(JcrConstants.JCR_UUID, tmpUuid); root.commit(); assertEquals(1, waitForUuid(session, tmpUuid).size()); root.getTree("/tmp").remove(); root.commit(); }
/** * Creating a tree which is referenceable doesn't require any property * related privilege to be granted as the jcr:uuid property is defined to * be autocreated and protected. */ @Test public void testCreateJcrUuid() throws Exception { setupPermission("/a", testPrincipal, true, PrivilegeConstants.JCR_READ, PrivilegeConstants.JCR_ADD_CHILD_NODES); Root testRoot = getTestRoot(); testRoot.refresh(); NodeUtil a = new NodeUtil(testRoot.getTree("/a")); NodeUtil test = a.addChild("referenceable2", NT_NAME); test.setString(JcrConstants.JCR_UUID, UUIDUtils.generateUUID()); testRoot.commit(); }
/** * Creating a non-referenceable tree with an jcr:uuid must fail * with AccessDeniedException unless the REP_ADD_PROPERTY privilege * is granted */ @Test public void testCreateNonReferenceableJcrUuid() throws Exception { setupPermission("/a", testPrincipal, true, PrivilegeConstants.JCR_READ, PrivilegeConstants.JCR_ADD_CHILD_NODES); try { Root testRoot = getTestRoot(); NodeUtil a = new NodeUtil(testRoot.getTree("/a")); a.setString(JCR_UUID, UUIDUtils.generateUUID()); testRoot.commit(); fail("Creating a jcr:uuid property for an unstructured node without ADD_PROPERTY permission must fail."); } catch (CommitFailedException e) { assertTrue(e.isAccessViolation()); } }
@Test public void testCreateNestedUser() throws Exception { Tree userTree = root.getTree(getTestUser().getPath()); NodeUtil userNode = new NodeUtil(userTree); NodeUtil profile = userNode.addChild("profile", JcrConstants.NT_UNSTRUCTURED); NodeUtil nested = profile.addChild("nested", UserConstants.NT_REP_USER); nested.setString(UserConstants.REP_PRINCIPAL_NAME, "nested"); nested.setString(UserConstants.REP_AUTHORIZABLE_ID, "nested"); nested.setString(JcrConstants.JCR_UUID, UUIDUtils.generateUUID("nested")); try { root.commit(); fail("Creating nested users must be detected."); } catch (CommitFailedException e) { // success assertEquals(29, e.getCode()); } finally { root.refresh(); } }