incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1547382 - /sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/impl/DefaultReplicationAgentConfigurationManagerTest.java
Date Tue, 03 Dec 2013 13:24:29 GMT
Author: bdelacretaz
Date: Tue Dec  3 13:24:28 2013
New Revision: 1547382

URL: http://svn.apache.org/r1547382
Log:
SLING-3223 - more selective exceptions test

Modified:
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/impl/DefaultReplicationAgentConfigurationManagerTest.java

Modified: sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/impl/DefaultReplicationAgentConfigurationManagerTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/impl/DefaultReplicationAgentConfigurationManagerTest.java?rev=1547382&r1=1547381&r2=1547382&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/impl/DefaultReplicationAgentConfigurationManagerTest.java
(original)
+++ sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/impl/DefaultReplicationAgentConfigurationManagerTest.java
Tue Dec  3 13:24:28 2013
@@ -36,13 +36,14 @@ public class DefaultReplicationAgentConf
 
     @Test
     public void testRetrievalWithNoConfigurationAvailable() throws Exception {
+        ConfigurationAdmin configAdmin = mock(ConfigurationAdmin.class);
+        ReplicationAgent agent = mock(ReplicationAgent.class);
+        DefaultReplicationAgentConfigurationManager defaultReplicationAgentConfigurationManager
= new DefaultReplicationAgentConfigurationManager();
+        Field configAdminField = defaultReplicationAgentConfigurationManager.getClass().getDeclaredField("configAdmin");
+        configAdminField.setAccessible(true);
+        configAdminField.set(defaultReplicationAgentConfigurationManager, configAdmin);
+        
         try {
-            ConfigurationAdmin configAdmin = mock(ConfigurationAdmin.class);
-            ReplicationAgent agent = mock(ReplicationAgent.class);
-            DefaultReplicationAgentConfigurationManager defaultReplicationAgentConfigurationManager
= new DefaultReplicationAgentConfigurationManager();
-            Field configAdminField = defaultReplicationAgentConfigurationManager.getClass().getDeclaredField("configAdmin");
-            configAdminField.setAccessible(true);
-            configAdminField.set(defaultReplicationAgentConfigurationManager, configAdmin);
             defaultReplicationAgentConfigurationManager.getConfiguration(agent);
             fail("an exception should be thrown when no configuration is available");
         } catch (Exception e) {
@@ -52,15 +53,16 @@ public class DefaultReplicationAgentConf
 
     @Test
     public void testRetrievalWithMultipleConfigurationsAvailable() throws Exception {
+        ConfigurationAdmin configAdmin = mock(ConfigurationAdmin.class);
+        ReplicationAgent agent = mock(ReplicationAgent.class);
+        when(agent.getName()).thenReturn("publish");
+        when(configAdmin.listConfigurations("(name=publish)")).thenReturn(new Configuration[]{null,
null});
+        DefaultReplicationAgentConfigurationManager defaultReplicationAgentConfigurationManager
= new DefaultReplicationAgentConfigurationManager();
+        Field configAdminField = defaultReplicationAgentConfigurationManager.getClass().getDeclaredField("configAdmin");
+        configAdminField.setAccessible(true);
+        configAdminField.set(defaultReplicationAgentConfigurationManager, configAdmin);
+        
         try {
-            ConfigurationAdmin configAdmin = mock(ConfigurationAdmin.class);
-            ReplicationAgent agent = mock(ReplicationAgent.class);
-            when(agent.getName()).thenReturn("publish");
-            when(configAdmin.listConfigurations("(name=publish)")).thenReturn(new Configuration[]{null,
null});
-            DefaultReplicationAgentConfigurationManager defaultReplicationAgentConfigurationManager
= new DefaultReplicationAgentConfigurationManager();
-            Field configAdminField = defaultReplicationAgentConfigurationManager.getClass().getDeclaredField("configAdmin");
-            configAdminField.setAccessible(true);
-            configAdminField.set(defaultReplicationAgentConfigurationManager, configAdmin);
             defaultReplicationAgentConfigurationManager.getConfiguration(agent);
             fail("an exception should be thrown when multiple configurations are available");
         } catch (Exception e) {



Mime
View raw message