Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Validation of the management server broadcasting

  • Loading branch information...
commit 293ce56fd73c9b4ad2c3cdf47c175c913c856f3e 2 parents c8ed478 + 984bb42
@sskhiri sskhiri authored
View
5 NOTICE
@@ -20,4 +20,7 @@ and founded by EURANOVA
Portions of this software were developed in collaboration with
the "Université Libre de Bruxelles" (ULB) in Brussels, Belgium.
-This software built upon the ZeroMQ library, developed a.o. by Pieter Hintjens
+This software built upon the ZeroMQ library, developed a.o. by Pieter Hintjens,
+the sqlite-jdbc developed by xerial,
+the BSON encoder/decoder provided by the mongo-DB driver and developed by Mongo DB,
+and finally Maven2 for the build and Jenkins for the continous integration.
View
10 roq-management/src/main/java/org/roqmessaging/management/GlobalConfigurationManager.java
@@ -71,8 +71,10 @@
/**
* Constructor.
+ * @param period the period for sending the configuration udpate to the
+ * management controller.
*/
- public GlobalConfigurationManager() {
+ public GlobalConfigurationManager( int period) {
this.hostManagerAddresses = new ArrayList<String>();
this.logger.info("Started global config Runnable");
this.queueMonitorLocations = new HashMap<String, String>();
@@ -85,12 +87,14 @@ public GlobalConfigurationManager() {
//Init variables and pointers
this.running = true;
this.serializationUtils = new RoQSerializationUtils();
+ this.configPeriod = period;
//The shutdown thread
this.shutDownMonitor = new ShutDownMonitor(5001, this);
new Thread(this.shutDownMonitor).start();
- //The mngt controller
- this.mngtController = new MngtController("localhost", dbName, 60000);
+
+ //The Management controller - the start is in the run to take the period attribute
+ this.mngtController = new MngtController("localhost", dbName, (this.configPeriod+500));
new Thread(mngtController).start();
}
View
2  ...ement/src/main/java/org/roqmessaging/management/launcher/GlobalConfigurationLauncher.java
@@ -32,7 +32,7 @@
*/
public static void main(String[] args) {
System.out.println("Starting the global configuration manager");
- GlobalConfigurationManager configurationManager = new GlobalConfigurationManager();
+ GlobalConfigurationManager configurationManager = new GlobalConfigurationManager(60000);
ShutDownHook hook = new ShutDownHook(configurationManager.getShutDownMonitor());
Runtime.getRuntime().addShutdownHook(hook);
Thread configThread = new Thread(configurationManager);
View
6 roq-management/src/main/java/org/roqmessaging/management/serializer/RoQBSONSerializer.java
@@ -72,7 +72,7 @@
logger.debug("Encoding hosts in BSON ...");
// Create the bson object
BSONObject bsonObject = new BasicBSONObject();
- bsonObject.put("hosts", hosts);
+ bsonObject.put("Hosts", hosts);
logger.debug(bsonObject.toString());
// Encode the object
@@ -84,7 +84,7 @@
*/
public byte[] serialiseCMDID(int cmd) {
BSONObject bsonObject = new BasicBSONObject();
- bsonObject.put("CMD_ID", cmd);
+ bsonObject.put("CMD", cmd);
logger.debug("Encoding CMD ID in BSON= "+bsonObject.toString());
return BSON.encode(bsonObject);
}
@@ -117,7 +117,7 @@
@SuppressWarnings("unchecked")
public List<String> unSerializeHosts(byte[] encodedH) {
BSONObject newHostObject = decoder.readObject(encodedH);
- return (ArrayList<String>) newHostObject.get("hosts");
+ return (ArrayList<String>) newHostObject.get("Hosts");
}
/**
View
2  roq-management/src/test/java/org/roqmessaging/management/TestLogicalQueue.java
@@ -48,7 +48,7 @@ public void setUp() throws Exception {
this.logger.info("Initial setup Start global config thread");
this.logger.info("Start global config...");
if (configurationManager == null) {
- configurationManager = new GlobalConfigurationManager();
+ configurationManager = new GlobalConfigurationManager(4000);
Thread configThread = new Thread(configurationManager);
configThread.start();
}
View
11 roq-simulation/src/main/java/org/roq/simulation/RoQAllLocalLauncher.java
@@ -18,6 +18,7 @@
import org.roqmessaging.core.utils.RoQUtils;
import org.roqmessaging.management.GlobalConfigurationManager;
import org.roqmessaging.management.HostConfigManager;
+import org.roqmessaging.management.server.MngtController;
/**
* Class RoQAllLocalLauncher
@@ -47,8 +48,7 @@ public void setUp() throws Exception {
this.configurationServer =RoQUtils.getInstance().getLocalIP().toString();
this.logger.info("Initial setup Start global config thread");
this.logger.info("Start global config...");
- configurationManager = new GlobalConfigurationManager();
- this.configurationManager.setConfigPeriod(configPeriod);
+ configurationManager = new GlobalConfigurationManager(configPeriod);
Thread configThread = new Thread(configurationManager);
configThread.start();
// 2. Start the host configuration manager locally
@@ -136,4 +136,11 @@ public int getConfigPeriod() {
public void setConfigPeriod(int configPeriod) {
this.configPeriod = configPeriod;
}
+
+ /**
+ * @return the mangement controller handle
+ */
+ public MngtController getMngtController(){
+ return this.configurationManager.getMngtController();
+ }
}
View
2  roq-simulation/src/test/java/org/roq/simulation/BasicSetupTest.java
@@ -75,7 +75,7 @@ public void setUp() throws Exception {
* Start the global configuration thread
*/
private void startGlobalConfig() {
- this.configManager = new GlobalConfigurationManager();
+ this.configManager = new GlobalConfigurationManager(4000);
//1. start a host config manager
this.logger.info("Start host config...");
if(hostConfigManager==null){
View
12 roq-simulation/src/test/java/org/roqmessaging/management/server/TestMngtController.java
@@ -25,7 +25,6 @@
import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.roq.simulation.RoQAllLocalLauncher;
import org.roqmessaging.core.utils.RoQUtils;
@@ -38,7 +37,7 @@
*
* @author sskhiri
*/
-@Ignore
+//@Ignore
public class TestMngtController {
private RoQAllLocalLauncher launcher = null;
private Logger logger = Logger.getLogger(TestMngtController.class);
@@ -68,6 +67,7 @@ public void setUp() throws Exception {
this.launcher.setConfigPeriod(3000);
this.launcher.setUp();
this.factory = new LogicalQFactory(RoQUtils.getInstance().getLocalIP().toString());
+ this.mngtController = this.launcher.getMngtController();
}
/**
@@ -87,9 +87,11 @@ public void test() {
// 1. Create Q
this.factory.createQueue("queue1", RoQUtils.getInstance().getLocalIP().toString());
this.factory.createQueue("queueTest", RoQUtils.getInstance().getLocalIP().toString());
- //2. Init the management controller
- mngtController = new MngtController(RoQUtils.getInstance().getLocalIP(), "SampleManagement.db", 4000);
- new Thread(mngtController).start();
+
+ //2. Start the test class
+ MngtSubscriber subscriber = new MngtSubscriber();
+ new Thread(subscriber).start();
+
//3. Sleep for test
Thread.sleep(5000);
View
3  roq-simulation/src/test/java/org/roqmessaging/management/server/UnitTestManagement.java
@@ -69,8 +69,7 @@ public void setUp() throws Exception {
statement.executeUpdate("drop table if exists Queues");
//Start the config
- globalConfigurationManager = new GlobalConfigurationManager();
- globalConfigurationManager.setConfigPeriod(3000);
+ globalConfigurationManager = new GlobalConfigurationManager(3000);
new Thread(globalConfigurationManager).start();
//Launching a thread that listens the broadcast channel for management update
Please sign in to comment.
Something went wrong with that request. Please try again.