Search in sources :

Example 1 with InstanceInfo

use of org.neo4j.management.InstanceInfo in project graphdb by neo4j-attic.

the class TestHaBean method canConnectToInstance.

@Test
public void canConnectToInstance() throws Exception {
    Neo4jManager neo4j = new Neo4jManager(db.getManagementBean(Kernel.class));
    HighAvailability ha = neo4j.getHighAvailabilityBean();
    InstanceInfo[] instances = ha.getInstancesInCluster();
    assertNotNull(instances);
    assertEquals(1, instances.length);
    InstanceInfo instance = instances[0];
    assertNotNull(instance);
    Pair<Neo4jManager, HighAvailability> proc = instance.connect();
    assertNotNull("could not connect", proc);
    neo4j = proc.first();
    ha = proc.other();
    assertNotNull(neo4j);
    assertNotNull(ha);
    instances = ha.getInstancesInCluster();
    assertNotNull(instances);
    assertEquals(1, instances.length);
    assertEquals(instance.getAddress(), instances[0].getAddress());
    assertEquals(instance.getInstanceId(), instances[0].getInstanceId());
}
Also used : Neo4jManager(org.neo4j.management.Neo4jManager) HighAvailability(org.neo4j.management.HighAvailability) Kernel(org.neo4j.jmx.Kernel) InstanceInfo(org.neo4j.management.InstanceInfo) Test(org.junit.Test)

Example 2 with InstanceInfo

use of org.neo4j.management.InstanceInfo in project graphdb by neo4j-attic.

the class TestHaBean method canGetInstanceConnectionInformation.

@Test
public void canGetInstanceConnectionInformation() throws Exception {
    Neo4jManager neo4j = new Neo4jManager(db.getManagementBean(Kernel.class));
    InstanceInfo[] instances = neo4j.getHighAvailabilityBean().getInstancesInCluster();
    assertNotNull(instances);
    assertEquals(1, instances.length);
    InstanceInfo instance = instances[0];
    assertNotNull(instance);
    String address = instance.getAddress();
    assertNotNull("No JMX address for instance", address);
    String id = instance.getInstanceId();
    assertNotNull("No instance id", id);
}
Also used : Neo4jManager(org.neo4j.management.Neo4jManager) Kernel(org.neo4j.jmx.Kernel) InstanceInfo(org.neo4j.management.InstanceInfo) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Kernel (org.neo4j.jmx.Kernel)2 InstanceInfo (org.neo4j.management.InstanceInfo)2 Neo4jManager (org.neo4j.management.Neo4jManager)2 HighAvailability (org.neo4j.management.HighAvailability)1