PanelProxy.java

1
package com.jsql.view.swing.panel.preferences;
2
3
import com.jsql.view.swing.action.ActionCheckIp;
4
import com.jsql.view.swing.panel.PanelPreferences;
5
import com.jsql.view.swing.text.JPopupTextField;
6
import com.jsql.view.swing.text.listener.DocumentListenerEditing;
7
import com.jsql.view.swing.util.MediatorHelper;
8
9
import javax.swing.*;
10
import javax.swing.event.DocumentListener;
11
import java.awt.*;
12
import java.util.stream.Stream;
13
14
public class PanelProxy extends JPanel {
15
16
    private final JCheckBox checkboxIsUsingProxy = new JCheckBox("<html>Enable proxy for <b>HTTP</b>:</html>", MediatorHelper.model().getMediatorUtils().getProxyUtil().isUsingProxyHttp());
17
    private final JCheckBox checkboxIsUsingProxyHttps = new JCheckBox("<html>Enable proxy for <b>HTTPS</b>:</html>", MediatorHelper.model().getMediatorUtils().getProxyUtil().isUsingProxyHttps());
18
19
    private final JTextField textProxyAddress = new JPopupTextField("e.g. Tor address: 127.0.0.1", MediatorHelper.model().getMediatorUtils().getProxyUtil().getProxyAddressHttp()).getProxy();
20
    private final JTextField textProxyPort = new JPopupTextField("e.g. Tor port: 8118", MediatorHelper.model().getMediatorUtils().getProxyUtil().getProxyPortHttp()).getProxy();
21
    private final JTextField textProxyAddressHttps = new JPopupTextField("e.g. Tor address: 127.0.0.1", MediatorHelper.model().getMediatorUtils().getProxyUtil().getProxyAddressHttps()).getProxy();
22
    private final JTextField textProxyPortHttps = new JPopupTextField("e.g. Tor port: 8118", MediatorHelper.model().getMediatorUtils().getProxyUtil().getProxyPortHttps()).getProxy();
23
24
    public PanelProxy(PanelPreferences panelPreferences) {
25
        var panelHttpIpAddress = new JPanel();
26 1 1. <init> : removed call to javax/swing/JPanel::setLayout → NO_COVERAGE
        panelHttpIpAddress.setLayout(new BoxLayout(panelHttpIpAddress, BoxLayout.X_AXIS));
27
        panelHttpIpAddress.add(new JLabel("IP "));
28
        panelHttpIpAddress.add(this.textProxyAddress);
29 1 1. <init> : removed call to javax/swing/JPanel::setMaximumSize → NO_COVERAGE
        panelHttpIpAddress.setMaximumSize(new Dimension(325, this.textProxyAddress.getPreferredSize().height));
30
31
        var panelHttpPort = new JPanel();
32 1 1. <init> : removed call to javax/swing/JPanel::setLayout → NO_COVERAGE
        panelHttpPort.setLayout(new BoxLayout(panelHttpPort, BoxLayout.X_AXIS));
33
        panelHttpPort.add(new JLabel("Port "));
34
        panelHttpPort.add(this.textProxyPort);
35 1 1. <init> : removed call to javax/swing/JPanel::setMaximumSize → NO_COVERAGE
        panelHttpPort.setMaximumSize(new Dimension(325, this.textProxyPort.getPreferredSize().height));
36 1 1. <init> : removed call to javax/swing/JPanel::setBorder → NO_COVERAGE
        panelHttpPort.setBorder(BorderFactory.createEmptyBorder(0,0,10,0));
37
38
        var panelHttpsIpAddress = new JPanel();
39 1 1. <init> : removed call to javax/swing/JPanel::setLayout → NO_COVERAGE
        panelHttpsIpAddress.setLayout(new BoxLayout(panelHttpsIpAddress, BoxLayout.X_AXIS));
40
        panelHttpsIpAddress.add(new JLabel("IP "));
41
        panelHttpsIpAddress.add(this.textProxyAddressHttps);
42 1 1. <init> : removed call to javax/swing/JPanel::setMaximumSize → NO_COVERAGE
        panelHttpsIpAddress.setMaximumSize(new Dimension(325, this.textProxyAddressHttps.getPreferredSize().height));
43
44
        var panelHttpsPort = new JPanel();
45 1 1. <init> : removed call to javax/swing/JPanel::setLayout → NO_COVERAGE
        panelHttpsPort.setLayout(new BoxLayout(panelHttpsPort, BoxLayout.X_AXIS));
46
        panelHttpsPort.add(new JLabel("Port "));
47
        panelHttpsPort.add(this.textProxyPortHttps);
48 1 1. <init> : removed call to javax/swing/JPanel::setMaximumSize → NO_COVERAGE
        panelHttpsPort.setMaximumSize(new Dimension(325, this.textProxyPortHttps.getPreferredSize().height));
49 1 1. <init> : removed call to javax/swing/JPanel::setBorder → NO_COVERAGE
        panelHttpsPort.setBorder(BorderFactory.createEmptyBorder(0,0,10,0));
50
51 1 1. <init> : removed call to javax/swing/JCheckBox::setToolTipText → NO_COVERAGE
        this.checkboxIsUsingProxy.setToolTipText("Enable proxy for HTTP protocol");
52 1 1. <init> : removed call to javax/swing/JCheckBox::setToolTipText → NO_COVERAGE
        this.checkboxIsUsingProxyHttps.setToolTipText("Enable proxy for HTTPS protocol");
53
54
        Stream.of(
55
            this.checkboxIsUsingProxy,
56
            this.checkboxIsUsingProxyHttps
57
        )
58 2 1. <init> : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
2. lambda$new$0 : removed call to javax/swing/JCheckBox::addActionListener → NO_COVERAGE
        .forEach(button -> button.addActionListener(panelPreferences.getActionListenerSave()));
59
        
60
        DocumentListener documentListenerSave = new DocumentListenerEditing() {
61
            @Override
62
            public void process() {
63 1 1. process : removed call to java/awt/event/ActionListener::actionPerformed → NO_COVERAGE
                panelPreferences.getActionListenerSave().actionPerformed(null);
64
            }
65
        };
66
67
        Stream.of(
68
            this.textProxyAddress,
69
            this.textProxyPort,
70
            this.textProxyAddressHttps,
71
            this.textProxyPortHttps
72
        )
73 2 1. lambda$new$1 : removed call to javax/swing/text/Document::addDocumentListener → NO_COVERAGE
2. <init> : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
        .forEach(textField -> textField.getDocument().addDocumentListener(documentListenerSave));
74
75
        final var buttonCheckIp = new JButton("Check your IP address");
76 1 1. <init> : removed call to javax/swing/JButton::addActionListener → NO_COVERAGE
        buttonCheckIp.addActionListener(new ActionCheckIp());
77 1 1. <init> : removed call to javax/swing/JButton::setToolTipText → NO_COVERAGE
        buttonCheckIp.setToolTipText(
78
            "<html><b>Show your public IP address</b><br>"
79
            + "Your internal IP is displayed if you don't set a proxy. If you set a proxy<br>"
80
            + "like TOR then another IP is used instead of your internal IP.</html>"
81
        );
82
83
        var labelOrigin = new JLabel("<html><b>Proxy settings (e.g Burp, Tor and Privoxy)</b></html>");
84 1 1. <init> : removed call to javax/swing/JLabel::setBorder → NO_COVERAGE
        labelOrigin.setBorder(PanelGeneral.MARGIN);
85
86
        var groupLayout = new GroupLayout(this);
87 1 1. <init> : removed call to com/jsql/view/swing/panel/preferences/PanelProxy::setLayout → NO_COVERAGE
        this.setLayout(groupLayout);
88
        
89 1 1. <init> : removed call to javax/swing/GroupLayout::setHorizontalGroup → NO_COVERAGE
        groupLayout.setHorizontalGroup(
90
            groupLayout
91
            .createSequentialGroup()
92
            .addGroup(
93
                groupLayout
94
                .createParallelGroup(GroupLayout.Alignment.LEADING, false)
95
                .addComponent(labelOrigin)
96
                .addComponent(this.checkboxIsUsingProxy)
97
                .addComponent(panelHttpIpAddress)
98
                .addComponent(panelHttpPort)
99
                .addComponent(this.checkboxIsUsingProxyHttps)
100
                .addComponent(panelHttpsIpAddress)
101
                .addComponent(panelHttpsPort)
102
                .addComponent(buttonCheckIp)
103
            )
104
        );
105
        
106 1 1. <init> : removed call to javax/swing/GroupLayout::setVerticalGroup → NO_COVERAGE
        groupLayout.setVerticalGroup(
107
            groupLayout
108
            .createSequentialGroup()
109
            .addGroup(
110
                groupLayout
111
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
112
                .addComponent(labelOrigin)
113
            )
114
            .addGroup(
115
                groupLayout
116
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
117
                .addComponent(this.checkboxIsUsingProxy)
118
            )
119
            .addGroup(
120
                groupLayout
121
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
122
                .addComponent(panelHttpIpAddress)
123
            )
124
            .addGroup(
125
                groupLayout
126
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
127
                .addComponent(panelHttpPort)
128
            )
129
            .addGroup(
130
                groupLayout
131
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
132
                .addComponent(this.checkboxIsUsingProxyHttps)
133
            )
134
            .addGroup(
135
                groupLayout
136
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
137
                .addComponent(panelHttpsIpAddress)
138
            )
139
            .addGroup(
140
                groupLayout
141
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
142
                .addComponent(panelHttpsPort)
143
            )
144
            .addGroup(
145
                groupLayout
146
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
147
                .addComponent(buttonCheckIp)
148
            )
149
        );
150
    }
151
    
152
    
153
    // Getter and setter
154
    
155
    public JCheckBox getCheckboxIsUsingProxy() {
156 1 1. getCheckboxIsUsingProxy : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getCheckboxIsUsingProxy → NO_COVERAGE
        return this.checkboxIsUsingProxy;
157
    }
158
159
    public JTextField getTextProxyAddress() {
160 1 1. getTextProxyAddress : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getTextProxyAddress → NO_COVERAGE
        return this.textProxyAddress;
161
    }
162
163
    public JTextField getTextProxyPort() {
164 1 1. getTextProxyPort : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getTextProxyPort → NO_COVERAGE
        return this.textProxyPort;
165
    }
166
167
    public JCheckBox getCheckboxIsUsingProxyHttps() {
168 1 1. getCheckboxIsUsingProxyHttps : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getCheckboxIsUsingProxyHttps → NO_COVERAGE
        return this.checkboxIsUsingProxyHttps;
169
    }
170
171
    public JTextField getTextProxyAddressHttps() {
172 1 1. getTextProxyAddressHttps : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getTextProxyAddressHttps → NO_COVERAGE
        return this.textProxyAddressHttps;
173
    }
174
175
    public JTextField getTextProxyPortHttps() {
176 1 1. getTextProxyPortHttps : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getTextProxyPortHttps → NO_COVERAGE
        return this.textProxyPortHttps;
177
    }
178
}

