sk-hoth 0.0.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/README.rdoc +69 -39
  2. data/THANKS.md +9 -0
  3. data/TODO +2 -0
  4. data/lib/hoth/encoding/json.rb +28 -0
  5. data/lib/hoth/encoding/no_op.rb +19 -0
  6. data/lib/hoth/endpoint.rb +28 -0
  7. data/lib/hoth/exceptions.rb +14 -0
  8. data/lib/hoth/extension/core/exception.rb +15 -0
  9. data/lib/hoth/modules.rb +27 -0
  10. data/lib/hoth/providers/bertrpc_provider.rb +35 -0
  11. data/lib/hoth/providers/rack_provider.rb +45 -0
  12. data/lib/hoth/service.rb +50 -0
  13. data/lib/hoth/service_definition.rb +18 -0
  14. data/lib/hoth/service_module.rb +49 -0
  15. data/lib/hoth/service_registry.rb +34 -0
  16. data/lib/hoth/services.rb +51 -0
  17. data/lib/hoth/transport/base.rb +19 -0
  18. data/lib/hoth/transport/bert.rb +87 -0
  19. data/lib/hoth/transport/http.rb +41 -0
  20. data/lib/hoth/transport/http_hmac.rb +37 -0
  21. data/lib/hoth/transport/workling.rb +23 -0
  22. data/lib/hoth/transport.rb +48 -0
  23. data/lib/hoth/util/logger.rb +46 -0
  24. data/lib/hoth.rb +56 -0
  25. data/spec/spec_helper.rb +7 -26
  26. data/spec/unit/encoding/json_spec.rb +25 -0
  27. data/spec/unit/endpoint_spec.rb +34 -0
  28. data/spec/unit/extension/core/exception_spec.rb +34 -0
  29. data/spec/unit/hoth_spec.rb +30 -0
  30. data/spec/unit/providers/rack_provider_spec.rb +49 -0
  31. data/spec/unit/service_definition_spec.rb +21 -0
  32. data/spec/unit/service_module_spec.rb +59 -0
  33. data/spec/unit/service_spec.rb +77 -0
  34. data/spec/unit/transport/base_spec.rb +43 -0
  35. data/spec/unit/transport/http_hmac_spec.rb +44 -0
  36. data/spec/unit/transport/http_spec.rb +73 -0
  37. data/spec/unit/transport/workling_spec.rb +42 -0
  38. data/spec/unit/transport_spec.rb +29 -0
  39. metadata +86 -23
  40. data/lib/king_soa/rack/middleware.rb +0 -47
  41. data/lib/king_soa/registry.rb +0 -55
  42. data/lib/king_soa/service.rb +0 -88
  43. data/lib/king_soa.rb +0 -56
  44. data/spec/king_soa/rack/middleware_spec.rb +0 -36
  45. data/spec/king_soa/registry_spec.rb +0 -28
  46. data/spec/king_soa/service_spec.rb +0 -46
  47. data/spec/server/app.rb +0 -26
@@ -1,46 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper.rb'
2
-
3
- describe KingSoa::Service do
4
- before(:each) do
5
- end
6
-
7
- it "should init" do
8
-
9
- end
10
- end
11
-
12
- describe KingSoa::Service, 'local request' do
13
-
14
- it "should call service" do
15
- s = KingSoa::Service.new(:name=>:local_soa_class)
16
- res = s.perform(1,2,3)
17
- res.should == [1,2,3]
18
- end
19
- end
20
-
21
- # needs the local testserver !!!
22
- # ruby spec/server/app
23
- describe KingSoa::Service, 'remote request' do
24
-
25
- it "should call a service remote" do
26
- s = KingSoa::Service.new(:name=>:soa_test_service, :url=>'http://localhost:4567', :auth_key=>'12345')
27
- s.perform(1,2,3).should == [1,2,3]
28
- end
29
-
30
- it "should call a service remote and return auth error" do
31
- s = KingSoa::Service.new(:name=>:soa_test_service, :url=>'http://localhost:4567', :auth_key=>'wrong')
32
- s.perform(1,2,3).should == "Please provide a valid authentication key"
33
- end
34
-
35
- it "should call a service remote and return auth error" do
36
- s = KingSoa::Service.new(:name=>:wrong_service, :url=>'http://localhost:4567', :auth_key=>'12345')
37
- s.perform(1,2,3).should == "An error occurred! (undefined method `auth_key' for nil:NilClass)"
38
- end
39
- end
40
-
41
-
42
- class LocalSoaClass
43
- def self.perform(param1, param2, param3)
44
- return [param1, param2, param3]
45
- end
46
- end
data/spec/server/app.rb DELETED
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems'
3
- require 'sinatra'
4
- require "#{File.dirname(__FILE__)}/../../lib/king_soa"
5
-
6
- use KingSoa::Rack::Middleware
7
-
8
-
9
- ###################################################
10
- # method to kill this server instance
11
- #'/die'
12
- #######################################
13
- # Somewhere in you app
14
- #
15
- # setup test registry
16
- service = KingSoa::Service.new(:name=>'soa_test_service', :auth_key=>'12345')
17
- KingSoa::Registry << service
18
-
19
- # the class beeing called localy
20
- class SoaTestService
21
-
22
- def self.perform(param1, param2, param3)
23
- return [param1, param2, param3]
24
- end
25
-
26
- end