/**
   * 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;
  }
  @Test
  public void testAll() throws Exception {

    LrdSvnRepository repository = new LrdSvnRepository(repositoryBean);

    LrdProject project = new LrdProject("sample");

    RepositoryInfo repositoryInfo = new RepositoryInfo();
    repositoryInfo.setAuthUser(SVN_USER);
    repositoryInfo.setAuthPass(SVN_PASS);
    repositoryInfo.setRepositoryUrl(SVN_URL);
    project.setRepositoryInfo(repositoryInfo);

    LrdNode root = repository.getDirectoryRoot();
    Assert.assertNotNull(root);

    repository.addFile("sample1.lrd");
    repository.addFile("sample2.lrd");
    repository.addFile("sample3.lrd");
    repository.addFile("sample/sub1.lrd");
    repository.addFile("sample/sub2.lrd");
    repository.addFile("1/2/3.lrd");

    CommitFileInfo file = repository.getRepositoryFile("sample1.lrd");
    Assert.assertNotNull(file);

    CommitFileInfo[] files =
        repository.getRepositoryFiles(new String[] {"sample1.lrd", "sample2.lrd"});
    Assert.assertNotNull(files);
    Assert.assertEquals(2, files.length);

    LrdPath[] lrdPaths = repository.getFilesFromDirectory("");
    Assert.assertNotNull(lrdPaths);
    Assert.assertEquals(3, lrdPaths.length);

    Assert.assertFalse(repository.isDirectory("sample1.lrd"));

    SVNRepository svnRepository = repository.getSvnRepository();
    Assert.assertNotNull(svnRepository);

    Date timestamp = repository.getTimestamp("", SVN_USER, SVN_PASS);
    Assert.assertNotNull(timestamp);

    context.checking(
        new Expectations() {
          {
            allowing(writer)
                .writeAllMenu(
                    with(any(RepositoryBean.class)),
                    with(any(Writer.class)),
                    with(any(LrdNode.class)));
          }
        });
    repository.getAllMenu(writer);
    repository.getAllMenu(writer); // 2回目はキャッシュ使用

    CommitFileInfo[] infos =
        new CommitFileInfo[] {
          new CommitFileInfo("sample3.lrd", "SAMPLE".getBytes(), "EUC-JP"),
        };
    repository.commitMultiFile(infos);

    file = repository.getRepositoryFile("sample3.lrd");
    Assert.assertEquals("SAMPLE", file.getContentStr());
  }