Преглед на файлове

Fix fallout from plugin deprecations.

Change-Id: Ib559fda3ac9d5b65937c563b165ef078106cdd15
Depends-On: Id6cafe38cb04a9ee4513ac6e98158faf3cafc37d
Reviewed-on: http://gerrit.dmdirc.com/2099
Reviewed-by: Chris Smith <chris@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.7rc1
Greg Holmes преди 13 години
родител
ревизия
ed90b0e13f
променени са 22 файла, в които са добавени 316 реда и са изтрити 94 реда
  1. 11
    5
      src/com/dmdirc/addons/dcc/DCCPlugin.java
  2. 44
    19
      src/com/dmdirc/addons/freedesktop_notifications/FreeDesktopNotificationsPlugin.java
  3. 16
    3
      src/com/dmdirc/addons/identd/IdentdPlugin.java
  4. 9
    2
      src/com/dmdirc/addons/lagdisplay/LagDisplayPlugin.java
  5. 13
    5
      src/com/dmdirc/addons/logging/LoggingPlugin.java
  6. 14
    1
      src/com/dmdirc/addons/mediasource_vlc/VlcMediaSourcePlugin.java
  7. 7
    4
      src/com/dmdirc/addons/mediasource_windows/WindowsMediaSourcePlugin.java
  8. 15
    4
      src/com/dmdirc/addons/nickcolours/NickColourPlugin.java
  9. 10
    3
      src/com/dmdirc/addons/notifications/NotificationsPlugin.java
  10. 10
    3
      src/com/dmdirc/addons/nowplaying/NowPlayingPlugin.java
  11. 11
    3
      src/com/dmdirc/addons/osd/OsdPlugin.java
  12. 15
    4
      src/com/dmdirc/addons/parser_twitter/TwitterPlugin.java
  13. 15
    2
      src/com/dmdirc/addons/relaybot/RelayBotPlugin.java
  14. 12
    4
      src/com/dmdirc/addons/systray/SystrayPlugin.java
  15. 24
    6
      src/com/dmdirc/addons/ui_swing/SwingController.java
  16. 2
    2
      src/com/dmdirc/addons/ui_swing/dialogs/about/InfoPanel.java
  17. 11
    3
      src/com/dmdirc/addons/windowflashing/WindowFlashing.java
  18. 11
    3
      src/com/dmdirc/addons/windowstatus/WindowStatusPlugin.java
  19. 10
    13
      test/com/dmdirc/addons/logging/LoggingPluginTest.java
  20. 48
    0
      test/com/dmdirc/addons/logging/TestLoggingPlugin.java
  21. 7
    4
      test/com/dmdirc/addons/mediasource_vlc/VlcMediaSourcePluginTest.java
  22. 1
    1
      test/com/dmdirc/harness/ui/DMDircUITestCase.java

+ 11
- 5
src/com/dmdirc/addons/dcc/DCCPlugin.java Целия файл

@@ -48,6 +48,7 @@ import com.dmdirc.logger.Logger;
48 48
 import com.dmdirc.parser.interfaces.ClientInfo;
49 49
 import com.dmdirc.parser.interfaces.Parser;
50 50
 import com.dmdirc.plugins.BasePlugin;
51
+import com.dmdirc.plugins.PluginInfo;
51 52
 import com.dmdirc.plugins.PluginManager;
52 53
 import com.dmdirc.ui.WindowManager;
53 54
 
@@ -68,14 +69,19 @@ public final class DCCPlugin extends BasePlugin implements ActionListener {
68 69
 
69 70
     /** Our DCC Container window. */
70 71
     private PlaceholderContainer container;
72
+    /** This plugin's plugin info. */
73
+    private final PluginInfo pluginInfo;
71 74
 
72 75
     /**
73 76
      * Creates a new instance of this plugin.
74 77
      *
75 78
      * @param controller The controller to register UI implementations with
79
+     * @param pluginInfo This plugin's plugin info
76 80
      */
77
-    public DCCPlugin(final SwingController controller) {
81
+    public DCCPlugin(final SwingController controller,
82
+            final PluginInfo pluginInfo) {
78 83
         super();
84
+        this.pluginInfo = pluginInfo;
79 85
         registerCommand(new DCCCommand(this), DCCCommand.INFO);
80 86
         final SwingWindowFactory factory = controller.getWindowFactory();
81 87
         factory.registerImplementation(new HashSet<String>(Arrays.asList(
@@ -724,13 +730,13 @@ public final class DCCPlugin extends BasePlugin implements ActionListener {
724 730
     @Override
725 731
     public void showConfig(final PreferencesDialogModel manager) {
726 732
         final PreferencesCategory general = new PluginPreferencesCategory(
727
-                getPluginInfo(), "DCC", "", "category-dcc");
733
+                pluginInfo, "DCC", "", "category-dcc");
728 734
         final PreferencesCategory firewall = new PluginPreferencesCategory(
729
-                getPluginInfo(), "Firewall", "");
735
+                pluginInfo, "Firewall", "");
730 736
         final PreferencesCategory sending = new PluginPreferencesCategory(
731
-                getPluginInfo(), "Sending", "");
737
+                pluginInfo, "Sending", "");
732 738
         final PreferencesCategory receiving = new PluginPreferencesCategory(
733
-                getPluginInfo(), "Receiving", "");
739
+                pluginInfo, "Receiving", "");
734 740
 
735 741
         manager.getCategory("Plugins").addSubCategory(general.setInlineAfter());
736 742
         general.addSubCategory(firewall.setInline());

+ 44
- 19
src/com/dmdirc/addons/freedesktop_notifications/FreeDesktopNotificationsPlugin.java Целия файл

@@ -31,7 +31,7 @@ import com.dmdirc.config.prefs.PreferencesType;
31 31
 import com.dmdirc.interfaces.ConfigChangeListener;
32 32
 import com.dmdirc.logger.ErrorLevel;
33 33
 import com.dmdirc.logger.Logger;
34
-import com.dmdirc.plugins.BasePlugin;
34
+import com.dmdirc.plugins.BaseFileDependantPlugin;
35 35
 import com.dmdirc.plugins.PluginInfo;
36 36
 import com.dmdirc.plugins.PluginManager;
37 37
 import com.dmdirc.ui.messages.Styliser;
@@ -46,8 +46,8 @@ import org.apache.commons.lang.StringEscapeUtils;
46 46
 /**
47 47
  * This plugin adds freedesktop Style Notifications to dmdirc.
48 48
  */
49
-public final class FreeDesktopNotificationsPlugin extends BasePlugin
50
-        implements ConfigChangeListener {
49
+public final class FreeDesktopNotificationsPlugin
50
+        extends BaseFileDependantPlugin implements ConfigChangeListener {
51 51
 
52 52
     /** notification timeout. */
53 53
     private int timeout;
@@ -59,10 +59,17 @@ public final class FreeDesktopNotificationsPlugin extends BasePlugin
59 59
     private boolean strictescape;
60 60
     /** Strip codes. */
61 61
     private boolean stripcodes;
62
+    /** This plugin's plugin info. */
63
+    private final PluginInfo pluginInfo;
62 64
 
63
-    /** Creates a new instance of this plugin. */
64
-    public FreeDesktopNotificationsPlugin() {
65
-        super();
65
+    /**
66
+     * Creates a new instance of this plugin.
67
+     *
68
+     * @param pluginInfo This plugin's plugin info
69
+     */
70
+    public FreeDesktopNotificationsPlugin(final PluginInfo pluginInfo) {
71
+        super(pluginInfo.getMetaData());
72
+        this.pluginInfo = pluginInfo;
66 73
         registerCommand(new FDNotifyCommand(this), FDNotifyCommand.INFO);
67 74
     }
68 75
 
@@ -175,29 +182,47 @@ public final class FreeDesktopNotificationsPlugin extends BasePlugin
175 182
     /** {@inheritDoc} */
176 183
     @Override
177 184
     public void domainUpdated() {
178
-        IdentityManager.getAddonIdentity().setOption(getDomain(), "general.icon", getFilesDirString() + "icon.png");
185
+        IdentityManager.getAddonIdentity().setOption(getDomain(),
186
+                "general.icon", getFilesDirString() + "icon.png");
179 187
     }
180 188
 
181 189
     /** {@inheritDoc} */
182 190
     @Override
183 191
     public void showConfig(final PreferencesDialogModel manager) {
184
-        final PreferencesCategory general = new PluginPreferencesCategory(getPluginInfo(), "FreeDesktop Notifications", "General configuration for FreeDesktop Notifications plugin.");
185
-
186
-        general.addSetting(new PreferencesSetting(PreferencesType.INTEGER, getDomain(), "general.timeout", "Timeout", "Length of time in seconds before the notification popup closes."));
187
-        general.addSetting(new PreferencesSetting(PreferencesType.FILE, getDomain(), "general.icon", "icon", "Path to icon to use on the notification."));
188
-        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(), "advanced.escapehtml", "Escape HTML", "Some Implementations randomly parse HTML, escape it before showing?"));
189
-        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(), "advanced.strictescape", "Strict Escape HTML", "Strictly escape HTML or just the basic characters? (&, < and >)"));
190
-        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(), "advanced.stripcodes", "Strip Control Codes", "Strip IRC Control codes from messages?"));
192
+        final PreferencesCategory general = new PluginPreferencesCategory(
193
+                pluginInfo, "FreeDesktop Notifications",
194
+                "General configuration for FreeDesktop Notifications plugin.");
195
+
196
+        general.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
197
+                getDomain(), "general.timeout", "Timeout",
198
+                "Length of time in seconds before the notification popup closes."));
199
+        general.addSetting(new PreferencesSetting(PreferencesType.FILE,
200
+                getDomain(), "general.icon", "icon",
201
+                "Path to icon to use on the notification."));
202
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
203
+                getDomain(), "advanced.escapehtml", "Escape HTML",
204
+                "Some Implementations randomly parse HTML, escape it before showing?"));
205
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
206
+                getDomain(), "advanced.strictescape", "Strict Escape HTML",
207
+                "Strictly escape HTML or just the basic characters? (&, < and >)"));
208
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
209
+                getDomain(), "advanced.stripcodes", "Strip Control Codes",
210
+                "Strip IRC Control codes from messages?"));
191 211
 
