session.save();
eventService.waitForAsyncCompletion();
session.save();
socialDocumentFacetedNotePrivate = session.getDocument(socialDocumentFacetedNotePrivate.getRef());
SocialDocument socialDocument = toSocialDocument(socialDocumentFacetedNotePrivate);
assertTrue(socialDocument.isRestrictedToMembers());
assertFalse(socialDocument.isPublic());
assertNull(socialDocument.getPublicDocument());
assertNotNull(socialDocument.getRestrictedDocument());
assertTrue(socialDocument.getRestrictedDocument().isProxy());
checkRestricted(socialDocument.getRestrictedDocument());
DocumentModel socialDocumentFacetedNotePublic = session.createDocumentModel(
socialWorkspaceDoc.getPathAsString(), "Social Document Note2",
"Note");
socialDocumentFacetedNotePublic.addFacet(SOCIAL_DOCUMENT_FACET);
socialDocumentFacetedNotePublic.setPropertyValue(
SOCIAL_DOCUMENT_IS_PUBLIC_PROPERTY, true);
socialDocumentFacetedNotePublic = session.createDocument(socialDocumentFacetedNotePublic);
session.save();
eventService.waitForAsyncCompletion();
session.save();
socialDocumentFacetedNotePublic = session.getDocument(socialDocumentFacetedNotePublic.getRef());
socialDocument = toSocialDocument(socialDocumentFacetedNotePublic);
assertFalse(socialDocument.isRestrictedToMembers());
assertTrue(socialDocument.isPublic());
assertNotNull(socialDocument.getPublicDocument());
assertTrue(socialDocument.getPublicDocument().isProxy());
assertNull(socialDocument.getRestrictedDocument());
checkPublic(socialDocument.getPublicDocument());
}