PanelProxy.java

1
package com.jsql.view.swing.panel.preferences;
2
3
import com.jsql.view.swing.panel.PanelPreferences;
4
import com.jsql.view.swing.text.JPopupTextField;
5
import com.jsql.view.swing.text.listener.DocumentListenerEditing;
6
import com.jsql.view.swing.util.MediatorHelper;
7
import com.jsql.view.swing.util.UiUtil;
8
import org.apache.commons.lang3.StringUtils;
9
10
import javax.swing.*;
11
import javax.swing.event.DocumentListener;
12
import java.awt.*;
13
import java.util.stream.Stream;
14
15
public class PanelProxy extends JPanel {
16
17
    private final JCheckBox checkboxIsUsingProxy = new JCheckBox(StringUtils.EMPTY, MediatorHelper.model().getMediatorUtils().getProxyUtil().isUsingProxyHttp());
18
    private final JCheckBox checkboxIsUsingProxyHttps = new JCheckBox(StringUtils.EMPTY, MediatorHelper.model().getMediatorUtils().getProxyUtil().isUsingProxyHttps());
19
20
    private final JTextField textProxyAddress = new JPopupTextField("e.g. Tor address: 127.0.0.1", MediatorHelper.model().getMediatorUtils().getProxyUtil().getProxyAddressHttp()).getProxy();
21
    private final JTextField textProxyPort = new JPopupTextField("e.g. Tor port: 8118", MediatorHelper.model().getMediatorUtils().getProxyUtil().getProxyPortHttp()).getProxy();
22
    private final JTextField textProxyAddressHttps = new JPopupTextField("e.g. Tor address: 127.0.0.1", MediatorHelper.model().getMediatorUtils().getProxyUtil().getProxyAddressHttps()).getProxy();
23
    private final JTextField textProxyPortHttps = new JPopupTextField("e.g. Tor port: 8118", MediatorHelper.model().getMediatorUtils().getProxyUtil().getProxyPortHttps()).getProxy();
24
25
    public PanelProxy(PanelPreferences panelPreferences) {
26
        
27 1 1. <init> : removed call to com/jsql/view/swing/panel/preferences/PanelProxy::setBorder → NO_COVERAGE
        this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
28
        
29
        // Proxy label
30
        var labelProxyAddress = new JLabel("Address  ");
31
        var labelProxyPort = new JLabel("Port  ");
32
        var labelProxyAddressHttps = new JLabel("Address  ");
33
        var labelProxyPortHttps = new JLabel("Port  ");
34
        var buttonIsUsingProxy = new JButton("Proxy for http://");
35
        var buttonIsUsingProxyHttps = new JButton("Proxy for https://");
36
        var tooltipIsUsingProxy = "Enable proxy communication (e.g. TOR with Privoxy or Burp) for HTTP protocol.";
37 1 1. <init> : removed call to javax/swing/JButton::setToolTipText → NO_COVERAGE
        buttonIsUsingProxy.setToolTipText(tooltipIsUsingProxy);
38
        var tooltipIsUsingProxyHttps = "Enable proxy communication (e.g. TOR with Privoxy or Burp) for HTTPS protocol.";
39 1 1. <init> : removed call to javax/swing/JButton::setToolTipText → NO_COVERAGE
        buttonIsUsingProxyHttps.setToolTipText(tooltipIsUsingProxyHttps);
40
41
        // Proxy setting: IP, port, checkbox to activate proxy
42 1 1. <init> : removed call to javax/swing/JCheckBox::setToolTipText → NO_COVERAGE
        this.getCheckboxIsUsingProxy().setToolTipText(tooltipIsUsingProxy);
43 1 1. <init> : removed call to javax/swing/JCheckBox::setFocusable → NO_COVERAGE
        this.getCheckboxIsUsingProxy().setFocusable(false);
44
45 1 1. <init> : removed call to javax/swing/JButton::addActionListener → NO_COVERAGE
        buttonIsUsingProxy.addActionListener(actionEvent -> {
46
            
47 2 1. lambda$new$0 : negated conditional → NO_COVERAGE
2. lambda$new$0 : removed call to javax/swing/JCheckBox::setSelected → NO_COVERAGE
            this.getCheckboxIsUsingProxy().setSelected(!this.getCheckboxIsUsingProxy().isSelected());
48 1 1. lambda$new$0 : removed call to java/awt/event/ActionListener::actionPerformed → NO_COVERAGE
            panelPreferences.getActionListenerSave().actionPerformed(null);
49
        });
50
        
51 1 1. <init> : removed call to javax/swing/JCheckBox::setToolTipText → NO_COVERAGE
        this.getCheckboxIsUsingProxyHttps().setToolTipText(tooltipIsUsingProxyHttps);
52 1 1. <init> : removed call to javax/swing/JCheckBox::setFocusable → NO_COVERAGE
        this.getCheckboxIsUsingProxyHttps().setFocusable(false);
53
        
54 1 1. <init> : removed call to javax/swing/JButton::addActionListener → NO_COVERAGE
        buttonIsUsingProxyHttps.addActionListener(actionEvent -> {
55
            
56 2 1. lambda$new$1 : negated conditional → NO_COVERAGE
2. lambda$new$1 : removed call to javax/swing/JCheckBox::setSelected → NO_COVERAGE
            this.getCheckboxIsUsingProxyHttps().setSelected(!this.getCheckboxIsUsingProxyHttps().isSelected());
57 1 1. lambda$new$1 : removed call to java/awt/event/ActionListener::actionPerformed → NO_COVERAGE
            panelPreferences.getActionListenerSave().actionPerformed(null);
58
        });
59
60 1 1. <init> : removed call to javax/swing/JTextField::setMaximumSize → NO_COVERAGE
        this.getTextProxyAddress().setMaximumSize(new Dimension(200, 0));
61 1 1. <init> : removed call to javax/swing/JTextField::setMaximumSize → NO_COVERAGE
        this.getTextProxyPort().setMaximumSize(new Dimension(200, 0));
62 1 1. <init> : removed call to javax/swing/JTextField::setMaximumSize → NO_COVERAGE
        this.getTextProxyAddressHttps().setMaximumSize(new Dimension(200, 0));
63 1 1. <init> : removed call to javax/swing/JTextField::setMaximumSize → NO_COVERAGE
        this.getTextProxyPortHttps().setMaximumSize(new Dimension(200, 0));
64
        
65 1 1. <init> : removed call to javax/swing/JTextField::setFont → NO_COVERAGE
        this.getTextProxyAddress().setFont(UiUtil.FONT_NON_MONO_BIG);
66 1 1. <init> : removed call to javax/swing/JTextField::setFont → NO_COVERAGE
        this.getTextProxyPort().setFont(UiUtil.FONT_NON_MONO_BIG);
67 1 1. <init> : removed call to javax/swing/JTextField::setFont → NO_COVERAGE
        this.getTextProxyAddressHttps().setFont(UiUtil.FONT_NON_MONO_BIG);
68 1 1. <init> : removed call to javax/swing/JTextField::setFont → NO_COVERAGE
        this.getTextProxyPortHttps().setFont(UiUtil.FONT_NON_MONO_BIG);
69
        
70
        Stream.of(
71
            this.getCheckboxIsUsingProxy()
72
        )
73 2 1. <init> : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
2. lambda$new$2 : removed call to javax/swing/JCheckBox::addActionListener → NO_COVERAGE
        .forEach(button -> button.addActionListener(panelPreferences.getActionListenerSave()));
74
        
75
        DocumentListener documentListenerSave = new DocumentListenerEditing() {
76
            @Override
77
            public void process() {
78 1 1. process : removed call to java/awt/event/ActionListener::actionPerformed → NO_COVERAGE
                panelPreferences.getActionListenerSave().actionPerformed(null);
79
            }
80
        };
81
82
        Stream.of(
83
            this.getTextProxyAddress(),
84
            this.getTextProxyPort(),
85
            this.getTextProxyAddressHttps(),
86
            this.getTextProxyPortHttps()
87
        )
88 2 1. <init> : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
2. lambda$new$3 : removed call to javax/swing/text/Document::addDocumentListener → NO_COVERAGE
        .forEach(textField -> textField.getDocument().addDocumentListener(documentListenerSave));
89
90
        Stream.of(
91
            buttonIsUsingProxy,
92
            buttonIsUsingProxyHttps
93
        )
94 1 1. <init> : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
        .forEach(label -> {
95
            
96 1 1. lambda$new$4 : removed call to javax/swing/JButton::setHorizontalAlignment → NO_COVERAGE
            label.setHorizontalAlignment(SwingConstants.LEFT);
97 1 1. lambda$new$4 : removed call to javax/swing/JButton::setBorderPainted → NO_COVERAGE
            label.setBorderPainted(false);
98 1 1. lambda$new$4 : removed call to javax/swing/JButton::setContentAreaFilled → NO_COVERAGE
            label.setContentAreaFilled(false);
99
        });
100
        
101
        var groupLayout = new GroupLayout(this);
102 1 1. <init> : removed call to com/jsql/view/swing/panel/preferences/PanelProxy::setLayout → NO_COVERAGE
        this.setLayout(groupLayout);
103
        
104
        var labelProxyHttpsHidden = new JLabel();
105
        var labelProxyHttps = new JLabel();
106 1 1. <init> : removed call to javax/swing/JLabel::setBorder → NO_COVERAGE
        labelProxyHttps.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0));
