-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Java ProducerPushDestination transformation and interceptor brok…
…en (#978)
- Loading branch information
1 parent
98ef7e7
commit be6d25a
Showing
2 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...c/test/scala/akka/projection/grpc/consumer/javadsl/EventProducerPushDestinationSpec.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,46 @@ | ||
/* | ||
* Copyright (C) 2009-2023 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package akka.projection.grpc.consumer.javadsl | ||
|
||
import akka.Done | ||
import akka.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit | ||
import akka.grpc.scaladsl.MetadataBuilder | ||
import org.scalatest.wordspec.AnyWordSpecLike | ||
|
||
import java.util.Collections | ||
import java.util.concurrent.CompletableFuture | ||
import scala.annotation.nowarn | ||
|
||
class EventProducerPushDestinationSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike { | ||
|
||
"The Java DSL EventProducerPushDestination" should { | ||
|
||
"correctly map the transformationForOrigin to accept Scala GRPC metadata" in { | ||
@nowarn("msg=never used") | ||
val epsd = EventProducerPushDestination | ||
.create("origin-id", Collections.emptyList(), system) | ||
.withTransformationForOrigin((originId, metadata) => Transformation.identity) | ||
val scalaEpsd = epsd.asScala | ||
|
||
val transformation = scalaEpsd.transformationForOrigin("someOrigin", MetadataBuilder.empty) | ||
|
||
transformation should be(Transformation.identity.delegate) | ||
} | ||
|
||
"correctly map the interceptor to accept Scala GRPC metadata" in { | ||
@nowarn("msg=never used") | ||
val epsd = EventProducerPushDestination | ||
.create("origin-id", Collections.emptyList(), system) | ||
.withInterceptor((originId, metadata) => CompletableFuture.completedFuture(Done)) | ||
val scalaEpsd = epsd.asScala | ||
|
||
val interceptResult = scalaEpsd.interceptor.get.intercept("someOrigin", MetadataBuilder.empty) | ||
|
||
interceptResult.futureValue should be(Done) | ||
} | ||
|
||
} | ||
|
||
} |
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