kimchi 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 74d556ba7f72327244762b5bf743e90c9275214b
4
+ data.tar.gz: 1a7e1224ad0fbfcf028f21608b0b7c7986121597
5
+ SHA512:
6
+ metadata.gz: 157121e698f35462e62a2603c74956bbc60e4a61b6a0e70ef76957a0637981f2be20dfac7cf339bd7539bcd91a4f1d28420a7bfa5786bf44859155bff5386934
7
+ data.tar.gz: f19fa638106dba00a06c073ecdccddf962727bf0210e87f700cda708bcae958d7d7b2e1f6ff4eb090702e845c0835d1470e27ec3d85b5ac432e4b8ecfe9d8c6e
data/.gitignore ADDED
@@ -0,0 +1,24 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.*~
19
+ *.iws
20
+ *.iml
21
+ *.ipr
22
+ target/
23
+ test-output/
24
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in kimchi.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 David Berkman
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Kimchi
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'kimchi'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install kimchi
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/kimchi.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kimchi/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "kimchi"
8
+ spec.version = Kimchi::VERSION
9
+ spec.authors = ["Taylor Gautier", "David Berkman"]
10
+ spec.email = ["robot@icix-usa.com"]
11
+ spec.summary = %q{Various frameworks and utilities to accelerate ICIX bdd tests}
12
+ spec.description = %q{BDD testing frameworks and utilities}
13
+ spec.homepage = "http://www.icix.com"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.4"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_dependency "uuid"
25
+ spec.add_dependency "bunny"
26
+ end
@@ -0,0 +1,3 @@
1
+ module Kimchi
2
+ VERSION = "0.0.2"
3
+ end
data/lib/kimchi.rb ADDED
@@ -0,0 +1,98 @@
1
+ After do |scenario|
2
+ if (scenario.failed?)
3
+ subject = scenario.title
4
+ time = Time.now.to_i
5
+ page.driver.render("./testresults/#{time}-failed-#{subject}.png", :full => true)
6
+ end
7
+ end
8
+
9
+ When /^I click the "(.*?)" button$/ do |arg1|
10
+ click_button(arg1)
11
+ end
12
+
13
+ When /^I click the link "(.*?)"$/ do |arg1|
14
+ click_link(arg1)
15
+ end
16
+
17
+ When /^I choose "(.*?)"$/ do |arg1|
18
+ choose(arg1)
19
+ end
20
+
21
+ Then /^I should see a title with text "(.*?)"$/ do |arg1|
22
+ page.find('h1.title').text.should match(arg1)
23
+ end
24
+
25
+ Then /^the "(.*?)" button should not be enabled$/ do |arg1|
26
+ page.should have_css('.btn.btn-primary[disabled]')
27
+ end
28
+
29
+ Then /^the "(.*?)" button should be enabled$/ do |arg1|
30
+ page.has_no_css?('.btn.btn-primary[disabled]')
31
+ end
32
+
33
+ Then /^I should see a "(.*?)" button$/ do |arg1|
34
+ page.has_button?(arg1)
35
+ end
36
+
37
+ Then /^there should be a "(.*?)" with text "(.*?)"$/ do |arg1, arg2|
38
+ find(arg1, :text => arg2).visible?
39
+ end
40
+
41
+ Then /^there should be a link with text "(.*?)"/ do |arg1|
42
+ find_link(arg1).visible?
43
+ end
44
+
45
+ Then /^there should be a link called "(.*?)" with href "(.*?)"$/ do |arg1, arg2|
46
+ page.has_link?(arg1, :href => arg2)
47
+ end
48
+
49
+ Then /^there should be a link "(.*?)" with href "(.*?)" and target "(.*?)"$/ do |arg1, arg2, arg3|
50
+ find_link(arg1)[:href].should == arg2
51
+ find_link(arg1)[:target].should == arg3
52
+ end
53
+
54
+ Then /^"(.*?)" should be visible$/ do |text|
55
+ page.should have_xpath("//*[contains(text(),'#{text}')]", :visible => true)
56
+ end
57
+
58
+ Then /^"(.*?)" should not be visible$/ do |text|
59
+ page.should_not have_xpath("//*[text()='#{text}']", :visible => true)
60
+ end
61
+
62
+ Then /^the "(.*?)" field option should be set to "(.*?)"$/ do |elem, text|
63
+ page.has_select?(elem, :selected => text).should == true
64
+ end
65
+
66
+ When /^I fill field "(.*?)" with "(.*?)"$/ do |elem, text|
67
+ fill_in(elem, :with => text);
68
+ end
69
+
70
+
71
+ Then /^the "(.*?)" field should be valid$/ do |arg1|
72
+ page.should have_css('#'+ arg1 + ".ng-valid")
73
+ end
74
+
75
+ Then /^the "(.*?)" field should be invalid$/ do |arg1|
76
+ page.should have_css('#'+ arg1 + ".ng-invalid")
77
+ end
78
+
79
+ Then /^the "(.*?)" field shoud be too long$/ do |arg1|
80
+ page.should have_css('#'+ arg1 + ".ng-invalid-max-length")
81
+ end
82
+
83
+ Given /^I am on the "(.*?)" page$/ do |arg1|
84
+ visit(arg1)
85
+ end
86
+
87
+ Then /^the field "(.*?)" should have the text "(.*?)"$/ do |arg1, arg2|
88
+ find_field(arg1).value.should == arg2
89
+ end
90
+
91
+ Then /^the querystring is "(.*?)"$/ do |arg1|
92
+ uri = URI.parse(current_url)
93
+ uri.fragment.end_with?(arg1).should be_true
94
+ end
95
+
96
+ Then /^I should see a server error$/ do
97
+ page.should have_css(".alert-error")
98
+ end
data/lib/wire.rb ADDED
@@ -0,0 +1,57 @@
1
+ require "rubygems"
2
+ require "uuid"
3
+ require "bunny"
4
+
5
+ module Wire
6
+
7
+ class Function
8
+ def initialize(name, signature = nil, result = nil)
9
+ @name = name
10
+ @signature = signature
11
+ @result = result
12
+ end
13
+ def to_json
14
+ "{\"endpoint\": \"#{@name}\"" + ((@signature == nil) ? "" : ", \"signature\": #{@signature}") + ((@result == nil) ? "" : ", \"result\": \"#{@result}\"") + "}"
15
+ end
16
+ end
17
+
18
+ class InvocationSignal
19
+ def initialize(function, arguments, contexts)
20
+ @function = function
21
+ @arguments = arguments
22
+ @contexts = contexts
23
+ end
24
+ def to_json
25
+ "{\"address\": #{@function.to_json}, \"body\": #{@arguments.to_json}, \"contexts\": #{@contexts}}"
26
+ end
27
+ end
28
+
29
+ class RabbitMQTransport
30
+ def initialize (host, port, service_name)
31
+ @connection = Bunny.new("amqp://#{host}:#{port}")
32
+ @connection.start
33
+
34
+ @uuid = UUID.new
35
+ @caller_id = @uuid.generate
36
+
37
+ request_channel = @connection.create_channel
38
+ @request_exchange = request_channel.topic("#{service_name}.request")
39
+
40
+ response_queue_name = @uuid.generate
41
+ response_channel = @connection.create_channel
42
+ response_exchange = response_channel.topic("#{service_name}.response")
43
+ response_queue = response_channel.queue("#{response_queue_name}", {:durable => false, :exclusive => true, :auto_delete => true})
44
+
45
+ response_queue.bind(response_exchange, :routing_key => "#{@caller_id}").subscribe do |delivery_info, metadata, payload|
46
+ result_body = JSON.parse(payload)
47
+ puts "#{payload}"
48
+ end
49
+ end
50
+
51
+ def transmit_in_only(version, invocation_signal)
52
+
53
+ @request_exchange.publish(invocation_signal.to_json, :routing_key => "#{version}.2", :headers => {"x-opt-callerId" => "#{@caller_id}"}, :content_type => "application/json", :message_id => "#{@uuid.generate}", :timestamp => Time.new.to_i)
54
+ end
55
+ end
56
+
57
+ end
@@ -0,0 +1,7 @@
1
+ require_relative "wire"
2
+ require "json"
3
+
4
+ puts "hellO"
5
+ Wire::RabbitMQTransport.new("localhost", 5672, "echo").transmit_in_only("1", Wire::InvocationSignal.new(Wire::Function.new("talk"),{"message" => "Hello out there"}, []))
6
+ sleep 60
7
+
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kimchi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Taylor Gautier
8
+ - David Berkman
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-10-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '1.4'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: '1.4'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: uuid
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: bunny
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ description: BDD testing frameworks and utilities
71
+ email:
72
+ - robot@icix-usa.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - kimchi.gemspec
83
+ - lib/kimchi.rb
84
+ - lib/kimchi/version.rb
85
+ - lib/wire.rb
86
+ - src/main/ruby/kimchi/wire/foo.rb
87
+ homepage: http://www.icix.com
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.1.9
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Various frameworks and utilities to accelerate ICIX bdd tests
111
+ test_files: []