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

Split TestHelpers, one for JobHandler and one for EventHandler #72

Merged
merged 1 commit into from
May 27, 2015

Conversation

jcredding
Copy link
Member

This splits the test helpers into two mixins, one for JobHandler
and one for EventHandler. This is so each can provide a different
test_runner method and in general, different test helpers as
needed.

This renames the TestRunner to JobTestRunner and adds an
EventTestRunner that inherits from it. The EventTestRunner
checks that its passed an EventHandler and also sets up passing
an event job. EventHandler, unlike JobHandler, requires its
runner to have an event job. To handle this, the EventTestRunner
will build an event job and super it to the TestRunner. It also
handles params so it can easily be passed event params directly.

This also fixes a minor issue with how the Runner set its
attributes and built its handler. Since event handlers require
their runner to have an event job when they are built, the base
Runner needs to set its attributes before it builds an instance
of the handler.

@kellyredding - Ready for review.


end

class EventTestRunner < TestRunner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcredding we discussed you could just rename test runner as "job test runner and have the event test runner subclass. That job handler check shouldn't fail on event handlers since they bring job handler in.

@kellyredding
Copy link
Member

@jcredding made a couple of comments. I'd like to take a second look and see how you choose to address them.

@jcredding
Copy link
Member Author

@kellyredding - I've updated this. I renamed the TestRunner to JobTestRunner and changed the Factory usage to just hard-coded strings.

This splits the test helpers into two mixins, one for `JobHandler`
and one for `EventHandler`. This is so each can provide a different
`test_runner` method and in general, different test helpers as
needed.

This renames the `TestRunner` to `JobTestRunner` and adds an
`EventTestRunner` that inherits from it. The `EventTestRunner`
checks that its passed an `EventHandler` and also sets up passing
an event job. `EventHandler`, unlike `JobHandler`, requires its
runner to have an event job. To handle this, the `EventTestRunner`
will build an event job and super it to the `TestRunner`. It also
handles params so it can easily be passed event params directly.

This also fixes a minor issue with how the `Runner` set its
attributes and built its handler. Since event handlers require
their runner to have an event job when they are built, the base
`Runner` needs to set its attributes before it builds an instance
of the handler.

All of this is part of adding an events system to Qs.
@kellyredding
Copy link
Member

@jcredding very cool - I like it. 👎

jcredding added a commit that referenced this pull request May 27, 2015
Split `TestHelpers`, one for `JobHandler` and one for `EventHandler`
@jcredding jcredding merged commit 06f6d82 into master May 27, 2015
@jcredding jcredding deleted the jcr-split-test-helpers branch May 27, 2015 18:20
jcredding added a commit that referenced this pull request Aug 4, 2015
* Add `Event` (#67)
* Add `EventHandler` mixin (#68)
* Hotfix: Updating benchmark report to set new baseline (a3a88f5)
* Add `dispatcher_queue` to Qs, setup for publishing events (#69)
* Add payload type to jobs (#70)
* Update `Event` to set a custom payload type (#73)
* Add `Qs.publish` (#74)
* Add `event` to `Queue` (#75)
* Split `TestHelpers` (#72)
* Store queues as event subscribers in redis (#76)
* Add `Payload` module for serializing and deserializing (#78)
* Add `Message`, setup `Event` being a kind of `Message` (#79)
* Add `MessageHandler` (#80)
* Update runners to expect a message (#81)
* Update `Event` to be a kind of `Message` (#82)
* Add optional publisher for events (#77)
* Rename `RedisItem` to `QueueItem` (#83)
* Pass params via options when building jobs and events (#84)
* Add separate logging for jobs and events (#85)
* Add `DispatchJobHandler` (#86)
* Update dispatcher queue (#87)
* Benchmark publishing and running events (#89)
* Add daemon event handling system tests (#88)
* Add subscription system tests, fix sync (#90)

/cc @kellyredding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants