HomeFolderProviderSynchronizer extends AbstractLifecycleBean { public void setOverrideHomeFolderProviderName(String overrideHomeFolderProviderName) { this.overrideHomeFolderProviderName = overrideHomeFolderProviderName; } HomeFolderProviderSynchronizer(
            TransactionService transactionService,
            AuthorityService authorityService, PersonService personService,
            FileFolderService fileFolderService, NodeService nodeService,
            PortableHomeFolderManager homeFolderManager,
            TenantAdminService tenantAdminService); void setEnabled(String enabled); void setOverrideHomeFolderProviderName(String overrideHomeFolderProviderName); void setKeepEmptyParents(String keepEmptyParents);  }
@Test public void testOverrideProvider() throws Exception { NodeRef person = createUser("a/b/c", "fred"); moveUserHomeFolders(); assertHomeFolderLocation("fred", "fr/fred"); homeFolderProviderSynchronizer.setOverrideHomeFolderProviderName( testHomeFolderProviderName); moveUserHomeFolders(); assertHomeFolderLocation("fred", "a/b/c/fred"); String providerName = (String) nodeService.getProperty(person, ContentModel.PROP_HOME_FOLDER_PROVIDER); assertEquals(testHomeFolderProviderName , providerName); }
@Test public void testNoOriginalProvider() throws Exception { createUser("a/b/c", "fred", null, true); homeFolderProviderSynchronizer.setOverrideHomeFolderProviderName( largeHomeFolderProviderName); moveUserHomeFolders(); assertHomeFolderLocation("fred", "fr/fred"); assertTrue("Expected the empty parent 'a/b/c' to still exist as original " + "root was unknown, because the original home folder provider was not set.", exists("a/b/c")); }
@Test @SuppressWarnings("deprecation") public void testVersion1HomeFolderProvider() throws Exception { final String name = "v1Provider"; HomeFolderProvider v1Provider = new HomeFolderProvider() { @Override public void onCreateNode(ChildAssociationRef childAssocRef) { } @Override public String getName() { return name; } }; homeFolderManager.addProvider(v1Provider); createUser("a/b/c", "fred"); homeFolderProviderSynchronizer.setOverrideHomeFolderProviderName(name); moveUserHomeFolders(); assertHomeFolderLocation("fred", "a/b/c/fred"); }
@Test @SuppressWarnings("deprecation") public void testExtendsAbstractHomeFolderProvider() throws Exception { final String name = "v1Provider"; AbstractHomeFolderProvider v1Provider = new UIDBasedHomeFolderProvider(); v1Provider.setBeanName(name); v1Provider.setHomeFolderManager(homeFolderManager); v1Provider.setOnCreatePermissionsManager(largeHomeFolderProvider.getOnCreatePermissionsManager()); v1Provider.setOnReferencePermissionsManager(largeHomeFolderProvider.getOnReferencePermissionsManager()); v1Provider.setOwnerOnCreate(largeHomeFolderProvider.getOwner()); v1Provider.setPath(largeHomeFolderProvider.getRootPath()); v1Provider.setServiceRegistry(serviceRegistry); v1Provider.setStoreUrl(largeHomeFolderProvider.getStoreUrl()); v1Provider.setTenantService(tenantService); v1Provider.afterPropertiesSet(); createUser("a/b/c", "fred"); homeFolderProviderSynchronizer.setOverrideHomeFolderProviderName(name); moveUserHomeFolders(); assertHomeFolderLocation("fred", "fred"); }