activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/6] activemq-artemis git commit: ARTEMIS-737 - added class javadoc to rules
Date Mon, 26 Sep 2016 21:58:46 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 27ed7ec65 -> c86e41d4f


ARTEMIS-737 - added class javadoc to rules


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/32b7c039
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/32b7c039
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/32b7c039

Branch: refs/heads/master
Commit: 32b7c039d834444a80339815378bf9b2ead4b63d
Parents: db09592
Author: Quinn Stevenson <quinn@pronoia-solutions.com>
Authored: Fri Sep 23 14:33:45 2016 -0600
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Mon Sep 26 17:57:52 2016 -0400

----------------------------------------------------------------------
 .../artemis/junit/ActiveMQConsumerResource.java | 27 ++++++++++++++++
 .../junit/ActiveMQDynamicProducerResource.java  | 19 +++++++++++
 .../artemis/junit/ActiveMQProducerResource.java | 27 ++++++++++++++++
 .../artemis/junit/EmbeddedActiveMQResource.java | 34 ++++++++++++++------
 .../artemis/junit/EmbeddedJMSResource.java      | 15 +++++++++
 5 files changed, 112 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/32b7c039/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java
----------------------------------------------------------------------
diff --git a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java
b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java
index 2e3088c..d48ef1d 100644
--- a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java
+++ b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java
@@ -22,6 +22,25 @@ import org.apache.activemq.artemis.api.core.client.ClientConsumer;
 import org.apache.activemq.artemis.api.core.client.ClientMessage;
 import org.apache.activemq.artemis.api.core.client.ServerLocator;
 
