Conversation
| ValueEntityTestKitGenerator.integrationTest(main, entity, service).content, | ||
| """package com.example.shoppingcart.api | ||
|
|
||
| import com.akkaserverless.scalasdk.testkit.AkkaServerlessTestkit |
There was a problem hiding this comment.
Are we moving out of using the |? I have see that at least one other suite were not using it.
I don't mind. Maybe be even easier to read. Soon I will be write codegen for the replicated entity. I will use that new style then.
There was a problem hiding this comment.
Oh, this was not particularly intentional, I'm fine with either
There was a problem hiding this comment.
Maybe be easier if we remove the |.
There was a problem hiding this comment.
since we have mostly used | I think we should continue with that, and at least to me it reads a bit weird to suddenly have code to the very left
| * testkit before testing the service with gRPC or HTTP clients. Call {@link #stop} after tests are complete. | ||
| */ | ||
| class AkkaServerlessTestkit(impl: JTestKit) { | ||
| def start() = impl.start() |
There was a problem hiding this comment.
nitpicking:
We have been using impl, but I think we should call it delegate. Both are implementations, but one is an adapter that delegates all calls to the other impl.
Co-authored-by: Renato Cavalcanti <[email protected]>
|
|
||
| def stop() = delegate.stop() | ||
| } | ||
| object AkkaServerlessTestkit { |
There was a problem hiding this comment.
can we have this at the top, since that is the starting point for using it?
| * <p>Create an AkkaServerlessTestkit with an {@link AkkaServerless} service descriptor, and then {@link #start} the | ||
| * testkit before testing the service with gRPC or HTTP clients. Call {@link #stop} after tests are complete. | ||
| */ | ||
| class AkkaServerlessTestkit(delegate: JTestKit) { |
There was a problem hiding this comment.
make the constructor private
|
|
||
| val testkit = AkkaServerlessTestkit(Main.createAkkaServerless()) | ||
| testkit.start() | ||
| implicit val system = testkit.system |
There was a problem hiding this comment.
system: ActorSystem to avoid warnings in Intellij
There was a problem hiding this comment.
is that needed for running streaming calls, or something else? wonder if we should not include it since it exposes a bit too much low level Akka? btw, if it's for streams we should have it as Materializer since that is what we have in the contexts
There was a problem hiding this comment.
It's used for creating the Akka gRPC client
There was a problem hiding this comment.
ah, we could have a grpcClient utility method similar to what we provide in the context. That would become more unified. Can be a separate ticket.
|
|
||
| def system = delegate.getActorSystem() | ||
|
|
||
| def stop() = delegate.stop() |
There was a problem hiding this comment.
explicit return type on all things here
| val entityClassName = service.fqn.name | ||
|
|
||
| File( | ||
| service.fqn.fileBasename + "IntegrationSpec.scala", |
There was a problem hiding this comment.
if we have these in test scope I wonder if there is a way to run all unit tests without these?
Thinking about testOnly **Spec but that would include IntegrationSpec too. Shall we name the others UnitSpec so that testOnly **UnitSpec would work?
There was a problem hiding this comment.
*UnitSpec could work, though it's a bit unfortunate when ideally you'd want to have many unit tests and few integration tests. The only alternative I can think of is using ScalaTest tagging, though that's a bit obscure.
| ValueEntityTestKitGenerator.integrationTest(main, entity, service).content, | ||
| """package com.example.shoppingcart.api | ||
|
|
||
| import com.akkaserverless.scalasdk.testkit.AkkaServerlessTestkit |
There was a problem hiding this comment.
since we have mostly used | I think we should continue with that, and at least to me it reads a bit weird to suddenly have code to the very left
| * <p>Create an AkkaServerlessTestkit with an {@link AkkaServerless} service descriptor, and then {@link #start} the | ||
| * testkit before testing the service with gRPC or HTTP clients. Call {@link #stop} after tests are complete. | ||
| */ | ||
| object AkkaServerlessTestkit { |
There was a problem hiding this comment.
Different casing than all other test kits
| object AkkaServerlessTestkit { | |
| object AkkaServerlessTestKit { |
There was a problem hiding this comment.
well, the javadsl AkkaServerlessTestkit is also lowercase-k. I'll also update that one then ;)
Especially important for codegenCore
| val entityClassName = service.fqn.name | ||
|
|
||
| File( | ||
| service.fqn.fileBasename + "IntegrationSpec.scala", |
5690e94 to
abcd7bf
Compare
Part of #372