CallablePageSource.java

1
package com.jsql.model.suspendable.callable;
2
3
import com.jsql.model.InjectionModel;
4
import org.apache.commons.lang3.StringUtils;
5
6
import java.util.concurrent.Callable;
7
8
/**
9
 * Callable for concurrent HTTP tasks
10
 * url: SQL query
11
 * content: source code of the web page
12
 * tag: store user information (ex. current index)
13
 */
14
public class CallablePageSource implements Callable<CallablePageSource> {
15
    
16
    /**
17
     * URL to load.
18
     */
19
    private final String query;
20
    private final int nbIndex;
21
    private final String metadataInjectionProcess;
22
23
    /**
24
     * Source code for current page.
25
     */
26
    private String content = StringUtils.EMPTY;
27
28
    /**
29
     * Character used for current page.
30
     */
31
    private String characterInsertion;
32
    
33
    private final InjectionModel injectionModel;
34
    
35
    /**
36
     * Create a callable to get initial query or insertion character.
37
     */
38
    public CallablePageSource(String query, InjectionModel injectionModel, String metadataInjectionProcess, int nbIndex) {
39
        this.query = query;
40
        this.nbIndex = nbIndex;
41
        this.injectionModel = injectionModel;
42
        this.metadataInjectionProcess = metadataInjectionProcess;
43
    }
44
45
    /**
46
     * Create callable for current insertion character test.
47
     */
48
    public CallablePageSource(
49
        String query,
50
        String characterInsertion,
51
        InjectionModel injectionModel,
52
        String metadataInjectionProcess
53
    ) {
54
        this(query, injectionModel, metadataInjectionProcess, 0);
55
        this.characterInsertion = characterInsertion;
56
    }
57
    
58
    @Override
59
    public CallablePageSource call() {
60
        this.content = this.injectionModel.injectWithoutIndex(this.query, this.metadataInjectionProcess);
61 1 1. call : replaced return value with null for com/jsql/model/suspendable/callable/CallablePageSource::call → NO_COVERAGE
        return this;
62
    }
63
64
    
65
    // Getters
66
67
    public String getQuery() {
68 1 1. getQuery : replaced return value with "" for com/jsql/model/suspendable/callable/CallablePageSource::getQuery → NO_COVERAGE
        return this.query;
69
    }
70
    
71
    public String getContent() {
72 1 1. getContent : replaced return value with "" for com/jsql/model/suspendable/callable/CallablePageSource::getContent → NO_COVERAGE
        return this.content;
73
    }
74
    
75
    public String getCharacterInsertion() {
76 1 1. getCharacterInsertion : replaced return value with "" for com/jsql/model/suspendable/callable/CallablePageSource::getCharacterInsertion → NO_COVERAGE
        return this.characterInsertion;
77
    }
78
79
    public int getNbIndex() {
80 1 1. getNbIndex : replaced int return with 0 for com/jsql/model/suspendable/callable/CallablePageSource::getNbIndex → NO_COVERAGE
        return this.nbIndex;
81
    }
82
}

Mutations

61

1.1
Location : call
Killed by : none
replaced return value with null for com/jsql/model/suspendable/callable/CallablePageSource::call → NO_COVERAGE

68

1.1
Location : getQuery
Killed by : none
replaced return value with "" for com/jsql/model/suspendable/callable/CallablePageSource::getQuery → NO_COVERAGE

72

1.1
Location : getContent
Killed by : none
replaced return value with "" for com/jsql/model/suspendable/callable/CallablePageSource::getContent → NO_COVERAGE

76

1.1
Location : getCharacterInsertion
Killed by : none
replaced return value with "" for com/jsql/model/suspendable/callable/CallablePageSource::getCharacterInsertion → NO_COVERAGE

80

1.1
Location : getNbIndex
Killed by : none
replaced int return with 0 for com/jsql/model/suspendable/callable/CallablePageSource::getNbIndex → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.18.2