GH-17 - Polishing.
Formatting. Nullability constraints.
This commit is contained in:
@@ -60,23 +60,25 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Test Containers -->
|
||||
<!-- Testcontainers -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>testcontainers</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hsqldb</groupId>
|
||||
@@ -97,4 +99,5 @@
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -97,9 +97,10 @@ class JdbcEventPublicationRepository implements EventPublicationRepository {
|
||||
(rs, rowNum) -> rs.getObject("ID", UUID.class), serializedEvent, publication.getTargetIdentifier().getValue());
|
||||
|
||||
if (!results.isEmpty()) {
|
||||
operations.update(
|
||||
SQL_STATEMENT_UPDATE,
|
||||
publication.getCompletionDate().map(Timestamp::from).orElse(null),
|
||||
|
||||
operations.update( //
|
||||
SQL_STATEMENT_UPDATE, //
|
||||
publication.getCompletionDate().map(Timestamp::from).orElse(null), //
|
||||
results.get(0));
|
||||
}
|
||||
|
||||
@@ -114,11 +115,12 @@ class JdbcEventPublicationRepository implements EventPublicationRepository {
|
||||
var results = operations.query(SQL_STATEMENT_FIND_BY_EVENT_AND_LISTENER_ID, this::resultSetToPublications,
|
||||
serializeEvent(event), targetIdentifier.getValue());
|
||||
|
||||
return Optional.ofNullable((results == null) || results.isEmpty() ? null : results.get(0));
|
||||
return Optional.ofNullable(results == null || results.isEmpty() ? null : results.get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
@SuppressWarnings("null")
|
||||
public List<EventPublication> findIncompletePublications() {
|
||||
return operations.query(SQL_STATEMENT_FIND_UNCOMPLETED, this::resultSetToPublications);
|
||||
}
|
||||
@@ -195,13 +197,13 @@ class JdbcEventPublicationRepository implements EventPublicationRepository {
|
||||
private static class JdbcEventPublication implements CompletableEventPublication {
|
||||
|
||||
private final UUID id;
|
||||
private final @Nullable Instant publicationDate;
|
||||
private final Instant publicationDate;
|
||||
private final String listenerId;
|
||||
private final String serializedEvent;
|
||||
private final Class<?> eventType;
|
||||
|
||||
private final EventSerializer serializer;
|
||||
private Instant completionDate;
|
||||
private @Nullable Instant completionDate;
|
||||
|
||||
@Override
|
||||
public Object getEvent() {
|
||||
|
||||
@@ -46,7 +46,6 @@ class DatabaseSchemaInitializerIntegrationTests {
|
||||
@ImportAutoConfiguration(JdbcEventPublicationAutoConfiguration.class)
|
||||
@ContextConfiguration(classes = TestApplication.class)
|
||||
static class TestBase {
|
||||
|
||||
@MockBean EventSerializer serializer;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
spring.datasource.driverClassName=org.h2.Driver
|
||||
spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
|
||||
#
|
||||
|
||||
spring.test.database.replace=NONE
|
||||
#
|
||||
|
||||
spring.modulith.events.schema-initialization.enabled=true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
spring.datasource.driverClassName=org.hsqldb.jdbc.JDBCDriver
|
||||
spring.datasource.url=jdbc:hsqldb:mem:testdb;DB_CLOSE_DELAY=-1
|
||||
#
|
||||
|
||||
spring.test.database.replace=NONE
|
||||
#
|
||||
|
||||
spring.modulith.events.schema-initialization.enabled=true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
spring.datasource.url=jdbc:tc:postgresql:13.2:////postgres
|
||||
spring.datasource.driverClassName=org.testcontainers.jdbc.ContainerDatabaseDriver
|
||||
#
|
||||
|
||||
spring.test.database.replace=NONE
|
||||
#
|
||||
|
||||
spring.modulith.events.schema-initialization.enabled=true
|
||||
|
||||
Reference in New Issue
Block a user