ActionListenerSave.java

1
package com.jsql.view.swing.panel.preferences;
2
3
import com.jsql.view.swing.action.ActionNewWindow;
4
import com.jsql.view.swing.panel.PanelPreferences;
5
import com.jsql.view.swing.util.MediatorHelper;
6
7
import javax.swing.*;
8
import java.awt.event.ActionEvent;
9
import java.awt.event.ActionListener;
10
11
public class ActionListenerSave implements ActionListener {
12
    
13
    private final PanelPreferences panelPreferences;
14
15
    public ActionListenerSave(PanelPreferences panelPreferences) {
16
        
17
        this.panelPreferences = panelPreferences;
18
    }
19
20
    @Override
21
    public void actionPerformed(ActionEvent e) {
22
        
23
        MediatorHelper.model().getMediatorUtils().getPreferencesUtil()
24
        
25
        .withIsCheckingUpdate(this.panelPreferences.getPanelGeneral().getCheckboxIsCheckingUpdate().isSelected())
26
        .withIsReportingBugs(this.panelPreferences.getPanelGeneral().getCheckboxIsReportingBugs().isSelected())
27
        .withIs4K(this.panelPreferences.getPanelGeneral().getCheckboxIs4K().isSelected())
28
        
29
        .withIsFollowingRedirection(this.panelPreferences.getPanelConnection().getCheckboxIsFollowingRedirection().isSelected())
30
        .withIsHttp2Disabled(this.panelPreferences.getPanelConnection().getCheckboxIsHttp2Disabled().isSelected())
31
        .withIsUnicodeDecodeDisabled(this.panelPreferences.getPanelConnection().getCheckboxIsUnicodeDecodeDisabled().isSelected())
32
        .withIsUrlDecodeDisabled(this.panelPreferences.getPanelConnection().getCheckboxIsUrlDecodeDisabled().isSelected())
33
        .withIsNotTestingConnection(this.panelPreferences.getPanelConnection().getCheckboxIsNotTestingConnection().isSelected())
34
        .withIsNotProcessingCookies(this.panelPreferences.getPanelConnection().getCheckboxIsNotProcessingCookies().isSelected())
35
        .withIsProcessingCsrf(this.panelPreferences.getPanelConnection().getCheckboxProcessCsrf().isSelected())
36
        .withIsLimitingThreads(this.panelPreferences.getPanelConnection().getCheckboxIsLimitingThreads().isSelected())
37
        .withCountLimitingThreads((Integer) this.panelPreferences.getPanelConnection().getSpinnerLimitingThreads().getValue())
38
        .withIsConnectionTimeout(this.panelPreferences.getPanelConnection().getCheckboxIsConnectionTimeout().isSelected())
39
        .withCountConnectionTimeout((Integer) this.panelPreferences.getPanelConnection().getSpinnerConnectionTimeout().getValue())
40
        .withIsCsrfUserTag(this.panelPreferences.getPanelConnection().getCheckboxIsCsrfUserTag().isSelected())
41
        .withCsrfUserTag(this.panelPreferences.getPanelConnection().getTextfieldCsrfUserTag().getText())
42
        .withCsrfUserTagOutput(this.panelPreferences.getPanelConnection().getTextfieldCsrfUserTagOutput().getText())
43
                
44
        .withIsParsingForm(this.panelPreferences.getPanelInjection().getCheckboxIsParsingForm().isSelected())
45
        .withIsNotInjectingMetadata(this.panelPreferences.getPanelInjection().getCheckboxIsNotInjectingMetadata().isSelected())
46
        .withIsNotSearchingCharInsertion(this.panelPreferences.getPanelInjection().getCheckboxIsNotSearchingCharInsertion().isSelected())
47
        .withIsNotShowingVulnReport(this.panelPreferences.getPanelInjection().getCheckboxIsNotShowingVulnReport().isSelected())
48
        .withIsLimitingNormalIndex(this.panelPreferences.getPanelInjection().getCheckboxIsLimitingNormalIndex().isSelected())
49
        .withCountNormalIndex((Integer) this.panelPreferences.getPanelInjection().getSpinnerNormalIndexCount().getValue())
50
        .withIsCheckingAllParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllParam().isSelected())
51
        .withIsCheckingAllURLParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllURLParam().isSelected())
52
        .withIsCheckingAllRequestParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllRequestParam().isSelected())
53
        .withIsCheckingAllHeaderParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllHeaderParam().isSelected())
54
        .withIsCheckingAllBase64Param(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllBase64Param().isSelected())
55
        .withIsCheckingAllJsonParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllJsonParam().isSelected())
56
        .withIsCheckingAllSoapParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllSoapParam().isSelected())
57
        .withIsCheckingAllCookieParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllCookieParam().isSelected())
58
        .withIsDefaultStrategy(this.panelPreferences.getPanelInjection().getRadioIsDefaultStrategy().isSelected())
59
        .withIsZipStrategy(this.panelPreferences.getPanelInjection().getRadioIsZipStrategy().isSelected())
60
        .withIsDiosStrategy(this.panelPreferences.getPanelInjection().getRadioIsDiosStrategy().isSelected())
61
        .withIsUrlEncodingDisabled(this.panelPreferences.getPanelInjection().getCheckboxIsUrlEncodingDisabled().isSelected())
62
        .withIsUrlRandomSuffixDisabled(this.panelPreferences.getPanelInjection().getCheckboxIsUrlRandomSuffixDisabled().isSelected())
