sosCheckin.setPassword(SOS_PASSWORD); sosCheckin.setLocalPath(new Path(project, LOCAL_PATH)); sosCheckin.setNoCache(true); sosCheckin.setNoCompress(true); sosCheckin.setVerbose(true); sosCheckin.setRecursive(true); commandline = sosCheckin.buildCmdLine(); checkCommandLines(sTestCmdLine, commandline.getCommandline()); } /** Test CheckInProject option flags */ public void testCheckinProjectFlags() { String[] sTestCmdLine = {"soscmd", "-command", "CheckInProject", "-recursive", "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME, "-password", "", "-database", VSS_SERVER_PATH, "-project", DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir", project.getBaseDir().getAbsolutePath(), "-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(DS_VSS_PROJECT_PATH); sosCheckin.setComment(SRC_COMMENT); sosCheckin.setUsername(SOS_USERNAME); sosCheckin.setSosHome(SOS_HOME); sosCheckin.setNoCache(true); sosCheckin.setNoCompress(false); sosCheckin.setVerbose(false); sosCheckin.setRecursive(true); commandline = sosCheckin.buildCmdLine(); checkCommandLines(sTestCmdLine, commandline.getCommandline()); } /** Test SOSCheckIn required attributes. */ public void testCheckinExceptions() { configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml"); expectSpecificBuildException("soscheckin.1", "some cause", "sosserverpath attribute must be set!"); expectSpecificBuildException("soscheckin.2", "some cause", "username attribute must be set!"); expectSpecificBuildException("soscheckin.3", "some cause", "vssserverpath attribute must be set!"); expectSpecificBuildException("soscheckin.4", "some cause", "projectpath attribute must be set!");
sosGet.setVersion(VERSION); sosGet.setLocalPath(new Path(project, LOCAL_PATH)); sosGet.setNoCache(true); sosGet.setNoCompress(true); sosGet.setVerbose(true); sosGet.setRecursive(true); commandline = sosGet.buildCmdLine(); checkCommandLines(sTestCmdLine, commandline.getCommandline()); } /** Test SOSGetProject flags & commandline generation */ public void testGetProjectFlags() { String[] sTestCmdLine = {"soscmd", "-command", "GetProject", "-recursive", "-label", SRC_LABEL, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME, "-password", "", "-database", VSS_SERVER_PATH, "-project", DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir", project.getBaseDir().getAbsolutePath()}; // Set up a SOSGet task SOSGet sosGet = new SOSGet(); sosGet.setProject(project); sosGet.setVssServerPath(VSS_SERVER_PATH); sosGet.setSosServerPath(SOS_SERVER_PATH); sosGet.setProjectPath(DS_VSS_PROJECT_PATH); sosGet.setLabel(SRC_LABEL); sosGet.setUsername(SOS_USERNAME); 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!");
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
sosCheckin.setPassword(SOS_PASSWORD);
1
sosGet.setVersion(VERSION);
2
        sosCheckin.setLocalPath(new Path(project, LOCAL_PATH));
2
        sosGet.setLocalPath(new Path(project, LOCAL_PATH));
3
        sosCheckin.setNoCache(true);
3
        sosGet.setNoCache(true);
4
        sosCheckin.setNoCompress(true);
4
        sosGet.setNoCompress(true);
5
        sosCheckin.setVerbose(true);
5
        sosGet.setVerbose(true);
6
        sosCheckin.setRecursive(true);
6
        sosGet.setRecursive(true);
7
        commandline = sosCheckin.buildCmdLine();
7
        commandline = sosGet.buildCmdLine();
8
        checkCommandLines(sTestCmdLine, commandline.getCommandline());
8
        checkCommandLines(sTestCmdLine, commandline.getCommandline());
9
    }
9
    }
10
    /**  Test CheckInProject option flags  */
10
    /**  Test SOSGetProject flags & commandline generation  */
11
    public void testCheckinProjectFlags() {
11
    public void testGetProjectFlags() {
12
        String[] sTestCmdLine = {"soscmd", "-command", "CheckInProject",
12
        String[] sTestCmdLine = {"soscmd", "-command", "GetProject", "-recursive",
13
                "-recursive", "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
13
                "-label", SRC_LABEL, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
14
                "-password", "", "-database", VSS_SERVER_PATH, "-project",
14
                "-password", "", "-database", VSS_SERVER_PATH, "-project",
15
                DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
15
                DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
16
                project.getBaseDir().getAbsolutePath(), "-log", SRC_COMMENT,};
16
                project.getBaseDir().getAbsolutePath()};
17
        // Set up a SOSCheckin task
17
        // Set up a SOSGet task
18
        SOSCheckin sosCheckin = new SOSCheckin();
18
        SOSGet sosGet = new SOSGet();
19
        sosCheckin.setProject(project);
19
        sosGet.setProject(project);
20
        sosCheckin.setVssServerPath(VSS_SERVER_PATH);
20
        sosGet.setVssServerPath(VSS_SERVER_PATH);
21
        sosCheckin.setSosServerPath(SOS_SERVER_PATH);
21
        sosGet.setSosServerPath(SOS_SERVER_PATH);
22
        sosCheckin.setProjectPath(DS_VSS_PROJECT_PATH);
22
        sosGet.setProjectPath(DS_VSS_PROJECT_PATH);
23
        sosCheckin.setComment(SRC_COMMENT);
23
        sosGet.setLabel(SRC_LABEL);
24
        sosCheckin.setUsername(SOS_USERNAME);
24
        sosGet.setUsername(SOS_USERNAME);
25
        sosCheckin.setSosHome(SOS_HOME);
25
        sosGet.setSosHome(SOS_HOME);
26
        sosCheckin.setNoCache(true);
26
        sosGet.setNoCache(true);
27
        sosCheckin.setNoCompress(false);
27
        sosGet.setNoCompress(false);
28
        sosCheckin.setVerbose(false);
28
        sosGet.setVerbose(false);
29
        sosCheckin.setRecursive(true);
29
        sosGet.setRecursive(true);
30
        commandline = sosCheckin.buildCmdLine();
30
        commandline = sosGet.buildCmdLine();
31
        checkCommandLines(sTestCmdLine, commandline.getCommandline());
31
        checkCommandLines(sTestCmdLine, commandline.getCommandline());
32
    }
32
    }
33
    /**  Test SOSCheckIn required attributes.  */
33
    /**  Tests SOSGet required attributes.  */
34
    public void testCheckinExceptions() {
34
    public void testGetExceptions() {
35
        configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
35
        configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
36
        expectSpecificBuildException("soscheckin.1", "some cause", "sosserverpath attribute must be set!");
36
        expectSpecificBuildException("sosget.1", "some cause", "sosserverpath attribute must be set!");
37
        expectSpecificBuildException("soscheckin.2", "some cause", "username attribute must be set!");
37
        expectSpecificBuildException("sosget.2", "some cause", "username attribute must be set!");
38
        expectSpecificBuildException("soscheckin.3", "some cause", "vssserverpath attribute must be set!");
38
        expectSpecificBuildException("sosget.3", "some cause", "vssserverpath attribute must be set!");
39
        expectSpecificBuildException("soscheckin.4", "some cause", "projectpath attribute must be set!");
39
        expectSpecificBuildException("sosget.4", "some cause", "projectpath attribute must be set!");
40
    
40
    
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