Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java  view on Meta::CPAN

                this.fsType = ISVNRepos.FSFS;
            }
        }

        this.localTmp = new File(this.rootDir, "local_tmp");
        this.conf = new File(this.localTmp, "config");
        this.repositories = new File(this.rootDir, "repositories");
        this.workingCopies = new File(this.rootDir, "working_copies");
    }

    /**
     * Standard initialization of one test
     * @throws Exception
     */
    protected void setUp() throws Exception
    {
        super.setUp();

        createDirectories();

        // create and configure the needed subversion objects
        admin = new SVNRepos();
        initClient();

        // build and dump the sample repository
        File greekFiles = buildGreekFiles();
        greekRepos = new File(localTmp, "repos");
        greekDump = new File(localTmp, "greek_dump");
        admin.create(greekRepos, true,false, null, this.fsType);
        addExpectedCommitItem(greekFiles.getAbsolutePath(), null, null,
                              NodeKind.none, CommitItemStateFlags.Add);
        client.doImport(greekFiles.getAbsolutePath(),
                       makeReposUrl(greekRepos).toString(),
                        Depth.infinity, false, false, null,
                        new MyCommitMessage(), null);
        admin.dump(greekRepos, new FileOutputStream(greekDump),
                   null, null, false, false, null);
    }

    /**
     * Create a directory for the sample (Greek) repository, config
     * files, repositories and working copies.
     */
    private void createDirectories()
    {
        this.rootDir.mkdirs();

        if (this.localTmp.exists())
        {
            removeDirOrFile(this.localTmp);
        }
        this.localTmp.mkdir();
        this.conf.mkdir();

        this.repositories.mkdir();
        this.workingCopies.mkdir();
    }

    /**
     * Initialize {@link #client}, setting up its notifier, commit
     * message handler, user name, password, config directory, and
     * expected commit items.
     */
    private void initClient()
        throws SubversionException
    {
        this.client = new SVNClient();
        this.client.notification2(new MyNotifier());
        this.client.setPrompt(new DefaultPromptUserPassword());
        this.client.username(USERNAME);
        this.client.setProgressCallback(new DefaultProgressListener());
        this.client.setConfigDirectory(this.conf.getAbsolutePath());
        this.expectedCommitItems = new HashMap<String, MyCommitItem>();
    }
    /**
     * the default prompt : never prompts the user, provides defaults answers
     */
    protected static class DefaultPromptUserPassword implements UserPasswordCallback
    {

        public int askTrustSSLServer(String info, boolean allowPermanently)
        {
            return UserPasswordCallback.AcceptTemporary;
        }

        public String askQuestion(String realm, String question, boolean showAnswer)
        {
            return "";
        }

        public boolean askYesNo(String realm, String question, boolean yesIsDefault)
        {
            return yesIsDefault;
        }

        public String getPassword()
        {
            return PASSWORD;
        }

        public String getUsername()
        {
            return USERNAME;
        }

        public boolean prompt(String realm, String username)
        {
            return false;
        }

        public boolean prompt(String realm, String username, boolean maySave)
        {
            return false;
        }

        public String askQuestion(String realm, String question,
                boolean showAnswer, boolean maySave)
        {
            return "";
        }



( run in 1.361 second using v1.01-cache-2.11-cpan-d8267643d1d )