⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basictests.java

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        thisTest.getWc().setItemPropStatus("A/B/F", Status.Kind.none);        client.remove(new String[] {thisTest.getWCPath()+"/A/C"}, null, true);        thisTest.getWc().setItemTextStatus("A/C",Status.Kind.deleted);        client.remove(new String[] {thisTest.getWCPath()+"/A/B/X"}, null, true);        file = new File(thisTest.getWorkingCopy(), "iota");        file.delete();        client.remove(new String[] {file.getAbsolutePath()}, null, true);        thisTest.getWc().setItemTextStatus("iota",Status.Kind.deleted);        file = new File(thisTest.getWorkingCopy(), "A/D/gamma");        file.delete();        client.remove(new String[] {file.getAbsolutePath()}, null, false);        thisTest.getWc().setItemTextStatus("A/D/gamma",Status.Kind.deleted);        client.remove(new String[] {file.getAbsolutePath()}, null, true);        client.remove(new String[] {thisTest.getWCPath()+"/A/B/E"}, null,                false);        thisTest.getWc().removeItem("A/B/X");        thisTest.getWc().removeItem("A/B/X/xi");        thisTest.getWc().removeItem("A/C/sigma");        thisTest.getWc().removeItem("A/C/Q");        thisTest.checkStatus();        client.remove(new String[] {thisTest.getWCPath()+"/A/D"},null, true);        thisTest.getWc().setItemTextStatus("A/D", Status.Kind.deleted);        thisTest.getWc().removeItem("A/D/Y");        // check the status of the working copy        thisTest.checkStatus();        // confirm that the file are realy deleted        assertFalse("failed to remove text modified file",                new File(thisTest.getWorkingCopy(), "A/D/G/rho").exists());        assertFalse("failed to remove prop modified file",                new File(thisTest.getWorkingCopy(), "A/D/H/chi").exists());        assertFalse("failed to remove unversioned file",                new File(thisTest.getWorkingCopy(), "A/C/sigma").exists());        assertFalse("failed to remove unmodified file",                new File(thisTest.getWorkingCopy(), "A/B/E/alpha").exists());        file = new File(thisTest.getWorkingCopy(),"A/B/F");        assertTrue("removed versioned dir", file.exists()                && file.isDirectory());        assertFalse("failed to remove unversioned dir",                new File(thisTest.getWorkingCopy(), "A/C/Q").exists());        assertFalse("failed to remove added dir",                new File(thisTest.getWorkingCopy(), "A/B/X").exists());        // delete unversioned file foo        file = new File(thisTest.getWCPath(),"foo");        pw = new PrintWriter(new FileOutputStream(file));        pw.print("unversioned foo");        pw.close();        client.remove(new String[] {file.getAbsolutePath()}, null, true);        assertFalse("failed to remove unversioned file foo", file.exists());        try        {            // delete non-existant file foo            client.remove(new String[] {file.getAbsolutePath()}, null, true);            fail("missing exception");        }        catch(ClientException expected)        {        }        // delete file iota in the repository        addExpectedCommitItem(null, thisTest.getUrl(), "iota", NodeKind.none,                CommitItemStateFlags.Delete);        client.remove(new String[] {thisTest.getUrl()+"/iota"},                "delete iota URL", false);    }    public void testBasicCheckoutDeleted() throws Throwable    {        // create working copy        OneTest thisTest = new OneTest();        // delete A/D and its content        client.remove(new String[] {thisTest.getWCPath()+"/A/D"}, null, true);        thisTest.getWc().setItemTextStatus("A/D", Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/D/G", Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/D/G/rho", Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/D/G/pi", Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/D/G/tau", Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/D/H", Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/D/H/chi", Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/D/H/psi", Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/D/H/omega", Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/D/gamma", Status.Kind.deleted);        // check the working copy status        thisTest.checkStatus();        // commit the change        addExpectedCommitItem(thisTest.getWCPath(),                thisTest.getUrl(), "A/D", NodeKind.dir,                CommitItemStateFlags.Delete);        assertEquals("wrong revision from commit",                client.commit(new String[]{thisTest.getWCPath()}, "log message",                        true),2);        thisTest.getWc().removeItem("A/D");        thisTest.getWc().removeItem("A/D/G");        thisTest.getWc().removeItem("A/D/G/rho");        thisTest.getWc().removeItem("A/D/G/pi");        thisTest.getWc().removeItem("A/D/G/tau");        thisTest.getWc().removeItem("A/D/H");        thisTest.getWc().removeItem("A/D/H/chi");        thisTest.getWc().removeItem("A/D/H/psi");        thisTest.getWc().removeItem("A/D/H/omega");        thisTest.getWc().removeItem("A/D/gamma");        // check the working copy status        thisTest.checkStatus();        // check out the previous revision        client.checkout(thisTest.getUrl()+"/A/D", thisTest.getWCPath()+"/new_D",                new Revision.Number(1), true);    }    /**     * Test if Subversion will detect the change of a file to a direcory     * @throws Throwable     */    public void testBasicNodeKindChange() throws Throwable    {        // create working copy        OneTest thisTest = new OneTest();        //  remove A/D/gamma        client.remove(new String[] {thisTest.getWCPath()+"/A/D/gamma"}, null,                false);        thisTest.getWc().setItemTextStatus("A/D/gamma", Status.Kind.deleted);        // check the working copy status        thisTest.checkStatus();        try        {            // creating a directory in the place of the deleted file should            // fail            client.mkdir(new String[] {thisTest.getWCPath()+"/A/D/gamma"},                    null);            fail("can change node kind");        }        catch(ClientException e)        {        }        // check the working copy status        thisTest.checkStatus();        // commit the deletion        addExpectedCommitItem(thisTest.getWCPath(),                thisTest.getUrl(), "A/D/gamma", NodeKind.file,                CommitItemStateFlags.Delete);        assertEquals("wrong revision number from commit",                client.commit(new String[]{thisTest.getWCPath()},"log message",                        true), 2);        thisTest.getWc().removeItem("A/D/gamma");        // check the working copy status        thisTest.checkStatus();        try        {            // creating a directory in the place of the deleted file should            // still fail            client.mkdir(                    new String[] {thisTest.getWCPath()+"/A/D/gamma"}, null);            fail("can change node kind");        }        catch(ClientException e)        {        }        // check the working copy status        thisTest.checkStatus();        // update the working copy        client.update(thisTest.getWCPath(), null, true);        // check the working copy status        thisTest.checkStatus();        // now creating the directory should succeed        client.mkdir(new String[] {thisTest.getWCPath()+"/A/D/gamma"}, null);        thisTest.getWc().addItem("A/D/gamma", null);        thisTest.getWc().setItemTextStatus("A/D/gamma", Status.Kind.added);        // check the working copy status        thisTest.checkStatus();    }    /**     * Test the basic SVNClient.import functionality     * @throws Throwable     */    public void testBasicImport() throws Throwable    {        // create the working copy        OneTest thisTest = new OneTest();        // create new_file        File file = new File(thisTest.getWCPath(),"new_file");        PrintWriter pw = new PrintWriter(new FileOutputStream(file));        pw.print("some text");        pw.close();        // import new_file info dirA/dirB/newFile        addExpectedCommitItem(thisTest.getWCPath(),                null, "new_file", NodeKind.none, CommitItemStateFlags.Add);        client.doImport(file.getAbsolutePath(),                thisTest.getUrl()+"/dirA/dirB/new_file",                "log message for new import", true);        // delete new_file        file.delete();        // update the working        assertEquals("wrong revision from update",                client.update(thisTest.getWCPath(), null, true),2);        thisTest.getWc().addItem("dirA", null);        thisTest.getWc().setItemWorkingCopyRevision("dirA",2);        thisTest.getWc().addItem("dirA/dirB", null);        thisTest.getWc().setItemWorkingCopyRevision("dirA/dirB",2);        thisTest.getWc().addItem("dirA/dirB/new_file", "some text");        thisTest.getWc().setItemWorkingCopyRevision("dirA/dirB/new_file",2);        // test the working copy status        thisTest.checkStatus();    }    /**     * test the basic SVNClient.fileContent functionality     * @throws Throwable     */    public void testBasicCat() throws Throwable    {        // create the working copy        OneTest thisTest = new OneTest();        // modify A/mu        File mu = new File(thisTest.getWorkingCopy(), "A/mu");        PrintWriter pw = new PrintWriter(new FileOutputStream(mu, true));        pw.print("some text");        pw.close();        // get the content from the repository        byte[] content = client.fileContent(thisTest.getWCPath()+"/A/mu", null);        byte[] testContent = thisTest.getWc().getItemContent("A/mu").getBytes();        // the content should be the same        assertTrue("content changed", Arrays.equals(content, testContent));    }    /**     * test the basic SVNClient.fileContent functionality     * @throws Throwable     */    public void testBasicCatStream() throws Throwable    {        // create the working copy        OneTest thisTest = new OneTest();        // modify A/mu        File mu = new File(thisTest.getWorkingCopy(), "A/mu");        PrintWriter pw = new PrintWriter(new FileOutputStream(mu, true));        pw.print("some text");        pw.close();        // get the content from the repository        ByteArrayOutputStream baos = new ByteArrayOutputStream();        client.streamFileContent(thisTest.getWCPath() + "/A/mu", null, null,                                 100, baos);                byte[] content = baos.toByteArray();        byte[] testContent = thisTest.getWc().getItemContent("A/mu").getBytes();        // the content should be the same        assertTrue("content changed", Arrays.equals(content, testContent));    }    /**     * test the basic SVNClient.list functionality     * @throws Throwable     */    public void testBasicLs() throws Throwable    {        // create the working copy        OneTest thisTest = new OneTest();        // list the repository root dir        DirEntry[] entries = client.list(thisTest.getWCPath(), null, false);        thisTest.getWc().check(entries,"", false);        // list directory A        entries = client.list(thisTest.getWCPath()+"/A", null, false);        thisTest.getWc().check(entries,"A", false);        // list directory A in BASE revision        entries = client.list(thisTest.getWCPath()+"/A", Revision.BASE, false);        thisTest.getWc().check(entries,"A", false);        // list file A/mu        entries = client.list(thisTest.getWCPath()+"/A/mu", null, false);        thisTest.getWc().check(entries,"A/mu");    }    /**     * test the basis SVNClient.add functionality with files that should be     * ignored     * @throws Throwable     */    public void testBasicAddIgnores() throws Throwable    {        // create working copy        OneTest thisTest = new OneTest();        // create dir

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -