function = new JexlFunction(); result = new SampleResult(); jmctx = JMeterContextService.getContext(); String data = "The quick brown fox"; result.setResponseData(data.getBytes()); vars = new JMeterVariables(); jmctx.setVariables(vars); jmctx.setPreviousResult(result); params = new LinkedList();
establishConnection(); sampler = new HTTPSampler();// This must be the original (Java) HTTP sampler postWriter=new PostWriter(); // Create the test file content TEST_FILE_CONTENT = "foo content &?=01234+56789-\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052".getBytes(UTF_8); // create a temporary file to make sure we always have a file to give to the PostWriter // Whereever we are or Whatever the current path is. temporaryFile = File.createTempFile("foo", "txt"); OutputStream output = new FileOutputStream(temporaryFile); output.write(TEST_FILE_CONTENT); output.flush(); output.close();
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/functions/TestJexlFunction.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java
Method name: void setUp() Method name: void setUp()
Number of AST nodes: 9 Number of AST nodes: 9
1
function = new JexlFunction();
1
establishConnection();
2
        result = new SampleResult();
2
        sampler = new HTTPSample
3
        jmctx = JMeterContextService.getContext();
4
        String data = "The quick brown fox";
5
        result.setResponseData(data.getBytes());
6
        vars = new JMeterVariables();
7
        jmctx.setVariables(vars);
8
        jmctx.setPreviousResult(result);
9
        params = new LinkedList
3
r();// This must be the original (Java) HTTP sampler
4
        postWriter=new PostWriter();
5
        
6
        // Create the test file content
7
        TEST_FILE_CONTENT = "foo content &?=01234+56789-\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052".getBytes(UTF_8);
8
        // create a temporary file to make sure we always have a file to give to the PostWriter 
9
        // Whereever we are or Whatever the current path is.
10
        temporaryFile = File.createTempFile("foo", "txt");
11
        OutputStream output = new FileOutputStream(temporaryFile);
12
        output.write(TEST_FILE_CONTENT);
13
        output.flush();
10
();
14
        output.close();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in different classes having the same super class
Number of node comparisons81
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment8
    Number of unmapped statements in the second code fragment8
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    function = new JexlFunction();
                                                                  
                                                              
    2
    sampler = new HTTPSampler();
    2
    result = new SampleResult();
                                                              
                                                                  
    3
    postWriter = new PostWriter();
    3
    jmctx = JMeterContextService.getContext();
                                                                                          
                                                                                                                                                                                                                                                      
    4
    TEST_FILE_CONTENT = "foo content &?=01234+56789-\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052".getBytes(UTF_8);
    4
    String data = "The quick brown fox";
                                                                              
    5
    result.setResponseData(data.getBytes());
    5
    result.setResponseData(data.getBytes());
    1
    establishConnection();
    Differences
    Expression1Expression2Difference
    setResponseDataestablishConnectionMETHOD_INVOCATION_NAME_MISMATCH
    result.setResponseData(data.getBytes())establishConnection()ARGUMENT_NUMBER_MISMATCH
    resultMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression result.setResponseData(data.getBytes()) is a void method call, and thus it cannot be parameterized
    Expression establishConnection() is a void method call, and thus it cannot be parameterized
    Expression result.setResponseData(data.getBytes()) is a void method call, and thus it cannot be parameterized
    Expression establishConnection() is a void method call, and thus it cannot be parameterized
    1
    establishConnection();
                                                                                                        
    5
    temporaryFile = File.createTempFile("foo", "txt");
                                                                                                                          
    6
    OutputStream output = new FileOutputStream(temporaryFile);
    6
    vars = new JMeterVariables();
                                                                
                                                                          
    7
    output.write(TEST_FILE_CONTENT);
    7
    jmctx.setVariables(vars);
                                                            
                                        
    8
    output.flush();
    8
    jmctx.setPreviousResult(result);
                                                                          
                                        
    9
    output.close();
    9
    params = new LinkedList();
                                                          
    Precondition Violations (4)
    Row Violation
    1Expression result.setResponseData(data.getBytes()) is a void method call, and thus it cannot be parameterized
    2Expression establishConnection() is a void method call, and thus it cannot be parameterized
    3Expression result.setResponseData(data.getBytes()) is a void method call, and thus it cannot be parameterized
    4Expression establishConnection() is a void method call, and thus it cannot be parameterized