+/**
+ * A JUnit Rule that embeds an ActiveMQ Artemis ClientConsumer into a test.
+ *
+ * This JUnit Rule is designed to simplify using ActiveMQ Artemis clients in unit tests.
 Adding the rule to a test will startup
+ * a ClientConsumer, which can then be used to consume messages from an ActiveMQ Artemis
server.
+ *
+ * <pre><code>
+ * public class SimpleTest {
+ *    {@code @Rule}
+ *     public ActiveMQConsumerResource producer = new ActiveMQProducerResource( "vm://0",
"test.queue" );
+ *
+ *    {@code @Test}
+ *     public void testSomething() throws Exception {
+ *         // Use the embedded client here
+ *         ClientMessage message = client.receiveMessage();
+ *     }
+ * }
+ * </code></pre>
+ */
 public class ActiveMQConsumerResource extends AbstractActiveMQClientResource {
 
    long defaultReceiveTimeout = 50;
@@ -29,11 +48,19 @@ public class ActiveMQConsumerResource extends AbstractActiveMQClientResource
{
    SimpleString queueName;
    ClientConsumer consumer;
 
+   public ActiveMQConsumerResource(String url, String queueName) {
+      this(url, SimpleString.toSimpleString(queueName));
+   }
+
    public ActiveMQConsumerResource(String url, SimpleString queueName) {
       super(url);
       this.queueName = queueName;
    }
 
+   public ActiveMQConsumerResource(ServerLocator serverLocator, String queueName) {
+      this(serverLocator, SimpleString.toSimpleString(queueName));
+   }
+
    public ActiveMQConsumerResource(ServerLocator serverLocator, SimpleString queueName) {
       super(serverLocator);
       this.queueName = queueName;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/32b7c039/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResource.java
----------------------------------------------------------------------
diff --git a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResource.java
b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResource.java
index 477dd39..acb8601 100644
--- a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResource.java
+++ b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResource.java
@@ -23,6 +23,25 @@ import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.client.ClientMessage;
 import org.apache.activemq.artemis.api.core.client.ServerLocator;
 
+/**
+ * A JUnit Rule that embeds an dynamic (i.e. unbound) ActiveMQ Artemis ClientProducer into
a test.
+ *
+ * This JUnit Rule is designed to simplify using ActiveMQ Artemis clients in unit tests.
 Adding the rule to a test will startup
+ * an unbound ClientProducer, which can then be used to feed messages to any address on the
ActiveMQ Artemis server.
+ *
+ * <pre><code>
+ * public class SimpleTest {
+ *    {@code @Rule}
+ *     public ActiveMQDynamicProducerResource producer = new ActiveMQDynamicProducerResource(
"vm://0");
+ *
+ *    {@code @Test}
+ *     public void testSomething() throws Exception {
+ *         // Use the embedded ClientProducer here
+ *         producer.sendMessage( "test.address", "String Body" );
+ *     }
+ * }
+ * </code></pre>
+ */
 public class ActiveMQDynamicProducerResource extends ActiveMQProducerResource {
 
    public ActiveMQDynamicProducerResource(String url) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/32b7c039/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java
----------------------------------------------------------------------
diff --git a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java
b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java
index d9336d4..8d57bac 100644
--- a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java
+++ b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java
@@ -24,6 +24,25 @@ import org.apache.activemq.artemis.api.core.client.ClientMessage;
 import org.apache.activemq.artemis.api.core.client.ClientProducer;
 import org.apache.activemq.artemis.api.core.client.ServerLocator;
 
+/**
+ * A JUnit Rule that embeds an ActiveMQ Artemis ClientProducer bound to a specific address
into a test.
+ *
+ * This JUnit Rule is designed to simplify using ActiveMQ Artemis clients in unit tests.
 Adding the rule to a test will startup
+ * a ClientProducer, which can then be used to feed messages to the bound address on an ActiveMQ
Artemis server.
+ *
+ * <pre><code>
+ * public class SimpleTest {
+ *    {@code @Rule}
+ *     public ActiveMQProducerResource producer = new ActiveMQProducerResource( "vm://0",
"test.queue");
+ *
+ *    {@code @Test}
+ *     public void testSomething() throws Exception {
+ *         // Use the embedded ClientProducer here
+ *         producer.sendMessage( "String Body" );
+ *     }
+ * }
+ * </code></pre>
+ */
 public class ActiveMQProducerResource extends AbstractActiveMQClientResource {
 
    boolean useDurableMessage = true;
@@ -38,6 +57,10 @@ public class ActiveMQProducerResource extends AbstractActiveMQClientResource
{
       super(serverLocator);
    }
 
+   public ActiveMQProducerResource(String url, String address) {
+      this(url, SimpleString.toSimpleString(address));
+   }
+
    public ActiveMQProducerResource(String url, SimpleString address) {
       super(url);
       if (address == null) {
@@ -46,6 +69,10 @@ public class ActiveMQProducerResource extends AbstractActiveMQClientResource
{
       this.address = address;
    }
 
+   public ActiveMQProducerResource(ServerLocator serverLocator, String address) {
+      this(serverLocator, SimpleString.toSimpleString(address));
+   }
+
    public ActiveMQProducerResource(ServerLocator serverLocator, SimpleString address) {
       super(serverLocator);
       if (address == null) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/32b7c039/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java
----------------------------------------------------------------------
diff --git a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java
b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java
index 90e567f..43bae8c 100644
--- a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java
+++ b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java
@@ -46,6 +46,21 @@ import org.slf4j.LoggerFactory;
 
 /**
  * A JUnit Rule that embeds an ActiveMQ Artemis server into a test.
+ *
+ * This JUnit Rule is designed to simplify using embedded servers in unit tests.  Adding
the rule to a test will startup
+ * an embedded server, which can then be used by client applications.
+ *
+ * <pre><code>
+ * public class SimpleTest {
+ *    {@code @Rule}
+ *     public EmbeddedActiveMQResource server = new EmbeddedActiveMQResource();
+ *
+ *    {@code @Test}
+ *     public void testSomething() throws Exception {
+ *         // Use the embedded server here
+ *     }
+ * }
+ * </code></pre>
  */
 public class EmbeddedActiveMQResource extends ExternalResource {
 
@@ -138,7 +153,7 @@ public class EmbeddedActiveMQResource extends ExternalResource {
 
    /**
     * Start the embedded ActiveMQ Artemis server.
-    * <p/>
+    *
     * The server will normally be started by JUnit using the before() method.  This method
allows the server to
     * be started manually to support advanced testing scenarios.
     */
@@ -155,7 +170,7 @@ public class EmbeddedActiveMQResource extends ExternalResource {
 
    /**
     * Stop the embedded ActiveMQ Artemis server
-    * <p/>
+    *
     * The server will normally be stopped by JUnit using the after() method.  This method
allows the server to
     * be stopped manually to support advanced testing scenarios.
     */
@@ -177,7 +192,6 @@ public class EmbeddedActiveMQResource extends ExternalResource {
 
    /**
     * Invoked by JUnit to setup the resource - start the embedded ActiveMQ Artemis server
-    * <p/>
     */
    @Override
    protected void before() throws Throwable {
@@ -241,7 +255,7 @@ public class EmbeddedActiveMQResource extends ExternalResource {
 
    /**
     * Get the EmbeddedActiveMQ server.
-    * <p/>
+    *
     * This may be required for advanced configuration of the EmbeddedActiveMQ server.
     *
     * @return the embedded ActiveMQ broker
@@ -380,7 +394,7 @@ public class EmbeddedActiveMQResource extends ExternalResource {
 
    /**
     * Create a ClientMessage
-    * <p>
+    *
     * If useDurableMessage is false, a non-durable message is created.  Otherwise, a durable
message is created
     *
     * @return a new ClientMessage
@@ -392,7 +406,7 @@ public class EmbeddedActiveMQResource extends ExternalResource {
 
    /**
     * Create a ClientMessage with the specified body
-    * <p>
+    *
     * If useDurableMessage is false, a non-durable message is created.  Otherwise, a durable
message is created
     *
     * @param body the body for the new message
@@ -411,7 +425,7 @@ public class EmbeddedActiveMQResource extends ExternalResource {
 
    /**
     * Create a ClientMessage with the specified body
-    * <p>
+    *
     * If useDurableMessage is false, a non-durable message is created.  Otherwise, a durable
message is created
     *
     * @param body the body for the new message
@@ -430,7 +444,7 @@ public class EmbeddedActiveMQResource extends ExternalResource {
 
    /**
     * Create a ClientMessage with the specified message properties
-    * <p>
+    *
     * If useDurableMessage is false, a non-durable message is created.  Otherwise, a durable
message is created
     *
     * @param properties message properties for the new message
@@ -447,7 +461,7 @@ public class EmbeddedActiveMQResource extends ExternalResource {
 
    /**
     * Create a ClientMessage with the specified body and message properties
-    * <p>
+    *
     * If useDurableMessage is false, a non-durable message is created.  Otherwise, a durable
message is created
     *
     * @param body       the body for the new message
@@ -464,7 +478,7 @@ public class EmbeddedActiveMQResource extends ExternalResource {
 
    /**
     * Create a ClientMessage with the specified body and message properties
-    * <p>
+    *
     * If useDurableMessage is false, a non-durable message is created.  Otherwise, a durable
message is created
     *
     * @param body       the body for the new message

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/32b7c039/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedJMSResource.java
----------------------------------------------------------------------
diff --git a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedJMSResource.java
b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedJMSResource.java
index 788e0ce..1471a51 100644
--- a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedJMSResource.java
+++ b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedJMSResource.java
@@ -56,6 +56,21 @@ import org.slf4j.LoggerFactory;
 
 /**
  * A JUnit Rule that embeds an ActiveMQ Artemis JMS server into a test.
+ *
+ * This JUnit Rule is designed to simplify using embedded servers in unit tests.  Adding
the rule to a test will startup
+ * an embedded JMS server, which can then be used by client applications.
+ *
+ * <pre><code>
+ * public class SimpleTest {
+ *    {@code @Rule}
+ *     public EmbeddedJMSResource server = new EmbeddedJMSResource();
+ *
+ *    {@code @Test}
+ *     public void testSomething() throws Exception {
+ *         // Use the embedded server here
+ *     }
+ * }
+ * </code></pre>
  */
 public class EmbeddedJMSResource extends ExternalResource {
 


Mime
View raw message