-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54bd1cb
commit dceae12
Showing
4 changed files
with
98 additions
and
4 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
46 changes: 46 additions & 0 deletions
46
src/test/java/org/radarbase/output/path/RecordPathFactoryTest.kt
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,46 @@ | ||
package org.radarbase.output.path | ||
|
||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
import org.radarbase.output.config.PathConfig | ||
import org.radarbase.output.config.PathFormatterConfig | ||
import org.radarbase.output.config.ResourceConfig | ||
import org.radarbase.output.config.S3Config | ||
|
||
internal class RecordPathFactoryTest { | ||
|
||
@Test | ||
fun testInit() { | ||
var properties = mapOf("key1" to "value1", "key2" to "value2") | ||
|
||
val pathConfig = PathConfig( | ||
factory = "org.radarbase.output.path.FormattedPathFactory", | ||
properties = properties, | ||
path = PathFormatterConfig( | ||
format = "\${topic}/\${projectId}/\${userId}/\${sourceId}/\${filename}", | ||
plugins = "fixed", | ||
), | ||
) | ||
|
||
val targetConfig = S3Config( | ||
endpoint = "http://localhost:9000", | ||
accessToken = "minioadmin", | ||
secretKey = "minioadmin", | ||
bucket = "target", | ||
) | ||
|
||
val factory = pathConfig.createFactory( | ||
ResourceConfig("s3", s3 = targetConfig), | ||
"test-extension", | ||
topics = mapOf(), | ||
) | ||
|
||
properties = buildMap { | ||
putAll(properties) | ||
putIfAbsent("extension", "test-extension") | ||
} | ||
|
||
assertEquals(properties, factory.pathConfig.path.properties) | ||
assertEquals(properties, factory.pathConfig.path.properties) | ||
} | ||
} |