Mutations

26

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPanel::setLayout → NO_COVERAGE

29

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPanel::setMaximumSize → NO_COVERAGE

32

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPanel::setLayout → NO_COVERAGE

35

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPanel::setMaximumSize → NO_COVERAGE

36

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPanel::setBorder → NO_COVERAGE

39

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPanel::setLayout → NO_COVERAGE

42

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPanel::setMaximumSize → NO_COVERAGE

45

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPanel::setLayout → NO_COVERAGE

48

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPanel::setMaximumSize → NO_COVERAGE

49

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPanel::setBorder → NO_COVERAGE

51

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JCheckBox::setToolTipText → NO_COVERAGE

52

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JCheckBox::setToolTipText → NO_COVERAGE

58

1.1
Location : <init>
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

2.2
Location : lambda$new$0
Killed by : none
removed call to javax/swing/JCheckBox::addActionListener → NO_COVERAGE

63

1.1
Location : process
Killed by : none
removed call to java/awt/event/ActionListener::actionPerformed → NO_COVERAGE

73

1.1
Location : lambda$new$1
Killed by : none
removed call to javax/swing/text/Document::addDocumentListener → NO_COVERAGE

2.2
Location : <init>
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

76

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JButton::addActionListener → NO_COVERAGE

77

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JButton::setToolTipText → NO_COVERAGE

84

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JLabel::setBorder → NO_COVERAGE

87

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/preferences/PanelProxy::setLayout → NO_COVERAGE

89

1.1
Location : <init>
Killed by : none
removed call to javax/swing/GroupLayout::setHorizontalGroup → NO_COVERAGE

106

1.1
Location : <init>
Killed by : none
removed call to javax/swing/GroupLayout::setVerticalGroup → NO_COVERAGE

156

1.1
Location : getCheckboxIsUsingProxy
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getCheckboxIsUsingProxy → NO_COVERAGE

160

1.1
Location : getTextProxyAddress
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getTextProxyAddress → NO_COVERAGE

164

1.1
Location : getTextProxyPort
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getTextProxyPort → NO_COVERAGE

168

1.1
Location : getCheckboxIsUsingProxyHttps
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getCheckboxIsUsingProxyHttps → NO_COVERAGE

172

1.1
Location : getTextProxyAddressHttps
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getTextProxyAddressHttps → NO_COVERAGE

176

1.1
Location : getTextProxyPortHttps
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getTextProxyPortHttps → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.19.1