192 212
         manager.getCategory("Plugins").addSubCategory(general);
193 213
     }
194 214
 
195 215
     private void setCachedSettings() {
196
-        timeout = IdentityManager.getGlobalConfig().getOptionInt(getDomain(), "general.timeout");
197
-        icon = IdentityManager.getGlobalConfig().getOption(getDomain(), "general.icon");
198
-        escapehtml = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "advanced.escapehtml");
199
-        strictescape = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "advanced.strictescape");
200
-        stripcodes = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "advanced.stripcodes");
216
+        timeout = IdentityManager.getGlobalConfig().getOptionInt(getDomain(),
217
+                "general.timeout");
218
+        icon = IdentityManager.getGlobalConfig().getOption(getDomain(),
219
+                "general.icon");
220
+        escapehtml = IdentityManager.getGlobalConfig().getOptionBool(
221
+                getDomain(), "advanced.escapehtml");
222
+        strictescape = IdentityManager.getGlobalConfig().getOptionBool(
223
+                getDomain(), "advanced.strictescape");
224
+        stripcodes = IdentityManager.getGlobalConfig().getOptionBool(
225
+                getDomain(), "advanced.stripcodes");
201 226
     }
202 227
 
203 228
     /** {@inheritDoc} */

+ 16
- 3
src/com/dmdirc/addons/identd/IdentdPlugin.java Целия файл

@@ -34,6 +34,7 @@ import com.dmdirc.config.prefs.PreferencesSetting;
34 34
 import com.dmdirc.config.prefs.PreferencesType;
35 35
 import com.dmdirc.interfaces.ActionListener;
36 36
 import com.dmdirc.plugins.BasePlugin;
37
+import com.dmdirc.plugins.PluginInfo;
37 38
 import com.dmdirc.util.validators.PortValidator;
38 39
 
39 40
 import java.util.ArrayList;
