ManagerSqlShell.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.view.swing.manager;
12
13
import com.jsql.model.exception.JSqlException;
14
import com.jsql.util.I18nUtil;
15
import com.jsql.view.swing.text.JPopupTextField;
16
import com.jsql.view.swing.util.MediatorHelper;
17
import com.jsql.view.swing.util.UiUtil;
18
19
import javax.swing.*;
20
import java.awt.*;
21
22
/**
23
 * Manager for uploading PHP SQL shell to the host and send queries.
24
 */
25
public class ManagerSqlShell extends AbstractManagerShell {
26
    
27
    private final JTextField username = new JPopupTextField(I18nUtil.valueByKey("SQL_SHELL_USERNAME_LABEL")).getProxy();
28
    private final JTextField password = new JPopupTextField(I18nUtil.valueByKey("SQL_SHELL_PASSWORD_LABEL")).getProxy();
29
    
30
    /**
31
     * Build the manager panel.
32
     */
33
    public ManagerSqlShell() {
34
35 1 1. <init> : removed call to com/jsql/view/swing/manager/util/JButtonStateful::setText → NO_COVERAGE
        this.run.setText("Create SQL shell(s)");
36
        
37
        var userPassPanel = new JPanel();
38
        
39
        var layout = new GroupLayout(userPassPanel);
40 1 1. <init> : removed call to javax/swing/JPanel::setLayout → NO_COVERAGE
        userPassPanel.setLayout(layout);
41 1 1. <init> : removed call to javax/swing/JPanel::setAlignmentX → NO_COVERAGE
        userPassPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
42 1 1. <init> : removed call to javax/swing/JPanel::setBorder → NO_COVERAGE
        userPassPanel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
43
        
44 1 1. <init> : removed call to javax/swing/JTextField::setToolTipText → NO_COVERAGE
        this.username.setToolTipText(I18nUtil.valueByKey("SQL_SHELL_USERNAME_TOOLTIP"));
45 1 1. <init> : removed call to javax/swing/JTextField::setToolTipText → NO_COVERAGE
        this.password.setToolTipText(I18nUtil.valueByKey("SQL_SHELL_PASSWORD_TOOLTIP"));
46
        
47 1 1. <init> : removed call to javax/swing/JTextField::setBorder → NO_COVERAGE
        this.username.setBorder(UiUtil.BORDER_BLU);
48 1 1. <init> : removed call to javax/swing/JTextField::setBorder → NO_COVERAGE
        this.password.setBorder(UiUtil.BORDER_BLU);
49
        
50
        var panelPassword = new JPanel(new BorderLayout());
51 1 1. <init> : removed call to javax/swing/JPanel::setBorder → NO_COVERAGE
        panelPassword.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0));
52
        panelPassword.add(this.password);
53
        
54 1 1. <init> : removed call to javax/swing/GroupLayout::setHorizontalGroup → NO_COVERAGE
        layout.setHorizontalGroup(
55
            layout
56
            .createSequentialGroup()
57
            .addGroup(
58
                layout
59
                .createParallelGroup(GroupLayout.Alignment.TRAILING, false)
60
            )
61
            .addGroup(
62
                layout.createParallelGroup()
63
                .addComponent(this.username)
64
                .addComponent(panelPassword)
65
            )
66
        );
67
68 1 1. <init> : removed call to javax/swing/GroupLayout::setVerticalGroup → NO_COVERAGE
        layout.setVerticalGroup(
69
            layout
70
            .createSequentialGroup()
71
            .addGroup(
72
                layout
73
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
74
                .addComponent(this.username)
75
            )
76
            .addGroup(
77
                layout
78
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
79
                .addComponent(panelPassword)
80
            )
81
        );
82
        
83 1 1. <init> : removed call to com/jsql/view/swing/manager/ManagerSqlShell::add → NO_COVERAGE
        this.add(userPassPanel, BorderLayout.NORTH);
84
    }
85
86
    @Override
87
    protected void createPayload(String shellPath, String shellURL) throws JSqlException {
88 1 1. createPayload : removed call to com/jsql/model/accessible/ResourceAccess::createSqlShell → NO_COVERAGE
        MediatorHelper.model().getResourceAccess().createSqlShell(shellPath, shellURL, this.username.getText(), this.password.getText());
89
    }
90
}

Mutations

35

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/manager/util/JButtonStateful::setText → NO_COVERAGE

40

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

41

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

42

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

44

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

45

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

47

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

48

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

51

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

54

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

68

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

83

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerSqlShell::add → NO_COVERAGE

88

1.1
Location : createPayload
Killed by : none
removed call to com/jsql/model/accessible/ResourceAccess::createSqlShell → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.16.1