Skip to content

Commit dcd8131

Browse files
committed
Bump versions and fix minor issues
1 parent 0373b3c commit dcd8131

File tree

9 files changed

+30
-23
lines changed

9 files changed

+30
-23
lines changed

build.sbt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ version := "1.0"
66

77
scalaVersion := "2.13.15"
88

9-
val pekkoVersion = "1.1.2"
9+
val pekkoVersion = "1.1.3"
1010
val pekkoHTTPVersion = "1.1.0"
1111
val pekkoConnectorVersion = "1.0.2"
1212
val pekkoConnectorKafkaVersion = "1.1.0"
1313

14-
val kafkaVersion = "3.8.0"
14+
val kafkaVersion = "3.8.1"
1515
val activemqVersion = "5.18.5" // We are stuck with 5.x
1616
val artemisVersion = "2.37.0"
1717
val testContainersVersion = "1.20.4"
@@ -124,8 +124,8 @@ libraryDependencies ++= Seq(
124124
"org.testcontainers" % "localstack" % testContainersVersion,
125125
"org.testcontainers" % "clickhouse" % testContainersVersion,
126126

127-
"com.clickhouse" % "clickhouse-jdbc" % "0.6.5",
128-
"com.crobox.clickhouse" %% "client" % "1.2.2",
127+
"com.clickhouse" % "clickhouse-jdbc" % "0.7.2",
128+
"com.crobox.clickhouse" %% "client" % "1.2.6",
129129

130130
"org.opensearch" % "opensearch-testcontainers" % "2.0.1",
131131
"com.github.dasniko" % "testcontainers-keycloak" % "3.5.1",

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.10.6
1+
sbt.version=1.10.7

src/main/java/util/ConnectionStatusChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private long testSockets(String hostAddress, int port) {
102102
*/
103103
private boolean testPing(String hostAddress) throws IOException, InterruptedException {
104104
String os = System.getProperty("os.name");
105-
String pingOption = (os.equals("Windows 10")) ? "n" : "c";
105+
String pingOption = (os.startsWith("windows")) ? "n" : "c";
106106

107107
String[] cmd = {"ping", "-" + pingOption, "1", hostAddress};
108108
Process p1 = java.lang.Runtime.getRuntime().exec(cmd);

src/main/scala/alpakka/file/uploader/DirectoryWatcher.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import org.apache.commons.io.monitor.{FileAlterationListenerAdaptor, FileAlterat
44
import org.apache.pekko.actor.{ActorSystem, Terminated}
55
import org.apache.pekko.stream.connectors.file.scaladsl.Directory
66
import org.apache.pekko.stream.scaladsl.{Sink, Source, SourceQueueWithComplete}
7-
import org.apache.pekko.stream.{OverflowStrategy, QueueOfferResult}
7+
import org.apache.pekko.stream.{ActorAttributes, OverflowStrategy, QueueOfferResult, Supervision}
88
import org.slf4j.{Logger, LoggerFactory}
99

1010
import java.io.File
@@ -43,6 +43,7 @@ class DirectoryWatcher(uploadDir: Path, processedDir: Path) {
4343
private val uploadSourceQueue: SourceQueueWithComplete[Path] = Source
4444
.queue[Path](bufferSize = 1000, OverflowStrategy.backpressure, maxConcurrentOffers = 1000)
4545
.mapAsync(1)(path => uploadAndMove(path))
46+
.withAttributes(ActorAttributes.supervisionStrategy(Supervision.restartingDecider))
4647
.to(Sink.ignore)
4748
.run()
4849

@@ -103,11 +104,15 @@ class DirectoryWatcher(uploadDir: Path, processedDir: Path) {
103104
}
104105

105106
private def uploadAndMove(path: Path) = {
106-
if (path.toFile.isFile) {
107+
if (Files.exists(path) && path.toFile.isFile && Files.isReadable(path)) {
107108
logger.info(s"About to upload and move file: $path")
108-
uploader.upload(path.toFile).andThen { case _ => move(path) }
109+
val response = uploader.upload(path.toFile).andThen { case _ => move(path) }
110+
logger.info(s"Successfully uploaded and moved file: $path")
111+
response
109112
} else {
110-
Future.successful("Do nothing on dir")
113+
val msg = s"Do nothing for: $path (because unreadable file or dir)"
114+
logger.info(msg)
115+
Future.successful(msg)
111116
}
112117
}
113118

src/main/scala/alpakka/influxdb/InfluxdbReader.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ class InfluxdbReader(baseURL: String, token: String, org: String = "testorg", bu
3535
implicit val system: ActorSystem = actorSystem
3636
implicit val ec: ExecutionContextExecutor = actorSystem.dispatcher
3737

38-
//import system.dispatcher
39-
4038
val deciderFlow: Supervision.Decider = {
4139
case NonFatal(e) =>
4240
logger.info(s"Stream failed with: ${e.getMessage}, going to restart")

src/test/scala/alpakka/clickhousedb/ClickhousedbIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private static void browserClient(Integer port) throws IOException, InterruptedE
208208
if (os.equals("mac os x")) {
209209
String[] cmd = {"open", tabuxURL};
210210
Runtime.getRuntime().exec(cmd);
211-
} else if (os.equals("windows 10")) {
211+
} else if (os.startsWith("windows")) {
212212
String[] cmd = {"cmd /c start", tabuxURL};
213213
Runtime.getRuntime().exec(cmd);
214214
} else {

src/test/scala/alpakka/file/DirectoryWatcherSpec.scala

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,43 @@ final class DirectoryWatcherSpec extends AsyncWordSpec with Matchers with Before
2929
var processedDir: Path = _
3030

3131
"DirectoryWatcher" should {
32-
"detect_files_on_startup" in {
32+
"detect_files_on_startup_in_parent_dir" in {
3333
watcher = DirectoryWatcher(uploadDir, processedDir)
3434
waitForCondition(3.seconds)(watcher.countFilesProcessed() == 2) shouldBe true
3535
}
3636

37-
"detect_added_files_at_runtime_in_parent" in {
38-
copyTestFileToDir(uploadDir)
37+
"detect_added_file_at_runtime_in_parent_dir" in {
3938
watcher = DirectoryWatcher(uploadDir, processedDir)
39+
copyTestFileToDir(uploadDir)
4040
waitForCondition(3.seconds)(watcher.countFilesProcessed() == 2 + 1) shouldBe true
4141
}
4242

43-
"detect_added_files_at_runtime_in_subdir" in {
44-
copyTestFileToDir(uploadDir.resolve("subdir"))
43+
"detect_added_files_at_runtime_in_sub_dir" in {
4544
watcher = DirectoryWatcher(uploadDir, processedDir)
45+
copyTestFileToDir(uploadDir.resolve("subdir"))
4646
waitForCondition(3.seconds)(watcher.countFilesProcessed() == 2 + 1) shouldBe true
4747
}
4848

4949
"detect_added_nested_subdir_at_runtime_with_files_in_subdir" in {
50+
watcher = DirectoryWatcher(uploadDir, processedDir)
5051
val tmpDir = Files.createTempDirectory("tmp")
5152
val sourcePath = Paths.get("src/main/resources/testfile.jpg")
5253
val targetPath = tmpDir.resolve(createUniqueFileName(sourcePath.getFileName))
5354
val targetPath2 = tmpDir.resolve(createUniqueFileName(sourcePath.getFileName))
5455
Files.copy(sourcePath, targetPath)
5556
Files.copy(sourcePath, targetPath2)
56-
5757
val targetDir = Files.createDirectories(uploadDir.resolve("subdir").resolve("nestedDirWithFiles"))
5858
FileUtils.copyDirectory(tmpDir.toFile, targetDir.toFile)
59+
waitForCondition(3.seconds)(watcher.countFilesProcessed() == 2 + 2) shouldBe true
60+
}
5961

62+
"handle_large_number_of_files_in_parent_dir" in {
63+
(1 to 1000).foreach(_ => copyTestFileToDir(uploadDir))
6064
watcher = DirectoryWatcher(uploadDir, processedDir)
61-
waitForCondition(3.seconds)(watcher.countFilesProcessed() == 2 + 2) shouldBe true
65+
waitForCondition(5.seconds)(watcher.countFilesProcessed() == 2 + 1000) shouldBe true
6266
}
6367

64-
"handle invalid parent directory path" in {
68+
"handle_invalid_parent_directory_path" in {
6569
val invalidParentDir = Paths.get("/path/to/non-existent/directory")
6670
val processedDir = Files.createTempDirectory("processed")
6771

src/test/scala/alpakka/firehose/FirehoseEchoIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private static void browserClient() throws IOException {
6363
if (os.equals("mac os x")) {
6464
String[] cmd = {"open", elasticsearchEndpoint};
6565
Runtime.getRuntime().exec(cmd);
66-
} else if (os.equals("windows 10")) {
66+
} else if (os.startsWith("windows")) {
6767
String[] cmd = {"cmd /c start", elasticsearchEndpoint};
6868
Runtime.getRuntime().exec(cmd);
6969
} else {

src/test/scala/alpakka/influxdb/InfluxdbIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private static void browserClient() throws IOException {
9999
if (os.equals("mac os x")) {
100100
String[] cmd = {"open", influxURL};
101101
Runtime.getRuntime().exec(cmd);
102-
} else if (os.equals("windows 10")) {
102+
} else if (os.startsWith("windows")) {
103103
String[] cmd = {"cmd /c start", influxURL};
104104
Runtime.getRuntime().exec(cmd);
105105
} else {

0 commit comments

Comments
 (0)