107
        
108
        groupLayout
109 1 1. <init> : removed call to javax/swing/GroupLayout::setHorizontalGroup → NO_COVERAGE
        .setHorizontalGroup(
110
            groupLayout
111
            .createSequentialGroup()
112
            .addGroup(
113
                groupLayout
114
                .createParallelGroup(GroupLayout.Alignment.TRAILING, false)
115
                .addComponent(this.getCheckboxIsUsingProxy())
116
                .addComponent(labelProxyAddress)
117
                .addComponent(labelProxyPort)
118
                .addComponent(labelProxyHttpsHidden)
119
                .addComponent(this.getCheckboxIsUsingProxyHttps())
120
                .addComponent(labelProxyAddressHttps)
121
                .addComponent(labelProxyPortHttps)
122
            ).addGroup(
123
                groupLayout
124
                .createParallelGroup()
125
                .addComponent(buttonIsUsingProxy)
126
                .addComponent(this.getTextProxyAddress())
127
                .addComponent(this.getTextProxyPort())
128
                .addComponent(labelProxyHttps)
129
                .addComponent(buttonIsUsingProxyHttps)
130
                .addComponent(this.getTextProxyAddressHttps())
131
                .addComponent(this.getTextProxyPortHttps())
132
            )
133
        );
134
        
