Search in sources :

Example 1 with Neo4jManager

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

the class TestHaBean method canGetHaBean.

@Test
public void canGetHaBean() throws Exception {
    Neo4jManager neo4j = new Neo4jManager(db.getManagementBean(Kernel.class));
    HighAvailability ha = neo4j.getHighAvailabilityBean();
    assertNotNull("could not get ha bean", ha);
    assertTrue("single instance should be master", ha.isMaster());
}
Also used : Neo4jManager(org.neo4j.management.Neo4jManager) HighAvailability(org.neo4j.management.HighAvailability) Kernel(org.neo4j.jmx.Kernel) Test(org.junit.Test)

Example 2 with Neo4jManager

use of org.neo4j.management.Neo4jManager 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 3 with Neo4jManager

use of org.neo4j.management.Neo4jManager 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)3 Kernel (org.neo4j.jmx.Kernel)3 Neo4jManager (org.neo4j.management.Neo4jManager)3 HighAvailability (org.neo4j.management.HighAvailability)2 InstanceInfo (org.neo4j.management.InstanceInfo)2