You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2013/01/14 19:26:57 UTC

svn commit: r1433024 - /activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java

Author: tabish
Date: Mon Jan 14 18:26:57 2013
New Revision: 1433024

URL: http://svn.apache.org/viewvc?rev=1433024&view=rev
Log:
apply patch for: https://issues.apache.org/jira/browse/AMQ-4254

Modified:
    activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java

Modified: activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java?rev=1433024&r1=1433023&r2=1433024&view=diff
==============================================================================
--- activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java (original)
+++ activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java Mon Jan 14 18:26:57 2013
@@ -20,6 +20,9 @@ import java.io.File;
 import java.io.FileFilter;
 import java.io.FileInputStream;
 import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
@@ -32,34 +35,49 @@ import org.apache.activemq.broker.Broker
 import org.apache.activemq.broker.TransportConnector;
 import org.apache.activemq.transport.stomp.StompConnection;
 import org.apache.activemq.util.URISupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class BrokerXmlConfigStartTest extends TestCase {
+@RunWith(value = Parameterized.class)
+public class BrokerXmlConfigStartTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(BrokerXmlConfigStartTest.class);
     Properties secProps;
-    public void testStartBrokerUsingXmlConfig() throws Exception {
-        doTestStartBrokerUsingXmlConfig("xbean:src/release/conf/activemq.xml");
-    }
 
-    public void testStartBrokerUsingSampleConfig() throws Exception {
-        // resource:copy-resource brings all config files into target/conf
+    private String configUrl;
+
+    @Parameterized.Parameters
+    public static Collection<String[]> getTestParameters() {
+        List<String[]> configUrls = new ArrayList<String[]>();
+        configUrls.add(new String[]{"xbean:src/release/conf/activemq.xml"});
+
         File sampleConfDir = new File("target/conf");
-        
         for (File xmlFile : sampleConfDir.listFiles(new FileFilter() {
             public boolean accept(File pathname) {
                 return pathname.isFile() &&
-                pathname.getName().startsWith("activemq-") &&
-                pathname.getName().endsWith("xml");
+                        pathname.getName().startsWith("activemq-") &&
+                        pathname.getName().endsWith("xml");
             }})) {
-            
-            doTestStartBrokerUsingXmlConfig("xbean:" + sampleConfDir.getAbsolutePath() + "/" + xmlFile.getName());
+
+            configUrls.add(new String[]{"xbean:" + sampleConfDir.getAbsolutePath() + "/" + xmlFile.getName()});
         }
+
+        return configUrls;
     }
 
-    public void doTestStartBrokerUsingXmlConfig(String configUrl) throws Exception {
 
+    public BrokerXmlConfigStartTest(String config) {
+        this.configUrl = config;
+    }
+
+    @Test
+    public void testStartBrokerUsingXmlConfig1() throws Exception {
         BrokerService broker = null;
         LOG.info("Broker config: " + configUrl);
         System.err.println("Broker config: " + configUrl);
@@ -95,6 +113,7 @@ public class BrokerXmlConfigStartTest ex
         }
     }
 
+    @Before
     public void setUp() throws Exception {
         System.setProperty("activemq.base", "target");
         System.setProperty("activemq.home", "target"); // not a valid home but ok for xml validation
@@ -104,6 +123,7 @@ public class BrokerXmlConfigStartTest ex
         secProps.load(new FileInputStream(new File("target/conf/credentials.properties")));
     }
     
+    @After
     public void tearDown() throws Exception {
         TimeUnit.SECONDS.sleep(1);
     }