Quellcode durchsuchen

Remove singleton IdentityManager accessors.

Woohoo.

Change-Id: Ib5dfa40b37670633791a39cc166ef53aeb2c2e79
Fixes-Issue: CLIENT-423
Reviewed-on: http://gerrit.dmdirc.com/3145
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8rc1
Chris Smith vor 10 Jahren
Ursprung
Commit
912140c077

+ 0
- 1
src/com/dmdirc/ClientModule.java Datei anzeigen

120
         final IdentityManager identityManager =
120
         final IdentityManager identityManager =
121
                 new IdentityManager(baseDirectory, identitiesDirectory);
121
                 new IdentityManager(baseDirectory, identitiesDirectory);
122
         ErrorManager.getErrorManager().initialise(identityManager);
122
         ErrorManager.getErrorManager().initialise(identityManager);
123
-        IdentityManager.setIdentityManager(identityManager);
124
         identityManager.loadVersionIdentity();
123
         identityManager.loadVersionIdentity();
125
 
124
 
126
         try {
125
         try {

+ 27
- 21
src/com/dmdirc/config/ConfigFileBackedConfigProvider.java Datei anzeigen

42
 import java.util.Map;
42
 import java.util.Map;
43
 import java.util.Set;
43
 import java.util.Set;
44
 
44
 
45
+import javax.annotation.Nullable;
46
+
45
 import org.slf4j.LoggerFactory;
47
 import org.slf4j.LoggerFactory;
46
 
48
 
47
 /**
49
 /**
57
     private static final String PROFILE_DOMAIN = "profile";
59
     private static final String PROFILE_DOMAIN = "profile";
58
     /** The target for this identity. */
60
     /** The target for this identity. */
59
     protected final ConfigTarget myTarget;
61
     protected final ConfigTarget myTarget;
62
+    /** The identity manager to use for writable configs. */
63
+    @Nullable
64
+    private final IdentityManager identityManager;
60
     /** The configuration details for this identity. */
65
     /** The configuration details for this identity. */
61
     protected final ConfigFile file;
66
     protected final ConfigFile file;
62
     /** The global config manager. */
67
     /** The global config manager. */
69
     /**
74
     /**
70
      * Creates a new instance of Identity.
75
      * Creates a new instance of Identity.
71
      *
76
      *
72
-     * @param file         The file to load this identity from
73
-     * @param forceDefault Whether to force this identity to be loaded as default identity or not
77
+     * @param identityManager The manager to use for hackily reading global state.
78
+     * @param file            The file to load this identity from
79
+     * @param forceDefault    Whether to force this identity to be loaded as default identity or not
74
      *
80
      *
75
      * @throws InvalidIdentityFileException Missing required properties
81
      * @throws InvalidIdentityFileException Missing required properties
76
      * @throws IOException                  Input/output exception
82
      * @throws IOException                  Input/output exception
77
      */
83
      */
78
-    public ConfigFileBackedConfigProvider(final File file, final boolean forceDefault) throws
79
-            IOException,
80
-            InvalidIdentityFileException {
81
-        super();
82
-
84
+    public ConfigFileBackedConfigProvider(final IdentityManager identityManager, final File file,
85
+            final boolean forceDefault) throws IOException, InvalidIdentityFileException {
86
+        this.identityManager = identityManager;
83
         this.file = new ConfigFile(file);
87
         this.file = new ConfigFile(file);
84
         this.file.setAutomake(true);
88
         this.file.setAutomake(true);
85
         initFile(forceDefault);
89
         initFile(forceDefault);
100
      * @throws IOException                  Input/output exception
104
      * @throws IOException                  Input/output exception
101
      */
105
      */
102
     public ConfigFileBackedConfigProvider(final InputStream stream, final boolean forceDefault)
106
     public ConfigFileBackedConfigProvider(final InputStream stream, final boolean forceDefault)
103
-            throws IOException,
104
-            InvalidIdentityFileException {
105
-        super();
106
-
107
+            throws IOException, InvalidIdentityFileException {
108
+        this.identityManager = null;
107
         this.file = new ConfigFile(stream);
109
         this.file = new ConfigFile(stream);
108
         this.file.setAutomake(true);
110
         this.file.setAutomake(true);
109
         initFile(forceDefault);
111
         initFile(forceDefault);
117
     /**
119
     /**
118
      * Creates a new identity from the specified config file.
120
      * Creates a new identity from the specified config file.
119
      *
121
      *
120
-     * @param configFile The config file to use
121
-     * @param target     The target of this identity
122
+     * @param identityManager The manager to use for hackily reading global state.
123
+     * @param configFile      The config file to use
124
+     * @param target          The target of this identity
122
      */
125
      */
123
-    public ConfigFileBackedConfigProvider(final ConfigFile configFile, final ConfigTarget target) {
124
-        super();
125
-
126
+    public ConfigFileBackedConfigProvider(final IdentityManager identityManager,
127
+            final ConfigFile configFile, final ConfigTarget target) {
128
+        this.identityManager = identityManager;
126
         this.file = configFile;
129
         this.file = configFile;
127
         this.file.setAutomake(true);
130
         this.file.setAutomake(true);
128
         this.myTarget = target;
131
         this.myTarget = target;
329
                 // covered by global defaults.
332
                 // covered by global defaults.
330
 
333
 
331
                 if (globalConfig == null) {
334
                 if (globalConfig == null) {
332
-                    globalConfig = new ConfigManager("", "", "", "");
335
+                    // TODO: This is horrible. Filtering of saves should be abstracted.
336
+                    globalConfig = (ConfigManager) identityManager
337
+                            .createAggregateConfig("", "", "", "");
333
                 }
338
                 }
334
 
339
 
335
                 globalConfig.removeIdentity(this);
340
                 globalConfig.removeIdentity(this);
436
                 // like that until you manually change it again, as opposed
441
                 // like that until you manually change it again, as opposed
437
                 // to being removed as soon as you use a build from that
442
                 // to being removed as soon as you use a build from that
438
                 // channel.
443
                 // channel.
444
+                // TODO: This behaviour should be managed by something else.
439
 
445
 
440
                 if (globalConfig == null) {
446
                 if (globalConfig == null) {
441
-                    globalConfig = new ConfigManager("", "", "", "");
447
+                    globalConfig = (ConfigManager) identityManager
448
+                            .createAggregateConfig("", "", "", "");
442
                 }
449
                 }
443
 
450
 
444
                 globalConfig.removeIdentity(this);
451
                 globalConfig.removeIdentity(this);
445
-                globalConfig.removeIdentity(IdentityManager.getIdentityManager().
446
-                        getVersionSettings());
452
+                globalConfig.removeIdentity(identityManager.getVersionSettings());
447
 
453
 
448
                 if (log.isTraceEnabled()) {
454
                 if (log.isTraceEnabled()) {
449
                     for (ConfigProvider source : globalConfig.getSources()) {
455
                     for (ConfigProvider source : globalConfig.getSources()) {
493
             file.delete();
499
             file.delete();
494
         }
500
         }
495
 
501
 
496
-        IdentityManager.getIdentityManager().removeConfigProvider(this);
502
+        identityManager.removeConfigProvider(this);
497
     }
503
     }
498
 
504
 
499
     /** {@inheritDoc} */
505
     /** {@inheritDoc} */

+ 13
- 8
src/com/dmdirc/config/ConfigManager.java Datei anzeigen

58
     private final MapList<String, ConfigChangeListener> listeners = new MapList<>();
58
     private final MapList<String, ConfigChangeListener> listeners = new MapList<>();
59
     /** The config binder to use for this manager. */
59
     /** The config binder to use for this manager. */
60
     private final ConfigBinder binder = new ConfigBinder(this);
60
     private final ConfigBinder binder = new ConfigBinder(this);
61
+    /** The manager to use to fetch global state. */
62
+    private final IdentityManager manager;
61
     /** The protocol this manager is for. */
63
     /** The protocol this manager is for. */
62
     private String protocol;
64
     private String protocol;
63
     /** The ircd this manager is for. */
65
     /** The ircd this manager is for. */
72
     /**
74
     /**
73
      * Creates a new instance of ConfigManager.
75
      * Creates a new instance of ConfigManager.
74
      *
76
      *
77
+     * @param manager  The manager to use to retrieve global state horribly.
75
      * @param protocol The protocol for this manager
78
      * @param protocol The protocol for this manager
76
      * @param ircd     The name of the ircd for this manager
79
      * @param ircd     The name of the ircd for this manager
77
      * @param network  The name of the network for this manager
80
      * @param network  The name of the network for this manager
80
      * @since 0.6.3
83
      * @since 0.6.3
81
      */
84
      */
82
     ConfigManager(
85
     ConfigManager(
86
+            final IdentityManager manager,
83
             final String protocol, final String ircd,
87
             final String protocol, final String ircd,
84
             final String network, final String server) {
88
             final String network, final String server) {
85
-        this(protocol, ircd, network, server, "<Unknown>");
89
+        this(manager, protocol, ircd, network, server, "<Unknown>");
86
     }
90
     }
87
 
91
 
88
     /**
92
     /**
89
      * Creates a new instance of ConfigManager.
93
      * Creates a new instance of ConfigManager.
90
      *
94
      *
95
+     * @param manager  The manager to use to retrieve global state horribly.
91
      * @param protocol The protocol for this manager
96
      * @param protocol The protocol for this manager
92
      * @param ircd     The name of the ircd for this manager
97
      * @param ircd     The name of the ircd for this manager
93
      * @param network  The name of the network for this manager
98
      * @param network  The name of the network for this manager
96
      *
101
      *
97
      * @since 0.6.3
102
      * @since 0.6.3
98
      */
103
      */
99
-    ConfigManager(final String protocol, final String ircd,
104
+    ConfigManager(
105
+            final IdentityManager manager,
106
+            final String protocol, final String ircd,
100
             final String network, final String server, final String channel) {
107
             final String network, final String server, final String channel) {
101
         final String chanName = channel + "@" + network;
108
         final String chanName = channel + "@" + network;
102
 
109
 
110
+        this.manager = manager;
103
         this.protocol = protocol;
111
         this.protocol = protocol;
104
         this.ircd = ircd;
112
         this.ircd = ircd;
105
         this.network = network;
113
         this.network = network;
163
     @Override
171
     @Override
164
     public Map<String, String> getOptions(final String domain) {
172
     public Map<String, String> getOptions(final String domain) {
165
         if (VERSION_DOMAIN.equals(domain)) {
173
         if (VERSION_DOMAIN.equals(domain)) {
166
-            return IdentityManager.getIdentityManager()
167
-                    .getVersionSettings().getOptions(domain);
174
+            return manager.getVersionSettings().getOptions(domain);
168
         }
175
         }
169
 
176
 
170
         final Map<String, String> res = new HashMap<>();
177
         final Map<String, String> res = new HashMap<>();
220
      */
227
      */
221
     protected ConfigProvider getScope(final String domain, final String option) {
228
     protected ConfigProvider getScope(final String domain, final String option) {
222
         if (VERSION_DOMAIN.equals(domain)) {
229
         if (VERSION_DOMAIN.equals(domain)) {
223
-            return IdentityManager.getIdentityManager()
224
-                    .getVersionSettings();
230
+            return manager.getVersionSettings();
225
         }
231
         }
226
 
232
 
227
         synchronized (sources) {
233
         synchronized (sources) {
375
             }
381
             }
376
         }
382
         }
377
 
383
 
378
-        final List<ConfigProvider> newSources = IdentityManager.getIdentityManager()
379
-                .getIdentitiesForManager(this);
384
+        final List<ConfigProvider> newSources = manager.getIdentitiesForManager(this);
380
         for (ConfigProvider identity : newSources) {
385
         for (ConfigProvider identity : newSources) {
381
             log.trace("Testing new identity: {}", identity);
386
             log.trace("Testing new identity: {}", identity);
382
             checkIdentity(identity);
387
             checkIdentity(identity);

+ 13
- 38
src/com/dmdirc/config/IdentityManager.java Datei anzeigen

65
     private static final String IDENTITY_DOMAIN = "identity";
65
     private static final String IDENTITY_DOMAIN = "identity";
66
     /** The domain used for profile settings. */
66
     /** The domain used for profile settings. */
67
     private static final String PROFILE_DOMAIN = "profile";
67
     private static final String PROFILE_DOMAIN = "profile";
68
-    /** A singleton instance of IdentityManager. */
69
-    private static IdentityManager instance;
70
     /** Base configuration directory where the main configuration file will be located. */
68
     /** Base configuration directory where the main configuration file will be located. */
71
     private final String configDirectory;
69
     private final String configDirectory;
72
     /** Directory to save and load identities in. */
70
     /** Directory to save and load identities in. */
105
         this.identitiesDirectory = identitiesDirectory;
103
         this.identitiesDirectory = identitiesDirectory;
106
     }
104
     }
107
 
105
 
108
-    /** {@inheritDoc} */
109
     @Override
106
     @Override
110
     @Deprecated
107
     @Deprecated
111
     public String getConfigurationDirectory() {
108
     public String getConfigurationDirectory() {
139
         addonSettings.put("name", "Addon defaults");
136
         addonSettings.put("name", "Addon defaults");
140
         addonConfigFile.addDomain("identity", addonSettings);
137
         addonConfigFile.addDomain("identity", addonSettings);
141
 
138
 
142
-        addonConfig = new ConfigFileBackedConfigProvider(addonConfigFile, target);
139
+        addonConfig = new ConfigFileBackedConfigProvider(this, addonConfigFile, target);
143
         addConfigProvider(addonConfig);
140
         addConfigProvider(addonConfig);
144
 
141
 
145
         if (!getGlobalConfiguration().hasOptionString("identity", "defaultsversion")) {
142
         if (!getGlobalConfiguration().hasOptionString("identity", "defaultsversion")) {
301
         }
298
         }
302
 
299
 
303
         try {
300
         try {
304
-            addConfigProvider(new ConfigFileBackedConfigProvider(file, false));
301
+            addConfigProvider(new ConfigFileBackedConfigProvider(this, file, false));
305
         } catch (InvalidIdentityFileException ex) {
302
         } catch (InvalidIdentityFileException ex) {
306
             Logger.userError(ErrorLevel.MEDIUM,
303
             Logger.userError(ErrorLevel.MEDIUM,
307
                     "Invalid identity file: " + file.getAbsolutePath()
304
                     "Invalid identity file: " + file.getAbsolutePath()
371
                 file.createNewFile();
368
                 file.createNewFile();
372
             }
369
             }
373
 
370
 
374
-            config = new ConfigFileBackedConfigProvider(file, true);
371
+            config = new ConfigFileBackedConfigProvider(this, file, true);
375
             config.setOption("identity", "name", "Global config");
372
             config.setOption("identity", "name", "Global config");
376
             addConfigProvider(config);
373
             addConfigProvider(config);
377
         } catch (IOException ex) {
374
         } catch (IOException ex) {
692
 
689
 
693
         configFile.write();
690
         configFile.write();
694
 
691
 
695
-        final ConfigFileBackedConfigProvider identity = new ConfigFileBackedConfigProvider(file,
696
-                false);
692
+        final ConfigFileBackedConfigProvider identity = new ConfigFileBackedConfigProvider(this,
693
+                file, false);
697
         addConfigProvider(identity);
694
         addConfigProvider(identity);
698
 
695
 
699
         return identity;
696
         return identity;
700
     }
697
     }
701
 
698
 
702
-    /**
703
-     * Gets a singleton instance of the Identity Manager.
704
-     *
705
-     * @return A singleton instance of the IdentityManager.
706
-     *
707
-     * @deprecated Shouldn't use global state.
708
-     */
709
-    @Deprecated
710
-    public static IdentityManager getIdentityManager() {
711
-        return instance;
712
-    }
713
-
714
-    /**
715
-     * Sets the singleton instance of the Identity Manager.
716
-     *
717
-     * @param identityManager The identity manager to use.
718
-     *
719
-     * @deprecated Shouldn't use global state.
720
-     */
721
-    @Deprecated
722
-    public static void setIdentityManager(final IdentityManager identityManager) {
723
-        instance = identityManager;
724
-    }
725
-
726
     /**
699
     /**
727
      * Finds and adds sources for the given manager, and adds it as an identity listener.
700
      * Finds and adds sources for the given manager, and adds it as an identity listener.
728
      *
701
      *
743
     @Override
716
     @Override
744
     public ConfigProviderMigrator createMigratableConfig(final String protocol,
717
     public ConfigProviderMigrator createMigratableConfig(final String protocol,
745
             final String ircd, final String network, final String server) {
718
             final String ircd, final String network, final String server) {
746
-        final ConfigManager configManager = new ConfigManager(protocol, ircd, network, server);
719
+        final ConfigManager configManager =
720
+                new ConfigManager(this, protocol, ircd, network, server);
747
         setUpConfigManager(configManager);
721
         setUpConfigManager(configManager);
748
         return new ConfigManagerMigrator(configManager);
722
         return new ConfigManagerMigrator(configManager);
749
     }
723
     }
752
     @Override
726
     @Override
753
     public ConfigProviderMigrator createMigratableConfig(final String protocol,
727
     public ConfigProviderMigrator createMigratableConfig(final String protocol,
754
             final String ircd, final String network, final String server, final String channel) {
728
             final String ircd, final String network, final String server, final String channel) {
755
-        final ConfigManager configManager = new ConfigManager(protocol, ircd, network, server,
756
-                channel);
729
+        final ConfigManager configManager =
730
+                new ConfigManager(this, protocol, ircd, network, server, channel);
757
         setUpConfigManager(configManager);
731
         setUpConfigManager(configManager);
758
         return new ConfigManagerMigrator(configManager);
732
         return new ConfigManagerMigrator(configManager);
759
     }
733
     }
761
     @Override
735
     @Override
762
     public AggregateConfigProvider createAggregateConfig(final String protocol, final String ircd,
736
     public AggregateConfigProvider createAggregateConfig(final String protocol, final String ircd,
763
             final String network, final String server) {
737
             final String network, final String server) {
764
-        final ConfigManager configManager = new ConfigManager(protocol, ircd, network, server);
738
+        final ConfigManager configManager =
739
+                new ConfigManager(this, protocol, ircd, network, server);
765
         setUpConfigManager(configManager);
740
         setUpConfigManager(configManager);
766
         return configManager;
741
         return configManager;
767
     }
742
     }
769
     @Override
744
     @Override
770
     public AggregateConfigProvider createAggregateConfig(final String protocol, final String ircd,
745
     public AggregateConfigProvider createAggregateConfig(final String protocol, final String ircd,
771
             final String network, final String server, final String channel) {
746
             final String network, final String server, final String channel) {
772
-        final ConfigManager configManager = new ConfigManager(protocol, ircd, network, server,
773
-                channel);
747
+        final ConfigManager configManager =
748
+                new ConfigManager(this, protocol, ircd, network, server, channel);
774
         setUpConfigManager(configManager);
749
         setUpConfigManager(configManager);
775
         return configManager;
750
         return configManager;
776
     }
751
     }

+ 9
- 4
test/com/dmdirc/config/ConfigManagerTest.java Datei anzeigen

19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
  * SOFTWARE.
20
  * SOFTWARE.
21
  */
21
  */
22
+
22
 package com.dmdirc.config;
23
 package com.dmdirc.config;
23
 
24
 
24
 import com.dmdirc.interfaces.config.ConfigChangeListener;
25
 import com.dmdirc.interfaces.config.ConfigChangeListener;
26
 
27
 
27
 import org.junit.Test;
28
 import org.junit.Test;
28
 import org.junit.runner.RunWith;
29
 import org.junit.runner.RunWith;
30
+import org.mockito.Mock;
29
 import org.mockito.runners.MockitoJUnitRunner;
31
 import org.mockito.runners.MockitoJUnitRunner;
30
 
32
 
31
 import static org.junit.Assert.*;
33
 import static org.junit.Assert.*;
34
 @RunWith(MockitoJUnitRunner.class)
36
 @RunWith(MockitoJUnitRunner.class)
35
 public class ConfigManagerTest {
37
 public class ConfigManagerTest {
36
 
38
 
39
+    @Mock private IdentityManager identityManager;
40
+
37
     @Test
41
     @Test
38
     public void testNonExistantOption() {
42
     public void testNonExistantOption() {
39
-        assertNull(new ConfigManager("", "", "", "").getOption("unit-test123", "foobar"));
43
+        assertNull(new ConfigManager(identityManager, "", "", "", "")
44
+                .getOption("unit-test123", "foobar"));
40
     }
45
     }
41
 
46
 
42
     @Test
47
     @Test
43
     public void testStats() {
48
     public void testStats() {
44
-        final ConfigManager cm = new ConfigManager("", "", "", "");
49
+        final ConfigManager cm = new ConfigManager(identityManager, "", "", "", "");
45
         assertNull(ConfigManager.getStats().get("unit-test123.baz"));
50
         assertNull(ConfigManager.getStats().get("unit-test123.baz"));
46
         cm.hasOption("unit-test123", "baz", new PermissiveValidator<String>());
51
         cm.hasOption("unit-test123", "baz", new PermissiveValidator<String>());
47
         assertNotNull(ConfigManager.getStats().get("unit-test123.baz"));
52
         assertNotNull(ConfigManager.getStats().get("unit-test123.baz"));
51
     @Test
56
     @Test
52
     public void testDomainListener() {
57
     public void testDomainListener() {
53
         final ConfigChangeListener listener = mock(ConfigChangeListener.class);
58
         final ConfigChangeListener listener = mock(ConfigChangeListener.class);
54
-        final ConfigManager cm = new ConfigManager("", "", "", "");
59
+        final ConfigManager cm = new ConfigManager(identityManager, "", "", "", "");
55
         cm.addChangeListener("unit-test", listener);
60
         cm.addChangeListener("unit-test", listener);
56
 
61
 
57
         cm.configChanged("foo", "bar");
62
         cm.configChanged("foo", "bar");
64
     @Test
69
     @Test
65
     public void testDomainKeyListener() {
70
     public void testDomainKeyListener() {
66
         final ConfigChangeListener listener = mock(ConfigChangeListener.class);
71
         final ConfigChangeListener listener = mock(ConfigChangeListener.class);
67
-        final ConfigManager cm = new ConfigManager("", "", "", "");
72
+        final ConfigManager cm = new ConfigManager(identityManager, "", "", "", "");
68
         cm.addChangeListener("unit-test", "foo", listener);
73
         cm.addChangeListener("unit-test", "foo", listener);
69
 
74
 
70
         cm.configChanged("foo", "bar");
75
         cm.configChanged("foo", "bar");

+ 13
- 5
test/com/dmdirc/config/IdentityTest.java Datei anzeigen

32
 import org.junit.Before;
32
 import org.junit.Before;
33
 import org.junit.Ignore;
33
 import org.junit.Ignore;
34
 import org.junit.Test;
34
 import org.junit.Test;
35
+import org.junit.runner.RunWith;
36
+import org.mockito.Mock;
37
+import org.mockito.runners.MockitoJUnitRunner;
35
 
38
 
36
 import static org.junit.Assert.*;
39
 import static org.junit.Assert.*;
37
 import static org.mockito.Mockito.*;
40
 import static org.mockito.Mockito.*;
38
 
41
 
42
+@RunWith(MockitoJUnitRunner.class)
39
 public class IdentityTest {
43
 public class IdentityTest {
40
 
44
 
45
+    @Mock private IdentityManager identityManager;
41
     private ConfigFileBackedConfigProvider myIdent;
46
     private ConfigFileBackedConfigProvider myIdent;
42
     private ConfigTarget target;
47
     private ConfigTarget target;
43
 
48
 
46
         target = new ConfigTarget();
51
         target = new ConfigTarget();
47
         target.setChannel("#unittest@unittest");
52
         target.setChannel("#unittest@unittest");
48
 
53
 
49
-        myIdent = new ConfigFileBackedConfigProvider(new ConfigFile(getClass().getResourceAsStream("identity2")), target);
54
+        myIdent = new ConfigFileBackedConfigProvider(identityManager,
55
+                new ConfigFile(getClass().getResourceAsStream("identity2")), target);
50
     }
56
     }
51
 
57
 
52
     @Test
58
     @Test
134
 
140
 
135
         myIdent.save();
141
         myIdent.save();
136
 
142
 
137
-        myIdent = new ConfigFileBackedConfigProvider(myIdent.file.getFile(), false);
143
+        myIdent = new ConfigFileBackedConfigProvider(identityManager,
144
+                myIdent.file.getFile(), false);
138
 
145
 
139
         assertEquals("baz!", myIdent.getOption("foo", "bar"));
146
         assertEquals("baz!", myIdent.getOption("foo", "bar"));
140
     }
147
     }
145
         assertEquals(target.getType(), myIdent.getTarget().getType());
152
         assertEquals(target.getType(), myIdent.getTarget().getType());
146
     }
153
     }
147
 
154
 
148
-    @Test(expected=InvalidIdentityFileException.class)
155
+    @Test(expected = InvalidIdentityFileException.class)
149
     public void testNoName() throws IOException, InvalidIdentityFileException {
156
     public void testNoName() throws IOException, InvalidIdentityFileException {
150
         new ConfigFileBackedConfigProvider(getClass().getResourceAsStream("identity1"), false);
157
         new ConfigFileBackedConfigProvider(getClass().getResourceAsStream("identity1"), false);
151
     }
158
     }
152
 
159
 
153
-    @Test(expected=InvalidIdentityFileException.class)
160
+    @Test(expected = InvalidIdentityFileException.class)
154
     public void testNoTarget() throws IOException, InvalidIdentityFileException {
161
     public void testNoTarget() throws IOException, InvalidIdentityFileException {
155
         new ConfigFileBackedConfigProvider(getClass().getResourceAsStream("identity2"), false);
162
         new ConfigFileBackedConfigProvider(getClass().getResourceAsStream("identity2"), false);
156
     }
163
     }
157
 
164
 
158
     @Test
165
     @Test
159
     public void testMigrate() throws IOException, InvalidIdentityFileException {
166
     public void testMigrate() throws IOException, InvalidIdentityFileException {
160
-        final ConfigFileBackedConfigProvider id = new ConfigFileBackedConfigProvider(getClass().getResourceAsStream("identity3"), false);
167
+        final ConfigFileBackedConfigProvider id = new ConfigFileBackedConfigProvider(getClass().
168
+                getResourceAsStream("identity3"), false);
161
 
169
 
162
         assertTrue(id.file.isKeyDomain("identity"));
170
         assertTrue(id.file.isKeyDomain("identity"));
163
         assertTrue(id.file.isKeyDomain("meep"));
171
         assertTrue(id.file.isKeyDomain("meep"));

Laden…
Abbrechen
Speichern