use of org.alfresco.traitextender.SpringExtensionBundle in project alfresco-repository by Alfresco.
the class VirtualizationIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
ctx = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS);
;
virtualizationConfigTestBootstrap = ctx.getBean(VIRTUALIZATION_CONFIG_TEST_BOOTSTRAP_BEAN_ID, VirtualizationConfigTestBootstrap.class);
// Get the required services
ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry");
transactionService = serviceRegistry.getTransactionService();
retryingTransactionHelper = serviceRegistry.getRetryingTransactionHelper();
nodeService = serviceRegistry.getNodeService();
contentService = serviceRegistry.getContentService();
fileAndFolderService = serviceRegistry.getFileFolderService();
permissionService = serviceRegistry.getPermissionService();
authenticationComponent = ctx.getBean("authenticationComponent", AuthenticationComponent.class);
environment = ctx.getBean("actualEnvironment", ActualEnvironment.class);
typeAndAspectsFormProcessor = ctx.getBean("typeAndAspectsFormProcessor", TypeAndAspectsFormProcessor.class);
constraints = ctx.getBean("systemTemplateLocations", SystemTemplateLocationsConstraint.class);
Repository repository = ctx.getBean("repositoryHelper", Repository.class);
if (!virtualizationConfigTestBootstrap.areVirtualFoldersEnabled()) {
// "use the force" and enable virtual folders
SpringExtensionBundle vfBundle = ctx.getBean("smartFoldersBundle", SpringExtensionBundle.class);
vfBundle.start();
} else {
logger.info("Virtual folders are spring-enabled.");
}
this.authenticationComponent.setSystemUserAsCurrentUser();
// start the transaction
txn = transactionService.getUserTransaction();
txn.begin();
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
companyHomeNodeRef = repository.getCompanyHome();
testRootFolder = fileAndFolderService.create(companyHomeNodeRef, TEST_ROOT_FOLDER_NAME, ContentModel.TYPE_FOLDER);
virtualFolder1NodeRef = createVirtualizedFolder(testRootFolder.getNodeRef(), VIRTUAL_FOLDER_1_NAME, TEST_TEMPLATE_1_JSON_SYS_PATH);
rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
setupMocks();
}
use of org.alfresco.traitextender.SpringExtensionBundle in project alfresco-repository by Alfresco.
the class VirtualizationIntegrationTest method tearDown.
@After
public void tearDown() throws Exception {
if (!virtualizationConfigTestBootstrap.areVirtualFoldersEnabled()) {
// "use the force" and disable virtual folders
SpringExtensionBundle vfBundle = ctx.getBean("smartFoldersBundle", SpringExtensionBundle.class);
vfBundle.stop();
}
if (configuredTemplatesClassPath != null) {
constraints.setTemplatesParentClasspath(configuredTemplatesClassPath);
configuredTemplatesClassPath = null;
}
authenticationComponent.clearCurrentSecurityContext();
try {
txn.rollback();
} catch (Exception e) {
logger.error("Test tear down failed. Has the test setup transaction been tempered with ? Hint : " + txnTamperHint, e);
}
// super.tearDown();
}
Aggregations