use of com.sleepycat.je.rep.ReplicaWriteException in project qpid-broker-j by apache.
the class ReplicatedEnvironmentFacadeTest method testReplicaWriteExceptionIsConvertedIntoConnectionScopedRuntimeException.
@Test
public void testReplicaWriteExceptionIsConvertedIntoConnectionScopedRuntimeException() throws Exception {
ReplicatedEnvironmentFacade master = createMaster();
String nodeName2 = TEST_NODE_NAME + "_2";
String host = "localhost";
int port = _portHelper.getNextAvailable();
String node2NodeHostPort = host + ":" + port;
final ReplicatedEnvironmentFacade replica = createReplica(nodeName2, node2NodeHostPort, new NoopReplicationGroupListener());
// close the master
master.close();
try {
replica.openDatabase("test", DatabaseConfig.DEFAULT.setAllowCreate(true));
fail("Replica write operation should fail");
} catch (ReplicaWriteException e) {
RuntimeException handledException = master.handleDatabaseException("test", e);
final boolean condition = handledException instanceof ConnectionScopedRuntimeException;
assertTrue("Unexpected exception", condition);
}
}
Aggregations