Search in sources :

Example 1 with ServiceUnavailableException

use of org.neo4j.driver.v1.exceptions.ServiceUnavailableException in project neo4j by neo4j.

the class BoltCausalClusteringIT method sessionCreationShouldFailIfCallingDiscoveryProcedureOnEdgeServer.

@Test
public void sessionCreationShouldFailIfCallingDiscoveryProcedureOnEdgeServer() throws Exception {
    // given
    cluster = clusterRule.withNumberOfReadReplicas(1).startCluster();
    ReadReplica readReplica = cluster.getReadReplicaById(0);
    try {
        GraphDatabase.driver(readReplica.routingURI(), AuthTokens.basic("neo4j", "neo4j"));
        fail("Should have thrown an exception using a read replica address for routing");
    } catch (ServiceUnavailableException ex) {
        // then
        assertEquals(format("Server %s couldn't perform discovery", readReplica.boltAdvertisedAddress()), ex.getMessage());
    }
}
Also used : ReadReplica(org.neo4j.causalclustering.discovery.ReadReplica) ServiceUnavailableException(org.neo4j.driver.v1.exceptions.ServiceUnavailableException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 ReadReplica (org.neo4j.causalclustering.discovery.ReadReplica)1 ServiceUnavailableException (org.neo4j.driver.v1.exceptions.ServiceUnavailableException)1