63
        .withIsPerfIndexDisabled(this.panelPreferences.getPanelInjection().getCheckboxIsPerfIndexDisabled().isSelected())
64
        .withIsLimitingSleepTimeStrategy(this.panelPreferences.getPanelInjection().getCheckboxIsLimitingSleepTimeStrategy().isSelected())
65
        .withCountSleepTimeStrategy((Integer) this.panelPreferences.getPanelInjection().getSpinnerSleepTimeStrategy().getValue())
66
                
67
        .withIsTamperingBase64(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingBase64().isSelected())
68
        .withIsTamperingEqualToLike(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingEqualToLike().isSelected())
69
        .withIsTamperingFunctionComment(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingFunctionComment().isSelected())
70
        .withIsTamperingVersionComment(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingVersionComment().isSelected())
71
        .withIsTamperingRandomCase(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingRandomCase().isSelected())
72
        .withIsTamperingEval(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingEval().isSelected())
73
        .withIsTamperingSpaceToDashComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToDashComment().isSelected())
74
        .withIsTamperingSpaceToMultilineComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToMultilineComment().isSelected())
75
        .withIsTamperingSpaceToSharpComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToSharpComment().isSelected())
76
        
77
        .withIsStrategyTimeDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyTimeDisabled().isSelected())
78
        .withIsStrategyBlindDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyBlindDisabled().isSelected())
79
        .withIsStrategyMultibitDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyMultibitDisabled().isSelected())
80
        .withIsStrategyStackedDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyStackedDisabled().isSelected())
81
        .withIsStrategyErrorDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyErrorDisabled().isSelected())
82
        .withIsStrategyNormalDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyNormalDisabled().isSelected())
83
84 1 1. actionPerformed : removed call to com/jsql/util/PreferencesUtil::persist → NO_COVERAGE
        .persist();
85
        
86 1 1. actionPerformed : removed call to com/jsql/util/ProxyUtil::setPreferences → NO_COVERAGE
        MediatorHelper.model().getMediatorUtils().getProxyUtil().setPreferences(
87
            this.panelPreferences.getPanelProxy().getCheckboxIsUsingProxy().isSelected(),
88
            this.panelPreferences.getPanelProxy().getTextProxyAddress().getText(),
89
            this.panelPreferences.getPanelProxy().getTextProxyPort().getText(),
90
            this.panelPreferences.getPanelProxy().getCheckboxIsUsingProxyHttps().isSelected(),
91
            this.panelPreferences.getPanelProxy().getTextProxyAddressHttps().getText(),
92
            this.panelPreferences.getPanelProxy().getTextProxyPortHttps().getText()
93
        );
94
        
95
        MediatorHelper.model().getMediatorUtils().getTamperingUtil()
96
        .withBase64(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingBase64().isSelected())
97
        .withEqualToLike(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingEqualToLike().isSelected())
98
        .withEval(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingEval().isSelected())
99
        .withFunctionComment(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingFunctionComment().isSelected())
100
        .withHexToChar(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingHexToChar().isSelected())
101
        .withQuoteToUtf8(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingQuoteToUtf8().isSelected())
102
        .withRandomCase(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingRandomCase().isSelected())
103
        .withSpaceToDashComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToDashComment().isSelected())
104
        .withSpaceToMultilineComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToMultilineComment().isSelected())
105
        .withSpaceToSharpComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToSharpComment().isSelected())
106
        .withStringToChar(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingStringToChar().isSelected())
107
        .withVersionComment(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingVersionComment().isSelected());
108
        
109
        boolean isRestartRequired = MediatorHelper.model().getMediatorUtils().getAuthenticationUtil().set(
110
            this.panelPreferences.getPanelAuth().getCheckboxUseDigestAuthentication().isSelected(),
111
            this.panelPreferences.getPanelAuth().getTextDigestAuthenticationUsername().getText(),
112
            this.panelPreferences.getPanelAuth().getTextDigestAuthenticationPassword().getText(),
113
            this.panelPreferences.getPanelAuth().getCheckboxUseKerberos().isSelected(),
114
            this.panelPreferences.getPanelAuth().getTextKerberosKrb5Conf().getText(),
115
            this.panelPreferences.getPanelAuth().getTextKerberosLoginConf().getText()
116
        );
117
        
118 1 1. actionPerformed : negated conditional → NO_COVERAGE
        if (
119
            isRestartRequired
120 1 1. actionPerformed : negated conditional → NO_COVERAGE
            && JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(
121
                MediatorHelper.frame(),
122
                "File krb5.conf has changed, please restart.",
123
                "Restart",
124
                JOptionPane.YES_NO_OPTION
125
            )
126
        ) {
127 1 1. actionPerformed : removed call to com/jsql/view/swing/action/ActionNewWindow::actionPerformed → NO_COVERAGE
            new ActionNewWindow().actionPerformed(null);
128
        }
129
    }
130
}

Mutations

84

1.1
Location : actionPerformed
Killed by : none
removed call to com/jsql/util/PreferencesUtil::persist → NO_COVERAGE

86

1.1
Location : actionPerformed
Killed by : none
removed call to com/jsql/util/ProxyUtil::setPreferences → NO_COVERAGE

118

1.1
Location : actionPerformed
Killed by : none
negated conditional → NO_COVERAGE

120

1.1
Location : actionPerformed
Killed by : none
negated conditional → NO_COVERAGE

127

1.1
Location : actionPerformed
Killed by : none
removed call to com/jsql/view/swing/action/ActionNewWindow::actionPerformed → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.16.1