Commit ead58ee6 authored by Guillaume Surrel's avatar Guillaume Surrel
Browse files

Adapt tests to new extended destinations.

parent a3af84cb
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2008 - 2009 ScalAgent Distributed Technologies
* Copyright (C) 2008 - 2010 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -22,6 +22,7 @@
*/
package joram.monitoring;
import java.util.Enumeration;
import java.util.Properties;
import javax.jms.Connection;
......@@ -34,11 +35,12 @@ import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.objectweb.joram.client.jms.Destination;
import org.objectweb.joram.client.jms.Queue;
import org.objectweb.joram.client.jms.admin.AdminModule;
import org.objectweb.joram.client.jms.admin.User;
import org.objectweb.joram.client.jms.tcp.TcpConnectionFactory;
import org.objectweb.joram.mom.dest.MonitoringAcquisition;
import framework.TestCase;
......@@ -96,11 +98,12 @@ public class TestMonitoringQueue1 extends TestCase implements MessageListener {
AdminModule.connect("localhost", 2560, "root", "root", 60);
Properties properties = new Properties();
properties.put("period", "2000");
properties.put("Joram#0:name=JoramAdminTopic,*", "DestinationId");
properties.put("acquisition.period", "2000");
properties.put("Joram#0:*", "DestinationId");
properties.put("acquisition.className", MonitoringAcquisition.class.getName());
// create a Queue
Queue queue = Queue.create(0, "MonitoringQueue", Queue.MONITORING_QUEUE, properties);
Queue queue = Queue.create(0, "MonitoringQueue", Destination.ACQUISITION_QUEUE, properties);
// create a user
User.create("anonymous", "anonymous");
......@@ -121,8 +124,13 @@ public class TestMonitoringQueue1 extends TestCase implements MessageListener {
public void onMessage(Message message) {
nbReceived++;
// System.out.println("\n --> Message received :" + message);
System.out.println("\n --> Message received :" + message);
try {
Enumeration enu = message.getPropertyNames();
while (enu.hasMoreElements()) {
String name = (String) enu.nextElement();
System.out.println(message.getStringProperty(name));
}
String id = message.getStringProperty("Joram#0:type=Destination,name=JoramAdminTopic:DestinationId");
assertTrue("#0.0.10".equals(id));
} catch (JMSException exc) {
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2008 - 2009 ScalAgent Distributed Technologies
* Copyright (C) 2008 - 2010 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -23,6 +23,7 @@
package joram.monitoring;
import java.util.Enumeration;
import java.util.Properties;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
......@@ -35,10 +36,12 @@ import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.objectweb.joram.client.jms.Destination;
import org.objectweb.joram.client.jms.Queue;
import org.objectweb.joram.client.jms.admin.AdminModule;
import org.objectweb.joram.client.jms.admin.User;
import org.objectweb.joram.client.jms.tcp.TcpConnectionFactory;
import org.objectweb.joram.mom.dest.MonitoringAcquisition;
import framework.TestCase;
......@@ -90,7 +93,7 @@ public class TestMonitoringQueue2 extends TestCase implements MessageListener {
assertTrue(nbReceived == 1);
msg = sessionp.createMessage();
msg.setLongProperty("period", 2000L);
msg.setLongProperty("acquisition.period", 2000L);
msg.setStringProperty("AgentServer:server=AgentServer#0,cons=Transaction", "LogMemorySize,GarbageRatio");
producer.send(msg);
......@@ -116,7 +119,9 @@ public class TestMonitoringQueue2 extends TestCase implements MessageListener {
AdminModule.connect("localhost", 2560, "root", "root", 60);
// create a queue
Queue queue = Queue.create(0, "MonitoringQueue", Queue.MONITORING_QUEUE, null);
Properties properties = new Properties();
properties.put("acquisition.className", MonitoringAcquisition.class.getName());
Queue queue = Queue.create(0, "MonitoringQueue", Destination.ACQUISITION_QUEUE, properties);
// create a user
User.create("anonymous", "anonymous");
......
......@@ -23,6 +23,7 @@
package joram.monitoring;
import java.util.Enumeration;
import java.util.Properties;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
......@@ -35,11 +36,12 @@ import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.objectweb.joram.client.jms.Destination;
import org.objectweb.joram.client.jms.Queue;
import org.objectweb.joram.client.jms.admin.AdminModule;
import org.objectweb.joram.client.jms.admin.User;
import org.objectweb.joram.client.jms.tcp.TcpConnectionFactory;
import org.objectweb.joram.mom.dest.MonitoringAcquisition;
import framework.TestCase;
......@@ -91,7 +93,7 @@ public class TestMonitoringQueue3 extends TestCase implements MessageListener {
assertTrue(nbReceived == 1);
msg = sessionp.createMessage();
msg.setLongProperty("period", 2000L);
msg.setLongProperty("acquisition.period", 2000L);
msg.setStringProperty("AgentServer:server=AgentServer#0,cons=Transaction", "LogMemorySize,GarbageRatio");
producer.send(msg);
......@@ -119,7 +121,9 @@ public class TestMonitoringQueue3 extends TestCase implements MessageListener {
// create a user
User.create("anonymous", "anonymous");
Queue queue = Queue.create("JoramMonitoringQueue");
Properties properties = new Properties();
properties.put("acquisition.className", MonitoringAcquisition.class.getName());
Queue queue = Queue.create(0, "MonitoringQueue", Destination.ACQUISITION_QUEUE, properties);
// set permissions
queue.setFreeReading();
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2008 - 2009 ScalAgent Distributed Technologies
* Copyright (C) 2008 - 2010 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -34,11 +34,12 @@ import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.objectweb.joram.client.jms.Destination;
import org.objectweb.joram.client.jms.Topic;
import org.objectweb.joram.client.jms.admin.AdminModule;
import org.objectweb.joram.client.jms.admin.User;
import org.objectweb.joram.client.jms.tcp.TcpConnectionFactory;
import org.objectweb.joram.mom.dest.MonitoringAcquisition;
import framework.TestCase;
......@@ -74,7 +75,7 @@ public class TestMonitoringTopic1 extends TestCase implements MessageListener {
// the consumer records on the topic
consumer.setMessageListener(this);
Thread.sleep(10000);
Thread.sleep(12000);
assertTrue(nbReceived > 2);
......@@ -96,11 +97,12 @@ public class TestMonitoringTopic1 extends TestCase implements MessageListener {
AdminModule.connect("localhost", 2560, "root", "root", 60);
Properties properties = new Properties();
properties.put("period", "2000");
properties.put("acquisition.period", "2000");
properties.put("Joram#0:name=JoramAdminTopic,*", "DestinationId");
properties.put("acquisition.className", MonitoringAcquisition.class.getName());
// create a Topic
Topic topic = Topic.create(0, "MonitoringTopic", Topic.MONITORING_TOPIC, properties);
Topic topic = Topic.create(0, "MonitoringTopic", Destination.ACQUISITION_TOPIC, properties);
// create a user
User.create("anonymous", "anonymous");
......@@ -121,7 +123,7 @@ public class TestMonitoringTopic1 extends TestCase implements MessageListener {
public void onMessage(Message message) {
nbReceived++;
// System.out.println("\n --> Message received :" + message);
// System.out.println("\n --> Message received :" + message);
try {
String id = message.getStringProperty("Joram#0:type=Destination,name=JoramAdminTopic:DestinationId");
assertTrue("#0.0.10".equals(id));
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2008 - 2009 ScalAgent Distributed Technologies
* Copyright (C) 2008 - 2010 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -23,6 +23,7 @@
package joram.monitoring;
import java.util.Enumeration;
import java.util.Properties;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
......@@ -35,10 +36,12 @@ import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.objectweb.joram.client.jms.Destination;
import org.objectweb.joram.client.jms.Topic;
import org.objectweb.joram.client.jms.admin.AdminModule;
import org.objectweb.joram.client.jms.admin.User;
import org.objectweb.joram.client.jms.tcp.TcpConnectionFactory;
import org.objectweb.joram.mom.dest.MonitoringAcquisition;
import framework.TestCase;
......@@ -90,7 +93,7 @@ public class TestMonitoringTopic2 extends TestCase implements MessageListener {
assertTrue(nbReceived == 1);
msg = sessionp.createMessage();
msg.setLongProperty("period", 2000L);
msg.setLongProperty("acquisition.period", 2000L);
msg.setStringProperty("AgentServer:server=AgentServer#0,cons=Transaction", "LogMemorySize,GarbageRatio");
producer.send(msg);
......@@ -116,7 +119,9 @@ public class TestMonitoringTopic2 extends TestCase implements MessageListener {
AdminModule.connect("localhost", 2560, "root", "root", 60);
// create a Topic
Topic topic = Topic.create(0, "MonitoringTopic", Topic.MONITORING_TOPIC, null);
Properties properties = new Properties();
properties.put("acquisition.className", MonitoringAcquisition.class.getName());
Topic topic = Topic.create(0, "MonitoringTopic", Destination.ACQUISITION_TOPIC, properties);
// create a user
User.create("anonymous", "anonymous");
......
......@@ -23,6 +23,7 @@
package joram.monitoring;
import java.util.Enumeration;
import java.util.Properties;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
......@@ -35,11 +36,12 @@ import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.objectweb.joram.client.jms.Destination;
import org.objectweb.joram.client.jms.Topic;
import org.objectweb.joram.client.jms.admin.AdminModule;
import org.objectweb.joram.client.jms.admin.User;
import org.objectweb.joram.client.jms.tcp.TcpConnectionFactory;
import org.objectweb.joram.mom.dest.MonitoringAcquisition;
import framework.TestCase;
......@@ -91,7 +93,7 @@ public class TestMonitoringTopic3 extends TestCase implements MessageListener {
assertTrue(nbReceived == 1);
msg = sessionp.createMessage();
msg.setLongProperty("period", 2000L);
msg.setLongProperty("acquisition.period", 2000L);
msg.setStringProperty("AgentServer:server=AgentServer#0,cons=Transaction", "LogMemorySize,GarbageRatio");
producer.send(msg);
......@@ -119,7 +121,9 @@ public class TestMonitoringTopic3 extends TestCase implements MessageListener {
// create a user
User.create("anonymous", "anonymous");
Topic topic = Topic.create("JoramMonitoringTopic");
Properties properties = new Properties();
properties.put("acquisition.className", MonitoringAcquisition.class.getName());
Topic topic = Topic.create(0, "MonitoringTopic", Destination.ACQUISITION_TOPIC, properties);
// set permissions
topic.setFreeReading();
......
......@@ -7,8 +7,6 @@
<service class="org.objectweb.joram.mom.proxies.tcp.TcpProxyService" args="2560"/>
<service class="fr.dyade.aaa.jndi2.server.JndiServer" args="16400"/>
<service class="org.objectweb.joram.mom.dest.MonitoringTopic" />
<service class="org.objectweb.joram.mom.dest.MonitoringQueue" />
</server>
</config>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment