Skip to content
Permalink
Browse files
AMQCLI-3 - Update to Artemis 2.0.0
  • Loading branch information
cshannon committed Mar 13, 2017
1 parent e872995 commit 4d14839b5968483bb2e57bb6e5b7b91c9c2c0dc7
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
@@ -209,7 +209,53 @@ protected void testExportQueues(String pattern) throws Exception {
}

@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 void testExportTopics() throws Exception {

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 @@ private void validate(File file, int count) throws JAXBException {
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) {
@@ -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>

0 comments on commit 4d14839

Please sign in to comment.