use of org.alfresco.repo.virtual.ref.VanillaProtocol in project alfresco-repository by Alfresco.
the class VirtualStoreImplTest method testResolveVirtualFolderDefinition_inactiveSynchronization.
@Test
public void testResolveVirtualFolderDefinition_inactiveSynchronization() throws Exception {
txnTamperHint = "VirtualStoreImplTest::testResolveVirtualFolderDefinition_inactiveSynchronization";
txn.rollback();
NodeRef ntVirtualizedFolder = null;
NodeRef jsonTemplateContent = null;
try {
final String templateName = "template1.json";
jsonTemplateContent = nodeService.getChildByName(companyHomeNodeRef, ContentModel.ASSOC_CONTAINS, templateName);
if (jsonTemplateContent == null) {
ChildAssociationRef templateChild = createContent(companyHomeNodeRef, templateName, ApplyTemplateMethodTest.class.getResourceAsStream(TEST_TEMPLATE_1_JSON_NAME), MimetypeMap.MIMETYPE_JSON, StandardCharsets.UTF_8.name());
jsonTemplateContent = templateChild.getChildRef();
}
final String folderName = "testCanVirtualize_nonTransactional";
ntVirtualizedFolder = nodeService.getChildByName(companyHomeNodeRef, ContentModel.ASSOC_CONTAINS, folderName);
if (ntVirtualizedFolder == null) {
ChildAssociationRef folderChild = createFolder(companyHomeNodeRef, folderName);
ntVirtualizedFolder = folderChild.getChildRef();
}
Reference aVanillaRef = ((VanillaProtocol) Protocols.VANILLA.protocol).newReference(VANILLA_PROCESSOR_JS_CLASSPATH, "/1", ntVirtualizedFolder, jsonTemplateContent);
// We use transactional-synchronized resources for caching. In
// non-transactional contexts they might not be available.
smartStore.resolveVirtualFolderDefinition(aVanillaRef);
} finally {
txn = transactionService.getUserTransaction();
txn.begin();
if (ntVirtualizedFolder != null) {
nodeService.deleteNode(ntVirtualizedFolder);
}
if (jsonTemplateContent != null) {
nodeService.deleteNode(jsonTemplateContent);
}
txn.commit();
}
}
Aggregations