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 String metadataInjectionProcess; | |
21 | ||
22 | /** | |
23 | * Source code for current page. | |
24 | */ | |
25 | private String content = StringUtils.EMPTY; | |
26 | ||
27 | /** | |
28 | * Character used for current page. | |
29 | */ | |
30 | private String characterInsertion; | |
31 | | |
32 | private final InjectionModel injectionModel; | |
33 | | |
34 | /** | |
35 | * Create a callable to get initial query or insertion character. | |
36 | * @param query | |
37 | * @param injectionModel | |
38 | */ | |
39 | public CallablePageSource(String query, InjectionModel injectionModel, String metadataInjectionProcess) { | |
40 | | |
41 | this.query = query; | |
42 | this.injectionModel = injectionModel; | |
43 | this.metadataInjectionProcess = metadataInjectionProcess; | |
44 | } | |
45 | ||
46 | /** | |
47 | * Create callable for current insertion character test. | |
48 | * @param query | |
49 | * @param characterInsertion | |
50 | */ | |
51 | public CallablePageSource( | |
52 | String query, | |
53 | String characterInsertion, | |
54 | InjectionModel injectionModel, | |
55 | String metadataInjectionProcess | |
56 | ) { | |
57 | | |
58 | this(query, injectionModel, metadataInjectionProcess); | |
59 | | |
60 | this.characterInsertion = characterInsertion; | |
61 | } | |
62 | | |
63 | @Override | |
64 | public CallablePageSource call() { | |
65 | | |
66 | this.content = this.injectionModel.injectWithoutIndex(this.query, this.metadataInjectionProcess); | |
67 | | |
68 |
1
1. call : replaced return value with null for com/jsql/model/suspendable/callable/CallablePageSource::call → NO_COVERAGE |
return this; |
69 | } | |
70 | ||
71 | | |
72 | // Getters | |
73 | ||
74 | public String getQuery() { | |
75 |
1
1. getQuery : replaced return value with "" for com/jsql/model/suspendable/callable/CallablePageSource::getQuery → NO_COVERAGE |
return this.query; |
76 | } | |
77 | | |
78 | public String getContent() { | |
79 |
1
1. getContent : replaced return value with "" for com/jsql/model/suspendable/callable/CallablePageSource::getContent → NO_COVERAGE |
return this.content; |
80 | } | |
81 | | |
82 | public String getCharacterInsertion() { | |
83 |
1
1. getCharacterInsertion : replaced return value with "" for com/jsql/model/suspendable/callable/CallablePageSource::getCharacterInsertion → NO_COVERAGE |
return this.characterInsertion; |
84 | } | |
85 | } | |
Mutations | ||
68 |
1.1 |
|
75 |
1.1 |
|
79 |
1.1 |
|
83 |
1.1 |