@Before public void setUp() throws Exception { FileUtils.deleteDirectory(SVN_DIR); System.out.println("setup..."); SVN_DIR.mkdirs(); ProcessBuilder builder = new ProcessBuilder(SVNADMIN_EXEC, "create", SVN_DIR.getAbsolutePath()); builder.redirectErrorStream(true); Process process = builder.start(); process.waitFor(); FileUtils.writeStringToFile( new File(SVN_DIR, "conf/svnserve.conf"), "[general]\npassword-db = passwd", null); FileUtils.writeStringToFile(new File(SVN_DIR, "conf/passwd"), "[users]\nguest = guest", null); System.out.println("setup ok."); writer = context.mock(LrdWriter.class); repositoryBean = new RepositoryBean(); repositoryBean.setUrl(SVN_URL); repositoryBean.setUserName(SVN_USER); repositoryBean.setPassword(SVN_PASS); }
/** * SVNリポジトリの全ツリーを取得します。 * * @param bean リポジトリBean * @return リポジトリルート * @throws LrdException Lrd共通例外 */ public static LrdNode getRepositoryRootNode(RepositoryBean bean) throws LrdException { RepositoryInfo repositoryInfo = bean.getRepositoryInfo(); // SVNLogClient logClient = SVNClientManager.newInstance( // SVNWCUtil.createDefaultOptions(true), // repositoryInfo.getAuthUser(), // repositoryInfo.getAuthPass()).getLogClient(); // SVNRepositoryFactoryImpl.setup(); LrdNode root = new LrdNode(new LrdPath(bean.getProject(), ""), true); // boolean recursive = true; // // LrdSVNDirEntryHandler handler = new LrdSVNDirEntryHandler(bean.getProject()); try { SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(repositoryInfo.getRepositoryUrl())); ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( repositoryInfo.getAuthUser(), repositoryInfo.getAuthPass()); repository.setAuthenticationManager(authManager); listEntries(repository, "", root); repository.closeSession(); // logClient.doList( // SVNURL.parseURIEncoded( // repositoryInfo.getRepositoryUrl()), // SVNRevision.UNDEFINED, // SVNRevision.HEAD, recursive, // handler); } catch (SVNException e) { throw new LrdException(e); } return root; }