Bladeren bron

Remove unused stuff from ServerInfo

Change-Id: Id2c55d69befbbbc1738ad7debb05d0a4d43a8396
Reviewed-on: http://gerrit.dmdirc.com/2181
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
tags/0.7rc1
Chris Smith 12 jaren geleden
bovenliggende
commit
7429b67662

+ 2
- 124
src/com/dmdirc/parser/irc/ServerInfo.java Bestand weergeven

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.parser.irc;
24 24
 
25 25
 import java.net.URI;
26
-import java.net.URISyntaxException;
27 26
 
28 27
 /**
29 28
  * Contains Server information.
@@ -37,42 +36,11 @@ public class ServerInfo {
37 36
      * structure is changed (or anything else that would prevent serialized
38 37
      * objects being unserialized with the new class).
39 38
      */
40
-    private static final long serialVersionUID = 1;
41
-    /** Are we using a socks proxy (Default: false). */
42
-    private boolean useSocksProxy;
43
-    /** Proxy server to connect to (Default: "127.0.0.1"). */
44
-    private String proxyHost = "127.0.0.1";
45
-    /** Port server listens on for client connections (Default: 8080). */
46
-    private int proxyPort = 1080;
47
-    /** Proxy username if required. */
48
-    private String proxyUser = "";
49
-    /** Proxy password if required. */
50
-    private String proxyPass = "";
39
+    private static final long serialVersionUID = 2;
40
+
51 41
     /** URI used to create this ServerInfo if applicable. */
52 42
     private URI uri;
53 43
 
