Parcourir la source

Remove MessageSinkManager singleton.

Change-Id: Iaafcea914d16f33ce98c331084cd3e9c8fdbbeda
Depends-On: I1cd8a5676beab1f3aba7f62b064dd5b2c2ce0f61
Reviewed-on: http://gerrit.dmdirc.com/2821
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
tags/0.8rc1
Chris Smith il y a 10 ans
Parent
révision
f8e15603bc

+ 12
- 6
src/com/dmdirc/Channel.java Voir le fichier

@@ -31,6 +31,7 @@ import com.dmdirc.config.ConfigManager;
31 31
 import com.dmdirc.interfaces.NicklistListener;
32 32
 import com.dmdirc.interfaces.TopicChangeListener;
33 33
 import com.dmdirc.interfaces.config.ConfigChangeListener;
34
+import com.dmdirc.messages.MessageSinkManager;
34 35
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
35 36
 import com.dmdirc.parser.interfaces.ChannelInfo;
36 37
 import com.dmdirc.parser.interfaces.ClientInfo;
@@ -101,19 +102,24 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
101 102
      * @param newChannelInfo The parser's channel object that corresponds to
102 103
      * this channel
103 104
      * @param focus Whether or not to focus this channel
105
+     * @param messageSinkManager The sink manager to use to despatch messages.
104 106
      * @param windowManager Window management
105 107
      */
106
-    public Channel(final Server newServer, final ChannelInfo newChannelInfo,
107
-            final boolean focus, final WindowManager windowManager) {
108
+    public Channel(
109
+            final Server newServer,
110
+            final ChannelInfo newChannelInfo,
111
+            final boolean focus,
112
+            final MessageSinkManager messageSinkManager,
113
+            final WindowManager windowManager) {
108 114
         super("channel-inactive", newChannelInfo.getName(),
109 115
                 Styliser.stipControlCodes(newChannelInfo.getName()),
110 116
                 new ConfigManager(newServer.getProtocol(), newServer.getIrcd(),
111 117
                 newServer.getNetwork(), newServer.getAddress(), newChannelInfo.getName()),
112
-                new ChannelCommandParser(newServer),
118
+                new ChannelCommandParser(newServer), messageSinkManager, windowManager,
113 119
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier(),
114
-                WindowComponent.INPUTFIELD.getIdentifier(),
115
-                WindowComponent.TOPICBAR.getIdentifier(),
116
-                        WindowComponent.USERLIST.getIdentifier()), windowManager);
120
+                    WindowComponent.INPUTFIELD.getIdentifier(),
121
+                    WindowComponent.TOPICBAR.getIdentifier(),
122
+                    WindowComponent.USERLIST.getIdentifier()));
117 123
 
118 124
         channelInfo = newChannelInfo;
119 125
         server = newServer;

+ 0
- 1
src/com/dmdirc/ClientModule.java Voir le fichier

@@ -196,7 +196,6 @@ public class ClientModule {
196 196
             final StatusBarManager statusBarManager,
197 197
             final WindowManager windowManager) {
198 198
         final MessageSinkManager messageSinkManager = new MessageSinkManager();
199
-        MessageSinkManager.setManager(messageSinkManager);
200 199
         messageSinkManager.loadDefaultSinks(statusBarManager, windowManager);
201 200
         return messageSinkManager;
202 201
     }

+ 19
- 9
src/com/dmdirc/GlobalWindow.java Voir le fichier

@@ -31,6 +31,7 @@ import com.dmdirc.interfaces.CommandController;
31 31
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
32 32
 import com.dmdirc.interfaces.config.ConfigChangeListener;
33 33
 import com.dmdirc.interfaces.config.IdentityController;
34
+import com.dmdirc.messages.MessageSinkManager;
34 35
 import com.dmdirc.ui.WindowManager;
35 36
 import com.dmdirc.ui.core.components.WindowComponent;
36 37
 import com.dmdirc.ui.input.TabCompleter;
