Alien-SVN

 view release on metacpan or  search on metacpan

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

            {
                this.fsType = SVNAdmin.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 SVNAdmin();
        initClient();

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

    /**
     * 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 SVNClientSynchronized();
        this.client.notification2(new MyNotifier());
        this.client.commitMessageHandler(new MyCommitMessage());
        this.client.setPrompt(new DefaultPromptUserPassword());
        this.client.username("jrandom");
        this.client.setProgressListener(new DefaultProgressListener());
        this.client.setConfigDirectory(this.conf.getAbsolutePath());
        this.expectedCommitItems = new HashMap();
    }
    /**
     * the default prompt : never prompts the user, provides defaults answers
     */
    private static class DefaultPromptUserPassword implements PromptUserPassword3
    {

        public int askTrustSSLServer(String info, boolean allowPermanently)
        {
            return PromptUserPassword3.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 "rayjandom";
        }

        public String getUsername()
        {
            return "jrandom";
        }

        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 0.885 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )