use of org.neo4j.kernel.ha.MasterClient214 in project neo4j by neo4j.
the class MasterClientResolverTest method shouldResolveMasterClientFactory.
@Test
public void shouldResolveMasterClientFactory() throws Exception {
// Given
LogEntryReader<ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader<>();
MasterClientResolver resolver = new MasterClientResolver(NullLogProvider.getInstance(), ResponseUnpacker.NO_OP_RESPONSE_UNPACKER, mock(InvalidEpochExceptionHandler.class), 1, 1, 1, 1024, Suppliers.singleton(logEntryReader));
LifeSupport life = new LifeSupport();
try {
life.start();
MasterClient masterClient1 = resolver.instantiate("cluster://localhost", 44, null, new Monitors(), StoreId.DEFAULT, life);
assertThat(masterClient1, instanceOf(MasterClient320.class));
} finally {
life.shutdown();
}
IllegalProtocolVersionException illegalProtocolVersionException = new IllegalProtocolVersionException(MasterClient214.PROTOCOL_VERSION.getApplicationProtocol(), MasterClient310.PROTOCOL_VERSION.getApplicationProtocol(), "Protocol is too modern");
// When
resolver.handle(illegalProtocolVersionException);
// Then
life = new LifeSupport();
try {
life.start();
MasterClient masterClient2 = resolver.instantiate("cluster://localhost", 55, null, new Monitors(), StoreId.DEFAULT, life);
assertThat(masterClient2, instanceOf(MasterClient214.class));
} finally {
life.shutdown();
}
}
Aggregations