use of org.neo4j.bolt.messaging.BoltIOException in project neo4j by neo4j.
the class AbstractTransactionInitiatingMessage method shouldThrowExceptionIfFailedToParseAccessModeCorrectly.
@Test
void shouldThrowExceptionIfFailedToParseAccessModeCorrectly() throws Throwable {
// Given
Map<String, Object> msgMetadata = map("mode", 666);
MapValue meta = ValueUtils.asMapValue(msgMetadata);
// When & Then
BoltIOException exception = assertThrows(BoltIOException.class, () -> createMessage(meta));
assertThat(exception.getMessage()).startsWith("Expecting access mode value to be a String value");
}
use of org.neo4j.bolt.messaging.BoltIOException in project neo4j by neo4j.
the class DiscardMessageTest method shouldThrowExceptionIfFailedToParseTransactionMetadataCorrectly.
@Test
void shouldThrowExceptionIfFailedToParseTransactionMetadataCorrectly() throws Throwable {
// Given
Map<String, Object> msgMetadata = map("n", "invalid value type");
MapValue meta = ValueUtils.asMapValue(msgMetadata);
// When & Then
BoltIOException exception = assertThrows(BoltIOException.class, () -> new DiscardMessage(meta));
assertThat(exception.getMessage()).startsWith("Expecting DISCARD size n to be a Long value, but got: String(\"invalid value type\")");
}
use of org.neo4j.bolt.messaging.BoltIOException in project neo4j by neo4j.
the class DiscardMessageTest method shouldThrowExceptionIfMissingMeta.
@Test
void shouldThrowExceptionIfMissingMeta() throws Throwable {
// When & Then
BoltIOException exception = assertThrows(BoltIOException.class, () -> new DiscardMessage(MapValue.EMPTY));
assertThat(exception.getMessage()).startsWith("Expecting DISCARD size n to be a Long value, but got: NO_VALUE");
}
use of org.neo4j.bolt.messaging.BoltIOException in project neo4j by neo4j.
the class TransactionStateMachineSPIProviderV4Test method shouldErrorIfDatabaseNotFound.
@Test
void shouldErrorIfDatabaseNotFound() {
DatabaseManagementService managementService = mock(DatabaseManagementService.class);
var databaseName = "database";
when(managementService.database(databaseName)).thenThrow(new DatabaseNotFoundException(databaseName));
TransactionStateMachineSPIProvider spiProvider = newSpiProvider(managementService);
BoltIOException error = assertThrows(BoltIOException.class, () -> spiProvider.getTransactionStateMachineSPI(databaseName, mock(StatementProcessorReleaseManager.class)));
assertThat(error.status()).isEqualTo(Status.Database.DatabaseNotFound);
assertThat(error.getMessage()).contains("Database does not exist. Database name: 'database'.");
}
use of org.neo4j.bolt.messaging.BoltIOException in project neo4j by neo4j.
the class MessageMetadataParserTest method shouldThrowForIncorrectDatabaseName.
@Test
void shouldThrowForIncorrectDatabaseName() {
BoltIOException e = assertThrows(BoltIOException.class, () -> parseDatabaseName(asMapValue(map("db", 10L))));
assertTrue(e.causesFailureMessage());
}
Aggregations