use of org.neo4j.graphdb.factory.TestHighlyAvailableGraphDatabaseFactory in project neo4j by neo4j.
the class ClusterTest method testInstancesWithConflictingHaPorts.
@Test
public void testInstancesWithConflictingHaPorts() throws Throwable {
HighlyAvailableGraphDatabase first = null;
try {
File storeDir = testDirectory.directory("testConflictingHaPorts");
first = (HighlyAvailableGraphDatabase) new TestHighlyAvailableGraphDatabaseFactory().newEmbeddedDatabaseBuilder(storeDir).setConfig(ClusterSettings.initial_hosts, "127.0.0.1:5001").setConfig(ClusterSettings.cluster_server, "127.0.0.1:5001").setConfig(ClusterSettings.server_id, "1").setConfig(HaSettings.ha_server, "127.0.0.1:6666").newGraphDatabase();
try {
HighlyAvailableGraphDatabase failed = (HighlyAvailableGraphDatabase) new TestHighlyAvailableGraphDatabaseFactory().newEmbeddedDatabaseBuilder(storeDir).setConfig(ClusterSettings.initial_hosts, "127.0.0.1:5001").setConfig(ClusterSettings.cluster_server, "127.0.0.1:5002").setConfig(ClusterSettings.server_id, "2").setConfig(HaSettings.ha_server, "127.0.0.1:6666").newGraphDatabase();
failed.shutdown();
fail("Should not start when ports conflict");
} catch (Exception e) {
// good
}
} finally {
if (first != null) {
first.shutdown();
}
}
}
use of org.neo4j.graphdb.factory.TestHighlyAvailableGraphDatabaseFactory in project neo4j by neo4j.
the class TestInstanceJoin method start.
private static HighlyAvailableGraphDatabase start(File storeDir, int i, Map<String, String> additionalConfig) {
HighlyAvailableGraphDatabase db = (HighlyAvailableGraphDatabase) new TestHighlyAvailableGraphDatabaseFactory().newEmbeddedDatabaseBuilder(storeDir).setConfig(ClusterSettings.cluster_server, "127.0.0.1:" + (5001 + i)).setConfig(ClusterSettings.server_id, i + "").setConfig(HaSettings.ha_server, "127.0.0.1:" + (6666 + i)).setConfig(HaSettings.pull_interval, "0ms").setConfig(additionalConfig).newGraphDatabase();
awaitStart(db);
return db;
}
use of org.neo4j.graphdb.factory.TestHighlyAvailableGraphDatabaseFactory in project neo4j by neo4j.
the class ClusterTest method testInstancesWithConflictingClusterPorts.
@Test
public void testInstancesWithConflictingClusterPorts() throws Throwable {
HighlyAvailableGraphDatabase first = null;
try {
File masterStoreDir = testDirectory.directory("testConflictingClusterPortsMaster");
first = (HighlyAvailableGraphDatabase) new TestHighlyAvailableGraphDatabaseFactory().newEmbeddedDatabaseBuilder(masterStoreDir).setConfig(ClusterSettings.initial_hosts, "127.0.0.1:5001").setConfig(ClusterSettings.cluster_server, "127.0.0.1:5001").setConfig(ClusterSettings.server_id, "1").setConfig(HaSettings.ha_server, "127.0.0.1:6666").newGraphDatabase();
try {
File slaveStoreDir = testDirectory.directory("testConflictingClusterPortsSlave");
HighlyAvailableGraphDatabase failed = (HighlyAvailableGraphDatabase) new TestHighlyAvailableGraphDatabaseFactory().newEmbeddedDatabaseBuilder(slaveStoreDir).setConfig(ClusterSettings.initial_hosts, "127.0.0.1:5001").setConfig(ClusterSettings.cluster_server, "127.0.0.1:5001").setConfig(ClusterSettings.server_id, "2").setConfig(HaSettings.ha_server, "127.0.0.1:6667").newGraphDatabase();
failed.shutdown();
fail("Should not start when ports conflict");
} catch (Exception e) {
// good
}
} finally {
if (first != null) {
first.shutdown();
}
}
}
Aggregations