From c827ee0430ebb6911f6c3c0a7a0f74a2f63239a0 Mon Sep 17 00:00:00 2001 From: Eugene Rubanov Date: Fri, 15 Mar 2024 11:28:46 +0000 Subject: [PATCH 1/7] refactor: remove dead code --- .../streams/extensions/CommonExtensions.kt | 40 ----------- .../streams/service/errors/ErrorService.kt | 17 +---- .../streams/utils/KafkaValidationUtils.kt | 69 ------------------- .../sink/errors/KafkaErrorServiceTest.kt | 1 - pom.xml | 1 + .../src/main/kotlin/streams/KafkaTestUtils.kt | 50 -------------- 6 files changed, 3 insertions(+), 175 deletions(-) delete mode 100644 common/src/main/kotlin/streams/utils/KafkaValidationUtils.kt delete mode 100644 test-support/src/main/kotlin/streams/KafkaTestUtils.kt diff --git a/common/src/main/kotlin/streams/extensions/CommonExtensions.kt b/common/src/main/kotlin/streams/extensions/CommonExtensions.kt index e614f730..9d6f9808 100644 --- a/common/src/main/kotlin/streams/extensions/CommonExtensions.kt +++ b/common/src/main/kotlin/streams/extensions/CommonExtensions.kt @@ -1,17 +1,10 @@ package streams.extensions -import org.apache.kafka.clients.consumer.ConsumerRecord -import org.apache.kafka.clients.consumer.OffsetAndMetadata -import org.apache.kafka.common.TopicPartition import org.neo4j.driver.types.Node import org.neo4j.driver.types.Relationship -import streams.service.StreamsSinkEntity -import streams.utils.JSONUtils -import java.nio.ByteBuffer import java.util.* import javax.lang.model.SourceVersion -fun Map.getInt(name:String, defaultValue: Int) = this.get(name)?.toInt() ?: defaultValue fun Map<*, *>.asProperties() = this.let { val properties = Properties() properties.putAll(it) @@ -34,10 +27,6 @@ fun Relationship.asStreamsMap(): Map { return relMap } -fun String.toPointCase(): String { - return this.split("(?<=[a-z])(?=[A-Z])".toRegex()).joinToString(separator = ".").toLowerCase() -} - fun String.quote(): String = if (SourceVersion.isIdentifier(this)) this else "`$this`" fun Map.flatten(map: Map = this, prefix: String = ""): Map { @@ -51,33 +40,4 @@ fun Map.flatten(map: Map = this, prefix: String = "" listOf(newKey to value) } }.toMap() -} - -fun ConsumerRecord<*, *>.topicPartition() = TopicPartition(this.topic(), this.partition()) -fun ConsumerRecord<*, *>.offsetAndMetadata(metadata: String = "") = OffsetAndMetadata(this.offset() + 1, metadata) - -private fun convertAvroData(rawValue: Any?): Any? = when (rawValue) { - is Collection<*> -> rawValue.map(::convertAvroData) - is Array<*> -> if (rawValue.javaClass.componentType.isPrimitive) rawValue else rawValue.map(::convertAvroData) - is Map<*, *> -> rawValue - .mapKeys { it.key.toString() } - .mapValues { convertAvroData(it.value) } - is ByteBuffer -> rawValue.array() - is CharSequence -> rawValue.toString() - else -> rawValue -} - - - -private fun convertData(data: Any?, stringWhenFailure: Boolean = false): Any? { - return when (data) { - null -> null - is ByteArray -> JSONUtils.readValue(data, stringWhenFailure) - else -> if (stringWhenFailure) data.toString() else throw RuntimeException("Unsupported type ${data::class.java.name}") - } -} -fun ConsumerRecord<*, *>.toStreamsSinkEntity(): StreamsSinkEntity { - val key = convertData(this.key(), true) - val value = convertData(this.value()) - return StreamsSinkEntity(key, value) } \ No newline at end of file diff --git a/common/src/main/kotlin/streams/service/errors/ErrorService.kt b/common/src/main/kotlin/streams/service/errors/ErrorService.kt index 8f187da6..75cb0e1b 100644 --- a/common/src/main/kotlin/streams/service/errors/ErrorService.kt +++ b/common/src/main/kotlin/streams/service/errors/ErrorService.kt @@ -1,10 +1,7 @@ package streams.service.errors -import org.apache.kafka.clients.consumer.ConsumerRecord -import org.apache.kafka.common.record.RecordBatch import java.util.Properties - data class ErrorData(val originalTopic: String, val timestamp: Long, val key: ByteArray?, @@ -17,21 +14,11 @@ data class ErrorData(val originalTopic: String, constructor(originalTopic: String, timestamp: Long?, key: Any?, value: Any?, partition: Int, offset: Long, executingClass: Class<*>?, databaseName: String?, exception: Exception?) : - this(originalTopic, timestamp ?: RecordBatch.NO_TIMESTAMP, toByteArray(key), toByteArray(value), partition.toString(),offset.toString(), executingClass, databaseName, exception) + this(originalTopic, timestamp ?: NO_TIMESTAMP, toByteArray(key), toByteArray(value), partition.toString(),offset.toString(), executingClass, databaseName, exception) companion object { - fun from(consumerRecord: ConsumerRecord, exception: Exception?, executingClass: Class<*>?, databaseName: String?): ErrorData { - return ErrorData(offset = consumerRecord.offset().toString(), - originalTopic = consumerRecord.topic(), - partition = consumerRecord.partition().toString(), - timestamp = consumerRecord.timestamp(), - exception = exception, - executingClass = executingClass, - key = toByteArray(consumerRecord.key()), - value = toByteArray(consumerRecord.value()), - databaseName = databaseName) - } + private const val NO_TIMESTAMP: Long = -1L fun toByteArray(v:Any?) = try { when (v) { diff --git a/common/src/main/kotlin/streams/utils/KafkaValidationUtils.kt b/common/src/main/kotlin/streams/utils/KafkaValidationUtils.kt deleted file mode 100644 index 8ecbb29e..00000000 --- a/common/src/main/kotlin/streams/utils/KafkaValidationUtils.kt +++ /dev/null @@ -1,69 +0,0 @@ -package streams.utils - -import org.apache.kafka.clients.CommonClientConfigs -import org.apache.kafka.clients.admin.AdminClient -import org.apache.kafka.clients.admin.AdminClientConfig -import org.apache.kafka.clients.consumer.ConsumerConfig -import org.apache.kafka.clients.producer.ProducerConfig -import org.apache.kafka.common.config.ConfigResource -import org.apache.kafka.common.config.SaslConfigs -import org.apache.kafka.common.config.SslConfigs -import org.apache.kafka.common.config.TopicConfig -import java.lang.reflect.Modifier -import java.util.Properties - -object KafkaValidationUtils { - fun getInvalidTopicsError(invalidTopics: List) = "The BROKER config `auto.create.topics.enable` is false, the following topics need to be created into the Kafka cluster otherwise the messages will be discarded: $invalidTopics" - - fun getInvalidTopics(kafkaProps: Properties, allTopics: List): List = try { - getInvalidTopics(AdminClient.create(kafkaProps), allTopics) - } catch (e: Exception) { - emptyList() - } - - fun getInvalidTopics(client: AdminClient, allTopics: List): List = try { - val kafkaTopics = client.listTopics().names().get() - val invalidTopics = allTopics.filter { !kafkaTopics.contains(it) } - if (invalidTopics.isNotEmpty() && isAutoCreateTopicsEnabled(client)) { - emptyList() - } else { - invalidTopics - } - } catch (e: Exception) { - emptyList() - } - - fun isAutoCreateTopicsEnabled(kafkaProps: Properties):Boolean = try { - isAutoCreateTopicsEnabled(AdminClient.create(kafkaProps)) - } catch (e: Exception) { - false - } - - fun isAutoCreateTopicsEnabled(client: AdminClient): Boolean = try { - val firstNodeId = client.describeCluster().nodes().get().first().id() - val configResources = listOf(ConfigResource(ConfigResource.Type.BROKER, firstNodeId.toString())) - val configs = client.describeConfigs(configResources).all().get() - configs.values - .flatMap { it.entries() } - .find { it.name() == "auto.create.topics.enable" } - ?.value() - ?.toBoolean() ?: false - } catch (e: Exception) { - false - } - - private fun getConfigProperties(clazz: Class<*>) = clazz.declaredFields - .filter { Modifier.isStatic(it.modifiers) && it.name.endsWith("_CONFIG") } - .map { it.get(null).toString() } - .toSet() - - private fun getBaseConfigs() = (getConfigProperties(CommonClientConfigs::class.java) - + AdminClientConfig.configNames() - + getConfigProperties(SaslConfigs::class.java) - + getConfigProperties(TopicConfig::class.java) - + getConfigProperties(SslConfigs::class.java)) - - fun getProducerProperties() = ProducerConfig.configNames() - getBaseConfigs() - - fun getConsumerProperties() = ConsumerConfig.configNames() - getBaseConfigs() -} \ No newline at end of file diff --git a/common/src/test/kotlin/streams/service/sink/errors/KafkaErrorServiceTest.kt b/common/src/test/kotlin/streams/service/sink/errors/KafkaErrorServiceTest.kt index 38b78b10..fb0cf360 100644 --- a/common/src/test/kotlin/streams/service/sink/errors/KafkaErrorServiceTest.kt +++ b/common/src/test/kotlin/streams/service/sink/errors/KafkaErrorServiceTest.kt @@ -6,7 +6,6 @@ import org.apache.kafka.clients.producer.ProducerRecord import org.apache.kafka.clients.producer.internals.FutureRecordMetadata import org.apache.kafka.common.record.RecordBatch import org.apache.kafka.common.utils.SystemTime -import org.apache.kafka.common.utils.Time import org.junit.Test import org.mockito.ArgumentMatchers import org.mockito.Mockito diff --git a/pom.xml b/pom.xml index e9c7985b..655a4fb9 100644 --- a/pom.xml +++ b/pom.xml @@ -49,6 +49,7 @@ UTF-8 11 + 11 1.9.20 1.7.3 4.4.27 diff --git a/test-support/src/main/kotlin/streams/KafkaTestUtils.kt b/test-support/src/main/kotlin/streams/KafkaTestUtils.kt deleted file mode 100644 index e72dc368..00000000 --- a/test-support/src/main/kotlin/streams/KafkaTestUtils.kt +++ /dev/null @@ -1,50 +0,0 @@ -package streams - -import org.apache.kafka.clients.consumer.ConsumerConfig -import org.apache.kafka.clients.consumer.KafkaConsumer -import org.apache.kafka.clients.producer.KafkaProducer -import org.apache.kafka.clients.producer.ProducerConfig -import org.apache.kafka.common.serialization.ByteArrayDeserializer -import org.apache.kafka.common.serialization.ByteArraySerializer -import org.apache.kafka.common.serialization.StringDeserializer -import org.apache.kafka.common.serialization.StringSerializer -import java.util.Properties - -object KafkaTestUtils { - fun createConsumer(bootstrapServers: String, - schemaRegistryUrl: String? = null, - keyDeserializer: String = StringDeserializer::class.java.name, - valueDeserializer: String = ByteArrayDeserializer::class.java.name, - vararg topics: String = emptyArray()): KafkaConsumer { - val props = Properties() - props[ProducerConfig.BOOTSTRAP_SERVERS_CONFIG] = bootstrapServers - props["group.id"] = "neo4j" // UUID.randomUUID().toString() - props["enable.auto.commit"] = "true" - props[ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG] = keyDeserializer - props[ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG] = valueDeserializer - props["auto.offset.reset"] = "earliest" - if (schemaRegistryUrl != null) { - props["schema.registry.url"] = schemaRegistryUrl - } - val consumer = KafkaConsumer(props) - if (!topics.isNullOrEmpty()) { - consumer.subscribe(topics.toList()) - } - return consumer - } - - fun createProducer(bootstrapServers: String, - schemaRegistryUrl: String? = null, - keySerializer: String = StringSerializer::class.java.name, - valueSerializer: String = ByteArraySerializer::class.java.name): KafkaProducer { - val props = Properties() - props[ProducerConfig.BOOTSTRAP_SERVERS_CONFIG] = bootstrapServers - props[ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG] = keySerializer - props[ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG] = valueSerializer - if (!schemaRegistryUrl.isNullOrBlank()) { - props["schema.registry.url"] = schemaRegistryUrl - } - return KafkaProducer(props) - } - -} \ No newline at end of file From 2e2deff12c2a6b059c21329865ed35e90fb30bed Mon Sep 17 00:00:00 2001 From: Eugene Rubanov Date: Fri, 15 Mar 2024 11:37:23 +0000 Subject: [PATCH 2/7] refactor: remove unused junit rules --- .../kotlin/org/neo4j/test/rule/DbmsRule.java | 392 ------------------ .../org/neo4j/test/rule/ExternalResource.java | 75 ---- .../neo4j/test/rule/ImpermanentDbmsRule.java | 48 --- 3 files changed, 515 deletions(-) delete mode 100644 test-support/src/main/kotlin/org/neo4j/test/rule/DbmsRule.java delete mode 100644 test-support/src/main/kotlin/org/neo4j/test/rule/ExternalResource.java delete mode 100644 test-support/src/main/kotlin/org/neo4j/test/rule/ImpermanentDbmsRule.java diff --git a/test-support/src/main/kotlin/org/neo4j/test/rule/DbmsRule.java b/test-support/src/main/kotlin/org/neo4j/test/rule/DbmsRule.java deleted file mode 100644 index 190d3d20..00000000 --- a/test-support/src/main/kotlin/org/neo4j/test/rule/DbmsRule.java +++ /dev/null @@ -1,392 +0,0 @@ -package org.neo4j.test.rule; - -import org.neo4j.common.DependencyResolver; -import org.neo4j.dbms.api.DatabaseManagementService; -import org.neo4j.dbms.api.DatabaseManagementServiceBuilder; -import org.neo4j.graphdb.GraphDatabaseService; -import org.neo4j.graphdb.QueryExecutionException; -import org.neo4j.graphdb.ResultTransformer; -import org.neo4j.graphdb.Transaction; -import org.neo4j.graphdb.config.Setting; -import org.neo4j.internal.kernel.api.connectioninfo.ClientConnectionInfo; -import org.neo4j.internal.kernel.api.security.LoginContext; -import org.neo4j.io.layout.DatabaseLayout; -import org.neo4j.kernel.api.KernelTransaction; -import org.neo4j.kernel.database.NamedDatabaseId; -import org.neo4j.kernel.impl.coreapi.InternalTransaction; -import org.neo4j.kernel.impl.factory.DbmsInfo; -import org.neo4j.kernel.internal.GraphDatabaseAPI; -import org.neo4j.monitoring.Monitors; - -import java.io.IOException; -import java.time.Duration; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; -import java.util.function.Function; - -import static org.neo4j.configuration.GraphDatabaseSettings.DEFAULT_DATABASE_NAME; - -@Deprecated -public abstract class DbmsRule extends ExternalResource implements GraphDatabaseAPI -{ - private DatabaseManagementServiceBuilder databaseBuilder; - private GraphDatabaseAPI database; - private boolean startEagerly = true; - private final Map, Object> globalConfig = new HashMap<>(); - private final Monitors monitors = new Monitors(); - private DatabaseManagementService managementService; - - /** - * Means the database will be started on first {@link #getGraphDatabaseAPI()}} - * or {@link #ensureStarted()} call. - */ - public DbmsRule startLazily() - { - startEagerly = false; - return this; - } - - public T executeAndCommit( Function function ) - { - return transaction( function, true ); - } - - public T executeAndRollback( Function function ) - { - return transaction( function, false ); - } - - public Function tx( Function function ) - { - return from -> - { - Function inner = graphDb -> function.apply( from ); - return executeAndCommit( inner ); - }; - } - - private T transaction( Function function, boolean commit ) - { - return tx( getGraphDatabaseAPI(), commit, function ); - } - - /** - * Perform a transaction, with the option to automatically retry on failure. - * - * @param db {@link GraphDatabaseService} to apply the transaction on. - * @param transaction {@link Consumer} containing the transaction logic. - */ - public static void tx( GraphDatabaseService db, Consumer transaction ) - { - Function voidFunction = tx -> - { - transaction.accept( tx ); - return null; - }; - tx( db, true, voidFunction ); - } - - /** - * Perform a transaction, with the option to automatically retry on failure. - * Also returning a result from the supplied transaction function. - * - * @param db {@link GraphDatabaseService} to apply the transaction on. - * @param commit whether or not to call {@link Transaction#commit()} in the end. - * @param transaction {@link Function} containing the transaction logic and returning a result. - * @return result from transaction {@link Function}. - */ - public static T tx( GraphDatabaseService db, boolean commit, Function transaction ) - { - try ( Transaction tx = db.beginTx() ) - { - T result = transaction.apply( tx ); - if ( commit ) - { - tx.commit(); - } - return result; - } - } - - @Override - public void executeTransactionally( String query ) throws QueryExecutionException - { - getGraphDatabaseAPI().executeTransactionally( query ); - } - - @Override - public void executeTransactionally( String query, Map parameters ) throws QueryExecutionException - { - getGraphDatabaseAPI().executeTransactionally( query, parameters ); - } - - @Override - public T executeTransactionally( String query, Map parameters, ResultTransformer resultTransformer ) throws QueryExecutionException - { - return getGraphDatabaseAPI().executeTransactionally( query, parameters, resultTransformer ); - } - - @Override - public T executeTransactionally( String query, Map parameters, ResultTransformer resultTransformer, Duration timeout ) - throws QueryExecutionException - { - return getGraphDatabaseAPI().executeTransactionally( query, parameters, resultTransformer, timeout ); - } - - @Override - public InternalTransaction beginTransaction( KernelTransaction.Type type, LoginContext loginContext ) - { - return getGraphDatabaseAPI().beginTransaction( type, loginContext ); - } - - @Override - public InternalTransaction beginTransaction( KernelTransaction.Type type, LoginContext loginContext, ClientConnectionInfo connectionInfo ) - { - return getGraphDatabaseAPI().beginTransaction( type, loginContext, connectionInfo ); - } - - @Override - public InternalTransaction beginTransaction( KernelTransaction.Type type, LoginContext loginContext, ClientConnectionInfo connectionInfo, long timeout, - TimeUnit unit ) - { - return getGraphDatabaseAPI().beginTransaction( type, loginContext, connectionInfo, timeout, unit ); - } - - @Override - public Transaction beginTx() - { - return getGraphDatabaseAPI().beginTx(); - } - - @Override - public Transaction beginTx( long timeout, TimeUnit timeUnit ) - { - return getGraphDatabaseAPI().beginTx( timeout, timeUnit ); - } - - @Override - protected void before() - { - create(); - if ( startEagerly ) - { - ensureStarted(); - } - } - - @Override - protected void after( boolean success ) - { - shutdown( success ); - } - - private void create() - { - createResources(); - try - { - databaseBuilder = newFactory(); - databaseBuilder.setMonitors( monitors ); - configure( databaseBuilder ); - databaseBuilder.setConfig( globalConfig ); - } - catch ( RuntimeException e ) - { - deleteResources(); - throw e; - } - } - - /** - * @return the high level monitor in the database. - */ - public Monitors getMonitors() - { - return monitors; - } - - protected void deleteResources() - { - } - - protected void createResources() - { - } - - protected abstract DatabaseManagementServiceBuilder newFactory(); - - protected void configure( DatabaseManagementServiceBuilder databaseFactory ) - { - // Override to configure the database factory - } - - /** - * {@link DbmsRule} now implements {@link GraphDatabaseAPI} directly, so no need. Also for ensuring - * a lazily started database is created, use {@link #ensureStarted()} instead. - */ - public GraphDatabaseAPI getGraphDatabaseAPI() - { - ensureStarted(); - return database; - } - - public DatabaseManagementService getManagementService() - { - return managementService; - } - - public synchronized void ensureStarted() - { - if ( database == null ) - { - managementService = databaseBuilder.build(); - database = (GraphDatabaseAPI) managementService.database( DEFAULT_DATABASE_NAME ); - } - } - - /** - * Adds or replaces a setting for the database managed by this database rule. - *

- * If this method is called when constructing the rule, the setting is considered a global setting applied to all tests. - *

- * If this method is called inside a specific test, i.e. after {@link #before()}, but before started (a call to {@link #startLazily()} have been made), - * then this setting will be considered a test-specific setting, adding to or overriding the global settings for this test only. - * Test-specific settings will be remembered throughout a test, even between restarts. - *

- * If this method is called when a database is already started an {@link IllegalStateException} will be thrown since the setting - * will have no effect, instead letting the developer notice that and change the test code. - */ - public DbmsRule withSetting( Setting key, T value ) - { - if ( database != null ) - { - // Database already started - throw new IllegalStateException( "Wanted to set " + key + "=" + value + ", but database has already been started" ); - } - if ( databaseBuilder != null ) - { - // Test already started, but db not yet started - databaseBuilder.setConfig( key, value ); - } - else - { - // Test haven't started, we're still in phase of constructing this rule - globalConfig.put( key, value ); - } - return this; - } - - /** - * Applies all settings in the settings map. - * - * @see #withSetting(Setting, Object) - */ - public DbmsRule withSettings( Map,Object> configuration ) - { - if ( database != null ) - { - // Database already started - throw new IllegalStateException( "Wanted to set " + configuration + ", but database has already been started" ); - } - if ( databaseBuilder != null ) - { - // Test already started, but db not yet started - databaseBuilder.setConfig( configuration ); - } - else - { - // Test haven't started, we're still in phase of constructing this rule - globalConfig.putAll( configuration ); - } - return this; - } - - public GraphDatabaseAPI restartDatabase() throws IOException - { - return restartDatabase(Collections.emptyMap()); - } - - public GraphDatabaseAPI restartDatabase( Map,Object> configChanges ) throws IOException - { - managementService.shutdown(); - database = null; - // This DatabaseBuilder has already been configured with the global settings as well as any test-specific settings, - // so just apply these additional settings. - databaseBuilder.setConfig( configChanges ); - return getGraphDatabaseAPI(); - } - - public void shutdown() - { - shutdown( true ); - } - - private void shutdown( boolean deleteResources ) - { - try - { - if ( managementService != null ) - { - managementService.shutdown(); - } - } - finally - { - if ( deleteResources ) - { - deleteResources(); - } - managementService = null; - database = null; - } - } - - public void shutdownAndKeepStore() - { - shutdown( false ); - } - - public T resolveDependency( Class type ) - { - return getGraphDatabaseAPI().getDependencyResolver().resolveDependency( type ); - } - - @Override - public NamedDatabaseId databaseId() - { - return database.databaseId(); - } - - @Override - public DbmsInfo dbmsInfo() - { - return database.dbmsInfo(); - } - - @Override - public DependencyResolver getDependencyResolver() - { - return database.getDependencyResolver(); - } - - @Override - public DatabaseLayout databaseLayout() - { - return database.databaseLayout(); - } - - @Override - public boolean isAvailable( long timeout ) - { - return database.isAvailable( timeout ); - } - - @Override - public String databaseName() - { - return database.databaseName(); - } -} diff --git a/test-support/src/main/kotlin/org/neo4j/test/rule/ExternalResource.java b/test-support/src/main/kotlin/org/neo4j/test/rule/ExternalResource.java deleted file mode 100644 index 05cd127e..00000000 --- a/test-support/src/main/kotlin/org/neo4j/test/rule/ExternalResource.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.neo4j.test.rule; - -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runners.model.Statement; - -/** - * A better version of {@link org.junit.rules.ExternalResource} that properly handles exceptions in {@link - * #after(boolean)}. - */ -@Deprecated -public abstract class ExternalResource implements TestRule -{ - @Override - public Statement apply( final Statement base, Description description ) - { - return new Statement() - { - @Override - public void evaluate() throws Throwable - { - before(); - Throwable failure = null; - try - { - base.evaluate(); - } - catch ( Throwable e ) - { - failure = e; - } - finally - { - try - { - after( failure == null ); - } - catch ( Throwable e ) - { - if ( failure != null ) - { - failure.addSuppressed( e ); - } - else - { - failure = e; - } - } - } - if ( failure != null ) - { - throw failure; - } - } - }; - } - - /** - * Override to set up your specific external resource. - * - * @throws Throwable if setup fails (which will disable {@code after} - */ - protected void before() throws Throwable - { - // do nothing - } - - /** - * Override to tear down your specific external resource. - */ - protected void after( boolean successful ) throws Throwable - { - // do nothing - } -} diff --git a/test-support/src/main/kotlin/org/neo4j/test/rule/ImpermanentDbmsRule.java b/test-support/src/main/kotlin/org/neo4j/test/rule/ImpermanentDbmsRule.java deleted file mode 100644 index 1394905e..00000000 --- a/test-support/src/main/kotlin/org/neo4j/test/rule/ImpermanentDbmsRule.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.neo4j.test.rule; - -import org.neo4j.dbms.api.DatabaseManagementServiceBuilder; -import org.neo4j.logging.LogProvider; -import org.neo4j.test.TestDatabaseManagementServiceBuilder; - -/** - * JUnit @Rule for configuring, creating and managing an ImpermanentGraphDatabase instance. - */ -@Deprecated -public class ImpermanentDbmsRule extends DbmsRule -{ - private final LogProvider userLogProvider; - private final LogProvider internalLogProvider; - - public ImpermanentDbmsRule() - { - this( null ); - } - - public ImpermanentDbmsRule( LogProvider logProvider ) - { - this.userLogProvider = logProvider; - this.internalLogProvider = logProvider; - } - - @Override - public ImpermanentDbmsRule startLazily() - { - return (ImpermanentDbmsRule) super.startLazily(); - } - - @Override - protected DatabaseManagementServiceBuilder newFactory() - { - return maybeSetInternalLogProvider( maybeSetUserLogProvider( new TestDatabaseManagementServiceBuilder().impermanent() ) ); - } - - protected final TestDatabaseManagementServiceBuilder maybeSetUserLogProvider( TestDatabaseManagementServiceBuilder factory ) - { - return ( userLogProvider == null ) ? factory : factory.setUserLogProvider( userLogProvider ); - } - - protected final TestDatabaseManagementServiceBuilder maybeSetInternalLogProvider( TestDatabaseManagementServiceBuilder factory ) - { - return ( internalLogProvider == null ) ? factory : factory.setInternalLogProvider( internalLogProvider ); - } -} From 5f742ded694728e5fabf7fa41f3f039dc8454bfb Mon Sep 17 00:00:00 2001 From: Eugene Rubanov Date: Fri, 15 Mar 2024 14:09:51 +0000 Subject: [PATCH 3/7] build: update kafka client --- .../kotlin/streams/service/sink/errors/KafkaErrorServiceTest.kt | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/test/kotlin/streams/service/sink/errors/KafkaErrorServiceTest.kt b/common/src/test/kotlin/streams/service/sink/errors/KafkaErrorServiceTest.kt index fb0cf360..f1557b31 100644 --- a/common/src/test/kotlin/streams/service/sink/errors/KafkaErrorServiceTest.kt +++ b/common/src/test/kotlin/streams/service/sink/errors/KafkaErrorServiceTest.kt @@ -24,7 +24,7 @@ class KafkaErrorServiceTest { val counter = AtomicInteger(0) Mockito.`when`(producer.send(ArgumentMatchers.any>())).then { counter.incrementAndGet() - FutureRecordMetadata(null, 0, RecordBatch.NO_TIMESTAMP, 0L, 0, 0, SystemTime()) + FutureRecordMetadata(null, 0, RecordBatch.NO_TIMESTAMP, 0, 0, SystemTime()) } val dlqService = KafkaErrorService(producer, ErrorService.ErrorConfig(fail=false,dlqTopic = "dlqTopic"), { s, e -> }) dlqService.report(listOf(dlqData())) diff --git a/pom.xml b/pom.xml index 655a4fb9..b994de71 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ 1.9.20 1.7.3 4.4.27 - 2.6.3 + 3.7.0 2.15.2 true 4.4.12 From 18422848950146713dd43e968bcc0b95bd2bde92 Mon Sep 17 00:00:00 2001 From: Eugene Rubanov Date: Mon, 18 Mar 2024 09:42:24 +0000 Subject: [PATCH 4/7] build: downgrade kafka client version to 3.4.1 --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b994de71..5944d5a8 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,8 @@ 1.9.20 1.7.3 4.4.27 - 3.7.0 + + 3.4.1 2.15.2 true 4.4.12 From dbfc75e81d43819a6e607eaf792fa79764eb778f Mon Sep 17 00:00:00 2001 From: Eugene Rubanov Date: Mon, 18 Mar 2024 11:12:56 +0000 Subject: [PATCH 5/7] build: remove duplicate java version property --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5944d5a8..64f9adc4 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,6 @@ UTF-8 11 - 11 1.9.20 1.7.3 4.4.27 From bca814c4988e7029e7fa4cd40e6d5852fab426f0 Mon Sep 17 00:00:00 2001 From: Eugene Rubanov Date: Mon, 18 Mar 2024 12:15:39 +0000 Subject: [PATCH 6/7] build: update actions --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5085ca61..1fbde119 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,15 +12,15 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 11 - name: Cache Maven packages - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} From 6551a92603cd83c32001a6341fbcd00960f5c300 Mon Sep 17 00:00:00 2001 From: Eugene Rubanov Date: Tue, 19 Mar 2024 09:13:11 +0000 Subject: [PATCH 7/7] build: add distribution --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fbde119..533418a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v4 with: + distribution: temurin java-version: 11 - name: Cache Maven packages