Scala sydoct2011

1,411 views

Published on

Talk about cloud apis and scala, how to mock and test them in a meaningful way with mockito. Presented to scalasyd in Oct 2011

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,411
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Scala sydoct2011

    1. 1. Mocking the cloudMichael Neale@michaelnealegithub.com/michaelneale
    2. 2. @cloudbees Hosted apps (PaaS a la GAE etc) Jenkins/hudson “as a service” lotsa elastic servers, variable load in production !
    3. 3. Where scala: Provisioning: Build servers, masters, new hosts, allocation “cloud controller” app Some Play! framework, some maven
    4. 4. CloudBees controller providore storageApp pool DB clusters Master pool Slave pool scala
    5. 5. Why scala? Easy ! * Saved time (early startup - I had to wear lots of hats) * Types help hard to reach (test) places * And why not
    6. 6. Result? New staff come on, able to contribute, maintain. No issues. But they aren’t idiots.
    7. 7. Next time?Seriously look at scala “native” things (akka)Avoid faux-oo - instead use objects as namespacesMonadic IO - Monadic server/cloudoperations?
    8. 8. server = do instance = launch_server "image-id" volume = create_volume_for instance "10G" return attach_volume instance volume
    9. 9. To the cloud (jclouds + scala) Avert your eyes children...
    10. 10. CloudClient “Discovered” semantics: Start, Stop, List, Status, Volume Create, Attach etc.. Create own easily mockable cloud api (trait) Don’t try this at home... (EBS sob stories for another time - pushed provisioning api to the limit)
    11. 11. Mockito + Scalatest Runs nicely in IDEA runner TestX extends ShouldMatchers (scalatest) import org.mockito.{Matchers, ArgumentCaptor}
    12. 12. Also: the REPL Invaluable: Controlled “live” testing Explore api behaviors, inspect Data in “hazelcast” - reload new version, continue Testing with real things == expensive

    ×