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

📄 basictests.java

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        thisTest.getWc().setItemTextStatus("iota", Status.Kind.modified);        // modify A/D/G/rho        file = new File(thisTest.getWorkingCopy(), "A/D/G/rho");        pw = new PrintWriter(new FileOutputStream(file, true));        pw.print("Added some text to 'rho'.");        pw.close();        thisTest.getWc().setItemTextStatus("A/D/G/rho", Status.Kind.modified);        // create new file A/D/H/zeta and add it to subversion        file = new File(thisTest.getWorkingCopy(), "A/D/H/zeta");        pw = new PrintWriter(new FileOutputStream(file, true));        pw.print("Added some text to 'zeta'.");        pw.close();        thisTest.getWc().addItem("A/D/H/zeta", "Added some text to 'zeta'.");        thisTest.getWc().setItemTextStatus("A/D/H/zeta", Status.Kind.added);        client.add(file.getAbsolutePath(), false);        // test the status of the working copy        thisTest.checkStatus();        // revert the changes        client.revert(thisTest.getWCPath()+"/A/B/E/beta", false);        thisTest.getWc().setItemTextStatus("A/B/E/beta", Status.Kind.normal);        client.revert(thisTest.getWCPath()+"/iota", false);        thisTest.getWc().setItemTextStatus("iota", Status.Kind.normal);        client.revert(thisTest.getWCPath()+"/A/D/G/rho", false);        thisTest.getWc().setItemTextStatus("A/D/G/rho", Status.Kind.normal);        client.revert(thisTest.getWCPath()+"/A/D/H/zeta", false);        thisTest.getWc().setItemTextStatus("A/D/H/zeta",                Status.Kind.unversioned);        thisTest.getWc().setItemNodeKind("A/D/H/zeta", NodeKind.unknown);        // test the status of the working copy        thisTest.checkStatus();        // delete A/B/E/beta and revert the change        file = new File(thisTest.getWorkingCopy(), "A/B/E/beta");        file.delete();        client.revert(file.getAbsolutePath(), false);        // resurected file should not be readonly        assertTrue("reverted file is not readonly",                file.canWrite()&& file.canRead());        // test the status of the working copy        thisTest.checkStatus();        // create & add the directory X        client.mkdir(new String[] {thisTest.getWCPath()+"/X"}, null);        thisTest.getWc().addItem("X", null);        thisTest.getWc().setItemTextStatus("X", Status.Kind.added);        // test the status of the working copy        thisTest.checkStatus();        // remove & revert X        removeDirectoryWithContent(new File(thisTest.getWorkingCopy(), "X"));        client.revert(thisTest.getWCPath()+"/X", false);        thisTest.getWc().removeItem("X");        // test the status of the working copy        thisTest.checkStatus();        // delete the directory A/B/E        client.remove(new String[] {thisTest.getWCPath()+"/A/B/E"}, null, true);        removeDirectoryWithContent(new File(thisTest.getWorkingCopy(), "A/B/E"));        thisTest.getWc().setItemTextStatus("A/B/E", Status.Kind.deleted);        thisTest.getWc().removeItem("A/B/E/alpha");        thisTest.getWc().removeItem("A/B/E/beta");        // test the status of the working copy        thisTest.checkStatus();        // revert A/B/E -> this will not resurect it        client.revert(thisTest.getWCPath()+"/A/B/E", true);        // test the status of the working copy        thisTest.checkStatus();    }    /**     * thest the basic SVNClient.switch functionality     * @throws Throwable     */    public void testBasicSwitch() throws Throwable    {        // create the test working copy        OneTest thisTest = new OneTest();        // switch iota to A/D/gamma        String iotaPath = thisTest.getWCPath() + "/iota";        String gammaUrl = thisTest.getUrl() + "/A/D/gamma";        thisTest.getWc().setItemContent("iota",                greekWC.getItemContent("A/D/gamma"));        thisTest.getWc().setItemIsSwitched("iota", true);        client.doSwitch(iotaPath, gammaUrl, null, true);        // check the status of the working copy        thisTest.checkStatus();        // switch A/D/H to /A/D/G        String adhPath = thisTest.getWCPath() + "/A/D/H";        String adgURL = thisTest.getUrl() + "/A/D/G";        thisTest.getWc().setItemIsSwitched("A/D/H",true);        thisTest.getWc().removeItem("A/D/H/chi");        thisTest.getWc().removeItem("A/D/H/omega");        thisTest.getWc().removeItem("A/D/H/psi");        thisTest.getWc().addItem("A/D/H/pi",                thisTest.getWc().getItemContent("A/D/G/pi"));        thisTest.getWc().addItem("A/D/H/rho",                thisTest.getWc().getItemContent("A/D/G/rho"));        thisTest.getWc().addItem("A/D/H/tau",                thisTest.getWc().getItemContent("A/D/G/tau"));        client.doSwitch(adhPath, adgURL, null, true);        // check the status of the working copy        thisTest.checkStatus();    }    /**     * test the basic SVNClient.remove functionality     * @throws Throwable     */    public void testBasicDelete() throws Throwable    {        // create the test working copy        OneTest thisTest = new OneTest();        // modify A/D/H/chi        File file = new File(thisTest.getWorkingCopy(), "A/D/H/chi");        PrintWriter pw = new PrintWriter(new FileOutputStream(file, true));        pw.print("added to chi");        pw.close();        thisTest.getWc().setItemTextStatus("A/D/H/chi", Status.Kind.modified);        // set a property on A/D/G/rho file        client.propertySet(thisTest.getWCPath()+"/A/D/G/rho", "abc", "def",                true);        thisTest.getWc().setItemPropStatus("A/D/G/rho", Status.Kind.modified);        // set a property on A/B/F directory        client.propertySet(thisTest.getWCPath()+"/A/B/F", "abc", "def", false);        thisTest.getWc().setItemPropStatus("A/B/F", Status.Kind.modified);        // create a unversioned A/C/sigma file        file = new File(thisTest.getWCPath(),"A/C/sigma");        pw = new PrintWriter(new FileOutputStream(file));        pw.print("unversioned sigma");        pw.close();        thisTest.getWc().addItem("A/C/sigma", "unversioned sigma");        thisTest.getWc().setItemTextStatus("A/C/sigma", Status.Kind.unversioned);        thisTest.getWc().setItemNodeKind("A/C/sigma", NodeKind.unknown);        // create unversioned directory A/C/Q        file = new File(thisTest.getWCPath(), "A/C/Q");        file.mkdir();        thisTest.getWc().addItem("A/C/Q", null);        thisTest.getWc().setItemNodeKind("A/C/Q", NodeKind.unknown);        thisTest.getWc().setItemTextStatus("A/C/Q", Status.Kind.unversioned);        // create & add the directory A/B/X        file = new File(thisTest.getWCPath(), "A/B/X");        client.mkdir(new String[] {file.getAbsolutePath()}, null);        thisTest.getWc().addItem("A/B/X", null);        thisTest.getWc().setItemTextStatus("A/B/X", Status.Kind.added);        // create & add the file A/B/X/xi        file = new File(file, "xi");        pw = new PrintWriter(new FileOutputStream(file));        pw.print("added xi");        pw.close();        client.add(file.getAbsolutePath(),false);        thisTest.getWc().addItem("A/B/X/xi", "added xi");        thisTest.getWc().setItemTextStatus("A/B/X/xi", Status.Kind.added);        // create & add the directory A/B/Y        file = new File(thisTest.getWCPath(), "A/B/Y");        client.mkdir(new String[] {file.getAbsolutePath()}, null);        thisTest.getWc().addItem("A/B/Y", null);        thisTest.getWc().setItemTextStatus("A/B/Y", Status.Kind.added);        // test the status of the working copy        thisTest.checkStatus();        // the following removes should all fail without force        try        {            // remove of A/D/H/chi without force should fail, because it is            // modified            client.remove(new String[] {thisTest.getWCPath()+"/A/D/H/chi"},                    null, false);            fail("missing exception");        }        catch(ClientException expected)        {        }        try        {            // remove of A/D/H without force should fail, because A/D/H/chi is            // modified            client.remove(new String[] {thisTest.getWCPath()+"/A/D/H"}, null,                    false);            fail("missing exception");        }        catch(ClientException expected)        {        }        try        {            // remove of A/D/G/rho without force should fail, because it has            // a new property            client.remove(new String[] {thisTest.getWCPath()+"/A/D/G/rho"},                    null, false);            fail("missing exception");        }        catch(ClientException expected)        {        }        try        {            // remove of A/D/G without force should fail, because A/D/G/rho has            // a new property            client.remove(new String[] {thisTest.getWCPath()+"/A/D/G"}, null,                    false);            fail("missing exception");        }        catch(ClientException expected)        {        }        try        {            // remove of A/B/F without force should fail, because it has            // a new property            client.remove(new String[] {thisTest.getWCPath()+"/A/B/F"}, null,                    false);            fail("missing exception");        }        catch(ClientException expected)        {        }        try        {            // remove of A/B without force should fail, because A/B/F has            // a new property            client.remove(new String[] {thisTest.getWCPath()+"/A/B"}, null,                    false);            fail("missing exception");        }        catch(ClientException expected)        {        }        try        {            // remove of A/C/sigma without force should fail, because it is            // unversioned            client.remove(new String[] {thisTest.getWCPath()+"/A/C/sigma"},                    null, false);            fail("missing exception");        }        catch(ClientException expected)        {        }        try        {            // remove of A/C without force should fail, because A/C/sigma is            // unversioned            client.remove(new String[] {thisTest.getWCPath()+"/A/C"}, null,                    false);            fail("missing exception");        }        catch(ClientException expected)        {        }        try        {            // remove of A/B/X without force should fail, because it is new            client.remove(new String[] {thisTest.getWCPath()+"/A/B/X"}, null,                    false);            fail("missing exception");        }        catch(ClientException expected)        {        }        // check the status of the working copy        thisTest.checkStatus();        // the following removes should all work        client.remove(new String[] {thisTest.getWCPath()+"/A/B/E"}, null,                false);        thisTest.getWc().setItemTextStatus("A/B/E",Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/B/E/alpha",Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/B/E/beta",Status.Kind.deleted);        client.remove(new String[] {thisTest.getWCPath()+"/A/D/H"}, null, true);        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/omega",Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/D/H/psi",Status.Kind.deleted);        client.remove(new String[] {thisTest.getWCPath()+"/A/D/G"}, null, true);        thisTest.getWc().setItemTextStatus("A/D/G",Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/D/G/rho",Status.Kind.deleted);        thisTest.getWc().setItemPropStatus("A/D/G/rho", Status.Kind.none);        thisTest.getWc().setItemTextStatus("A/D/G/pi",Status.Kind.deleted);        thisTest.getWc().setItemTextStatus("A/D/G/tau",Status.Kind.deleted);        client.remove(new String[] {thisTest.getWCPath()+"/A/B/F"}, null, true);        thisTest.getWc().setItemTextStatus("A/B/F",Status.Kind.deleted);

⌨️ 快捷键说明

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