Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation to reflect that TestServer no longer enables Cassandra and Clustering by default #287

Closed
TimMoore opened this issue Nov 24, 2016 · 2 comments

Comments

@TimMoore
Copy link
Contributor

As raised by @mihbor on 1818b3d#commitcomment-19935097

If I understand correctly SetupImpl and therefore TestServer.defaultSetup() now default to cluster and cassandra disabled. If so, the documentation at http://www.lagomframework.com/documentation/1.2.x/java/Test.html
and the comment in line 162 need updating:

* The default `Setup` configuration, which has persistence enabled.

TimMoore referenced this issue Nov 24, 2016
* Added support to the testkit for testing topics (doesn't use Kafka, we
  could add something that uses Kafka in future if we find it's needed,
  but for now it just plumbs the sinks/sources directly together through
  the message serializer).
* Removed dependence on persistence-cassandra from testkit. The testkit still allows
  to setup Cassandra, and will run it and shut it down for you, but
  because there's no longer a direct dependency in
  persistence-cassandra, you can also use the testkit with JDBC. There's
  no specific support for JDBC, but this can be added in future if for
  example we decide we want to support running H2 automatically for you.
@mihbor
Copy link
Contributor

mihbor commented Nov 24, 2016

Also, I noticed Kafka support is always disabled:

disableModules(b2, KafkaClientModule, KafkaBrokerModule)

Probably needs mentioning in the docs too.

And btw, how to test services with kafka? Is it not supported yet? Are there plans to add support for it?

I added a topic subscriber to my service as in http://www.lagomframework.com/documentation/1.2.x/java/MessageBrokerApi.html#subscribe-to-a-topic
and suddenly existing tests fail because guice can't inject dependencies any more:

com.google.inject.CreationException: Unable to create injector, see the following errors:
1) Error injecting constructor, java.lang.IllegalStateException: Attempt to get a topic, but there is no TopicFactory provided to implement it. You may need to add a dependency on lagom-javadsl-kafka-broker to your projects dependencies.

even though the dependency on lagom-javadsl-kafka-broker is present.

EDIT: I should add that I'm subscribing to a topic from the same service that is declaring the topic, in case it makes any difference. I also tried calling bindClient on the service's own interface in the configure method to see if that helps but it just gave a different injection exception.

@TimMoore
Copy link
Contributor Author

@mihbor we have been discussing among the team how best to support testing services with Kafka

You can see how we're doing it in one of our example apps here: lagom/online-auction-java#11 (essentially stubbing out the topic factory in the tests).

We're open to feedback about the best approach for tests with Kafka (particularly if you want to do integration tests against a running Kafka instance).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants