use of org.neo4j.bolt.BoltProtocolVersion in project neo4j by neo4j.
the class BoltProtocolV42Test method shouldVersionReturnBoltV42.
@Test
void shouldVersionReturnBoltV42() {
BoltProtocolV42 protocolV42 = createProtocolV42();
assertThat(protocolV42.version()).isEqualTo(new BoltProtocolVersion(4, 2));
}
use of org.neo4j.bolt.BoltProtocolVersion in project neo4j by neo4j.
the class BoltProtocolV43Test method shouldVersionReturnBoltV43.
@Test
void shouldVersionReturnBoltV43() {
BoltProtocolV43 protocolV43 = createProtocolV43();
assertThat(protocolV43.version()).isEqualTo(new BoltProtocolVersion(4, 3));
}
use of org.neo4j.bolt.BoltProtocolVersion in project neo4j by neo4j.
the class DefaultBoltProtocolFactoryTest method shouldCreateBoltProtocol.
@ParameterizedTest(name = "V{0}.{1}")
@CsvSource({ "3, 0", "4, 0", "4, 1", "4, 2", "4, 3" })
void shouldCreateBoltProtocol(int majorVersion, int minorVersion) throws Throwable {
EmbeddedChannel channel = new EmbeddedChannel();
BoltChannel boltChannel = newTestBoltChannel(channel);
BoltProtocolVersion boltProtocolVersion = new BoltProtocolVersion(majorVersion, minorVersion);
BoltStateMachineFactory stateMachineFactory = mock(BoltStateMachineFactory.class);
BoltStateMachine stateMachine = mock(BoltStateMachine.class);
var channelProtector = mock(ChannelProtector.class);
var memoryTracker = mock(MemoryTracker.class, RETURNS_MOCKS);
when(stateMachineFactory.newStateMachine(boltProtocolVersion, boltChannel, MapValue.EMPTY, memoryTracker)).thenReturn(stateMachine);
BoltConnectionFactory connectionFactory = mock(BoltConnectionFactory.class);
BoltConnection connection = mock(BoltConnection.class);
when(connectionFactory.newConnection(eq(boltChannel), eq(stateMachine), any())).thenReturn(connection);
BoltProtocolFactory factory = new DefaultBoltProtocolFactory(connectionFactory, stateMachineFactory, Config.defaults(), NullLogService.getInstance(), new TestDatabaseIdRepository(), CustomBookmarkFormatParser.DEFAULT, mock(TransportThrottleGroup.class), Clocks.fakeClock(), Duration.ZERO);
BoltProtocol protocol = factory.create(boltProtocolVersion, boltChannel, channelProtector, memoryTracker);
protocol.install();
// handler with correct version is created
assertEquals(boltProtocolVersion, protocol.version());
// it uses the expected worker
verify(connectionFactory).newConnection(eq(boltChannel), any(BoltStateMachine.class), any(BoltResponseMessageWriter.class));
verify(memoryTracker, times(5)).allocateHeap(anyLong());
// and halts this same worker when closed
verify(connection, never()).stop();
channel.close();
verify(connection).stop();
channel.finishAndReleaseAll();
}
use of org.neo4j.bolt.BoltProtocolVersion in project neo4j by neo4j.
the class BoltProtocolV41Test method shouldVersionReturnBoltV41.
@Test
void shouldVersionReturnBoltV41() {
BoltProtocolV41 protocolV41 = createProtocolV41();
assertThat(protocolV41.version()).isEqualTo(new BoltProtocolVersion(4, 1));
}
use of org.neo4j.bolt.BoltProtocolVersion in project neo4j by neo4j.
the class BoltProtocolV3Test method shouldVersionReturnBoltV3.
@Test
void shouldVersionReturnBoltV3() throws Throwable {
BoltProtocolV3 protocolV3 = createProtocolV3();
assertThat(protocolV3.version()).isEqualTo(new BoltProtocolVersion(3, 0));
}
Aggregations