activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r357139 - in /incubator/activemq/trunk/assembly: maven.xml src/test/org/activemq/usecases/PublishOnQueueConsumedMessageUsingActivemqXMLTest.java src/test/org/activemq/usecases/PublishOnTopicConsumerMessageUsingActivemqXMLTest.java
Date Fri, 16 Dec 2005 07:20:20 GMT
Author: jlim
Date: Thu Dec 15 23:20:06 2005
New Revision: 357139

URL: http://svn.apache.org/viewcvs?rev=357139&view=rev
Log:
added test cases to test release's activemq.xml. The test cases perform a publish/consume
on both topic and queue.

Added:
    incubator/activemq/trunk/assembly/src/test/org/activemq/usecases/PublishOnQueueConsumedMessageUsingActivemqXMLTest.java
    incubator/activemq/trunk/assembly/src/test/org/activemq/usecases/PublishOnTopicConsumerMessageUsingActivemqXMLTest.java
Modified:
    incubator/activemq/trunk/assembly/maven.xml

Modified: incubator/activemq/trunk/assembly/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/assembly/maven.xml?rev=357139&r1=357138&r2=357139&view=diff
==============================================================================
--- incubator/activemq/trunk/assembly/maven.xml (original)
+++ incubator/activemq/trunk/assembly/maven.xml Thu Dec 15 23:20:06 2005
@@ -35,6 +35,7 @@
     <!-- Default Global Goals -->
     <!-- ==================== -->
     <goal name="default">
+        <ant:copy todir="${basedir}/src/test/org/activemq/usecases" file="${basedir}/src/release/conf/activemq.xml"
overwrite="true"/>
         <attainGoal name="dist:build-bin"/>
     </goal>
     

Added: incubator/activemq/trunk/assembly/src/test/org/activemq/usecases/PublishOnQueueConsumedMessageUsingActivemqXMLTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/assembly/src/test/org/activemq/usecases/PublishOnQueueConsumedMessageUsingActivemqXMLTest.java?rev=357139&view=auto
==============================================================================
--- incubator/activemq/trunk/assembly/src/test/org/activemq/usecases/PublishOnQueueConsumedMessageUsingActivemqXMLTest.java
(added)
+++ incubator/activemq/trunk/assembly/src/test/org/activemq/usecases/PublishOnQueueConsumedMessageUsingActivemqXMLTest.java
Thu Dec 15 23:20:06 2005
@@ -0,0 +1,115 @@
+/**
+* <a href="http://activemq.org">ActiveMQ: The Open Source Message Fabric</a>
+*
+* Copyright 2005 (C) LogicBlaze, Inc. http://www.logicblaze.com
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+**/
+package org.activemq.usecases;
+
+import org.activemq.broker.BrokerService;
+import org.activemq.xbean.BrokerFactoryBean;
+import org.activemq.ActiveMQConnectionFactory;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+
+import java.io.File;
+
+/**
+ *
+ * Test Publish/Consume queue using the release activemq.xml configuration file
+ *
+ * @version $Revision: 1.2 $
+ */
+public class PublishOnQueueConsumedMessageUsingActivemqXMLTest extends PublishOnTopicConsumedMessageTest
{
+    protected static final String JOURNAL_ROOT = "../data/";
+    BrokerService broker;
+
+
+
+     /**
+     * Use the transportConnector uri configured on the activemq.xml
+     *
+     * @return ActiveMQConnectionFactory
+     * @throws Exception
+     */
+    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
+        return new ActiveMQConnectionFactory("tcp://localhost:61616");
+    }
+
+
+    /**
+     * Sets up a test where the producer and consumer have their own connection.
+     *
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        ;
+        File journalFile = new File(JOURNAL_ROOT);
+        recursiveDelete(journalFile);
+        // Create broker from resource
+        System.out.print("Creating broker... ");
+        broker = createBroker("org/activemq/usecases/activemq.xml");
+        System.out.println("Success");
+        super.setUp();
+
+    }
+
+
+
+     /*
+     * Stops the Broker
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+         System.out.println("Closing Broker");
+            if (broker != null) {
+               broker.stop();
+            }
+         System.out.println("Broker closed...");
+
+
+    }
+
+
+    /*
+     * clean up the journal
+     */
+
+    protected static void recursiveDelete(File file) {
+        if( file.isDirectory() ) {
+            File[] files = file.listFiles();
+            for (int i = 0; i < files.length; i++) {
+                recursiveDelete(files[i]);
+            }
+        }
+        file.delete();
+    }
+
+    protected BrokerService createBroker(String resource) throws Exception {
+        return createBroker(new ClassPathResource(resource));
+    }
+
+    protected BrokerService createBroker(Resource resource) throws Exception {
+        BrokerFactoryBean factory = new BrokerFactoryBean(resource);
+        factory.afterPropertiesSet();
+
+        BrokerService broker = factory.getBroker();
+
+        //assertTrue("Should have a broker!", broker != null);
+
+
+        return broker;
+    }
+}

