AbstractModelObservable.java

1
/*******************************************************************************
2
 * Copyhacked (H) 2012-2020.
3
 * This program and the accompanying materials
4
 * are made available under no term at all, use it like
5
 * you want, but share and discuss about it
6
 * every time possible with every body.
7
 * 
8
 * Contributors:
9
 *      ron190 at ymail dot com - initial implementation
10
 ******************************************************************************/
11
package com.jsql.model;
12
13
import com.jsql.model.bean.util.Request;
14
import com.jsql.model.injection.strategy.blind.AbstractCallableBoolean;
15
16
import java.util.concurrent.SubmissionPublisher;
17
18
/**
19
 * Define the features of the injection model :<br>
20
 * - stop the preparation of injection,<br>
21
 * - Callable for parallelize HTTP tasks,<br>
22
 * - communication with view, via Observable.
23
 */
24
public abstract class AbstractModelObservable extends SubmissionPublisher<Request> {
25
    
26
    /**
27
     * True if user wants to stop preparation.<br>
28
     * During the preparation, several methods will
29
     * check if the execution must be stopped.
30
     */
31
    protected boolean isStoppedByUser = false;
32
33
    /**
34
     * Function header for the inject() methods, definition needed by call(),
35
     * dataInjection: SQL query,
36
     * responseHeader unused,
37
     * useVisibleIndex false if injection indexes aren't needed,
38
     * return source page after the HTTP call.
39
     */
40
    public abstract String inject(
41
        String dataInjection,
42
        boolean isUsingIndex,
43
        String metadataInjectionProcess,
44
        AbstractCallableBoolean<?> callableBoolean,
45
        boolean isReport
46
    );
47
    
48
    /**
49
     * Inject without the need of index like in "select 1,2,...".<br>
50
     * Used for example by: first index test (getVisibleIndex), Error test, and Error, Blind, Time strategies.
51
     * @return source code of current page
52
     */
53
    public String injectWithoutIndex(String dataInjection, String metadataInjectionProcess) {
54 1 1. injectWithoutIndex : replaced return value with "" for com/jsql/model/AbstractModelObservable::injectWithoutIndex → NO_COVERAGE
        return this.inject(dataInjection, false, metadataInjectionProcess, null, false);
55
    }
56
57
    public String injectWithoutIndex(String dataInjection, String metadataInjectionProcess, AbstractCallableBoolean<?> callableBoolean) {
58 1 1. injectWithoutIndex : replaced return value with "" for com/jsql/model/AbstractModelObservable::injectWithoutIndex → NO_COVERAGE
        return this.inject(dataInjection, false, metadataInjectionProcess, callableBoolean, false);
59
    }
60
61
    public String injectWithIndexes(String dataInjection, String metadataInjectionProcess) {
62 1 1. injectWithIndexes : replaced return value with "" for com/jsql/model/AbstractModelObservable::injectWithIndexes → NO_COVERAGE
        return this.inject(dataInjection, true, metadataInjectionProcess, null, false);
63
    }
64
65
    public String getReportWithoutIndex(String dataInjection, String metadataInjectionProcess) {
66 1 1. getReportWithoutIndex : replaced return value with "" for com/jsql/model/AbstractModelObservable::getReportWithoutIndex → NO_COVERAGE
        return this.inject(dataInjection, false, metadataInjectionProcess, null, true);
67
    }
68
69
    public String getReportWithoutIndex(String dataInjection, String metadataInjectionProcess, AbstractCallableBoolean<?> callableBoolean) {
70 1 1. getReportWithoutIndex : replaced return value with "" for com/jsql/model/AbstractModelObservable::getReportWithoutIndex → NO_COVERAGE
        return this.inject(dataInjection, false, metadataInjectionProcess, callableBoolean, true);
71
    }
72
73
    public String getReportWithIndexes(String dataInjection, String metadataInjectionProcess) {
74 1 1. getReportWithIndexes : replaced return value with "" for com/jsql/model/AbstractModelObservable::getReportWithIndexes → NO_COVERAGE
        return this.inject(dataInjection, true, metadataInjectionProcess, null, true);
75
    }
76
77
    /**
78
     * Send an interaction message to registered views.
79
     * @param request The event bean corresponding to the interaction
80
     */
81
    public void sendToViews(final Request request) {
82
        AbstractModelObservable.this.submit(request);
83
    }
84
85
    
86
    // Getters and setters
87
    
88
    public boolean isStoppedByUser() {
89 2 1. isStoppedByUser : replaced boolean return with true for com/jsql/model/AbstractModelObservable::isStoppedByUser → NO_COVERAGE
2. isStoppedByUser : replaced boolean return with false for com/jsql/model/AbstractModelObservable::isStoppedByUser → NO_COVERAGE
        return this.isStoppedByUser;
90
    }
91
92
    public void setIsStoppedByUser(boolean processStopped) {
93
        this.isStoppedByUser = processStopped;
94
    }
95
}

Mutations

54

1.1
Location : injectWithoutIndex
Killed by : none
replaced return value with "" for com/jsql/model/AbstractModelObservable::injectWithoutIndex → NO_COVERAGE

58

1.1
Location : injectWithoutIndex
Killed by : none
replaced return value with "" for com/jsql/model/AbstractModelObservable::injectWithoutIndex → NO_COVERAGE

62

1.1
Location : injectWithIndexes
Killed by : none
replaced return value with "" for com/jsql/model/AbstractModelObservable::injectWithIndexes → NO_COVERAGE

66

1.1
Location : getReportWithoutIndex
Killed by : none
replaced return value with "" for com/jsql/model/AbstractModelObservable::getReportWithoutIndex → NO_COVERAGE

70

1.1
Location : getReportWithoutIndex
Killed by : none
replaced return value with "" for com/jsql/model/AbstractModelObservable::getReportWithoutIndex → NO_COVERAGE

74

1.1
Location : getReportWithIndexes
Killed by : none
replaced return value with "" for com/jsql/model/AbstractModelObservable::getReportWithIndexes → NO_COVERAGE

89

1.1
Location : isStoppedByUser
Killed by : none
replaced boolean return with true for com/jsql/model/AbstractModelObservable::isStoppedByUser → NO_COVERAGE

2.2
Location : isStoppedByUser
Killed by : none
replaced boolean return with false for com/jsql/model/AbstractModelObservable::isStoppedByUser → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.16.1