-
Notifications
You must be signed in to change notification settings - Fork 8
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
WIP – use NakadiMock in the spring-boot-2-test #109
base: master
Are you sure you want to change the base?
Conversation
} else if (withIdGreaterThan.equals("1")) { | ||
return Collections.singletonList(new Snapshot("2", "foo", filter)); | ||
return Collections.singletonList(new Snapshot("2", "foo", new Data("2", filter))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this so we actually get objects sent, not just null
or strings.
<dependency> | ||
<groupId>org.zalando</groupId> | ||
<artifactId>nakadi-mock</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is currently not yet released, and if it gets released, it might be under a different group name.
@@ -63,6 +69,7 @@ | |||
<groupId>io.rest-assured</groupId> | |||
<artifactId>rest-assured</artifactId> | |||
<version>3.1.0</version> | |||
<scope>test</scope> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated, I just noted that this does need only test scope.
import java.util.Collections; | ||
|
||
@EnableAutoConfiguration | ||
@EnableNakadiProducer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the deprecated annotation here.
/** | ||
* An application context initializer which sets up a NakadiMock bean and registers the server URL as a property. | ||
*/ | ||
class NakadiServerMockInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether it makes sense to move this class into either my Nakadi-Mock or even a new artifact, as this is useful whenever we are using both nakadi-producer and nakadi-mock together.
29b2f31
to
3c07ac1
Compare
Part of my Hackweek project. Please don't merge yet (we want to have a stable release of nakadi-mock first), but comments are already appreciated.
This is a Proof-of-concept of how to use my nakadi-mock project to test the event sending of spring-boot applications.
It turned out to be more complicated than I thought, because Spring-Boot-Autoconfigure detected that Undertow (an alternative web server, which I'm using in nakadi-mock) is on the class path, and tried to set it up as the application's web server (beside the Tomcat).
I solved that on the library side by shading undertow (renaming all class names and including in the Jar, thus removing the dependency).
Another issue is that we need to get the port number for the mock before configuring our Nakadi-Producer, which is why we are now using an ApplicationContextInitializer instead of normal
@Configuration
classes for that.Includes the changes of #107 and #108, so those should be merged first.