@@ -62,14 +63,18 @@ public class GlobalWindow extends WritableFrameContainer {
62 63
      *
63 64
      * @param config The ConfigManager to retrieve settings from.
64 65
      * @param parser The command parser to use to parse input.
65
-     * @param windowManager Window management
66
+     * @param windowManager The window manager.
67
+     * @param messageSinkManager The sink manager to use to despatch messages.
66 68
      */
67
-    public GlobalWindow(final AggregateConfigProvider config, final CommandParser parser,
68
-            final WindowManager windowManager) {
69
-        super("icon", "Global", "(Global)",
70
-                config, parser,
71
-                Arrays.asList(WindowComponent.TEXTAREA.getIdentifier(),
72
-                        WindowComponent.INPUTFIELD.getIdentifier()), windowManager);
69
+    public GlobalWindow(
70
+            final AggregateConfigProvider config,
71
+            final CommandParser parser,
72
+            final WindowManager windowManager,
73
+            final MessageSinkManager messageSinkManager) {
74
+        super("icon", "Global", "(Global)", config, parser, messageSinkManager, windowManager,
75
+                Arrays.asList(
76
+                        WindowComponent.TEXTAREA.getIdentifier(),
77
+                        WindowComponent.INPUTFIELD.getIdentifier()));
73 78
 
74 79
         tabCompleter = new TabCompleter(config);
75 80
         tabCompleter.addEntries(TabCompletionType.COMMAND,
@@ -124,6 +129,8 @@ public class GlobalWindow extends WritableFrameContainer {
124 129
         private final Provider<CommandController> commandControllerProvider;
125 130
         /** The provider to use to retrieve a window manager. */
126 131
         private final Provider<WindowManager> windowManagerProvider;
132
+        /** The provider to use to retrieve message sink managers. */
133
+        private final Provider<MessageSinkManager> messageSinkManagerProvider;
127 134
 
128 135
         /**
129 136
          * Creates a new instance of {@link GlobalWindowManager}.
@@ -131,15 +138,18 @@ public class GlobalWindow extends WritableFrameContainer {
131 138
          * @param identityController Controller to retrieve global configuration from.
132 139
          * @param commandControllerProvider The provider to use to retrieve a command controller.
133 140
          * @param windowManagerProvider The provider to use to retrieve a window manager.
141
+         * @param messageSinkManagerProvider The provider to use to retrieve a sink manager.
134 142
          */
135 143
         @Inject
136 144
         public GlobalWindowManager(
137 145
                 final IdentityController identityController,
138 146
                 final Provider<CommandController> commandControllerProvider,
139
-                final Provider<WindowManager> windowManagerProvider) {
147
+                final Provider<WindowManager> windowManagerProvider,
148
+                final Provider<MessageSinkManager> messageSinkManagerProvider) {
140 149
             this.globalConfig = identityController.getGlobalConfiguration();
141 150
             this.commandControllerProvider = commandControllerProvider;
142 151
             this.windowManagerProvider = windowManagerProvider;
152
+            this.messageSinkManagerProvider = messageSinkManagerProvider;
143 153
         }
144 154
 
145 155
         /** {@inheritDoc} */
@@ -166,7 +176,7 @@ public class GlobalWindow extends WritableFrameContainer {
166 176
                     if (globalWindow == null) {
167 177
                         globalWindow = new GlobalWindow(globalConfig,
168 178
                                 new GlobalCommandParser(globalConfig, commandControllerProvider.get()),
169
-                                windowManagerProvider.get());
179
+                                windowManagerProvider.get(), messageSinkManagerProvider.get());
170 180
                     }
171 181
                 } else {
172 182
                     if (globalWindow != null) {

+ 5
- 3
src/com/dmdirc/MessageTarget.java Voir le fichier

@@ -24,6 +24,7 @@ package com.dmdirc;
24 24
 
25 25
 import com.dmdirc.commandparser.parsers.CommandParser;
26 26
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
27
+import com.dmdirc.messages.MessageSinkManager;
27 28
 import com.dmdirc.ui.WindowManager;
28 29
 
29 30
 import java.util.Collection;
@@ -42,15 +43,16 @@ public abstract class MessageTarget extends WritableFrameContainer {
42 43
      * @param title The title of this target
43 44
      * @param config The config manager to use for this target
44 45
      * @param parser The command parser for this container
46
+     * @param messageSinkManager The sink manager to use to despatch messages.
45 47
      * @param components The UI components that this frame requires
46 48
      * @param windowManager Window manager
47 49
      * @since 0.6.4
48 50
      */
49 51
     public MessageTarget(final String icon, final String name,
50 52
             final String title, final AggregateConfigProvider config,
51
-            final CommandParser parser, final Collection<String> components,
52
-            final WindowManager windowManager) {
53
-        super(icon, name, title, config, parser, components, windowManager);
53
+            final CommandParser parser, final MessageSinkManager messageSinkManager,
54
+            final WindowManager windowManager, final Collection<String> components) {
55
+        super(icon, name, title, config, parser, messageSinkManager, windowManager, components);
54 56
     }
55 57
 
56 58
     /**

+ 8
- 14
src/com/dmdirc/Query.java Voir le fichier

@@ -29,6 +29,7 @@ import com.dmdirc.commandparser.CommandType;
29 29
 import com.dmdirc.commandparser.parsers.QueryCommandParser;
30 30
 import com.dmdirc.logger.ErrorLevel;
31 31
 import com.dmdirc.logger.Logger;
32
+import com.dmdirc.messages.MessageSinkManager;
32 33
 import com.dmdirc.parser.common.CallbackManager;
33 34
 import com.dmdirc.parser.common.CallbackNotFoundException;
34 35
 import com.dmdirc.parser.common.CompositionState;
@@ -67,32 +68,25 @@ public class Query extends MessageTarget implements PrivateActionListener,
67 68
     /** The tab completer for the query window. */
68 69
     private final TabCompleter tabCompleter;
69 70
 
70
-    /**
71
-     * Creates a new instance of Query.
72
-     *
73
-     * @param newHost host of the remove client
74
-     * @param newServer The server object that this Query belongs to
75
-     * @param windowManager Window management
76
-     */
77
-    public Query(final Server newServer, final String newHost, final WindowManager windowManager) {
78
-        this(newServer, newHost, false, windowManager);
79
-    }
80
-
81 71
     /**
82 72
      * Creates a new instance of Query.
83 73
      *
84 74
      * @param newHost host of the remove client
85 75
      * @param newServer The server object that this Query belongs to
86 76
      * @param focus Should we focus the query on open?
77
+     * @param messageSinkManager The sink manager to use to despatch messages.
87 78
      * @param windowManager Window management
88 79
      */
89 80
     public Query(final Server newServer, final String newHost,
90
-            final boolean focus, final WindowManager windowManager) {
81
+            final boolean focus, final MessageSinkManager messageSinkManager,
82
+            final WindowManager windowManager) {
91 83
         super("query", newServer.parseHostmask(newHost)[0],
92 84
                 newServer.parseHostmask(newHost)[0],
93 85
                 newServer.getConfigManager(), new QueryCommandParser(newServer),
94
-                Arrays.asList(WindowComponent.TEXTAREA.getIdentifier(),
95
-                        WindowComponent.INPUTFIELD.getIdentifier()), windowManager);
86
+                messageSinkManager, windowManager,
87
+                Arrays.asList(
88
+                        WindowComponent.TEXTAREA.getIdentifier(),
89
+                        WindowComponent.INPUTFIELD.getIdentifier()));
96 90
 
97 91
         this.server = newServer;
98 92
         this.host = newHost;

+ 8
- 3
src/com/dmdirc/Raw.java Voir le fichier

@@ -25,6 +25,7 @@ package com.dmdirc;
25 25
 import com.dmdirc.commandparser.parsers.ServerCommandParser;
26 26
 import com.dmdirc.logger.ErrorLevel;
27 27
 import com.dmdirc.logger.Logger;
28
+import com.dmdirc.messages.MessageSinkManager;
28 29
 import com.dmdirc.parser.common.CallbackNotFoundException;
29 30
 import com.dmdirc.parser.interfaces.Parser;
30 31
 import com.dmdirc.parser.interfaces.callbacks.DataInListener;
@@ -50,13 +51,17 @@ public class Raw extends WritableFrameContainer
50 51
      * Creates a new instance of Raw.
51 52
      *
52 53
      * @param newServer the server to monitor
54
+     * @param messageSinkManager The sink manager to use to despatch messages.
53 55
      * @param windowManager Window management
54 56
      */
55
-    public Raw(final Server newServer, final WindowManager windowManager) {
57
+    public Raw(final Server newServer, final MessageSinkManager messageSinkManager,
58
+            final WindowManager windowManager) {
56 59
         super("raw", "Raw", "(Raw log)", newServer.getConfigManager(),
57 60
                 new ServerCommandParser(newServer.getConfigManager()),
58
-                Arrays.asList(WindowComponent.TEXTAREA.getIdentifier(),
59
-                        WindowComponent.INPUTFIELD.getIdentifier()), windowManager);
61
+                messageSinkManager, windowManager,
62
+                Arrays.asList(
63
+                    WindowComponent.TEXTAREA.getIdentifier(),
64
+                    WindowComponent.INPUTFIELD.getIdentifier()));
60 65
 
61 66
         this.server = newServer;
62 67
 

+ 16
- 6
src/com/dmdirc/Server.java Voir le fichier

@@ -36,6 +36,7 @@ import com.dmdirc.interfaces.config.ConfigProvider;
36 36
 import com.dmdirc.interfaces.config.IdentityFactory;
37 37
 import com.dmdirc.logger.ErrorLevel;
38 38
 import com.dmdirc.logger.Logger;
39
+import com.dmdirc.messages.MessageSinkManager;
39 40
 import com.dmdirc.parser.common.ChannelJoinRequest;
40 41
 import com.dmdirc.parser.common.DefaultStringConverter;
41 42
 import com.dmdirc.parser.common.IgnoreList;
@@ -186,6 +187,9 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
186 187
     /** Factory to use to create new identities. */
187 188
     private final IdentityFactory identityFactory;
188 189
 
190
+    /** The sink manager to use to despatch messages. */
191
+    private final MessageSinkManager messageSinkManager;
192
+
189 193
     /** Window manager to pas to children. */
190 194
     private final WindowManager windowManager;
191 195
 
@@ -207,6 +211,7 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
207 211
      * @param tabCompleterFactory The factory to use for tab completers.
208 212
      * @param commandController The controller to use to retrieve commands.
209 213
      * @param identityFactory The factory to use to create identities.
214
+     * @param messageSinkManager The sink manager to use to despatch messages.
210 215
      * @param windowManager Window Manager
211 216
      * @param uri The address of the server to connect to
212 217
      * @param profile The profile to use
@@ -219,6 +224,7 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
219 224
             final TabCompleterFactory tabCompleterFactory,
220 225
             final CommandController commandController,
221 226
             final IdentityFactory identityFactory,
227
+            final MessageSinkManager messageSinkManager,
222 228
             final WindowManager windowManager,
223 229
             final URI uri,
224 230
             final ConfigProvider profile) {
@@ -227,13 +233,17 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
227 233
                 getHost(uri),
228 234
                 configManager,
229 235
                 commandParser,
230
-                Arrays.asList(WindowComponent.TEXTAREA.getIdentifier(),
231
-                WindowComponent.INPUTFIELD.getIdentifier(),
232
-                        WindowComponent.CERTIFICATE_VIEWER.getIdentifier()), windowManager);
236
+                messageSinkManager,
237
+                windowManager,
238
+                Arrays.asList(
239
+                    WindowComponent.TEXTAREA.getIdentifier(),
240
+                    WindowComponent.INPUTFIELD.getIdentifier(),
241
+                    WindowComponent.CERTIFICATE_VIEWER.getIdentifier()));
233 242
 
234 243
         this.manager = manager;
235 244
         this.parserFactory = parserFactory;
236 245
         this.identityFactory = identityFactory;
246
+        this.messageSinkManager = messageSinkManager;
237 247
         this.windowManager = windowManager;
238 248
         setConnectionDetails(uri, profile);
239 249
 
@@ -548,7 +558,7 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
548 558
         final String lnick = converter.toLowerCase(nick);
549 559
 
550 560
         if (!queries.containsKey(lnick)) {
551
-            final Query newQuery = new Query(this, host, focus, windowManager);
561
+            final Query newQuery = new Query(this, host, focus, messageSinkManager, windowManager);
552 562
 
553 563
             tabCompleter.addEntry(TabCompletionType.QUERY_NICK, nick);
554 564
             queries.put(lnick, newQuery);
@@ -584,7 +594,7 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
584 594
     @Override
585 595
     public void addRaw() {
586 596
         if (raw == null) {
587
-            raw = new Raw(this, windowManager);
597
+            raw = new Raw(this, messageSinkManager, windowManager);
588 598
 
589 599
             try {
590 600
                 parserLock.readLock().lock();
@@ -640,7 +650,7 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
640 650
             getChannel(chan.getName()).setChannelInfo(chan);
641 651
             getChannel(chan.getName()).selfJoin();
642 652
         } else {
643
-            final Channel newChan = new Channel(this, chan, focus, windowManager);
653
+            final Channel newChan = new Channel(this, chan, focus, messageSinkManager, windowManager);
644 654
 
645 655
             tabCompleter.addEntry(TabCompletionType.CHANNEL, chan.getName());
646 656
             channels.put(converter.toLowerCase(chan.getName()), newChan);

+ 8
- 0
src/com/dmdirc/ServerManager.java Voir le fichier

@@ -31,6 +31,7 @@ import com.dmdirc.interfaces.config.IdentityController;
31 31
 import com.dmdirc.interfaces.config.IdentityFactory;
32 32
 import com.dmdirc.logger.ErrorLevel;
33 33
 import com.dmdirc.logger.Logger;
34
+import com.dmdirc.messages.MessageSinkManager;
34 35
 import com.dmdirc.parser.common.ChannelJoinRequest;
35 36
 import com.dmdirc.ui.WindowManager;
36 37
 import com.dmdirc.ui.input.TabCompleterFactory;
@@ -65,6 +66,9 @@ public class ServerManager implements ServerFactory {
65 66
     /** A provider of {@link CommandController}s to pass to servers. */
66 67
     private final Provider<CommandController> commandController;
67 68
 
69
+    /** A provider of {@link MessageSinkManager}s to pass to servers. */
70
+    private final Provider<MessageSinkManager> messageSinkManager;
71
+
68 72
     /** The identity factory to give to servers. */
69 73
     private final IdentityFactory identityFactory;
70 74
 
@@ -82,6 +86,7 @@ public class ServerManager implements ServerFactory {
82 86
      * @param identityFactory The factory to use to create new identities.
83 87
      * @param commandController A provider of {@link CommandController}s to pass to servers.
84 88
      * @param tabCompleterFactory Factory to use for tab completers.
89
+     * @param messageSinkManager A provider of sink managers to use to despatch messages.
85 90
      * @param windowManager Window manager to add new servers to.
86 91
      */
87 92
     @Inject
@@ -91,12 +96,14 @@ public class ServerManager implements ServerFactory {
91 96
             final IdentityFactory identityFactory,
92 97
             final Provider<CommandController> commandController,
93 98
             final TabCompleterFactory tabCompleterFactory,
99
+            final Provider<MessageSinkManager> messageSinkManager,
94 100
             final WindowManager windowManager) {
95 101
         this.parserFactoryProvider = parserFactoryProvider;
96 102
         this.identityController = identityController;
97 103
         this.identityFactory = identityFactory;
98 104
         this.commandController = commandController;
99 105
         this.tabCompleterFactory = tabCompleterFactory;
106
+        this.messageSinkManager = messageSinkManager;
100 107
         this.windowManager = windowManager;
101 108
     }
102 109
 
@@ -113,6 +120,7 @@ public class ServerManager implements ServerFactory {
113 120
                 tabCompleterFactory,
114 121
                 commandController.get(),
115 122
                 identityFactory,
123
+                messageSinkManager.get(),
116 124
                 windowManager,
117 125
                 uri,
118 126
                 profile);

+ 15
- 5
src/com/dmdirc/WritableFrameContainer.java Voir le fichier

@@ -52,6 +52,9 @@ public abstract class WritableFrameContainer extends FrameContainer {
52 52
     /** The command parser used for commands in this container. */
53 53
     protected final CommandParser commandParser;
54 54
 
55
+    /** The manager to use to despatch messages to sinks. */
56
+    private final MessageSinkManager messageSinkManager;
57
+
55 58
     /**
56 59
      * Creates a new WritableFrameContainer.
57 60
      *
@@ -60,17 +63,24 @@ public abstract class WritableFrameContainer extends FrameContainer {
60 63
      * @param title The title of this container
61 64
      * @param config The config manager for this container
62 65
      * @param parser The command parser for this container
66
+     * @param messageSinkManager The sink manager to use to despatch messages
63 67
      * @param components The UI components that this frame requires
64 68
      * @param windowManager For window management
65 69
      * @since 0.6.4
66 70
      */
67
-    public WritableFrameContainer(final String icon, final String name,
68
-            final String title, final AggregateConfigProvider config,
69
-            final CommandParser parser, final Collection<String> components,
70
-            final WindowManager windowManager) {
71
+    public WritableFrameContainer(
72
+            final String icon,
73
+            final String name,
74
+            final String title,
75
+            final AggregateConfigProvider config,
76
+            final CommandParser parser,
77
+            final MessageSinkManager messageSinkManager,
78
+            final WindowManager windowManager,
79
+            final Collection<String> components) {
71 80
         super(icon, name, title, config, components, windowManager);
72 81
 
73 82
         this.commandParser = parser;
83
+        this.messageSinkManager = messageSinkManager;
74 84
         parser.setOwner(this);
75 85
     }
76 86
 
@@ -254,7 +264,7 @@ public abstract class WritableFrameContainer extends FrameContainer {
254 264
      * @param args The arguments for the message
255 265
      */
256 266
     public void handleNotification(final Date date, final String messageType, final Object... args) {
257
-        MessageSinkManager.getManager().despatchMessage(this, date, messageType, args);
267
+        messageSinkManager.despatchMessage(this, date, messageType, args);
258 268
     }
259 269
 
260 270
     /**

+ 0
- 21
src/com/dmdirc/messages/MessageSinkManager.java Voir le fichier

@@ -38,9 +38,6 @@ import java.util.regex.Matcher;
38 38
  */
39 39
 public class MessageSinkManager {
40 40
 
41
-    /** A singleton instance of the manager. */
42
-    private static MessageSinkManager instance;
43
-
44 41
     /** The configuration domain to use for looking up default sinks. */
45 42
     public static final String CONFIG_DOMAIN = "notifications";
46 43
 
@@ -148,22 +145,4 @@ public class MessageSinkManager {
148 145
         addSink(new StatusBarMessageSink(statusBarManager));
149 146
     }
150 147
 
151
-    /**
152
-     * Retrieves a singleton instance of the sink manager.
153
-     *
154
-     * @return A singleton manager instance
155
-     */
156
-    public static MessageSinkManager getManager() {
157
-        return instance;
158
-    }
159
-
160
-    /**
161
-     * Sets the singleton instance of the sink manager.
162
-     *
163
-     * @param manager The new singleton manager instance.
164
-     */
165
-    public static void setManager(final MessageSinkManager manager) {
166
-        instance = manager;
167
-    }
168
-
169 148
 }

+ 4
- 1
test/com/dmdirc/ServerManagerTest.java Voir le fichier

@@ -25,6 +25,7 @@ package com.dmdirc;
25 25
 import com.dmdirc.interfaces.CommandController;
26 26
 import com.dmdirc.interfaces.config.IdentityController;
27 27
 import com.dmdirc.interfaces.config.IdentityFactory;
28
+import com.dmdirc.messages.MessageSinkManager;
28 29
 import com.dmdirc.parser.common.ChannelJoinRequest;
29 30
 import com.dmdirc.ui.WindowManager;
30 31
 import com.dmdirc.ui.input.TabCompleterFactory;
@@ -49,6 +50,7 @@ public class ServerManagerTest {
49 50
     @Mock private IdentityFactory identityFactory;
50 51
     @Mock private Provider<ParserFactory> parserFactoryProvider;
51 52
     @Mock private Provider<CommandController> commandControllerProvider;
53
+    @Mock private Provider<MessageSinkManager> messageSinkManager;
52 54
     @Mock private TabCompleterFactory tabCompleterFactory;
53 55
     @Mock private WindowManager windowManager;
54 56
     private ServerManager serverManager;
@@ -56,7 +58,8 @@ public class ServerManagerTest {
56 58
     @Before
57 59
     public void setUp() throws Exception {
58 60
         serverManager = new ServerManager(parserFactoryProvider, identityController,
59
-                identityFactory, commandControllerProvider, tabCompleterFactory, windowManager);
61
+                identityFactory, commandControllerProvider, tabCompleterFactory,
62
+                messageSinkManager, windowManager);
60 63
     }
61 64
 
62 65
     @After

+ 3
- 0
test/com/dmdirc/ServerTest.java Voir le fichier

@@ -27,6 +27,7 @@ import com.dmdirc.interfaces.CommandController;
27 27
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
28 28
 import com.dmdirc.interfaces.config.ConfigProvider;
29 29
 import com.dmdirc.interfaces.config.IdentityFactory;
30
+import com.dmdirc.messages.MessageSinkManager;
30 31
 import com.dmdirc.ui.WindowManager;
31 32
 import com.dmdirc.ui.input.TabCompleterFactory;
32 33
 
@@ -51,6 +52,7 @@ public class ServerTest {
51 52
     @Mock private IdentityFactory identityFactory;
52 53
     @Mock private TabCompleterFactory tabCompleterFactory;
53 54
     @Mock private CommandController commandController;
55
+    @Mock private MessageSinkManager messageSinkManager;
54 56
     @Mock private WindowManager windowManager;
55 57
 
56 58
     private Server server;
@@ -69,6 +71,7 @@ public class ServerTest {
69 71
                 tabCompleterFactory,
70 72
                 commandController,
71 73
                 identityFactory,
74
+                messageSinkManager,
72 75
                 windowManager,
73 76
                 new URI("irc-test://255.255.255.255"),
74 77
                 profile);

+ 4
- 2
test/com/dmdirc/WritableFrameContainerTest.java Voir le fichier

@@ -26,6 +26,7 @@ import com.dmdirc.commandparser.CommandManager;
26 26
 import com.dmdirc.config.ConfigBinder;
27 27
 import com.dmdirc.harness.TestWritableFrameContainer;
28 28
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
29
+import com.dmdirc.messages.MessageSinkManager;
29 30
 import com.dmdirc.ui.WindowManager;
30 31
 
31 32
 import java.util.Arrays;
@@ -43,6 +44,7 @@ public class WritableFrameContainerTest {
43 44
     @Mock private AggregateConfigProvider acp;
44 45
     @Mock private ServerManager serverManager;
45 46
     @Mock private WindowManager windowManager;
47
+    @Mock private MessageSinkManager messageSinkManager;
46 48
     private CommandManager commands;
47 49
 
48 50
     @Before
@@ -59,7 +61,7 @@ public class WritableFrameContainerTest {
59 61
     @Test
60 62
     public void testGetNumLines() {
61 63
         final WritableFrameContainer container10
62
-                = new TestWritableFrameContainer(10, acp, commands, windowManager);
64
+                = new TestWritableFrameContainer(10, acp, commands, messageSinkManager, windowManager);
63 65
 
64 66
         final int res0a = container10.getNumLines("");
65 67
         final int res0b = container10.getNumLines("\r");
@@ -89,7 +91,7 @@ public class WritableFrameContainerTest {
89 91
     @Test
90 92
     public void testSplitLine() {
91 93
         final WritableFrameContainer container10
92
-                = new TestWritableFrameContainer(10, acp, commands, windowManager);
94
+                = new TestWritableFrameContainer(10, acp, commands, messageSinkManager, windowManager);
93 95
         final String[][][] tests = new String[][][]{
94 96
             {{""}, {""}},
95 97
             {{"0123456789"}, {"0123456789"}},

+ 4
- 3
test/com/dmdirc/harness/TestWritableFrameContainer.java Voir le fichier

@@ -27,6 +27,7 @@ import com.dmdirc.WritableFrameContainer;
27 27
 import com.dmdirc.commandparser.CommandManager;
28 28
 import com.dmdirc.commandparser.parsers.GlobalCommandParser;
29 29
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
30
+import com.dmdirc.messages.MessageSinkManager;
30 31
 import com.dmdirc.ui.WindowManager;
31 32
 import com.dmdirc.ui.input.TabCompleter;
32 33
 
@@ -38,10 +39,10 @@ public class TestWritableFrameContainer extends WritableFrameContainer {
38 39
 
39 40
     public TestWritableFrameContainer(final int lineLength,
40 41
             final AggregateConfigProvider cm, final CommandManager commandManager,
41
-            final WindowManager windowManager) {
42
+            final MessageSinkManager messageSinkManager, final WindowManager windowManager) {
42 43
         super("raw", "Raw", "(Raw)", cm,
43
-                new GlobalCommandParser(cm, commandManager),
44
-                Collections.<String>emptySet(), windowManager);
44
+                new GlobalCommandParser(cm, commandManager), messageSinkManager, windowManager,
45
+                Collections.<String>emptySet());
45 46
 
46 47
         this.lineLength = lineLength;
47 48
     }

Chargement…
Annuler
Enregistrer