You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by st...@apache.org on 2015/01/26 14:30:38 UTC

svn commit: r1654792 - /sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/topology/connector/ConnectorRegistryTest.java

Author: stefanegli
Date: Mon Jan 26 13:30:37 2015
New Revision: 1654792

URL: http://svn.apache.org/r1654792
Log:
no-jira : use setup/teardown to properly stop an instance's heartbeats (which otherwise conflict with tests that run at a later stage in the same run)

Modified:
    sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/topology/connector/ConnectorRegistryTest.java

Modified: sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/topology/connector/ConnectorRegistryTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/topology/connector/ConnectorRegistryTest.java?rev=1654792&r1=1654791&r2=1654792&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/topology/connector/ConnectorRegistryTest.java (original)
+++ sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/topology/connector/ConnectorRegistryTest.java Mon Jan 26 13:30:37 2015
@@ -29,10 +29,33 @@ import org.apache.sling.discovery.impl.s
 import org.apache.sling.discovery.impl.setup.MockFactory;
 import org.apache.sling.discovery.impl.setup.OSGiFactory;
 import org.apache.sling.discovery.impl.topology.announcement.AnnouncementRegistry;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 public class ConnectorRegistryTest {
 
+    private Instance i;
+
+    @Before
+    public void setup() throws Exception {
+        i = Instance.newStandaloneInstance("i", true);
+    }
+    
+    @After
+    public void teardown() throws Exception {
+        if (i!=null) {
+            try {
+                i.stopHeartbeats();
+            } catch (Throwable e) {
+                e.printStackTrace();
+                i.stop();
+                throw new RuntimeException(e);
+            }
+            i.stop();
+        }
+    }
+    
     @Test
     public void testRegisterUnregister() throws Exception {
         Instance i = Instance.newStandaloneInstance("i", true);