-
Notifications
You must be signed in to change notification settings - Fork 535
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
!tck #12 Migrated TCK to plain Java #15
!tck #12 Migrated TCK to plain Java #15
Conversation
libraryDependencies += "org.testng" % "testng" % "5.14.10" | ||
|
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.
will add auto autoScalaLibrary := false
when removing the Scala versions of the classes
Implementing from Scala now looks like this: class ActorProducerTest(_system: ActorSystem, env: JavaTestEnvironment, publisherShutdownTimeout: Long)
extends JavaPublisherVerification[Int](env, publisherShutdownTimeout)
with WithActorSystem with TestNGSuiteLike {
implicit val system = _system
import system.dispatcher
def this(system: ActorSystem) {
this(system, new JavaTestEnvironment(Timeouts.defaultTimeoutMillis(system)), Timeouts.publisherShutdownTimeoutMillis)
}
def this() {
this(ActorSystem(classOf[ActorProducerTest].getSimpleName, AkkaSpec.testConf))
} This is in order to make |
Just before I go through the code; have we've verified that the current akka-streams impl passes the migrated TCK? |
Yes, I've got it migrated to use the new TCK and it's all green. |
Ok, just wanted to make sure that it flies :) |
|
||
T x = nextT(); | ||
sendNext(x); | ||
expectNextElement(sub, x); |
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.
These three lines seem common enough to warrant a helper
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.
+1, added sendNextTFromUpstream
Updated PR |
* Override in your test if you want to enable completed-state verification. | ||
* If you don't override the respective tests will be ignored. | ||
*/ | ||
public Publisher<T> createCompletedStatePublisher() { |
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 think these should be abstract methods so the implementor has to implement them. i.e. no hidden surprises.
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.
make abstract but keep the style of return null == ignore these
tests? Akka streams don't use the error publisher for exampe
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.
Document on the method what one should do. :)
Can't wait for this :) thanks a lot. |
new TestSetup(env, testBufferSize) {{ | ||
TestEnvironment.ManualSubscriber<T> sub = newSubscriber(); | ||
sub.cancel(); | ||
expectCancelling(); |
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.
Btw, how does expectCancelling
know which Subscriber we expect to get cancelled?
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.
The test does something slightly different - so if all down-stream's are cancelled, we call cancel on the upstream one. (so expectCancelling
actually only cares if the ManualPublisher decides to cancel it's upstream subscription).
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.
Ah, that's pretty hard to see from just looking at the code.
LGTM, great work @ktoso |
|
||
// then | ||
for (String publisherTest : publisherTests) { | ||
String msg = String.format("%d tests in %s did not include %s!", processorTests.size(), IdentityProcessorVerification.class, publisherTest); |
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 output message doesn't seem to make sense for the processorTests.size(), am I missing something?
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.
Hm, read as "[n tests, in the "delegator test suite] test in "delegator" did not include [expected test to be delegated to]"; seems ok to me? // Extracted this loop as method.
LGTM |
private static final Optional NONE = new Optional() { | ||
@Override | ||
public Object get() { | ||
throw new RuntimeException(".get call on None!"); |
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.
NoSuchElementException :)
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.
👍
* In which we trade off less-DRY in order to be scala-version independent. * TCK does not depend on Scala at all now. * Added tests testing the TCK, if we properly delegate all tests from Processor -> {Producer, Subscriber} * Made SBT run the TestNG test * Made the "pending" tests (decided by returning null in the special create... methods) actualy visible as PENDING to testNG
Pushed final squash which addresses all of Viktor's latest feedback, so should be good to go (also tested akka-streams with it and we're green). Highlights include:
Thanks for the awesome code review! |
Fantastic work, Konrad! LGTM 👍 |
I guess we're awaiting a couple of extra +1's before we merge! :-) |
I’m trying out the publishing and cannot build the javadoc due to source duplication, will need to fix the build. But I’ll open a new PR for that once this one is merged, which I’d therefore like to do soon-ish. |
Excellent, just in time! |
@rkuhn what command is failing? I worked using |
I happened to have the old generated |
Sounds great |
Included @rkuhn's javadoc patch; Waiting for last LGTMs / merge and we'll release |
Will merge and publish a 0.3 now (since the first sync to Maven Central can take a lot longer). We can in any case publish a 0.4 if there are things to be fixed. |
!tck #12 Migrated TCK to plain Java
Perfect. Great turn-around time for this one, guys! |
lol :) Ok, will make those public; (in a few minutes) |
Great, thanks, Konrad! |
Migrated TCK to plain Java.
Had to replicate trait behaviour by delegating manually, so there's a bit more duplication (Processor test), but we're not locked to a concrete Scala version.
Please review and I'll rename the classes
Java* => *
and remove the Scala versions of them - then let's merge.// cc @viktorklang