-
Notifications
You must be signed in to change notification settings - Fork 29
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
Important PR: Complete API work, adding Scala testtools, big refactoring #63
Conversation
* Provide only wrapping functionality around java RecordParser. * Removed old tests * Fixed event bus message typing * Clean up package objects * An execution context for Vert.x to stay on the same thread * Reimplemented SharedData - there are many open questions for this.. * Remove unnecessary Map of handlers * Removed VertxConverters * private[this] trait VertxWrapper to not expose it to users * Provide apply methods to Pump factory
* Fix build script stuff to be able to use TestVerticle * TestVerticle now uses JavaClassRunner and is only available in /test * Class loader fixes * Added http tests and websocket tests * Added fileSystem tests * Added BufferTests for String, Int, Byte, Long, Float, Short, Buffer and Double are complete * Added NetTests * Added chmod tests * Added PumpTests * Refactored buffers * Added event bus tests
* Added test stub for DnsClient API
* Ported DnsExceptions to scala
* Fixes the the ScalaInterpreterTest * Put VerticleClass used by ScalaInterpreterTest back to its original location. * Restore console output for script vs class interpret stages. This helps the user understand what is going and understand why the console shows some errors when it first tries to run the file as a script and if it fails, it fallsback on running it as a verticle class.
We can close the other PR then, I guess :) |
* | ||
* @param elements The elements to put into the JsonArray. | ||
* @return A JsonArray containing the provided elements. | ||
*/ | ||
def arr(fields: Seq[Any]): JsonArray = { | ||
val a = new JsonArray() | ||
fields.foreach(f => addToArray(a, f)) | ||
a | ||
} |
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 we should kick the Json.apply() methods and only have Json.obj(fields: (String, Any)) and Json.arr(fields: Any) then. It's a bit more verbose than using Json(...stuff...) but since we always need to put a Seq[Any] in for arrays, that means you always have to do a Json.arr(List(...)) instead of being able to do Json.arr(x1, x2, ...)
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.
Hmmm, I guess you mean Json.arr(fields: Seq[Any])
instead of Json.arr(fields: Any)
in the first line?
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.
Argh, sorry, github formatting ate parts of my comment due to asterisks. I want to have these two methods:
def obj(fields: (String, Any)*): JsonObject
def arr(fields: Any*): JsonArray
And probably kick out the Json.apply(fields: (String, Any)*)
and Json.apply(elements: Seq[Any])
methods as they only add a very small amount of syntactic sugar compared to a much more clear syntax. Actually, Json(List(1, 2, 3))
is even 2 characters more verbose than Json.arr(1, 2, 3)
, so it's only adding value for creating JsonObject
s ;)
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.
Fine by me :)
@@ -0,0 +1,11 @@ | |||
# EventBus issues |
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.
Instead of adding a new file, why not add it to the README file? This way this is shown in the homepage of the github repo...etc.
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.
Actually this wasn't really intended and just for myself to make me not forget this issue. But you're right, we should add it to the readme file as long as we don't have a nice solution for it. Could you do that? Thanks
I've not finished yet but gotta leave it here for today. I'll finish the review tomorrow. |
Thanks for your time @galderz ! Hope the other contributors can have a look, too. I'd really like to see a release with more methods available. We rely on our own build right now, that we've taken out of these custom branches. @SaschaSchmidt made some tests for DNS now, but I have to admit I didn't really review them yet: https://github.com/campudus/mod-lang-scala/commit/df3a09b19af12e142f979cfc7e301bd0a4882568 If you'd pull this in, the tests should run through and the whole build should be successful once again! 👍 |
I saw that Gradle fails the test for The gradle template has a few integration tests as scripts in different languages. It would be nice to see something like this working for Scala, too. AIUI, the tests for the interpreter just create a ScalaInterpreter and let it interpret these predefined files. That's fine, but we cannot see how the interpreter would pick up a script itself like the template does. Can we somehow fix this, please? |
import scala.concurrent.ExecutionContext | ||
import org.vertx.scala.core.logging.Logger | ||
|
||
trait VertxExecutionContext extends ExecutionContext { |
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.
What is this for exactly? I mean, this context class extending scala.concurrent.ExecutionContext
, what are you using it for?
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.
You need a ExecutionContext for Futures and Promises. It is used implicitly by the map/flatMap methods in a Future for example. For Vert.x we need to use the "run directly on this thread" concept. If we'd use the global implicit ExecutionContext provided by Scala, Vert.x would break due to the different Threading model in it.
Disclaimer: Tim helped building this class, so I'd expect it to be correct from the logical point of view ;) and my code ran fine with using Futures and this ExecutionContext. :)
* README file is now asciidoc and added content * Added a quickstart * Added a section on current issues * Build status not shown correctly with asciidoc
I've fixed |
I temporarily put that while trying to get it to work. Let's try to make it more generic... |
@Narigo It needs some work to make it generic. I suggest we add as is and I'll make it more generic in the next few days? As it is, all tests pass and the code looks good. |
@galderz sure, go ahead! It would be nice to have it on master and send PRs against master again ;)
|
Why did the Travis build fail for OpenJDK 7? I don't really get its output :( |
@Narigo Let's integrate this and you can send a pull request for the JSon stuff? We should not take DNS out now. We're in no rush to get 0.2.0 out, so let's leave it in and release once we have a Vert.x version that includes it. For docu, I'd add whatever it's needed to the root readme file. Send a PR if there's anything specific you want in there. Examples should be added to this repo. I'm planning to add a script one and some more, so you can leave that with me. |
No idea about OpenJDK7 failure. |
@galderz I'd really like to have another release with all of that ASAP, actually. I have some dependencies on this branch already and ported some things to it. I wouldn't mind to do some work on it to get DNS out into another branch (for 0.3.0) so we can implement all the things that come with Vert.x 2.1.0 on it. Otherwise we'd have to implement all those new things, too, in order to have the complete Vert.x API available. That means at least HTTP compression, UDP, EventBus timeouts and I guess even more things. So to recap my proposal:
If you're okay with that, please start by merging this PR or send me a note to do so. Then I can start working on it right away. Maybe @SaschaSchmidt can help us with docs and examples a little bit this week, if we can merge it ASAP. ;) |
All looks good to me. The only thing is that we don't need a separate branch for the DNS + Vertx 2.1 stuff. Once the release is out, which should be in the next few days, master can be used for that. You can always have a topic branch with this work. |
No description provided.