54
-    /**
55
-     * Constructor using specifed host, port and password, SSL/Proxy must be
56
-     * specifed separately.
57
-     *
58
-     * @param serverHost Host to use
59
-     * @param serverPort Port to use
60
-     * @param serverPass Password to use
61
-     */
62
-    public ServerInfo(final String serverHost, final int serverPort,
63
-            final String serverPass) {
64
-        try {
65
-            uri = new URI("irc", serverPass, serverHost, serverPort, null,
66
-                    null, null);
67
-        } catch (URISyntaxException ex) {
68
-            try {
69
-                uri = new URI("irc", null, "127.0.0.1", -1, null, null, null);
70
-            } catch (URISyntaxException ex1) {
71
-                //Won't happen
72
-            }
73
-        }
74
-    }
75
-
76 44
     /**
77 45
      * Creates a new ServerInfo which will represent the server described by
78 46
      * the specified URI.
@@ -132,96 +100,6 @@ public class ServerInfo {
132 100
         return "ircs".equals(uri.getScheme());
133 101
     }
134 102
 
135
-    /**
136
-     * Set if we are connecting via a socks proxy.
137
-     *
138
-     * @param newValue true if we are using socks, else false
139
-     */
140
-    public void setUseSocks(final boolean newValue) {
141
-        useSocksProxy = newValue;
142
-    }
143
-
144
-    /**
145
-     * Get if we are connecting via a socks proxy.
146
-     *
147
-     * @return true if we are using socks, else false
148
-     */
149
-    public boolean getUseSocks() {
150
-        return useSocksProxy;
151
-    }
152
-
153
-    /**
154
-     * Set the Proxy hostname.
155
-     *
156
-     * @param newValue Value to set to.
157
-     */
158
-    public void setProxyHost(final String newValue) {
159
-        proxyHost = newValue;
160
-    }
161
-
162
-    /**
163
-     * Get the Proxy hostname.
164
-     *
165
-     * @return Current Proxy hostname
166
-     */
167
-    public String getProxyHost() {
168
-        return proxyHost;
169
-    }
170
-
171
-    /**
172
-     * Set the Proxy port.
173
-     *
174
-     * @param newValue Value to set to.
175
-     */
176
-    public void setProxyPort(final int newValue) {
177
-        proxyPort = newValue;
178
-    }
179
-
180
-    /**
181
-     * Get the Proxy port.
182
-     *
183
-     * @return Current Proxy port
184
-     */
185
-    public int getProxyPort() {
186
-        return proxyPort;
187
-    }
188
-
189
-    /**
190
-     * Set the Proxy username.
191
-     *
192
-     * @param newValue Value to set to.
193
-     */
194
-    public void setProxyUser(final String newValue) {
195
-        proxyUser = newValue;
196
-    }
197
-
198
-    /**
199
-     * Get the Proxy username.
200
-     *
201
-     * @return Current Proxy username
202
-     */
203
-    public String getProxyUser() {
204
-        return proxyUser;
205
-    }
206
-
207
-    /**
208
-     * Set the Proxy password.
209
-     *
210
-     * @param newValue Value to set to.
211
-     */
212
-    public void setProxyPass(final String newValue) {
213
-        proxyPass = newValue;
214
-    }
215
-
216
-    /**
217
-     * Get the Proxy password.
218
-     *
219
-     * @return Current Proxy password
220
-     */
221
-    public String getProxyPass() {
222
-        return proxyPass;
223
-    }
224
-
225 103
     /**
226 104
      * Retrieves a String describing any channels included in this ServerInfo's
227 105
      * URI.

+ 18
- 9
test/com/dmdirc/harness/parser/TestParser.java Bestand weergeven

@@ -27,6 +27,7 @@ import com.dmdirc.parser.common.QueuePriority;
27 27
 import com.dmdirc.parser.interfaces.Parser;
28 28
 import com.dmdirc.parser.irc.*;
29 29
 import java.net.URI;
30
+import java.net.URISyntaxException;
30 31
 import java.util.ArrayList;
31 32
 import java.util.List;
32 33
 import java.util.Timer;
@@ -36,11 +37,11 @@ public class TestParser extends IRCParser implements Parser {
36 37
     public final List<String> sentLines = new ArrayList<String>();
37 38
 
38 39
     public String nick = "nick";
39
-    
40
+
40 41
     public String network = null;
41 42
 
42 43
     public TestParser() {
43
-        super(new ServerInfo("", -1, ""));
44
+        super(new ServerInfo(buildURI()));
44 45
         currentSocketState = SocketState.OPEN;
45 46
     }
46 47
 
@@ -49,20 +50,28 @@ public class TestParser extends IRCParser implements Parser {
49 50
         currentSocketState = SocketState.OPEN;
50 51
     }
51 52
 
53
+    private static URI buildURI() {
54
+        try {
55
+            return new URI("irc://host:1234/");
56
+        } catch (URISyntaxException ex) {
57
+            return null;
58
+        }
59
+    }
60
+
52 61
     @Override
53 62
     protected boolean doSendString(String line, QueuePriority priority, boolean fromParser) {
54 63
         sentLines.add(line);
55 64
         return true;
56 65
     }
57
-    
66
+
58 67
     public String[] getLine(int index) {
59 68
         return tokeniseLine(sentLines.get(index));
60 69
     }
61
-    
70
+
62 71
     public void injectLine(String line) {
63 72
         processLine(new IRCReader.ReadLine(line, IRCParser.tokeniseLine(line)));
64 73
     }
65
-    
74
+
66 75
     public void injectConnectionStrings() {
67 76
         final String[] lines = new String[]{
68 77
             "NOTICE AUTH :Blah, blah",
@@ -76,13 +85,13 @@ public class TestParser extends IRCParser implements Parser {
76 85
             ":server 005 " + nick + " MAXNICKLEN=15 TOPICLEN=250 AWAYLEN=160 MODES=6 " +
77 86
                     "CHANMODES=bIeR,k,l,imnpstrDducCNMT :are supported by this server",
78 87
         };
79
-        
88
+
80 89
         sendConnectionStrings();
81
-        
90
+
82 91
         for (String line : lines) {
83 92
             injectLine(line);
84 93
         }
85
-        
94
+
86 95
         sentLines.clear();
87 96
     }
88 97
 
@@ -95,7 +104,7 @@ public class TestParser extends IRCParser implements Parser {
95 104
     public void run() {
96 105
         injectConnectionStrings();
97 106
     }
98
-    
107
+
99 108
     public void runSuper() {
100 109
         super.run();
101 110
     }

+ 3
- 25
test/com/dmdirc/parser/irc/ServerInfoTest.java Bestand weergeven

@@ -28,10 +28,10 @@ import org.junit.Test;
28 28
 import static org.junit.Assert.*;
29 29
 
30 30
 public class ServerInfoTest {
31
-    
31
+
32 32
     @Test
33 33
     public void testHost() throws URISyntaxException {
34
-        final ServerInfo si = new ServerInfo(new URI("ircs", "pass1", "host0", 
34
+        final ServerInfo si = new ServerInfo(new URI("ircs", "pass1", "host0",
35 35
                 5, null, null, null));
36 36
         assertEquals("host0", si.getHost());
37 37
     }
@@ -79,27 +79,5 @@ public class ServerInfoTest {
79 79
                 5, null, null, null));
80 80
         assertFalse(si.isSSL());
81 81
     }
82
-    
83
-    @Test
84
-    public void testUseSocks() {
85
-        final ServerInfo si = new ServerInfo("host0", 5, "pass1");
86
-        assertFalse(si.getUseSocks());
87
-        si.setUseSocks(true);
88
-        assertTrue(si.getUseSocks());
89
-    }
90
-    
91
-    @Test
92
-    public void testProxyHost() {
93
-        final ServerInfo si = new ServerInfo("host0", 5, "pass1");
94
-        si.setProxyHost("foo");
95
-        assertEquals("foo", si.getProxyHost());
96
-    }
97
-    
98
-    @Test
99
-    public void testProxyPort() {
100
-        final ServerInfo si = new ServerInfo("host0", 5, "pass1");
101
-        si.setProxyPort(1024);
102
-        assertEquals(1024, si.getProxyPort());
103
-    }
104
-    
82
+
105 83
 }

Laden…
Annuleren
Opslaan