@@ -48,6 +49,18 @@ public class IdentdPlugin extends BasePlugin implements ActionListener {
48 49
     private final List<Server> servers = new ArrayList<Server>();
49 50
     /** The IdentdServer that we use. */
50 51
     private IdentdServer myServer;
52
+    /** This plugin's plugin info. */
53
+    private final PluginInfo pluginInfo;
54
+
55
+    /**
56
+     * Creates a new instance of this plugin.
57
+     *
58
+     * @param pluginInfo This plugin's plugin info
59
+     */
60
+    public IdentdPlugin(final PluginInfo pluginInfo) {
61
+        super();
62
+        this.pluginInfo = pluginInfo;
63
+    }
51 64
 
52 65
     /**
53 66
      * Called when the plugin is loaded.
@@ -97,7 +110,7 @@ public class IdentdPlugin extends BasePlugin implements ActionListener {
97 110
         } else if (type == CoreActionType.SERVER_CONNECTED
98 111
                 || type == CoreActionType.SERVER_CONNECTERROR) {
99 112
             synchronized (servers) {
100
-                servers.remove(arguments[0]);
113
+                servers.remove((Server) arguments[0]);
101 114
 
102 115
                 if (servers.isEmpty() && !IdentityManager.getGlobalConfig()
103 116
                         .getOptionBool(getDomain(), "advanced.alwaysOn")) {
@@ -111,11 +124,11 @@ public class IdentdPlugin extends BasePlugin implements ActionListener {
111 124
     @Override
112 125
     public void showConfig(final PreferencesDialogModel manager) {
113 126
         final PreferencesCategory general = new PluginPreferencesCategory(
114
-                getPluginInfo(), "Identd",
127
+                pluginInfo, "Identd",
115 128
                 "General Identd Plugin config ('Lower' options take priority " +
116 129
                 "over those above them)");
117 130
         final PreferencesCategory advanced = new PluginPreferencesCategory(
118
-                getPluginInfo(), "Advanced",
131
+                pluginInfo, "Advanced",
119 132
                 "Advanced Identd Plugin config - Only edit these if you need " +
120 133
                 "to/know what you are doing. Editing these could prevent " +
121 134
                 "access to some servers. ('Lower' options take priority over " +

+ 9
- 2
src/com/dmdirc/addons/lagdisplay/LagDisplayPlugin.java Целия файл

@@ -41,6 +41,7 @@ import com.dmdirc.config.prefs.PreferencesType;
41 41
 import com.dmdirc.interfaces.ActionListener;
42 42
 import com.dmdirc.interfaces.ConfigChangeListener;
43 43
 import com.dmdirc.plugins.BasePlugin;
44
+import com.dmdirc.plugins.PluginInfo;
44 45
 import com.dmdirc.plugins.PluginManager;
45 46
 import com.dmdirc.util.RollingList;
46 47
 
@@ -70,14 +71,20 @@ public final class LagDisplayPlugin extends BasePlugin implements
70 71
     private boolean showLabels = true;
71 72
     /** The length of history to keep per-server. */
72 73
     private int historySize = 100;
74
+    /** This plugin's plugin info. */
75
+    private final PluginInfo pluginInfo;
73 76
 
74 77
     /**
75 78
      * Creates a new LagDisplayPlugin.
76 79
      *
77 80
      * @param controller The controller to add components to
81
+     * @param pluginInfo This plugin's plugin info
78 82
      */
79
-    public LagDisplayPlugin(final SwingController controller) {
83
+    public LagDisplayPlugin(final SwingController controller,
84
+            final PluginInfo pluginInfo) {
85
+        super();
80 86
         this.controller = controller;
87
+        this.pluginInfo = pluginInfo;
81 88
     }
82 89
 
83 90
     /** {@inheritDoc} */
@@ -264,7 +271,7 @@ public final class LagDisplayPlugin extends BasePlugin implements
264 271
     @Override
265 272
     public void showConfig(final PreferencesDialogModel manager) {
266 273
         final PreferencesCategory cat = new PluginPreferencesCategory(
267
-                getPluginInfo(), "Lag display plugin", "");
274
+                pluginInfo, "Lag display plugin", "");
268 275
         cat.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
269 276
                 getDomain(), "usealternate",
270 277
                 "Alternate method", "Use an alternate method of determining "

+ 13
- 5
src/com/dmdirc/addons/logging/LoggingPlugin.java Целия файл

@@ -45,6 +45,7 @@ import com.dmdirc.parser.interfaces.ChannelInfo;
45 45
 import com.dmdirc.parser.interfaces.ClientInfo;
46 46
 import com.dmdirc.parser.interfaces.Parser;
47 47
 import com.dmdirc.plugins.BasePlugin;
48
+import com.dmdirc.plugins.PluginInfo;
48 49
 import com.dmdirc.ui.messages.Styliser;
49 50
 import com.dmdirc.util.StreamUtil;
50 51
 
@@ -82,6 +83,8 @@ public class LoggingPlugin extends BasePlugin implements ActionListener,
82 83
     private String timestamp, usedateformat, logDirectory, colour;
83 84
     /** Cached int settings. */
84 85
     private int historyLines, backbufferLines;
86
+    /** This plugin's plugin info. */
87
+    private final PluginInfo pluginInfo;
85 88
 
86 89
     /** Open File. */
87 90
     protected static class OpenFile {
@@ -113,9 +116,14 @@ public class LoggingPlugin extends BasePlugin implements ActionListener,
113 116
     /** Date format used for "File Opened At" log. */
114 117
     final DateFormat openedAtFormat = new SimpleDateFormat("EEEE MMMM dd, yyyy - HH:mm:ss");
115 118
 
116
-    /** Creates a new instance of this plugin. */
117
-    public LoggingPlugin() {
119
+    /**
120
+     * Creates a new instance of this plugin.
121
+     *
122
+     * @param pluginInfo This plugin's plugin info
123
+     */
124
+    public LoggingPlugin(final PluginInfo pluginInfo) {
118 125
         super();
126
+        this.pluginInfo = pluginInfo;
119 127
         registerCommand(new LoggingCommand(), LoggingCommand.INFO);
120 128
     }
121 129
 
@@ -227,11 +235,11 @@ public class LoggingPlugin extends BasePlugin implements ActionListener,
227 235
     @Override
228 236
     public void showConfig(final PreferencesDialogModel manager) {
229 237
         final PreferencesCategory general = new PluginPreferencesCategory(
230
-                getPluginInfo(), "Logging", "General configuration for Logging plugin.");
238
+                pluginInfo, "Logging", "General configuration for Logging plugin.");
231 239
         final PreferencesCategory backbuffer = new PluginPreferencesCategory(
232
-                getPluginInfo(), "Back Buffer", "Options related to the automatic backbuffer");
240
+                pluginInfo, "Back Buffer", "Options related to the automatic backbuffer");
233 241
         final PreferencesCategory advanced = new PluginPreferencesCategory(
234
-                getPluginInfo(), "Advanced", "Advanced configuration for Logging plugin. You shouldn't need to edit this unless you know what you are doing.");
242
+                pluginInfo, "Advanced", "Advanced configuration for Logging plugin. You shouldn't need to edit this unless you know what you are doing.");
235 243
 
236 244
         general.addSetting(new PreferencesSetting(PreferencesType.DIRECTORY, getDomain(), "general.directory", "Directory", "Directory for log files"));
237 245
         general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(), "general.networkfolders", "Separate logs by network", "Should the files be stored in a sub-dir with the networks name?"));

+ 14
- 1
src/com/dmdirc/addons/mediasource_vlc/VlcMediaSourcePlugin.java Целия файл

@@ -31,6 +31,7 @@ import com.dmdirc.config.prefs.PreferencesDialogModel;
31 31
 import com.dmdirc.config.prefs.PreferencesSetting;
32 32
 import com.dmdirc.config.prefs.PreferencesType;
33 33
 import com.dmdirc.plugins.BasePlugin;
34
+import com.dmdirc.plugins.PluginInfo;
34 35
 import com.dmdirc.util.Downloader;
35 36
 
36 37
 import java.io.File;
