coupler 0.0.4-java → 0.0.6-java
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.
- data/Gemfile +7 -8
- data/Gemfile.lock +43 -24
- data/VERSION +1 -1
- data/coupler.gemspec +27 -31
- data/features/wizard.feature +2 -1
- data/lib/coupler.rb +2 -2
- data/lib/coupler/base.rb +4 -0
- data/lib/coupler/extensions/connections.rb +2 -12
- data/lib/coupler/extensions/jobs.rb +4 -2
- data/lib/coupler/extensions/projects.rb +1 -1
- data/lib/coupler/helpers.rb +9 -1
- data/lib/coupler/models.rb +8 -0
- data/lib/coupler/models/comparison.rb +5 -4
- data/lib/coupler/models/connection.rb +10 -1
- data/lib/coupler/models/import.rb +3 -7
- data/lib/coupler/models/transformer.rb +1 -1
- data/lib/coupler/runner.rb +1 -1
- data/lib/coupler/scheduler.rb +1 -1
- data/tasks/test.rake +8 -0
- data/test/functional/test_base.rb +17 -0
- data/test/functional/test_connections.rb +81 -0
- data/test/functional/test_imports.rb +76 -0
- data/test/{integration/extensions → functional}/test_jobs.rb +21 -12
- data/test/functional/test_matchers.rb +108 -0
- data/test/functional/test_projects.rb +67 -0
- data/test/functional/test_resources.rb +126 -0
- data/test/{integration/extensions → functional}/test_results.rb +20 -29
- data/test/functional/test_scenarios.rb +92 -0
- data/test/functional/test_transformations.rb +106 -0
- data/test/functional/test_transformers.rb +68 -0
- data/test/helper.rb +30 -20
- data/test/integration/test_transformation.rb +6 -1
- data/test/unit/models/test_common_model.rb +2 -2
- data/test/unit/models/test_comparison.rb +8 -8
- data/test/unit/models/test_connection.rb +2 -2
- data/test/unit/models/test_field.rb +2 -2
- data/test/unit/models/test_import.rb +9 -4
- data/test/unit/models/test_job.rb +2 -2
- data/test/unit/models/test_matcher.rb +2 -2
- data/test/unit/models/test_project.rb +2 -2
- data/test/unit/models/test_resource.rb +2 -2
- data/test/unit/models/test_result.rb +2 -2
- data/test/unit/models/test_scenario.rb +2 -2
- data/test/unit/models/test_transformation.rb +2 -2
- data/test/unit/models/test_transformer.rb +12 -2
- data/test/unit/test_base.rb +1 -14
- data/test/unit/test_data_uploader.rb +1 -1
- data/test/unit/test_database.rb +1 -1
- data/test/unit/test_helpers.rb +2 -2
- data/test/unit/test_import_buffer.rb +40 -38
- data/test/unit/test_logger.rb +1 -1
- data/test/unit/test_models.rb +1 -1
- data/test/unit/test_runner.rb +1 -1
- data/test/unit/test_scheduler.rb +1 -1
- data/webroot/public/css/style.css +7 -5
- data/webroot/public/js/jquery.dataTables.min.js +130 -574
- data/webroot/views/connections/new.erb +41 -3
- data/webroot/views/imports/new.erb +2 -0
- data/webroot/views/jobs/list.erb +25 -21
- data/webroot/views/projects/index.erb +23 -15
- data/webroot/views/resources/list.erb +1 -2
- data/webroot/views/resources/new.erb +2 -2
- data/webroot/views/resources/show.erb +5 -2
- data/webroot/views/scenarios/new.erb +1 -1
- data/webroot/views/transformations/new.erb +1 -1
- metadata +30 -44
- data/lib/coupler/config.rb +0 -128
- data/test/coupler/models/test_import.rb +0 -221
- data/test/factories.rb +0 -91
- data/test/integration/extensions/test_connections.rb +0 -80
- data/test/integration/extensions/test_imports.rb +0 -94
- data/test/integration/extensions/test_matchers.rb +0 -134
- data/test/integration/extensions/test_projects.rb +0 -82
- data/test/integration/extensions/test_resources.rb +0 -150
- data/test/integration/extensions/test_scenarios.rb +0 -88
- data/test/integration/extensions/test_transformations.rb +0 -113
- data/test/integration/extensions/test_transformers.rb +0 -80
- data/vendor/h2-1.3.154.jar +0 -0
@@ -1,113 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
module TestExtensions
|
4
|
-
class TestTransformations < Coupler::Test::IntegrationTest
|
5
|
-
def self.startup
|
6
|
-
super
|
7
|
-
conn = new_connection('h2', :name => 'foo')
|
8
|
-
conn.database do |db|
|
9
|
-
db.create_table!(:foo) do
|
10
|
-
primary_key :id
|
11
|
-
String :foo
|
12
|
-
String :bar
|
13
|
-
end
|
14
|
-
db[:foo].insert({:foo => 'foo', :bar => 'bar'})
|
15
|
-
db[:foo].insert({:foo => 'bar', :bar => 'foo'})
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def setup
|
20
|
-
super
|
21
|
-
@project = Project.create(:name => 'foo')
|
22
|
-
@connection = new_connection('h2', :name => 'h2 connection').save!
|
23
|
-
@resource = Resource.create(:name => 'foo', :project => @project, :connection => @connection, :table_name => 'foo')
|
24
|
-
@transformer = Transformer.create(:name => 'noop', :code => 'value', :allowed_types => %w{string integer datetime}, :result_type => 'same')
|
25
|
-
end
|
26
|
-
|
27
|
-
test "new" do
|
28
|
-
get "/projects/#{@project.id}/resources/#{@resource.id}/transformations/new"
|
29
|
-
assert last_response.ok?
|
30
|
-
end
|
31
|
-
|
32
|
-
test "new with non existant project" do
|
33
|
-
get "/projects/8675309/resources/#{@resource.id}/transformations/new"
|
34
|
-
assert last_response.redirect?
|
35
|
-
assert_equal "http://example.org/projects", last_response['location']
|
36
|
-
follow_redirect!
|
37
|
-
assert_match /The project you were looking for doesn't exist/, last_response.body
|
38
|
-
end
|
39
|
-
|
40
|
-
test "new with non existant resource" do
|
41
|
-
get "/projects/#{@project.id}/resources/8675309/transformations/new"
|
42
|
-
assert last_response.redirect?
|
43
|
-
assert_equal "http://example.org/projects/#{@project.id}/resources", last_response['location']
|
44
|
-
follow_redirect!
|
45
|
-
assert_match /The resource you were looking for doesn't exist/, last_response.body
|
46
|
-
end
|
47
|
-
|
48
|
-
test "successfully creating transformation" do
|
49
|
-
field = @resource.fields_dataset[:name => 'foo']
|
50
|
-
attribs = {
|
51
|
-
:transformer_id => @transformer.id.to_s,
|
52
|
-
:source_field_id => field.id.to_s
|
53
|
-
}
|
54
|
-
post("/projects/#{@project.id}/resources/#{@resource.id}/transformations", { 'transformation' => attribs })
|
55
|
-
transformation = @resource.transformations_dataset.first
|
56
|
-
assert transformation
|
57
|
-
|
58
|
-
assert last_response.redirect?, "Wasn't redirected"
|
59
|
-
assert_equal "http://example.org/projects/#{@project.id}/resources/#{@resource.id}", last_response['location']
|
60
|
-
end
|
61
|
-
|
62
|
-
test "delete" do
|
63
|
-
field = @resource.fields_dataset[:name => 'foo']
|
64
|
-
transformation = Transformation.create!(:resource => @resource, :transformer => @transformer, :source_field => field)
|
65
|
-
delete "/projects/#{@project.id}/resources/#{@resource.id}/transformations/#{transformation.id}"
|
66
|
-
assert_equal 0, Transformation.filter(:id => transformation.id).count
|
67
|
-
|
68
|
-
assert last_response.redirect?, "Wasn't redirected"
|
69
|
-
assert_equal "http://example.org/projects/#{@project.id}/resources/#{@resource.id}", last_response['location']
|
70
|
-
end
|
71
|
-
|
72
|
-
test "delete with non existant transformation" do
|
73
|
-
delete "/projects/#{@project.id}/resources/#{@resource.id}/transformations/8675309"
|
74
|
-
assert last_response.redirect?
|
75
|
-
assert_equal "http://example.org/projects/#{@project.id}/resources/#{@resource.id}/transformations", last_response['location']
|
76
|
-
follow_redirect!
|
77
|
-
assert_match /The transformation you were looking for doesn't exist/, last_response.body
|
78
|
-
end
|
79
|
-
|
80
|
-
test "for" do
|
81
|
-
field = @resource.fields_dataset[:name => 'foo']
|
82
|
-
t12n = Transformation.create!(:resource => @resource, :source_field => field, :transformer => @transformer)
|
83
|
-
|
84
|
-
get "/projects/#{@project.id}/resources/#{@resource.id}/transformations/for/foo"
|
85
|
-
assert_match /noop/, last_response.body
|
86
|
-
end
|
87
|
-
|
88
|
-
test "for with non existant field" do
|
89
|
-
get "/projects/#{@project.id}/resources/#{@resource.id}/transformations/for/gobbledegook"
|
90
|
-
assert last_response.ok?
|
91
|
-
assert_equal '', last_response.body
|
92
|
-
end
|
93
|
-
|
94
|
-
test "index" do
|
95
|
-
field = @resource.fields_dataset[:name => 'foo']
|
96
|
-
t12n = Transformation.create!(:resource => @resource, :source_field => field, :transformer => @transformer)
|
97
|
-
|
98
|
-
get "/projects/#{@project.id}/resources/#{@resource.id}/transformations"
|
99
|
-
assert last_response.ok?
|
100
|
-
end
|
101
|
-
|
102
|
-
test "preview" do
|
103
|
-
field = @resource.fields_dataset[:name => 'foo']
|
104
|
-
params = {
|
105
|
-
:transformer_id => @transformer.id.to_s,
|
106
|
-
:source_field_id => field.id.to_s,
|
107
|
-
:result_field_id => field.id.to_s
|
108
|
-
}
|
109
|
-
post "/projects/#{@project.id}/resources/#{@resource.id}/transformations/preview", :transformation => params
|
110
|
-
assert last_response.ok?, last_response.body
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
module TestExtensions
|
4
|
-
class TestTransformers < Coupler::Test::IntegrationTest
|
5
|
-
test "index" do
|
6
|
-
get '/transformers'
|
7
|
-
assert last_response.ok?
|
8
|
-
end
|
9
|
-
|
10
|
-
test "new" do
|
11
|
-
get '/transformers/new'
|
12
|
-
assert last_response.ok?
|
13
|
-
end
|
14
|
-
|
15
|
-
test "successful create" do
|
16
|
-
count = Transformer.count
|
17
|
-
attribs = {
|
18
|
-
:name => 'noop',
|
19
|
-
:code => 'value',
|
20
|
-
:allowed_types => %w{string},
|
21
|
-
:result_type => 'string'
|
22
|
-
}
|
23
|
-
post '/transformers', 'transformer' => attribs
|
24
|
-
assert_equal count + 1, Transformer.count
|
25
|
-
assert last_response.redirect?
|
26
|
-
assert_equal "http://example.org/transformers", last_response['location']
|
27
|
-
end
|
28
|
-
|
29
|
-
test "failed create" do
|
30
|
-
count = Transformer.count
|
31
|
-
attribs = {
|
32
|
-
:name => '',
|
33
|
-
:code => 'value',
|
34
|
-
:allowed_types => %w{string},
|
35
|
-
:result_type => 'string'
|
36
|
-
}
|
37
|
-
post '/transformers', 'transformer' => attribs
|
38
|
-
assert_equal count, Transformer.count
|
39
|
-
assert last_response.ok?
|
40
|
-
end
|
41
|
-
|
42
|
-
test "edit" do
|
43
|
-
xformer = Transformer.create(:name => 'noop', :code => 'value', :allowed_types => %w{string}, :result_type => 'string')
|
44
|
-
get "/transformers/#{xformer.id}/edit"
|
45
|
-
assert last_response.ok?
|
46
|
-
end
|
47
|
-
|
48
|
-
test "successful update" do
|
49
|
-
xformer = Transformer.create(:name => 'noop', :code => 'value', :allowed_types => %w{string}, :result_type => 'string')
|
50
|
-
put "/transformers/#{xformer.id}", :transformer => { 'code' => 'value' }
|
51
|
-
assert last_response.redirect?, last_response.inspect
|
52
|
-
assert_equal "http://example.org/transformers", last_response['location']
|
53
|
-
end
|
54
|
-
|
55
|
-
test "failed update" do
|
56
|
-
xformer = Transformer.create(:name => 'noop', :code => 'value', :allowed_types => %w{string}, :result_type => 'string')
|
57
|
-
put "/transformers/#{xformer.id}", :transformer => { 'code' => 'foo(' }
|
58
|
-
assert last_response.ok?
|
59
|
-
end
|
60
|
-
|
61
|
-
test "preview" do
|
62
|
-
post "/transformers/preview", :transformer => { 'code' => 'value.downcase', 'allowed_types' => %w{string}, 'result_type' => 'string' }
|
63
|
-
assert last_response.ok?
|
64
|
-
end
|
65
|
-
|
66
|
-
test "delete" do
|
67
|
-
xformer = Transformer.create(:name => 'noop', :code => 'value', :allowed_types => %w{string}, :result_type => 'string')
|
68
|
-
delete "/transformers/#{xformer.id}"
|
69
|
-
assert_equal 0, Transformer.filter(:id => xformer.id).count
|
70
|
-
assert last_response.redirect?, last_response.inspect
|
71
|
-
assert_equal "http://example.org/transformers", last_response['location']
|
72
|
-
end
|
73
|
-
|
74
|
-
test "show" do
|
75
|
-
xformer = Transformer.create(:name => 'noop', :code => 'value', :allowed_types => %w{string}, :result_type => 'string')
|
76
|
-
get "/transformers/#{xformer.id}"
|
77
|
-
assert last_response.ok?
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
data/vendor/h2-1.3.154.jar
DELETED
Binary file
|