use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class AbstractTransactionInitiatingMessage method shouldParseTransactionTimeoutCorrectly.
@Test
void shouldParseTransactionTimeoutCorrectly() throws Throwable {
// Given
Map<String, Object> msgMetadata = map("tx_timeout", 123456L);
MapValue meta = ValueUtils.asMapValue(msgMetadata);
// When
TransactionInitiatingMessage beginMessage = createMessage(meta);
// Then
assertThat(beginMessage.transactionTimeout().toMillis()).isEqualTo(123456L);
}
use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class AbstractTransactionInitiatingMessage method shouldParseReadAccessModeCorrectly.
@Test
void shouldParseReadAccessModeCorrectly() throws Throwable {
// Given
Map<String, Object> msgMetadata = map("mode", "r");
MapValue meta = ValueUtils.asMapValue(msgMetadata);
// When
TransactionInitiatingMessage beginMessage = createMessage(meta);
// Then
assertThat(beginMessage.getAccessMode()).isEqualTo(AccessMode.READ);
}
use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class AbstractTransactionInitiatingMessage method shouldThrowExceptionIfFailedToParseTransactionMetadataCorrectly.
@Test
void shouldThrowExceptionIfFailedToParseTransactionMetadataCorrectly() throws Throwable {
// Given
Map<String, Object> msgMetadata = map("tx_metadata", "invalid value type");
MapValue meta = ValueUtils.asMapValue(msgMetadata);
// When & Then
BoltIOException exception = assertThrows(BoltIOException.class, () -> createMessage(meta));
assertThat(exception.getMessage()).startsWith("Expecting transaction metadata value to be a Map value");
}
use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class AbstractTransactionInitiatingMessage method shouldParseNoAccessModeCorrectly.
@Test
void shouldParseNoAccessModeCorrectly() throws Throwable {
// Given
Map<String, Object> msgMetadata = map();
MapValue meta = ValueUtils.asMapValue(msgMetadata);
// When
TransactionInitiatingMessage beginMessage = createMessage(meta);
// Then
assertThat(beginMessage.getAccessMode()).isEqualTo(AccessMode.WRITE);
}
use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class AbstractTransactionInitiatingMessage method shouldThrowExceptionIfFailedToParseTransactionTimeoutCorrectly.
@Test
void shouldThrowExceptionIfFailedToParseTransactionTimeoutCorrectly() throws Throwable {
// Given
Map<String, Object> msgMetadata = map("tx_timeout", "invalid value type");
MapValue meta = ValueUtils.asMapValue(msgMetadata);
// When & Then
BoltIOException exception = assertThrows(BoltIOException.class, () -> createMessage(meta));
assertThat(exception.getMessage()).startsWith("Expecting transaction timeout value to be a Long value");
}
Aggregations