[ARTEMIS-1196] Fix missing JSON support
This commit is contained in:
parent
a970b41ebf
commit
b6dcff039f
|
@ -54,8 +54,8 @@
|
|||
<bundle dependency="true">mvn:org.jboss.logging/jboss-logging/${jboss.logging.version}</bundle>
|
||||
<bundle dependency="true">mvn:org.jgroups/jgroups/${jgroups.version}</bundle>
|
||||
|
||||
<bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-json_1.0_spec/${json-p.spec.version}</bundle>
|
||||
<bundle dependency="true">mvn:org.apache.johnzon/johnzon-core/${johnzon.version}</bundle>
|
||||
<bundle dependency="true">mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.json-api-1.1/${servicemix.json-1.1.spec.version}</bundle>
|
||||
<bundle>mvn:org.apache.johnzon/johnzon-core/${johnzon.version}</bundle>
|
||||
|
||||
<bundle>mvn:org.apache.activemq/artemis-native/${pom.version}</bundle>
|
||||
<bundle>mvn:org.apache.activemq/artemis-server-osgi/${pom.version}</bundle>
|
||||
|
|
1
pom.xml
1
pom.xml
|
@ -104,6 +104,7 @@
|
|||
<arquillian-weld-embedded.version>2.0.0.Beta3</arquillian-weld-embedded.version>
|
||||
<owb.version>1.7.0</owb.version>
|
||||
<arquillian.version>1.1.11.Final</arquillian.version>
|
||||
<servicemix.json-1.1.spec.version>2.9.0</servicemix.json-1.1.spec.version>
|
||||
|
||||
<owasp.version>1.4.3</owasp.version>
|
||||
|
||||
|
|
|
@ -23,14 +23,22 @@ import javax.jms.MessageConsumer;
|
|||
import javax.jms.MessageProducer;
|
||||
import javax.jms.Queue;
|
||||
import javax.jms.QueueBrowser;
|
||||
import javax.jms.QueueRequestor;
|
||||
import javax.jms.QueueSession;
|
||||
import javax.jms.TextMessage;
|
||||
import javax.json.Json;
|
||||
import javax.json.JsonArray;
|
||||
import javax.json.JsonString;
|
||||
import javax.security.auth.Subject;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.PrintStream;
|
||||
import java.io.StringReader;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
@ -148,7 +156,7 @@ public class ArtemisFeatureTest extends Assert {
|
|||
connection = factory.createConnection(USER, PASSWORD);
|
||||
connection.start();
|
||||
|
||||
javax.jms.Session sess = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
|
||||
QueueSession sess = (QueueSession) connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
|
||||
Queue queue = sess.createQueue("exampleQueue");
|
||||
MessageProducer producer = sess.createProducer(queue);
|
||||
producer.send(sess.createTextMessage("TEST"));
|
||||
|
@ -161,6 +169,21 @@ public class ArtemisFeatureTest extends Assert {
|
|||
}
|
||||
}
|
||||
|
||||
// Test management
|
||||
Queue managementQueue = sess.createQueue("activemq.management");
|
||||
QueueRequestor requestor = new QueueRequestor(sess, managementQueue);
|
||||
connection.start();
|
||||
TextMessage m = sess.createTextMessage();
|
||||
m.setStringProperty("_AMQ_ResourceName", "broker");
|
||||
m.setStringProperty("_AMQ_OperationName", "getQueueNames");
|
||||
m.setText("[\"ANYCAST\"]");
|
||||
Message reply = requestor.request(m);
|
||||
String json = ((TextMessage) reply).getText();
|
||||
JsonArray array = Json.createReader(new StringReader(json)).readArray();
|
||||
List<JsonString> queues = (List<JsonString>) array.get(0);
|
||||
assertNotNull(queues);
|
||||
assertFalse(queues.isEmpty());
|
||||
|
||||
MessageConsumer consumer = sess.createConsumer(queue);
|
||||
Message msg = consumer.receive(5000);
|
||||
assertNotNull(msg);
|
||||
|
|
Loading…
Reference in New Issue