Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vga91 committed Sep 3, 2024
1 parent e0c4a24 commit 82b16ec
Show file tree
Hide file tree
Showing 25 changed files with 13 additions and 850 deletions.
14 changes: 6 additions & 8 deletions extended/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jar {
}

compileKotlin {
kotlinOptions.jvmTarget = JavaVersion.VERSION_17
kotlinOptions.jvmTarget = "17"
}

generateGrammarSource {
Expand Down Expand Up @@ -62,7 +62,6 @@ dependencies {
exclude group: 'org.abego.treelayout'
}

def kotlinVersion = "1.6.0"
def kafkaVersion = "2.4.0"
def jacksonVersion = "2.17.2"

Expand Down Expand Up @@ -109,10 +108,9 @@ dependencies {
}
compileOnly group: 'com.couchbase.client', name: 'java-client', version: '3.3.0', withoutJacksons
compileOnly group: 'io.lettuce', name: 'lettuce-core', version: '6.1.1.RELEASE'
compileOnly group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: jacksonVersion
testImplementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: jacksonVersion
compileOnly group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion
testImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion
compileOnly group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: jacksonVersion, withoutJacksons
compileOnly group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion, withoutJacksons

compileOnly group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.270'
compileOnly group: 'com.amazonaws', name: 'aws-java-sdk-comprehend', version: '1.12.353' , withoutJacksons
compileOnly group: 'com.sun.mail', name: 'javax.mail', version: '1.6.0'
Expand All @@ -130,6 +128,8 @@ dependencies {
compileOnly group: 'com.github.conker84', name: 'neo4j-configuration-lifecycle', version: 'ad59084711'
compileOnly group: 'io.confluent', name: 'kafka-avro-serializer', version: '5.2.2'

testImplementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: jacksonVersion
testImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion
testImplementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.16.1'
testImplementation group: 'org.apache.arrow', name: 'arrow-vector', version: '13.0.0'
testImplementation group: 'org.apache.arrow', name: 'arrow-memory-netty', version: '13.0.0'
Expand Down Expand Up @@ -159,8 +159,6 @@ dependencies {
testImplementation group: 'org.apache.parquet', name: 'parquet-hadoop', version: '1.13.1', withoutServers
testImplementation group: 'com.opencsv', name: 'opencsv', version: '5.7.1'
testImplementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.4.2'
// testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlinVersion
// testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit5', version: kotlinVersion

testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: '1.6.0'

Expand Down
2 changes: 0 additions & 2 deletions extended/src/main/kotlin/apoc/kafka/KafkaHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class KafkaHandler(): LifecycleAdapter() {

override fun start() {
if(ApocConfig.apocConfig().getBoolean(APOC_KAFKA_ENABLED)) {
// println("start db......")

try {
StreamsRouterConfigurationListener(db, log)
Expand All @@ -41,7 +40,6 @@ class KafkaHandler(): LifecycleAdapter() {

override fun stop() {
if(ApocConfig.apocConfig().getBoolean(APOC_KAFKA_ENABLED)) {
// println("stop db..........")

StreamsRouterConfigurationListener(db, log).shutdown()
StreamsSinkConfigurationListener(db, log).shutdown()
Expand Down
43 changes: 0 additions & 43 deletions extended/src/main/kotlin/apoc/kafka/Neo4jStreamsStrategyStorage.kt

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion extended/src/main/kotlin/apoc/kafka/events/StreamsEvent.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package apoc.kafka.events

import org.neo4j.graphdb.schema.ConstraintType

enum class OperationType { created, updated, deleted }

Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion extended/src/main/kotlin/apoc/kafka/utils/Neo4jUtils.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.io.IOException;
import java.util.Map;

import static apoc.ExtendedApocConfig.APOC_KAFKA_ENABLED;
import static apoc.custom.CypherProceduresHandler.*;
import static apoc.util.DbmsTestUtil.startDbWithApocConfigs;
import static apoc.util.SystemDbTestUtil.PROCEDURE_DEFAULT_REFRESH;
Expand All @@ -21,10 +20,7 @@ public class CypherProcedureTestUtil {
public final static String QUERY_CREATE = "RETURN $input1 + $input2 as answer";
public static DatabaseManagementService startDbWithCustomApocConfigs(TemporaryFolder storeDir) throws IOException {
return startDbWithApocConfigs(storeDir,
Map.of(
CUSTOM_PROCEDURES_REFRESH, PROCEDURE_DEFAULT_REFRESH,
APOC_KAFKA_ENABLED, "true"
)
Map.of(CUSTOM_PROCEDURES_REFRESH, PROCEDURE_DEFAULT_REFRESH)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.stream.Collectors;
import java.util.stream.IntStream;

import static apoc.ExtendedApocConfig.APOC_KAFKA_ENABLED;
import static apoc.custom.CypherProcedureTestUtil.QUERY_CREATE;
import static apoc.custom.CypherProceduresHandler.CUSTOM_PROCEDURES_REFRESH;
import static apoc.util.DbmsTestUtil.startDbWithApocConfigs;
import static apoc.util.MapUtil.map;
Expand Down Expand Up @@ -57,10 +57,7 @@ public void setUp() throws Exception {
final int refreshTime = 3000;
// start db with apoc.conf: `apoc.custom.procedures.refresh=<time>`
dbms = startDbWithApocConfigs(STORE_DIR,
Map.of(
CUSTOM_PROCEDURES_REFRESH, refreshTime,
APOC_KAFKA_ENABLED, "true"
)
Map.of(CUSTOM_PROCEDURES_REFRESH, refreshTime)
);
greaterThanRefreshTime = refreshTime + 500;
} catch (IOException e) {
Expand Down
5 changes: 2 additions & 3 deletions extended/src/test/java/apoc/ml/VertexAIIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import static apoc.ml.VertexAIHandler.RESOURCE_CONF_KEY;
import static apoc.ml.VertexAIHandler.STREAM_RESOURCE;
import static apoc.util.TestUtil.testCall;
import static apoc.util.TestUtil.testCallEventually;
import static apoc.util.TestUtil.testResult;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -94,14 +93,14 @@ public void completion() {

@Test
public void chatCompletion() {
testCallEventually(db, """
testCall(db, """
CALL apoc.ml.vertexai.chat([
{author:"user", content:"What planet do timelords live on?"}
], $apiKey, $project, {temperature:0},
"Fictional universe of Doctor Who. Only answer with a single word!",
[{input:{content:"What planet do humans live on?"}, output:{content:"Earth"}}])""",
parameters,
(row) -> assertCorrectResponse(row, "gallifrey"), 3);
(row) -> assertCorrectResponse(row, "gallifrey"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package apoc.kafka.consumer.kafka

import apoc.ApocConfig
import apoc.kafka.producer.integrations.KafkaEventSinkSuiteIT
import apoc.kafka.common.support.Assert
import io.confluent.kafka.serializers.KafkaAvroDeserializer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ import org.neo4j.configuration.GraphDatabaseSettings
import org.neo4j.dbms.api.DatabaseManagementService
import org.neo4j.graphdb.GraphDatabaseService
import org.neo4j.kernel.api.procedure.GlobalProcedures
import org.neo4j.test.TestDatabaseManagementServiceBuilder

import apoc.ExtendedApocConfig.APOC_KAFKA_ENABLED

open class KafkaEventSinkBaseTSE {

companion object {
private var startedFromSuite = true

// lateinit var db: GraphDatabaseService

lateinit var dbms: DatabaseManagementService

@BeforeClass
Expand Down Expand Up @@ -103,9 +101,6 @@ open class KafkaEventSinkBaseTSE {
@AfterEach
fun tearDown() {
dbms.shutdown()

// dbms = TestDatabaseManagementServiceBuilder(temporaryFolder.root.toPath()).build()
// getDbServices()

if (::kafkaProducer.isInitialized) {
kafkaProducer.flushAndClose()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package apoc.kafka.consumer.kafka

import apoc.ApocConfig
import apoc.kafka.producer.integrations.KafkaEventSinkSuiteIT
import apoc.kafka.common.support.Assert
import apoc.kafka.common.support.KafkaTestUtils
// import apoc.kafka.support.start
import apoc.kafka.utils.JSONUtils
import org.apache.kafka.clients.consumer.ConsumerConfig
import org.apache.kafka.clients.producer.ProducerRecord
import org.apache.kafka.common.TopicPartition
import org.hamcrest.Matchers
import org.junit.Ignore
import org.junit.Test
import org.neo4j.function.ThrowingSupplier
import java.util.*
Expand Down
Loading

0 comments on commit 82b16ec

Please sign in to comment.