Skip to content

Instantly share code, notes, and snippets.

@ktoso
Created August 20, 2014 14:50
Show Gist options
  • Select an option

  • Save ktoso/21ea82887ca565dda475 to your computer and use it in GitHub Desktop.

Select an option

Save ktoso/21ea82887ca565dda475 to your computer and use it in GitHub Desktop.
# Reactive Streams TCK #
The purpose of the *Reactive Streams Technology Compatibility Kit* (from here on refered to as: *the TCK*) is to guide
and help Reactive Streams library implementors to validate their implementations against the rules defined in [the Specification](https://github.com/reactive-streams/reactive-streams).
The TCK is implemented using plain Java and **TestNG** tests, and should be possible to use from other languages and testing libraries (such as Scala, Groovy, JRuby or others).
## Types of tests included in the TCK
The TCK aims to cover all rules defined in the Specification, however for some rules outlined in the Specification it is
not possible (or viable) to construct automated tests, thus the TCK does not claim to completely verify an implementation, however it is very helpful and is able to validate the most important rules.
The TCK is split up into 4 files JUnit 4 test classes which should be extended by implementors, providing their `Publisher` / `Subscriber` implementations for the test harness to validate them. The tests are split in the following way:
* `PublisherVerification`
* `SubscriberBlackboxVerification`
* `SubscriberWhiteboxVerification`
* `IdentityProcessorVerification`
The next sections include examples on how these can be used and describe the various confiruration options.
## Publisher Verfication
## Subscriber Verfication
### Subscriber Blackbox Verification
### Subscriber Whitebox Verification
## Identity Processor Verification
## Upgrade story
TODO - what is our story about updating the TCK?
## Using the TCK from other languages
The TCK was designed such that it should be possible to consume it using different languages.
The section below shows how to use the TCK using different languages (contributions of examples for more languages are very welcome):
### Scala
In order to run the TCK using [ScalaTest](http://www.scalatest.org/) the test class must mix-in the `TestNGSuiteLike` trait (as of `2.2.x`).
```
class IterablePublisherTest(env: TestEnvironment, publisherShutdownTimeout: Long)
extends PublisherVerification[Int](env, publisherShutdownTimeout)
with TestNGSuiteLike {
def this() {
this(new TestEnvironment(500), 1000)
}
def createPublisher(elements: Long): Publisher[Int] = ???
// example error state publisher implementation
override def createErrorStatePublisher(): Publisher[Int] =
new Publisher[Int] {
override def subscribe(s: Subscriber[Int]): Unit = {
s.onError(new Exception("Unable to serve subscribers right now!"))
}
}
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment