-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bringing the fixes for Redis on master (#1012)
* Bringing the fixes for Redis on master * Adding missing close method. * Fix the compilation error * Avoid setting the base class or the tests need to convert back to GenericContainer * Removed unused import --------- Co-authored-by: stheppi <[email protected]>
- Loading branch information
Showing
15 changed files
with
152 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...-redis/src/main/scala/io/lenses/streamreactor/connect/redis/sink/JedisClientBuilder.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 2017-2023 Lenses.io Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.lenses.streamreactor.connect.redis.sink | ||
|
||
import io.lenses.streamreactor.connect.redis.sink.config.RedisSinkSettings | ||
import redis.clients.jedis.Jedis | ||
|
||
import java.io.File | ||
import java.io.FileNotFoundException | ||
|
||
object JedisClientBuilder { | ||
def createClient(sinkSettings: RedisSinkSettings): Jedis = { | ||
val connection = sinkSettings.connectionInfo | ||
|
||
if (connection.isSslConnection) { | ||
connection.keyStoreFilepath match { | ||
case Some(path) => | ||
if (!new File(path).exists) { | ||
throw new FileNotFoundException(s"Keystore not found in: [$path]") | ||
} | ||
|
||
System.setProperty("javax.net.ssl.keyStorePassword", connection.keyStorePassword.getOrElse("")) | ||
System.setProperty("javax.net.ssl.keyStore", path) | ||
System.setProperty("javax.net.ssl.keyStoreType", connection.keyStoreType.getOrElse("jceks")) | ||
|
||
case None => | ||
} | ||
|
||
connection.trustStoreFilepath match { | ||
case Some(path) => | ||
if (!new File(path).exists) { | ||
throw new FileNotFoundException(s"Truststore not found in: $path") | ||
} | ||
|
||
System.setProperty("javax.net.ssl.trustStorePassword", connection.trustStorePassword.getOrElse("")) | ||
System.setProperty("javax.net.ssl.trustStore", path) | ||
System.setProperty("javax.net.ssl.trustStoreType", connection.trustStoreType.getOrElse("jceks")) | ||
|
||
case None => | ||
} | ||
} | ||
|
||
val jedis = new Jedis(connection.host, connection.port, connection.isSslConnection) | ||
connection.password.foreach(p => jedis.auth(p)) | ||
jedis | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.