-
Notifications
You must be signed in to change notification settings - Fork 10
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
c62da8b
commit 63dc687
Showing
9 changed files
with
273 additions
and
132 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
30 changes: 30 additions & 0 deletions
30
kcl-fs2-ciris/src/main/scala/kinesis4cats/kcl/fs2/instances/eq.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,30 @@ | ||
/* | ||
* Copyright 2023-2023 etspaceman | ||
* | ||
* 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 kinesis4cats.kcl.fs2.instances | ||
|
||
import cats.Eq | ||
import cats.syntax.all._ | ||
|
||
import kinesis4cats.kcl.fs2.KCLConsumerFS2 | ||
|
||
object eq { | ||
implicit val fs2ConfigEq: Eq[KCLConsumerFS2.FS2Config] = (x, y) => | ||
x.commitMaxChunk === y.commitMaxChunk && | ||
x.commitMaxRetries === y.commitMaxRetries && | ||
x.commitMaxWait === y.commitMaxWait && | ||
x.commitRetryInterval === y.commitRetryInterval | ||
} |
33 changes: 33 additions & 0 deletions
33
kcl-fs2-ciris/src/main/scala/kinesis4cats/kcl/fs2/instances/show.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,33 @@ | ||
/* | ||
* Copyright 2023-2023 etspaceman | ||
* | ||
* 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 kinesis4cats.kcl.fs2.instances | ||
|
||
import cats.Show | ||
|
||
import kinesis4cats.ShowBuilder | ||
import kinesis4cats.kcl.fs2.KCLConsumerFS2 | ||
|
||
object show { | ||
implicit val fs2ConfigShow: Show[KCLConsumerFS2.FS2Config] = x => | ||
ShowBuilder("FS2Config") | ||
.add("queueSize", x.queueSize) | ||
.add("commitMaxChunk", x.commitMaxChunk) | ||
.add("commitMaxWait", x.commitMaxWait) | ||
.add("commitMaxRetries", x.commitMaxRetries) | ||
.add("commitRetryInterval", x.commitRetryInterval) | ||
.build | ||
} |
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,14 @@ | ||
<configuration> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>[%thread] %highlight(%-5level) %d{ISO8601} %cyan(%logger{15}) %yellow(%mdc) - %msg %n</pattern> | ||
</encoder> | ||
</appender> | ||
<logger name="kinesis4cats" level="ERROR"/> | ||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender"> | ||
<appender-ref ref="STDOUT" /> | ||
</appender> | ||
<root level="ERROR"> | ||
<appender-ref ref="ASYNC" /> | ||
</root> | ||
</configuration> |
53 changes: 53 additions & 0 deletions
53
kcl-fs2-ciris/src/test/scala/kinesis4cats/kcl/fs2/ciris/KCLCirisFS2Spec.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,53 @@ | ||
/* | ||
* Copyright 2023-2023 etspaceman | ||
* | ||
* 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 kinesis4cats.kcl.fs2.ciris | ||
|
||
import scala.concurrent.duration._ | ||
|
||
import cats.effect.IO | ||
import cats.syntax.all._ | ||
|
||
import kinesis4cats.kcl.fs2.KCLConsumerFS2 | ||
import kinesis4cats.kcl.fs2.instances.eq._ | ||
import kinesis4cats.kcl.fs2.instances.show._ | ||
|
||
class KCLCirisFS2Spec extends munit.CatsEffectSuite { | ||
test( | ||
"It should load the environment variables the same as system properties for CoordinatorConfig" | ||
) { | ||
for { | ||
configEnv <- KCLCirisFS2.readFS2Config(Some("env")).load[IO] | ||
configProp <- KCLCirisFS2.readFS2Config(Some("prop")).load[IO] | ||
expected = KCLConsumerFS2.FS2Config( | ||
200, | ||
500, | ||
5.seconds, | ||
3, | ||
1.second | ||
) | ||
} yield { | ||
assert( | ||
configEnv === configProp, | ||
s"envi: ${configEnv.show}\nprop: ${configProp.show}" | ||
) | ||
assert( | ||
configEnv === expected, | ||
s"envi: ${configEnv.show}\nexpe: ${expected.show}" | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.