activemq-cli-tools git commit: AMQCLI-3 - Update to Artemis 2.0.0

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

activemq-cli-tools git commit: AMQCLI-3 - Update to Artemis 2.0.0

cshannon
Repository: activemq-cli-tools
Updated Branches:
  refs/heads/master e872995ee -> 4d14839b5


AMQCLI-3 - Update to Artemis 2.0.0

Also add tests

https://issues.apache.org/jira/browse/AMQCLI-3


Project: http://git-wip-us.apache.org/repos/asf/activemq-cli-tools/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cli-tools/commit/4d14839b
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cli-tools/tree/4d14839b
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cli-tools/diff/4d14839b

Branch: refs/heads/master
Commit: 4d14839b5968483bb2e57bb6e5b7b91c9c2c0dc7
Parents: e872995
Author: Christopher L. Shannon (cshannon) <[hidden email]>
Authored: Mon Mar 13 08:43:57 2017 -0400
Committer: Christopher L. Shannon (cshannon) <[hidden email]>
Committed: Mon Mar 13 08:43:57 2017 -0400

----------------------------------------------------------------------
 .../cli/kahadb/exporter/ExporterTest.java       | 53 ++++++++++++++++++--
 pom.xml                                         |  2 +-
 2 files changed, 51 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-cli-tools/blob/4d14839b/activemq-kahadb-exporter/src/test/java/org/apache/activemq/cli/kahadb/exporter/ExporterTest.java
----------------------------------------------------------------------
diff --git a/activemq-kahadb-exporter/src/test/java/org/apache/activemq/cli/kahadb/exporter/ExporterTest.java b/activemq-kahadb-exporter/src/test/java/org/apache/activemq/cli/kahadb/exporter/ExporterTest.java
index ed252f6..70a14e2 100644
--- a/activemq-kahadb-exporter/src/test/java/org/apache/activemq/cli/kahadb/exporter/ExporterTest.java
+++ b/activemq-kahadb-exporter/src/test/java/org/apache/activemq/cli/kahadb/exporter/ExporterTest.java
@@ -209,7 +209,53 @@ public abstract class ExporterTest {
     }
 
     @Test
-    public void testExportTopics() throws Exception {
+    public void testExportTopicsPatternEmpty() throws Exception {
+        File kahaDbDir = storeFolder.newFolder();
+
+        ActiveMQTopic topic = new ActiveMQTopic("test.topic");
+        PersistenceAdapter adapter = getPersistenceAdapter(kahaDbDir);
+        adapter.start();
+        TopicMessageStore messageStore = adapter.createTopicMessageStore(topic);
+        messageStore.start();
+
+        SubscriptionInfo sub1 = new SubscriptionInfo("clientId1", "sub1");
+        sub1.setDestination(topic);
+        messageStore.addSubscription(sub1, false);
+
+        IdGenerator id = new IdGenerator();
+        ConnectionContext context = new ConnectionContext();
+        for (int i = 0; i < 5; i++) {
+            ActiveMQTextMessage message = new ActiveMQTextMessage();
+            message.setText("Test");
+            message.setProperty("MyStringProperty", "abc");
+            message.setProperty("MyIntegerProperty", 1);
+            message.setDestination(topic);
+            message.setMessageId(new MessageId(id.generateId() + ":1", i));
+            messageStore.addMessage(context, message);
+        }
+
+        adapter.stop();
+
+        //should be empty as no messages match empty.>
+        File xmlFile = new File(storeFolder.getRoot().getAbsoluteFile(), "outputXml.xml");
+        exportStore(ExportConfigurationBuilder.newBuilder()
+                .setTopicPattern("empty.>")
+                .setSource(kahaDbDir)
+                .setTarget(xmlFile));
+        validate(xmlFile, 0);
+    }
+
+    @Test
+    public void testExportTopicsAll() throws Exception {
+        testExportTopics(null);
+    }
+
+    @Test
+    public void testExportTopicsPattern() throws Exception {
+        testExportTopics("test.>");
+    }
+
+    protected void testExportTopics(String pattern) throws Exception {
 
         File kahaDbDir = storeFolder.newFolder();
 
@@ -248,10 +294,11 @@ public abstract class ExporterTest {
 
         File xmlFile = new File(storeFolder.getRoot().getAbsoluteFile(), "outputXml.xml");
         exportStore(ExportConfigurationBuilder.newBuilder()
+                .setTopicPattern(pattern)
                 .setSource(kahaDbDir)
                 .setTarget(xmlFile));
 
-        printFile(xmlFile);
+       // printFile(xmlFile);
 
         validate(xmlFile, 5);
 
@@ -386,7 +433,7 @@ public abstract class ExporterTest {
         assertEquals(count, read.getValue().getMessages().getMessage().size());
     }
 
-    private void printFile(File file) throws IOException {
+    protected void printFile(File file) throws IOException {
         try (BufferedReader br = new BufferedReader(new FileReader(file))) {
             String line = null;
             while ((line = br.readLine()) != null) {

http://git-wip-us.apache.org/repos/asf/activemq-cli-tools/blob/4d14839b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 183a172..672e8a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,7 +38,7 @@
     <maven.compiler.target>1.8</maven.compiler.target>
 
     <activemq-version>5.14.4</activemq-version>
-    <artemis-version>2.0.0-SNAPSHOT</artemis-version>
+    <artemis-version>2.0.0</artemis-version>
     <slf4j-version>1.7.13</slf4j-version>
     <log4j-version>1.2.17</log4j-version>
 

Loading...