@@ -39,17 +39,21 @@ class Neo4jSinkConnectorConfigTest {
3939
4040 @Test
4141 fun `should return the configuration` () {
42+ val a = " bolt://neo4j:7687"
43+ val b = " bolt://neo4j2:7687"
44+
4245 val originals = mapOf (SinkConnector .TOPICS_CONFIG to " foo" ,
4346 " ${Neo4jSinkConnectorConfig .TOPIC_CYPHER_PREFIX } foo" to " CREATE (p:Person{name: event.firstName})" ,
44- Neo4jSinkConnectorConfig .SERVER_URI to " bolt://neo4j:7687 " ,
47+ Neo4jSinkConnectorConfig .SERVER_URI to " $a , $b " , // Check for string trimming
4548 Neo4jSinkConnectorConfig .BATCH_SIZE to 10 ,
4649 Neo4jSinkConnectorConfig .AUTHENTICATION_BASIC_USERNAME to " FOO" ,
4750 Neo4jSinkConnectorConfig .AUTHENTICATION_BASIC_PASSWORD to " BAR" )
4851 val config = Neo4jSinkConnectorConfig (originals)
4952
5053 assertEquals(originals[" ${Neo4jSinkConnectorConfig .TOPIC_CYPHER_PREFIX } foo" ], config.topics.cypherTopics[" foo" ])
5154 assertFalse { config.encryptionEnabled }
52- assertEquals(originals[Neo4jSinkConnectorConfig .SERVER_URI ], config.serverUri.toString())
55+ assertEquals(a, config.serverUri.get(0 ).toString())
56+ assertEquals(b, config.serverUri.get(1 ).toString())
5357 assertEquals(originals[Neo4jSinkConnectorConfig .BATCH_SIZE ], config.batchSize)
5458 assertEquals(Config .TrustStrategy .Strategy .TRUST_ALL_CERTIFICATES , config.encryptionTrustStrategy)
5559 assertEquals(AuthenticationType .BASIC , config.authenticationType)
@@ -67,6 +71,22 @@ class Neo4jSinkConnectorConfigTest {
6771 assertEquals(Neo4jSinkConnectorConfig .BATCH_TIMEOUT_DEFAULT , config.batchTimeout)
6872 }
6973
74+ @Test
75+ fun `should return valid configuration with multiple URIs` () {
76+ val a = " bolt://neo4j:7687"
77+ val b = " bolt://neo4j2:7687"
78+ val c = " bolt://neo4j3:7777"
79+
80+ val originals = mapOf (SinkConnector .TOPICS_CONFIG to " foo" ,
81+ " ${Neo4jSinkConnectorConfig .TOPIC_CYPHER_PREFIX } foo" to " CREATE (p:Person{name: event.firstName})" ,
82+ Neo4jSinkConnectorConfig .SERVER_URI to " $a ,$b ,$c " )
83+ val config = Neo4jSinkConnectorConfig (originals)
84+
85+ assertEquals(a, config.serverUri.get(0 ).toString())
86+ assertEquals(b, config.serverUri.get(1 ).toString())
87+ assertEquals(c, config.serverUri.get(2 ).toString())
88+ }
89+
7090 @Test
7191 fun `should return the configuration with shuffled topic order` () {
7292 val originals = mapOf (SinkConnector .TOPICS_CONFIG to " bar,foo" ,
@@ -80,7 +100,7 @@ class Neo4jSinkConnectorConfigTest {
80100
81101 assertEquals(originals[" ${Neo4jSinkConnectorConfig .TOPIC_CYPHER_PREFIX } foo" ], config.topics.cypherTopics[" foo" ])
82102 assertFalse { config.encryptionEnabled }
83- assertEquals(originals[Neo4jSinkConnectorConfig .SERVER_URI ], config.serverUri.toString())
103+ assertEquals(originals[Neo4jSinkConnectorConfig .SERVER_URI ], config.serverUri.get( 0 ). toString())
84104 assertEquals(originals[Neo4jSinkConnectorConfig .BATCH_SIZE ], config.batchSize)
85105 assertEquals(Config .TrustStrategy .Strategy .TRUST_ALL_CERTIFICATES , config.encryptionTrustStrategy)
86106 assertEquals(AuthenticationType .BASIC , config.authenticationType)
0 commit comments