@@ -50,6 +51,18 @@ public class VlcMediaSourcePlugin extends BasePlugin implements MediaSource {
50 51
     /** The information obtained from VLC. */
51 52
     private final Map<String, String> information
52 53
             = new HashMap<String, String>();
54
+    /** This plugin's plugin info. */
55
+    private final PluginInfo pluginInfo;
56
+
57
+    /**
58
+     * Creates a new instance of this plugin.
59
+     *
60
+     * @param pluginInfo This plugin's plugin info
61
+     */
62
+    public VlcMediaSourcePlugin(final PluginInfo pluginInfo) {
63
+        super();
64
+        this.pluginInfo = pluginInfo;
65
+    }
53 66
 
54 67
     /** {@inheritDoc} */
55 68
     @Override
@@ -193,7 +206,7 @@ public class VlcMediaSourcePlugin extends BasePlugin implements MediaSource {
193 206
     @Override
194 207
     public void showConfig(final PreferencesDialogModel manager) {
195 208
         final PreferencesCategory general = new PluginPreferencesCategory(
196
-                getPluginInfo(), "VLC Media Source",
209
+                pluginInfo, "VLC Media Source",
197 210
                 "", "category-vlc");
198 211
 
199 212
         final PreferencesSetting setting = new PreferencesSetting(

+ 7
- 4
src/com/dmdirc/addons/mediasource_windows/WindowsMediaSourcePlugin.java Целия файл

@@ -26,7 +26,7 @@ import com.dmdirc.addons.nowplaying.MediaSource;
26 26
 import com.dmdirc.addons.nowplaying.MediaSourceManager;
27 27
 import com.dmdirc.logger.ErrorLevel;
28 28
 import com.dmdirc.logger.Logger;
29
-import com.dmdirc.plugins.BasePlugin;
29
+import com.dmdirc.plugins.BaseFileDependantPlugin;
30 30
 import com.dmdirc.plugins.PluginInfo;
31 31
 import com.dmdirc.plugins.PluginManager;
32 32
 import com.dmdirc.util.StreamReader;
@@ -39,16 +39,19 @@ import java.util.List;
39 39
 /**
40 40
  * Manages all Windows based media sources.
41 41
  */
42
-public class WindowsMediaSourcePlugin extends BasePlugin implements MediaSourceManager {
42
+public class WindowsMediaSourcePlugin extends BaseFileDependantPlugin
43
+        implements MediaSourceManager {
43 44
 
44 45
     /** Media sources. */
45 46
     private final List<MediaSource> sources;
46 47
 
47 48
     /**
48 49
      * Creates a new instance of DcopMediaSourcePlugin.
50
+     *
51
+     * @param pluginInfo This plugin's plugin info
49 52
      */
50
-    public WindowsMediaSourcePlugin() {
51
-        super();
53
+    public WindowsMediaSourcePlugin(final PluginInfo pluginInfo) {
54
+        super(pluginInfo.getMetaData());
52 55
         sources = new ArrayList<MediaSource>();
53 56
         sources.add(new DllSource(this, "Winamp", true));
54 57
         sources.add(new DllSource(this, "iTunes", false));

+ 15
- 4
src/com/dmdirc/addons/nickcolours/NickColourPlugin.java Целия файл

@@ -41,6 +41,7 @@ import com.dmdirc.parser.interfaces.ChannelClientInfo;
41 41
 import com.dmdirc.parser.interfaces.ChannelInfo;
42 42
 import com.dmdirc.parser.interfaces.ClientInfo;
43 43
 import com.dmdirc.plugins.BasePlugin;
44
+import com.dmdirc.plugins.PluginInfo;
44 45
 import com.dmdirc.plugins.PluginManager;
45 46
 import com.dmdirc.ui.messages.ColourManager;
46 47
 import com.dmdirc.util.ReturnableThread;
@@ -52,8 +53,6 @@ import java.util.Map;
52 53
 
53 54
 /**
54 55
  * Provides various features related to nickname colouring.
55
- *
56
- * @author chris
57 56
  */
58 57
 public final class NickColourPlugin extends BasePlugin implements ActionListener,
59 58
         ConfigChangeListener {
@@ -67,6 +66,18 @@ public final class NickColourPlugin extends BasePlugin implements ActionListener
67 66
     private boolean userandomcolour;
68 67
     private boolean settext;
69 68
     private boolean setnicklist;
69
+    /** This plugin's plugin info. */
70
+    private final PluginInfo pluginInfo;
71
+
72
+    /**
73
+     * Creates a new instance of this plugin.
74
+     *
75
+     * @param pluginInfo This plugin's plugin info
76
+     */
77
+    public NickColourPlugin(final PluginInfo pluginInfo) {
78
+        super();
79
+        this.pluginInfo = pluginInfo;
80
+    }
70 81
 
71 82
     /** {@inheritDoc} */
72 83
     @Override
@@ -247,10 +258,10 @@ public final class NickColourPlugin extends BasePlugin implements ActionListener
247 258
     @Override
248 259
     public void showConfig(final PreferencesDialogModel manager) {
249 260
         final PreferencesCategory general = new PluginPreferencesCategory(
250
-                getPluginInfo(), "Nick Colours",
261
+                pluginInfo, "Nick Colours",
251 262
                 "General configuration for NickColour plugin.");
252 263
         final PreferencesCategory colours = new PluginPreferencesCategory(
253
-                getPluginInfo(), "Colours",
264
+                pluginInfo, "Colours",
254 265
                 "Set colours for specific nicknames.", UIUtilities.invokeAndWait(
255 266
                 new ReturnableThread<NickColourPanel>() {
256 267
 

+ 10
- 3
src/com/dmdirc/addons/notifications/NotificationsPlugin.java Целия файл

@@ -48,10 +48,17 @@ public class NotificationsPlugin extends BasePlugin implements ActionListener {
48 48
     private final List<String> methods = new ArrayList<String>();
49 49
     /** The user's preferred order for method usage. */
50 50
     private List<String> order;
51
+    /** This plugin's plugin info. */
52
+    private final PluginInfo pluginInfo;
51 53
 
52
-    /** Creates a new instance of this plugin. */
53
-    public NotificationsPlugin() {
54
+    /**
55
+     * Creates a new instance of this plugin.
56
+     *
57
+     * @param pluginInfo This plugin's plugin info
58
+     */
59
+    public NotificationsPlugin(final PluginInfo pluginInfo) {
54 60
         super();
61
+        this.pluginInfo = pluginInfo;
55 62
         registerCommand(new NotificationCommand(this),
56 63
                 NotificationCommand.INFO);
57 64
     }
@@ -95,7 +102,7 @@ public class NotificationsPlugin extends BasePlugin implements ActionListener {
95 102
         });
96 103
 
97 104
         final PreferencesCategory category = new PluginPreferencesCategory(
98
-                getPluginInfo(), "Notifications", "", "category-notifications",
105
+                pluginInfo, "Notifications", "", "category-notifications",
99 106
                 configPanel);
100 107
         manager.getCategory("Plugins").addSubCategory(category);
101 108
     }

+ 10
- 3
src/com/dmdirc/addons/nowplaying/NowPlayingPlugin.java Целия файл

@@ -53,10 +53,17 @@ public class NowPlayingPlugin extends BasePlugin implements ActionListener  {
53 53
     private final List<MediaSourceManager> managers = new ArrayList<MediaSourceManager>();
54 54
     /** The user's preferred order for source usage. */
55 55
     private List<String> order;
56
+    /** This plugin's plugin info. */
57
+    private final PluginInfo pluginInfo;
56 58
 
57
-    /** Creates a new instance of this plugin. */
58
-    public NowPlayingPlugin() {
59
+    /**
60
+     * Creates a new instance of this plugin.
61
+     *
62
+     * @param pluginInfo This plugin's plugin info
63
+     */
64
+    public NowPlayingPlugin(final PluginInfo pluginInfo) {
59 65
         super();
66
+        this.pluginInfo = pluginInfo;
60 67
         registerCommand(new NowPlayingCommand(this), NowPlayingCommand.INFO);
61 68
     }
62 69
 
@@ -101,7 +108,7 @@ public class NowPlayingPlugin extends BasePlugin implements ActionListener  {
101 108
         });
102 109
 
103 110
         final PreferencesCategory category = new PluginPreferencesCategory(
104
-                getPluginInfo(), "Now Playing",
111
+                pluginInfo, "Now Playing",
105 112
                 "", "category-nowplaying", configPanel);
106 113
         manager.getCategory("Plugins").addSubCategory(category);
107 114
     }

+ 11
- 3
src/com/dmdirc/addons/osd/OsdPlugin.java Целия файл

@@ -32,6 +32,7 @@ import com.dmdirc.config.prefs.PreferencesSetting;
32 32
 import com.dmdirc.config.prefs.PreferencesType;
33 33
 import com.dmdirc.config.prefs.SettingChangeListener;
34 34
 import com.dmdirc.plugins.BasePlugin;
35
+import com.dmdirc.plugins.PluginInfo;
35 36
 import com.dmdirc.util.validators.NumericalValidator;
36 37
 import com.dmdirc.util.validators.OptionalValidator;
37 38
 
@@ -55,10 +56,17 @@ public final class OsdPlugin extends BasePlugin implements
55 56
     /** Setting objects with registered change listeners.*/
56 57
     private PreferencesSetting fontSizeSetting, backgroundSetting,
57 58
             foregroundSetting, widthSetting, timeoutSetting, maxWindowsSetting;
59
+    /** This plugin's plugin info. */
60
+    private final PluginInfo pluginInfo;
58 61
 
59
-    /** Creates a new instance of this plugin. */
60
-    public OsdPlugin() {
62
+    /**
63
+     * Creates a new instance of this plugin.
64
+     *
65
+     * @param pluginInfo This plugin's plugin info
66
+     */
67
+    public OsdPlugin(final PluginInfo pluginInfo) {
61 68
         super();
69
+        this.pluginInfo = pluginInfo;
62 70
         osdManager = new OsdManager(this);
63 71
         registerCommand(new OsdCommand(osdManager), OsdCommand.INFO);
64 72
     }
@@ -70,7 +78,7 @@ public final class OsdPlugin extends BasePlugin implements
70 78
         y = IdentityManager.getGlobalConfig().getOptionInt(getDomain(), "locationY");
71 79
 
72 80
         final PreferencesCategory category = new PluginPreferencesCategory(
73
-                getPluginInfo(), "OSD",
81
+                pluginInfo, "OSD",
74 82
                 "General configuration for OSD plugin.", "category-osd");
75 83
 
76 84
         fontSizeSetting = new PreferencesSetting(PreferencesType.INTEGER,

+ 15
- 4
src/com/dmdirc/addons/parser_twitter/TwitterPlugin.java Целия файл

@@ -33,19 +33,30 @@ import com.dmdirc.parser.common.MyInfo;
33 33
 import com.dmdirc.parser.interfaces.Parser;
34 34
 import com.dmdirc.parser.interfaces.ProtocolDescription;
35 35
 import com.dmdirc.plugins.BasePlugin;
36
+import com.dmdirc.plugins.PluginInfo;
36 37
 
37 38
 import java.net.URI;
38 39
 import java.util.ArrayList;
39 40
 
40 41
 /**
41 42
  * Facilitates creation of Twitter parsers.
42
- *
43
- * @author shane
44 43
  */
45 44
 public class TwitterPlugin extends BasePlugin {
46 45
 
47 46
     /** Are we currently unloading? */
48 47
     private volatile boolean unloading = false;
48
+    /** This plugin's plugin info. */
49
+    private final PluginInfo pluginInfo;
50
+
51
+    /**
52
+     * Creates a new instance of this plugin.
53
+     *
54
+     * @param pluginInfo This plugin's plugin info
55
+     */
56
+    public TwitterPlugin(final PluginInfo pluginInfo) {
57
+        super();
58
+        this.pluginInfo = pluginInfo;
59
+    }
49 60
 
50 61
     /** {@inheritDoc} */
51 62
     @Override
@@ -87,8 +98,8 @@ public class TwitterPlugin extends BasePlugin {
87 98
     /** {@inheritDoc} */
88 99
     @Override
89 100
     public void showConfig(final PreferencesDialogModel manager) {
90
-        final PreferencesCategory category = new PluginPreferencesCategory(getPluginInfo(), "Twitter Plugin", "Settings related to the twitter plugin", "category-twitter");
91
-        final PreferencesCategory advanced = new PluginPreferencesCategory(getPluginInfo(), "Advanced", "Advanced Settings related to the twitter plugin", "category-twitter");
101
+        final PreferencesCategory category = new PluginPreferencesCategory(pluginInfo, "Twitter Plugin", "Settings related to the twitter plugin", "category-twitter");
102
+        final PreferencesCategory advanced = new PluginPreferencesCategory(pluginInfo, "Advanced", "Advanced Settings related to the twitter plugin", "category-twitter");
92 103
 
93 104
         category.addSetting(new PreferencesSetting(PreferencesType.INTEGER, getDomain(), "statuscount", "Statuses to request", "How many statuses to request at a time?"));
94 105
         category.addSetting(new PreferencesSetting(PreferencesType.INTEGER, getDomain(), "apicalls", "API Calls", "Aim to only use how many API Calls per hour? (Twitter has a max of 350)"));

+ 15
- 2
src/com/dmdirc/addons/relaybot/RelayBotPlugin.java Целия файл

@@ -41,6 +41,7 @@ import com.dmdirc.parser.interfaces.ChannelClientInfo;
41 41
 import com.dmdirc.parser.interfaces.Parser;
42 42
 import com.dmdirc.parser.irc.IRCParser;
43 43
 import com.dmdirc.plugins.BasePlugin;
44
+import com.dmdirc.plugins.PluginInfo;
44 45
 import com.dmdirc.plugins.PluginManager;
45 46
 import com.dmdirc.util.ReturnableThread;
46 47
 
@@ -56,6 +57,18 @@ public class RelayBotPlugin extends BasePlugin implements ActionListener, Config
56 57
 
57 58
     /** Known RelayChannelHandlers. */
58 59
     private final Map<Channel, RelayChannelHandler> handlers = new HashMap<Channel, RelayChannelHandler>();
60
+    /** This plugin's plugin info. */
61
+    private final PluginInfo pluginInfo;
62
+
63
+    /**
64
+     * Creates a new instance of this plugin.
65
+     *
66
+     * @param pluginInfo This plugin's plugin info
67
+     */
68
+    public RelayBotPlugin(final PluginInfo pluginInfo) {
69
+        super();
70
+        this.pluginInfo = pluginInfo;
71
+    }
59 72
 
60 73
     /** {@inheritDoc} */
61 74
     @Override
@@ -263,11 +276,11 @@ public class RelayBotPlugin extends BasePlugin implements ActionListener, Config
263 276
     @Override
264 277
     public void showConfig(final PreferencesDialogModel manager) {
265 278
         final PreferencesCategory general = new PluginPreferencesCategory(
266
-                getPluginInfo(), "Relay Bot",
279
+                pluginInfo, "Relay Bot",
267 280
                 "General configuration for the Relay bot plugin.");
268 281
 
269 282
         final PreferencesCategory colours = new PluginPreferencesCategory(
270
-                getPluginInfo(), "Channels",
283
+                pluginInfo, "Channels",
271 284
                 "Identifies where and who the bot is in channels.",
272 285
                 UIUtilities.invokeAndWait(
273 286
                 new ReturnableThread<RelayChannelPanel>() {

+ 12
- 4
src/com/dmdirc/addons/systray/SystrayPlugin.java Целия файл

@@ -34,6 +34,7 @@ import com.dmdirc.config.prefs.PreferencesDialogModel;
34 34
 import com.dmdirc.config.prefs.PreferencesSetting;
35 35
 import com.dmdirc.config.prefs.PreferencesType;
36 36
 import com.dmdirc.plugins.BasePlugin;
37
+import com.dmdirc.plugins.PluginInfo;
37 38
 import com.dmdirc.plugins.PluginManager;
38 39
 import com.dmdirc.ui.IconManager;
39 40
 import com.dmdirc.ui.messages.Styliser;
@@ -61,10 +62,17 @@ public final class SystrayPlugin extends BasePlugin implements ActionListener,
61 62
     private final TrayIcon icon;
62 63
     /** Main frame instance. */
63 64
     private MainFrame mainFrame;
65
+    /** This plugin's plugin info. */
66
+    private final PluginInfo pluginInfo;
64 67
 
65
-    /** Creates a new system tray plugin. */
66
-    public SystrayPlugin() {
68
+    /**
69
+     * Creates a new system tray plugin.
70
+     *
71
+     * @param pluginInfo This plugin's plugin info
72
+     */
73
+    public SystrayPlugin(final PluginInfo pluginInfo) {
67 74
         super();
75
+        this.pluginInfo = pluginInfo;
68 76
         final MenuItem show = new MenuItem("Show/hide");
69 77
         final MenuItem quit = new MenuItem("Quit");
70 78
 
@@ -153,7 +161,7 @@ public final class SystrayPlugin extends BasePlugin implements ActionListener,
153 161
             continueLoading = false;
154 162
         }
155 163
         if (!continueLoading || mainFrame == null) {
156
-            getPluginInfo().unloadPlugin();
164
+            pluginInfo.unloadPlugin();
157 165
         }
158 166
         super.onLoad();
159 167
     }
@@ -170,7 +178,7 @@ public final class SystrayPlugin extends BasePlugin implements ActionListener,
170 178
     @Override
171 179
     public void showConfig(final PreferencesDialogModel manager) {
172 180
         final PreferencesCategory category = new PluginPreferencesCategory(
173
-                getPluginInfo(), "System Tray",
181
+                pluginInfo, "System Tray",
174 182
                 "General configuration settings");
175 183
 
176 184
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,

+ 24
- 6
src/com/dmdirc/addons/ui_swing/SwingController.java Целия файл

@@ -54,12 +54,14 @@ import com.dmdirc.config.prefs.PreferencesType;
54 54
 import com.dmdirc.logger.ErrorLevel;
55 55
 import com.dmdirc.logger.Logger;
56 56
 import com.dmdirc.plugins.BasePlugin;
57
+import com.dmdirc.plugins.PluginInfo;
57 58
 import com.dmdirc.ui.WindowManager;
58 59
 import com.dmdirc.ui.core.components.StatusBarManager;
59 60
 import com.dmdirc.ui.core.util.URLHandler;
60 61
 import com.dmdirc.ui.interfaces.InputWindow;
61 62
 import com.dmdirc.ui.interfaces.UIController;
62 63
 import com.dmdirc.ui.interfaces.Window;
64
+import com.dmdirc.updater.Version;
63 65
 import com.dmdirc.util.ReturnableThread;
64 66
 import com.dmdirc.util.validators.NumericalValidator;
65 67
 
@@ -115,10 +117,17 @@ public class SwingController extends BasePlugin implements UIController {
115 117
     private DMDircEventQueue eventQueue;
116 118
     /** Key listener to handle dialog key events. */
117 119
     private DialogKeyListener keyListener;
120
+    /** This plugin's plugin info object. */
121
+    private final PluginInfo pluginInfo;
118 122
 
119
-    /** Instantiates a new SwingController. */
120
-    public SwingController() {
123
+    /**
124
+     * Instantiates a new SwingController.
125
+     *
126
+     * @param pluginInfo Plugin info
127
+     */
128
+    public SwingController(final PluginInfo pluginInfo) {
121 129
         super();
130
+        this.pluginInfo = pluginInfo;
122 131
         setAntiAlias();
123 132
         windows = new ArrayList<java.awt.Window>();
124 133
         registerCommand(new ServerSettings(), ServerSettings.INFO);
@@ -549,7 +558,7 @@ public class SwingController extends BasePlugin implements UIController {
549 558
      */
550 559
     private PreferencesCategory createGeneralCategory() {
551 560
         final PreferencesCategory general = new PluginPreferencesCategory(
552
-                getPluginInfo(), "Swing UI", "These config options apply "
561
+                pluginInfo, "Swing UI", "These config options apply "
553 562
                 + "only to the swing UI.", "category-gui");
554 563
 
555 564
         final Map<String, String> lafs = new HashMap<String, String>();
@@ -610,7 +619,7 @@ public class SwingController extends BasePlugin implements UIController {
610 619
      */
611 620
     private PreferencesCategory createAdvancedCategory() {
612 621
         final PreferencesCategory advanced = new PluginPreferencesCategory(
613
-                getPluginInfo(), "Advanced", "");
622
+                pluginInfo, "Advanced", "");
614 623
 
615 624
         advanced.addSetting(new PreferencesSetting(
616 625
                 PreferencesType.OPTIONALINTEGER,
@@ -663,7 +672,7 @@ public class SwingController extends BasePlugin implements UIController {
663 672
      */
664 673
     private PreferencesCategory createTreeViewCategory() {
665 674
         final PreferencesCategory treeview = new PluginPreferencesCategory(
666
-                getPluginInfo(), "Treeview", "", "treeview");
675
+                pluginInfo, "Treeview", "", "treeview");
667 676
 
668 677
         treeview.addSetting(new PreferencesSetting(
669 678
                 PreferencesType.OPTIONALCOLOUR,
@@ -703,7 +712,7 @@ public class SwingController extends BasePlugin implements UIController {
703 712
      */
704 713
     private PreferencesCategory createNicklistCategory() {
705 714
         final PreferencesCategory nicklist = new PluginPreferencesCategory(
706
-                getPluginInfo(), "Nicklist", "", "nicklist");
715
+                pluginInfo, "Nicklist", "", "nicklist");
707 716
 
708 717
         nicklist.addSetting(new PreferencesSetting(
709 718
                 PreferencesType.OPTIONALCOLOUR,
@@ -796,4 +805,13 @@ public class SwingController extends BasePlugin implements UIController {
796 805
         requestWindowFocus(getWindowFactory().getSwingWindow(container));
797 806
     }
798 807
 
808
+    /**
809
+     * Returns the version of this swing UI.
810
+     *
811
+     * @return Swing version
812
+     */
813
+    public Version getVersion() {
814
+        return pluginInfo.getMetaData().getVersion();
815
+    }
816
+
799 817
 }

+ 2
- 2
src/com/dmdirc/addons/ui_swing/dialogs/about/InfoPanel.java Целия файл

@@ -82,8 +82,8 @@ public final class InfoPanel extends JPanel {
82 82
                  + "<b>Mode Alises version: </b>" + IdentityManager
83 83
                  .getGlobalConfig().getOption("identity", "modealiasversion")
84 84
                  + "<br>"
85
-                 + "<b>Swing UI version: </b>" + controller.getPluginInfo()
86
-                 .getMetaData().getVersion().toString() + "<br>"
85
+                 + "<b>Swing UI version: </b>" + controller.getVersion()
86
+                 .toString() + "<br>"
87 87
                  + "<b>OS Version: </b>" + Info.getOSVersion() + "<br>"
88 88
                  + "<b>Profile directory: </b>" + Main.getConfigDir() + "<br>"
89 89
                  + "<b>Java version: </b>" + Info.getJavaVersion() + "<br>"

+ 11
- 3
src/com/dmdirc/addons/windowflashing/WindowFlashing.java Целия файл

@@ -32,6 +32,7 @@ import com.dmdirc.config.prefs.PreferencesSetting;
32 32
 import com.dmdirc.config.prefs.PreferencesType;
33 33
 import com.dmdirc.interfaces.ConfigChangeListener;
34 34
 import com.dmdirc.plugins.BasePlugin;
35
+import com.dmdirc.plugins.PluginInfo;
35 36
 import com.dmdirc.plugins.PluginManager;
36 37
 
37 38
 import com.sun.jna.Native;
@@ -59,10 +60,17 @@ public class WindowFlashing extends BasePlugin implements ConfigChangeListener {
59 60
     private int flashcount = Integer.MAX_VALUE;
60 61
     /** Cached flags setting. */
61 62
     private int flags = 0;
63
+    /** This plugin's plugin info. */
64
+    private final PluginInfo pluginInfo;
62 65
 
63
-    /** Creates a new instance of this plugin. */
64
-    public WindowFlashing() {
66
+    /**
67
+     * Creates a new instance of this plugin.
68
+     *
69
+     * @param pluginInfo This plugin's plugin info
70
+     */
71
+    public WindowFlashing(final PluginInfo pluginInfo) {
65 72
         super();
73
+        this.pluginInfo = pluginInfo;
66 74
         registerCommand(new FlashWindow(this), FlashWindow.INFO);
67 75
     }
68 76
 
@@ -113,7 +121,7 @@ public class WindowFlashing extends BasePlugin implements ConfigChangeListener {
113 121
     @Override
114 122
     public void showConfig(final PreferencesDialogModel manager) {
115 123
         final PreferencesCategory category = new PluginPreferencesCategory(
116
-                getPluginInfo(), "Window Flashing",
124
+                pluginInfo, "Window Flashing",
117 125
                 "General configuration for window flashing plugin.");
118 126
 
119 127
         category.addSetting(new PreferencesSetting(

+ 11
- 3
src/com/dmdirc/addons/windowstatus/WindowStatusPlugin.java Целия файл

@@ -41,6 +41,7 @@ import com.dmdirc.parser.interfaces.ChannelClientInfo;
41 41
 import com.dmdirc.parser.interfaces.ChannelInfo;
42 42
 import com.dmdirc.parser.interfaces.ClientInfo;
43 43
 import com.dmdirc.plugins.BasePlugin;
44
+import com.dmdirc.plugins.PluginInfo;
44 45
 import com.dmdirc.plugins.PluginManager;
45 46
 import com.dmdirc.util.ReturnableThread;
46 47
 
@@ -64,10 +65,17 @@ public final class WindowStatusPlugin extends BasePlugin
64 65
     private boolean shownone;
65 66
     /** Prefix for users without modes. */
66 67
     private String nonePrefix;
68
+    /** This plugin's plugin info. */
69
+    private final PluginInfo pluginInfo;
67 70
 
68
-    /** Creates a new instance of WindowStatusPlugin. */
69
-    public WindowStatusPlugin() {
71
+    /**
72
+     * Creates a new instance of WindowStatusPlugin.
73
+     *
74
+     * @param pluginInfo This plugin's plugin info
75
+     */
76
+    public WindowStatusPlugin(final PluginInfo pluginInfo) {
70 77
         super();
78
+        this.pluginInfo = pluginInfo;
71 79
 
72 80
         panel = UIUtilities.invokeAndWait(
73 81
                 new ReturnableThread<WindowStatusPanel>() {
@@ -211,7 +219,7 @@ public final class WindowStatusPlugin extends BasePlugin
211 219
     @Override
212 220
     public void showConfig(final PreferencesDialogModel manager) {
213 221
         final PreferencesCategory category = new PluginPreferencesCategory(
214
-                getPluginInfo(), "Window status", "");
222
+                pluginInfo, "Window status", "");
215 223
 
216 224
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
217 225
                 getDomain(), "channel.shownone", "Show 'none' count",

+ 10
- 13
test/com/dmdirc/addons/logging/LoggingPluginTest.java Целия файл

@@ -23,13 +23,10 @@
23 23
 package com.dmdirc.addons.logging;
24 24
 
25 25
 import com.dmdirc.Channel;
26
-import com.dmdirc.Main;
27 26
 import com.dmdirc.Server;
28 27
 import com.dmdirc.Query;
29 28
 import com.dmdirc.actions.CoreActionType;
30 29
 import com.dmdirc.config.IdentityManager;
31
-import com.dmdirc.harness.TestLoggingPlugin;
32
-import com.dmdirc.addons.ui_dummy.DummyController;
33 30
 import com.dmdirc.parser.interfaces.ChannelInfo;
34 31
 import com.dmdirc.parser.interfaces.ClientInfo;
35 32
 import com.dmdirc.parser.interfaces.Parser;
@@ -44,7 +41,7 @@ import org.junit.Test;
44 41
 import static org.junit.Assert.*;
45 42
 
46 43
 public class LoggingPluginTest {
47
-    
44
+
48 45
     private static Server server;
49 46
     private static Channel channel;
50 47
     private static Query query;
@@ -57,14 +54,14 @@ public class LoggingPluginTest {
57 54
 
58 55
         ClientInfo clientinfo = mock(ClientInfo.class);
59 56
         when(clientinfo.toString()).thenReturn("foo!bar@baz");
60
-        
57
+
61 58
         Parser parser = mock(Parser.class);
62 59
         when(parser.getClient(anyString())).thenReturn(clientinfo);
63 60
 
64 61
         server = mock(Server.class);
65 62
         when(server.toString()).thenReturn("server");
66 63
         when(server.getParser()).thenReturn(parser);
67
-        
64
+
68 65
         ChannelInfo info = mock(ChannelInfo.class);
69 66
         when(info.toString()).thenReturn("#test");
70 67
 
@@ -90,30 +87,30 @@ public class LoggingPluginTest {
90 87
         lp.domainUpdated();
91 88
         lp.onLoad();
92 89
     }
93
-    
90
+
94 91
     @Test
95 92
     public void testChannelOpened() {
96 93
         lp.processEvent(CoreActionType.CHANNEL_OPENED, new StringBuffer(),
97 94
                 channel);
98
-        
95
+
99 96
         assertTrue(lp.lines.containsKey("#test"));
100 97
         assertEquals(2, lp.lines.get("#test").size());
101 98
         assertTrue(lp.lines.get("#test").get(1).isEmpty());
102 99
         assertTrue(lp.lines.get("#test").get(0).indexOf("opened") > -1);
103 100
         lp.lines.clear();
104 101
     }
105
-    
102
+
106 103
     @Test
107 104
     public void testChannelClosed() {
108 105
         lp.processEvent(CoreActionType.CHANNEL_CLOSED, new StringBuffer(),
109 106
                 channel);
110
-        
107
+
111 108
         assertTrue(lp.lines.containsKey("#test"));
112 109
         assertEquals(1, lp.lines.get("#test").size());
113 110
         assertTrue(lp.lines.get("#test").get(0).indexOf("closed") > -1);
114 111
         lp.lines.clear();
115 112
     }
116
-    
113
+
117 114
     @Test
118 115
     public void testQueryOpened() {
119 116
         lp.processEvent(CoreActionType.QUERY_OPENED, new StringBuffer(),
@@ -126,12 +123,12 @@ public class LoggingPluginTest {
126 123
         assertTrue(lp.lines.get("foo!bar@baz").get(0).indexOf("opened") > -1);
127 124
         lp.lines.clear();
128 125
     }
129
-    
126
+
130 127
     @Test
131 128
     public void testQueryClosed() {
132 129
         lp.processEvent(CoreActionType.QUERY_CLOSED, new StringBuffer(),
133 130
                 query);
134
-        
131
+
135 132
         assertTrue(lp.lines.containsKey("foo!bar@baz"));
136 133
         assertEquals(1, lp.lines.get("foo!bar@baz").size());
137 134
         assertTrue(lp.lines.get("foo!bar@baz").get(0).indexOf("closed") > -1);

+ 48
- 0
test/com/dmdirc/addons/logging/TestLoggingPlugin.java Целия файл

@@ -0,0 +1,48 @@
1
+/*
2
+ * Copyright (c) 2006-2011 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.logging;
24
+
25
+import com.dmdirc.plugins.PluginInfo;
26
+import com.dmdirc.util.MapList;
27
+import static org.mockito.Mockito.*;
28
+
29
+public class TestLoggingPlugin extends LoggingPlugin {
30
+
31
+    public final MapList<Object, String> lines = new MapList<Object, String>();
32
+
33
+    public TestLoggingPlugin() {
34
+        super(mock(PluginInfo.class));
35
+    }
36
+
37
+    @Override
38
+    protected String getLogFile(Object obj) {
39
+        return obj.toString();
40
+    }
41
+
42
+    @Override
43
+    protected boolean appendLine(String filename, String line) {
44
+        lines.add(filename, line);
45
+        return true;
46
+    }
47
+
48
+}

+ 7
- 4
test/com/dmdirc/addons/mediasource_vlc/VlcMediaSourcePluginTest.java Целия файл

@@ -22,25 +22,28 @@
22 22
 
23 23
 package com.dmdirc.addons.mediasource_vlc;
24 24
 
25
+import com.dmdirc.plugins.PluginInfo;
25 26
 import com.dmdirc.util.TextFile;
26 27
 import java.io.IOException;
27 28
 import org.junit.Test;
28 29
 import static org.junit.Assert.*;
30
+import static org.mockito.Mockito.*;
29 31
 
30 32
 public class VlcMediaSourcePluginTest {
31 33
 
32 34
     @Test
33 35
     public void testProcessInformation1() throws IOException {
34
-        final VlcMediaSourcePlugin plugin = new VlcMediaSourcePlugin();
36
+        final PluginInfo pluginInfo = mock(PluginInfo.class);
37
+        final VlcMediaSourcePlugin plugin = new VlcMediaSourcePlugin(pluginInfo);
35 38
         final TextFile index = new TextFile(getClass().getResourceAsStream("index-1.html"));
36 39
         final TextFile info = new TextFile(getClass().getResourceAsStream("info-1.html"));
37
-        
40
+
38 41
         plugin.parseInformation(info.getLines(), index.getLines());
39
-        
42
+
40 43
         // This doesn't work anymore because getState() calls fetchInformation()
41 44
         // which overwrites the stuff set by the parseInformation() call.
42 45
         // assertTrue(plugin.getState() == MediaSourceState.PLAYING);
43
-        
46
+
44 47
         assertEquals("Manic Street Preachers", plugin.getArtist());
45 48
         assertEquals("Send Away The Tigers", plugin.getAlbum());
46 49
         assertEquals("The Second Great Depression", plugin.getTitle());

+ 1
- 1
test/com/dmdirc/harness/ui/DMDircUITestCase.java Целия файл

@@ -71,7 +71,7 @@ public class DMDircUITestCase extends UISpecTestCase {
71 71
         final SwingWindowFactory windowFactory = mock(SwingWindowFactory.class);
72 72
         when(controller.getDomain()).thenReturn("test");
73 73
         when(controller.getWindowFactory()).thenReturn(windowFactory);
74
-        when(controller.getPluginInfo()).thenReturn(pluginInfo);
74
+        when(controller.getVersion()).thenReturn(new Version(1));
75 75
         when(pluginInfo.getMetaData()).thenReturn(metaData);
76 76
         when(metaData.getVersion()).thenReturn(new Version(1));
77 77
 

Loading…
Отказ
Запис