use of org.neo4j.kernel.ha.FakeMasterBroker in project graphdb by neo4j-attic.
the class StandaloneDatabase method withFakeBroker.
public static StandaloneDatabase withFakeBroker(String testMethodName, final File path, int machineId, final int masterId, String[] extraArgs) {
StandaloneDatabase standalone = new StandaloneDatabase(testMethodName, new Bootstrap(path, machineId) {
@Override
HighlyAvailableGraphDatabase start(String storeDir, Map<String, String> config) {
final PlaceHolderGraphDatabaseService placeHolderGraphDb = new PlaceHolderGraphDatabaseService(path.getAbsolutePath());
final Broker broker;
if (machineId == masterId) {
broker = new FakeMasterBroker(machineId, placeHolderGraphDb);
} else {
broker = new FakeSlaveBroker(new MasterClient("localhost", Protocol.PORT, placeHolderGraphDb), masterId, machineId, placeHolderGraphDb);
}
HighlyAvailableGraphDatabase db = new HighlyAvailableGraphDatabase(storeDir, config, AbstractHaTest.wrapBrokerAndSetPlaceHolderDb(placeHolderGraphDb, broker));
placeHolderGraphDb.setDb(db);
System.out.println("Started HA db (w/o zoo keeper)");
return db;
}
});
standalone.awaitStarted();
return standalone;
}
Aggregations