sosGet.setSosHome(SOS_HOME); sosGet.setNoCache(true); sosGet.setNoCompress(false); sosGet.setVerbose(false); sosGet.setRecursive(true); commandline = sosGet.buildCmdLine(); checkCommandLines(sTestCmdLine, commandline.getCommandline()); } /** Tests SOSGet required attributes. */ public void testGetExceptions() { configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml"); expectSpecificBuildException("sosget.1", "some cause", "sosserverpath attribute must be set!"); expectSpecificBuildException("sosget.2", "some cause", "username attribute must be set!"); expectSpecificBuildException("sosget.3", "some cause", "vssserverpath attribute must be set!"); expectSpecificBuildException("sosget.4", "some cause", "projectpath attribute must be set!"); } /** Test CheckInFile option flags */ public void testCheckinFileFlags() { String[] sTestCmdLine = {"soscmd", "-command", "CheckInFile", "-file", SRC_FILE, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME, "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH, "-project", DS_VSS_PROJECT_PATH, "-verbose", "-nocompress", "-nocache", "-workdir", project.getBaseDir().getAbsolutePath() + File.separator + LOCAL_PATH, "-log", SRC_COMMENT}; // Set up a SOSCheckin task SOSCheckin sosCheckin = new SOSCheckin(); sosCheckin.setProject(project); sosCheckin.setVssServerPath(VSS_SERVER_PATH); sosCheckin.setSosServerPath(SOS_SERVER_PATH); sosCheckin.setProjectPath(VSS_PROJECT_PATH); sosCheckin
sosCheckout.setSosHome(SOS_HOME); sosCheckout.setNoCache(true); sosCheckout.setNoCompress(false); sosCheckout.setVerbose(false); sosCheckout.setRecursive(true); commandline = sosCheckout.buildCmdLine(); checkCommandLines(sTestCmdLine, commandline.getCommandline()); } /** Test SOSCheckout required attributes. */ public void testCheckoutExceptions() { configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml"); expectSpecificBuildException("soscheckout.1", "some cause", "sosserverpath attribute must be set!"); expectSpecificBuildException("soscheckout.2", "some cause", "username attribute must be set!"); expectSpecificBuildException("soscheckout.3", "some cause", "vssserverpath attribute must be set!"); expectSpecificBuildException("soscheckout.4", "some cause", "projectpath attribute must be set!"); } /** Test Label option flags */ public void testLabelFlags() { String[] sTestCmdLine = {"soscmd", "-command", "AddLabel", "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME, "-password", "", "-database", VSS_SERVER_PATH, "-project", DS_VSS_PROJECT_PATH, "-label", SRC_LABEL, "-verbose", "-log", SRC_COMMENT}; // Set up a sosCheckout task SOSLabel sosLabel = new SOSLabel(); sosLabel.setVssServerPath(VSS_SERVER_PATH); sosLabel.setSosServerPath(SOS_SERVER_PATH); sosLabel.setProjectPath(DS_VSS_PROJECT_PATH); sosLabel.setUsername(SOS_USERNAME); sosLabel
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
sosGet.setSosHome(SOS_HOME);
1
sosCheckout.setSosHome(SOS_HOME);
2
        sosGet.setNoCache(true);
2
        sosCheckout.setNoCache(true);
3
        sosGet.setNoCompress(false);
3
        sosCheckout.setNoCompress(false);
4
        sosGet.setVerbose(false);
4
        sosCheckout.setVerbose(false);
5
        sosGet.setRecursive(true);
5
        sosCheckout.setRecursive(true);
6
        commandline = sosGet.buildCmdLine();
6
        commandline = sosCheckout.buildCmdLine();
7
        checkCommandLines(sTestCmdLine, commandline.getCommandline());
7
        checkCommandLines(sTestCmdLine, commandline.getCommandline());
8
    }
8
    }
9
    /**  Tests SOSGet required attributes.  */
9
    /**  Test SOSCheckout required attributes.  */
10
    public void testGetExceptions() {
10
    public void testCheckoutExceptions() {
11
        configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
11
        configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
12
        expectSpecificBuildException("sosget.1", "some cause", "sosserverpath attribute must be set!");
12
        expectSpecificBuildException("soscheckout.1", "some cause", "sosserverpath attribute must be set!");
13
        expectSpecificBuildException("sosget.2", "some cause", "username attribute must be set!");
13
        expectSpecificBuildException("soscheckout.2", "some cause", "username attribute must be set!");
14
        expectSpecificBuildException("sosget.3", "some cause", "vssserverpath attribute must be set!");
14
        expectSpecificBuildException("soscheckout.3", "some cause", "vssserverpath attribute must be set!");
15
        expectSpecificBuildException("sosget.4", "some cause", "projectpath attribute must be set!");
15
        expectSpecificBuildException("soscheckout.4", "some cause", "projectpath attribute must be set!");
16
    }
16
    }
17
    /**  Test CheckInFile option flags  */
17
    /**  Test Label option flags  */
18
    public void testCheckinFileFlags() {
18
    public void testLabelFlags() {
19
        String[] sTestCmdLine = {"soscmd", "-command", "CheckInFile", "-file",
19
        String[] sTestCmdLine = {"soscmd", "-command", "
20
                SRC_FILE, "-server",
20
AddLabel", "-server",
21
 SOS_SERVER_PATH, "-name", SOS_USERNAME,
21
                SOS_SERVER_PATH, "-name", SOS_USERNAME,
22
                "-password", SOS_PASSWORD, "-database",
22
 "-password", "", "-database",
23
 VSS_SERVER_PATH, "-project",
23
                VSS_SERVER_PATH, "-project",
24
                DS_VSS_PROJECT_PATH, "-verbose", "-nocompress", "-nocache",
24
 DS_VSS_PROJECT_PATH, "-
25
                "-workdir", project.getBaseDir().getAbsolutePath() + File.separator
26
                 + LOCAL_PATH
25
label",
27
, "-log", SRC_COMMENT};
26
                SRC_LABEL, "-verbose", "-log", SRC_COMMENT};
28
        // Set up a SOSCheckin task
27
        // Set up a sosCheckout task
29
        SOSCheckin sosCheckin = new SOSCheckin();
28
        SOSLabel sosLabel = new SOSLabel();
30
        sosCheckin.setProject(project);
29
        sos
31
        sosCheckin.setVssServerPath(VSS_SERVER_PATH);
30
Label.setVssServerPath(VSS_SERVER_PATH);
32
        sosCheckin.setSosServerPath(SOS_SERVER_PATH);
31
        sosLabel.setSosServerPath(SOS_SERVER_PATH);
33
        sosCheckin.setProjectPath(VSS_PROJECT_PATH);
32
        sosLabel.setProjectPath(DS_VSS_PROJECT_PATH);
34
        sosCheckin
33
        sosLabel.setUsername(SOS_USERNAME);
34
        sosLabel
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0