Re: How to write tests fro vertx and Clojure

2015-01-02 Thread Toby Crawley
Ah, right. When embedded, you'll have to use a platform manager to
deploy verticles. See
http://vertx.io/mod-lang-clojure/docs/1.0.4/vertx.embed.platform.html.

However, moving the code out of the veriticles for testing is probably
a better idea.

- Toby

On Sun, Dec 28, 2014 at 1:06 PM, rogergl ro...@gilliar.de wrote:
 Maybe it is a better solution to put the code I wan't to test outside the
 vertices and just leave the basic eventbus setup insides the vertices ?

 Regards
  Rpger


 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to write tests fro vertx and Clojure

2014-12-28 Thread Toby Crawley
On Sun, Dec 28, 2014 at 9:52 AM, rogergl ro...@gilliar.de wrote:
 it seems as if there is a test package for vertx and Clojure
 (vertx.testools)

 Since I would like to test my vertices I tried this simple approach:

 (tt/as-embedded (fn []
 (core/deploy-verticle project/vertices/time.clj)
  (tt/test-complete*)))

The above code will cause the test to exit immediately, before the
verticle finishes deploying. You probably want to call test-complete*
from an on-message handler listening to const/topic-time. See
https://github.com/vert-x/mod-lang-clojure/blob/master/api/src/test/clojure/vertx/eventbus_test.clj
for examples of this technique.

If that doesn't make sense or you are still having issues, feel free
to open an issue on https://github.com/vert-x/mod-lang-clojure/ and
we'll see if we can get you fixed up.


 But this gives me a timeout.

 BTW: The vertice is really simple:

 (core/periodic 1000
(let [now (h/now)]
  (eb/publish const/topic-time (h/to-transit {:date-time
 now}


 The question is: Is it possible to tests vertices that use the eventbus ?
 And if it is possible how it is done ?


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to write tests fro vertx and Clojure

2014-12-28 Thread rogergl
I think I'm getting close. The eventbus_test.clj 
https://github.com/vert-x/mod-lang-clojure/blob/master/api/src/test/clojure/vertx/eventbus_test.clj
 runs 
and I changed my test to:

(deftest eb-send
  (core/deploy-verticle /project/vertices/time.clj)
  (let [addr const/topic-time
id (atom nil)]
(reset! id
(eb/on-message
  addr
  (fn [m]
(t/test-complete
  (is true)
  (eb/unregister-handler @id)
(is (not (nil? @id)

But I get:

ERROR in (eb-send) (core.clj:70)
Uncaught exception, not in assertion.
expected: nil
  actual: org.vertx.java.core.VertxException: No container instance 
available. If embedded, see vertx.platform.
 at vertx.core$get_container.invoke (core.clj:70)

It seems as if  (core/deploy-verticle /project/vertices/time.clj) is the 
problem. 

Regards
  Roger

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to write tests fro vertx and Clojure

2014-12-28 Thread rogergl
Maybe it is a better solution to put the code I wan't to test outside the 
vertices and just leave the basic eventbus setup insides the vertices ?

Regards
 Rpger


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.