WebSiteRandomGenerator implements WebSiteGenerator, InitializingBean { public NodeRef generateWebSite(String siteName) { if(webHome ==null) { this.webHome = findOrCreateWebHome(); } Tree<String> siteStructure = generateRandomSiteStructure(); return siteBuilder.buildSiteStructure(webHome, siteName, siteStructure); }  File generateWebSiteAcp(String location); NodeRef generateWebSite(String siteName); @Override void afterPropertiesSet(); void setWebSiteBuilder(WebSiteBuilder siteBuilder); void setNodeService(NodeService nodeService); void setNodeLocatorService(NodeLocatorService nodeLocatorService); void setSiteService(SiteService siteService); void setTextGenerator(TextGenerator textGenerator); void setShareSiteName(String shareSiteName); void setMinSectionCount(int minSectionCount); void setMaxSectionCount(int maxSectionCount); void setMinSectionDepth(int minSectionDepth); void setMaxSectionDepth(int maxSectionDepth); static final String WEB_SITE_HOME_NAME; }
@Test public void testGenerateWebSite() throws Exception { AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); NodeRef site = generator.generateWebSite(SITE_NAME); assertNotNull(site); NodeRef companyHome = repositoryHelper.getCompanyHome(); NodeRef webHome = nodeService.getChildByName(companyHome, ASSOC_CATEGORIES, WebSiteRandomGenerator.WEB_SITE_HOME_NAME); assertNotNull(webHome); NodeRef actualSite= nodeService.getChildByName(webHome, ASSOC_CATEGORIES, SITE_NAME); assertEquals(site, actualSite); }