135
        groupLayout
136 1 1. <init> : removed call to javax/swing/GroupLayout::setVerticalGroup → NO_COVERAGE
        .setVerticalGroup(
137
            groupLayout
138
            .createSequentialGroup()
139
            .addGroup(
140
                groupLayout
141
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
142
                .addComponent(this.getCheckboxIsUsingProxy())
143
                .addComponent(buttonIsUsingProxy)
144
            )
145
            .addGroup(
146
                groupLayout
147
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
148
                .addComponent(labelProxyAddress)
149
                .addComponent(this.getTextProxyAddress())
150
            )
151
            .addGroup(
152
                groupLayout
153
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
154
                .addComponent(labelProxyPort)
155
                .addComponent(this.getTextProxyPort())
156
            )
157
            .addGroup(
158
                groupLayout
159
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
160
                .addComponent(labelProxyHttpsHidden)
161
                .addComponent(labelProxyHttps)
162
            )
163
            .addGroup(
164
                groupLayout
165
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
166
                .addComponent(this.getCheckboxIsUsingProxyHttps())
167
                .addComponent(buttonIsUsingProxyHttps)
168
            )
169
            .addGroup(
170
                groupLayout
171
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
172
                .addComponent(labelProxyAddressHttps)
173
                .addComponent(this.getTextProxyAddressHttps())
174
            )
175
            .addGroup(
176
                groupLayout
177
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
178
                .addComponent(labelProxyPortHttps)
179
                .addComponent(this.getTextProxyPortHttps())
180
            )
181
        );
182
    }
183
    
184
    
185
    // Getter and setter
186
    
187
    public JCheckBox getCheckboxIsUsingProxy() {
188 1 1. getCheckboxIsUsingProxy : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getCheckboxIsUsingProxy → NO_COVERAGE
        return this.checkboxIsUsingProxy;
189
    }
190
191
    public JTextField getTextProxyAddress() {
192 1 1. getTextProxyAddress : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getTextProxyAddress → NO_COVERAGE
        return this.textProxyAddress;
193
    }
194
195
    public JTextField getTextProxyPort() {
196 1 1. getTextProxyPort : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getTextProxyPort → NO_COVERAGE
        return this.textProxyPort;
197
    }
198
199
    public JCheckBox getCheckboxIsUsingProxyHttps() {
200 1 1. getCheckboxIsUsingProxyHttps : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getCheckboxIsUsingProxyHttps → NO_COVERAGE
        return this.checkboxIsUsingProxyHttps;
201
    }
202
203
    public JTextField getTextProxyAddressHttps() {
204 1 1. getTextProxyAddressHttps : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getTextProxyAddressHttps → NO_COVERAGE
        return this.textProxyAddressHttps;
205
    }
206
207
    public JTextField getTextProxyPortHttps() {
208 1 1. getTextProxyPortHttps : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelProxy::getTextProxyPortHttps → NO_COVERAGE
        return this.textProxyPortHttps;
209
    }
210
}

Mutations

27

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

37

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

39

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

42

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

43

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

45

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

47

1.1
Location : lambda$new$0
Killed by : none
negated conditional → NO_COVERAGE

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

48

1.1
Location : lambda$new$0
Killed by : none
removed call to java/awt/event/ActionListener::actionPerformed → 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::setFocusable → NO_COVERAGE

54

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

56

1.1
Location : lambda$new$1
Killed by : none
negated conditional → NO_COVERAGE

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

57

1.1
Location : lambda$new$1
Killed by : none
removed call to java/awt/event/ActionListener::actionPerformed → NO_COVERAGE

60

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

61

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

62

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

63

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

65

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

66

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

67

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

68

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

73

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

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

78

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

88

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

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

94

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

96

1.1
Location : lambda$new$4
Killed by : none
removed call to javax/swing/JButton::setHorizontalAlignment → NO_COVERAGE

97

1.1
Location : lambda$new$4
Killed by : none
removed call to javax/swing/JButton::setBorderPainted → NO_COVERAGE

98

1.1
Location : lambda$new$4
Killed by : none
removed call to javax/swing/JButton::setContentAreaFilled → NO_COVERAGE

102

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

106

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

109

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

136

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

188

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

192

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

196

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

200

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

204

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

208

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.16.1