true local replication test case that creates a leaderboard which is replicated automatically

This commit is contained in:
Axel Uhl
2012-05-03 00:26:01 +02:00
parent 9d74329444
commit 2f2901355c
14 changed files with 164 additions and 52 deletions
@@ -20,7 +20,7 @@ public class Activator implements BundleActivator {
MessageBrokerConfiguration brokerConfig = new MessageBrokerConfiguration("SailingServerReplicationBroker",
"tcp://localhost:61616", new File(tmpDir, "kahadb").getAbsolutePath());
messageBrokerManager = new MessageBrokerManager(brokerConfig);
messageBrokerManager.startMessageBroker();
messageBrokerManager.startMessageBroker(true);
messageBrokerManager.createAndStartConnection();
replicationInstancesManager = new ReplicationInstancesManager();
ReplicationService serverReplicationMasterService = new ReplicationServiceImpl(replicationInstancesManager, messageBrokerManager);
@@ -24,13 +24,13 @@ public class MessageBrokerManager {
this.configuration = configuration;
}
public void startMessageBroker() throws Exception {
public void startMessageBroker(boolean useJmx) throws Exception {
broker = new BrokerService();
broker.setBrokerName(configuration.getBrokerName());
if (configuration.getDataStoreDirectory() != null) {
broker.setDataDirectory(configuration.getDataStoreDirectory());
}
broker.setUseJmx(true);
broker.setUseJmx(useJmx);
TransportConnector transportConnector = new TransportConnector();
transportConnector.setUri(new URI(configuration.getBrokerUrl()));
broker.addConnector(transportConnector);
@@ -174,7 +174,7 @@ public class ReplicationServiceImpl implements ReplicationService, OperationExec
}
/**
* @return the UUID that the master generated for this client which is alsy entered into {@link #replicaUUIDs}
* @return the UUID that the master generated for this client which is also entered into {@link #replicaUUIDs}
*/
private String registerReplicaWithMaster(ReplicationMasterDescriptor master) throws IOException, ClassNotFoundException {
URL replicationRegistrationRequestURL = master.getReplicationRegistrationRequestURL();
@@ -189,7 +189,7 @@ public class ReplicationServiceImpl implements ReplicationService, OperationExec
read = content.read(buf);
}
String replicaUUID = uuid.toString();
replicaUUIDs.put(master, replicaUUID);
registerReplicaUuidForMaster(replicaUUID, master);
return replicaUUID;
}
@@ -201,5 +201,9 @@ public class ReplicationServiceImpl implements ReplicationService, OperationExec
throw new RuntimeException(e);
}
}
protected void registerReplicaUuidForMaster(String uuid, ReplicationMasterDescriptor master) {
replicaUUIDs.put(master, uuid);
}
}