Added: incubator/activemq/trunk/assembly/src/test/org/activemq/usecases/PublishOnTopicConsumerMessageUsingActivemqXMLTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/assembly/src/test/org/activemq/usecases/PublishOnTopicConsumerMessageUsingActivemqXMLTest.java?rev=357139&view=auto
==============================================================================
--- incubator/activemq/trunk/assembly/src/test/org/activemq/usecases/PublishOnTopicConsumerMessageUsingActivemqXMLTest.java
(added)
+++ incubator/activemq/trunk/assembly/src/test/org/activemq/usecases/PublishOnTopicConsumerMessageUsingActivemqXMLTest.java
Thu Dec 15 23:20:06 2005
@@ -0,0 +1,117 @@
+/**
+* <a href="http://activemq.org">ActiveMQ: The Open Source Message Fabric</a>
+*
+* Copyright 2005 (C) LogicBlaze, Inc. http://www.logicblaze.com
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+**/
+package org.activemq.usecases;
+
+import org.activemq.broker.BrokerService;
+import org.activemq.xbean.BrokerFactoryBean;
+import org.activemq.ActiveMQConnectionFactory;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+import java.io.File;
+
+/**
+ *
+ * Test Publish/Consume topic  using the release activemq.xml configuration file
+ *
+ * @version $Revision: 1.2 $
+ */
+public class PublishOnTopicConsumerMessageUsingActivemqXMLTest extends PublishOnTopicConsumedMessageTest
{
+    protected static final String JOURNAL_ROOT = "../data/";
+    BrokerService broker;
+
+
+
+     /**
+     * Use the transportConnector uri configured on the activemq.xml
+     *
+     * @return ActiveMQConnectionFactory
+     * @throws Exception
+     */
+    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
+        return new ActiveMQConnectionFactory("tcp://localhost:61616");
+    }
+
+
+    /**
+     * Sets up a test where the producer and consumer have their own connection.
+     *
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        ;
+        File journalFile = new File(JOURNAL_ROOT);
+        recursiveDelete(journalFile);
+        // Create broker from resource
+        System.out.print("Creating broker... ");
+        broker = createBroker("org/activemq/usecases/activemq.xml");
+        System.out.println("Success");
+        super.setUp();
+
+    }
+
+
+
+     /*
+     * Stops the Broker
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+         System.out.println("Closing Broker");
+            if (broker != null) {
+               broker.stop();
+            }
+         System.out.println("Broker closed...");
+
+
+    }
+
+
+
+
+
+    /*
+     * clean up the journal
+     */
+
+    protected static void recursiveDelete(File file) {
+        if( file.isDirectory() ) {
+            File[] files = file.listFiles();
+            for (int i = 0; i < files.length; i++) {
+                recursiveDelete(files[i]);
+            }
+        }
+        file.delete();
+    }
+
+    protected BrokerService createBroker(String resource) throws Exception {
+        return createBroker(new ClassPathResource(resource));
+    }
+
+    protected BrokerService createBroker(Resource resource) throws Exception {
+        BrokerFactoryBean factory = new BrokerFactoryBean(resource);
+        factory.afterPropertiesSet();
+
+        BrokerService broker = factory.getBroker();
+
+        //assertTrue("Should have a broker!", broker != null);
+
+
+        return broker;
+    }
+}



Mime
View raw message