Search in sources :

Example 1 with HighAvailability

use of org.neo4j.management.HighAvailability 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 HighAvailability

use of org.neo4j.management.HighAvailability in project neo4j by neo4j.

the class HaBeanIT method shouldAccessHaBeans.

@Test
public void shouldAccessHaBeans() throws Throwable {
    ManagedCluster cluster = clusterRule.startCluster();
    // High Availability bean
    HighAvailability ha = ha(cluster.getMaster());
    assertNotNull("could not get ha bean", ha);
    assertMasterInformation(ha);
    assertMasterAndSlaveInformation(ha.getInstancesInCluster());
    for (ClusterMemberInfo info : ha.getInstancesInCluster()) {
        assertTrue(info.isAlive());
        assertTrue(info.isAvailable());
    }
    // Branched data bean
    BranchedStore bs = beans(cluster.getMaster()).getBranchedStoreBean();
    assertNotNull("could not get branched store bean", bs);
}
Also used : ClusterMemberInfo(org.neo4j.management.ClusterMemberInfo) ManagedCluster(org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster) HighAvailability(org.neo4j.management.HighAvailability) BranchedStore(org.neo4j.management.BranchedStore) Test(org.junit.Test)

Example 3 with HighAvailability

use of org.neo4j.management.HighAvailability 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 4 with HighAvailability

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

the class Neo4jPlugin method addTabs.

private void addTabs(ManagementAccess manager, String suffix, Map<String, JPanel> result) {
    result.put("Neo4j" + suffix, add(new KernelWidget(manager)));
    try {
        HighAvailability ha = manager.getBean(HighAvailability.class);
        if (ha != null) {
            result.put("Neo4j HA" + suffix, add(new HaWidget(manager, ha)));
        }
    } catch (Exception haNotAvailable) {
    // ok, just don't include HA info
    }
    try {
        RemoteConnection remote = manager.getBean(RemoteConnection.class);
        if (remote != null) {
            DataBrowser browser = new DataBrowser(remote);
            result.put("Neo4j Graph" + suffix, browser.view());
        }
    } catch (LinkageError dataBrowserNotAvailable) {
    // ok, just don't data browser
    } catch (Exception dataBrowserNotAvailable) {
    // ok, just don't data browser
    }
}
Also used : HighAvailability(org.neo4j.management.HighAvailability) RemoteConnection(org.neo4j.management.RemoteConnection)

Aggregations

HighAvailability (org.neo4j.management.HighAvailability)4 Test (org.junit.Test)3 Kernel (org.neo4j.jmx.Kernel)2 Neo4jManager (org.neo4j.management.Neo4jManager)2 ManagedCluster (org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster)1 BranchedStore (org.neo4j.management.BranchedStore)1 ClusterMemberInfo (org.neo4j.management.ClusterMemberInfo)1 InstanceInfo (org.neo4j.management.InstanceInfo)1 RemoteConnection (org.neo4j.management.RemoteConnection)1