coupler 0.0.1-java
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitmodules +3 -0
- data/.rvmrc +1 -0
- data/.vimrc +40 -0
- data/Gemfile +27 -0
- data/Gemfile.lock +71 -0
- data/LICENSE +20 -0
- data/NOTES +6 -0
- data/README.rdoc +18 -0
- data/Rakefile +42 -0
- data/TODO +11 -0
- data/VERSION +1 -0
- data/bin/coupler +7 -0
- data/db/.gitignore +6 -0
- data/db/migrate/001_initial_schema.rb +166 -0
- data/db/migrate/002_stub.rb +4 -0
- data/db/migrate/003_stub.rb +4 -0
- data/db/migrate/004_create_comparisons.rb +28 -0
- data/db/migrate/005_move_database_name.rb +19 -0
- data/db/migrate/006_upgrade_comparisons.rb +34 -0
- data/db/migrate/007_add_which_to_comparisons.rb +23 -0
- data/db/migrate/008_add_result_field_to_transformations.rb +33 -0
- data/db/migrate/009_add_generated_flag_to_fields.rb +13 -0
- data/db/migrate/010_create_imports.rb +24 -0
- data/db/migrate/011_add_primary_key_type.rb +13 -0
- data/db/migrate/012_add_transformed_with_to_resources.rb +13 -0
- data/db/migrate/013_add_run_count_to_scenarios.rb +13 -0
- data/db/migrate/014_add_last_accessed_at_to_some_tables.rb +13 -0
- data/db/migrate/015_add_run_number_to_results.rb +15 -0
- data/db/migrate/016_fix_scenario_run_count.rb +27 -0
- data/db/migrate/017_rename_comparison_columns.rb +14 -0
- data/db/migrate/018_fix_scenario_linkage_type.rb +8 -0
- data/db/migrate/019_add_columns_to_imports.rb +24 -0
- data/db/migrate/020_rename_import_columns.rb +12 -0
- data/db/migrate/021_add_fields_to_connections.rb +15 -0
- data/db/migrate/022_remove_database_name_from_resources.rb +11 -0
- data/features/connections.feature +28 -0
- data/features/matchers.feature +35 -0
- data/features/projects.feature +11 -0
- data/features/resources.feature +62 -0
- data/features/scenarios.feature +45 -0
- data/features/step_definitions/coupler_steps.rb +145 -0
- data/features/step_definitions/matchers_steps.rb +26 -0
- data/features/step_definitions/resources_steps.rb +12 -0
- data/features/step_definitions/scenarios_steps.rb +7 -0
- data/features/step_definitions/transformations_steps.rb +3 -0
- data/features/support/env.rb +128 -0
- data/features/transformations.feature +22 -0
- data/features/wizard.feature +10 -0
- data/gfx/coupler-header.svg +213 -0
- data/gfx/coupler-sidebar.svg +656 -0
- data/gfx/coupler.svg +184 -0
- data/gfx/icon.svg +75 -0
- data/lib/coupler/base.rb +63 -0
- data/lib/coupler/config.rb +128 -0
- data/lib/coupler/data_uploader.rb +20 -0
- data/lib/coupler/database.rb +31 -0
- data/lib/coupler/extensions/connections.rb +57 -0
- data/lib/coupler/extensions/exceptions.rb +58 -0
- data/lib/coupler/extensions/imports.rb +43 -0
- data/lib/coupler/extensions/jobs.rb +21 -0
- data/lib/coupler/extensions/matchers.rb +64 -0
- data/lib/coupler/extensions/projects.rb +62 -0
- data/lib/coupler/extensions/resources.rb +89 -0
- data/lib/coupler/extensions/results.rb +100 -0
- data/lib/coupler/extensions/scenarios.rb +50 -0
- data/lib/coupler/extensions/transformations.rb +70 -0
- data/lib/coupler/extensions/transformers.rb +58 -0
- data/lib/coupler/extensions.rb +16 -0
- data/lib/coupler/helpers.rb +121 -0
- data/lib/coupler/import_buffer.rb +48 -0
- data/lib/coupler/logger.rb +16 -0
- data/lib/coupler/models/common_model.rb +104 -0
- data/lib/coupler/models/comparison.rb +166 -0
- data/lib/coupler/models/connection.rb +59 -0
- data/lib/coupler/models/field.rb +55 -0
- data/lib/coupler/models/import.rb +238 -0
- data/lib/coupler/models/job.rb +42 -0
- data/lib/coupler/models/jobify.rb +17 -0
- data/lib/coupler/models/matcher.rb +36 -0
- data/lib/coupler/models/project.rb +40 -0
- data/lib/coupler/models/resource.rb +287 -0
- data/lib/coupler/models/result.rb +92 -0
- data/lib/coupler/models/scenario/runner.rb +357 -0
- data/lib/coupler/models/scenario.rb +115 -0
- data/lib/coupler/models/transformation.rb +117 -0
- data/lib/coupler/models/transformer/runner.rb +28 -0
- data/lib/coupler/models/transformer.rb +110 -0
- data/lib/coupler/models.rb +30 -0
- data/lib/coupler/runner.rb +76 -0
- data/lib/coupler/scheduler.rb +56 -0
- data/lib/coupler.rb +34 -0
- data/log/.gitignore +1 -0
- data/misc/README +5 -0
- data/misc/jruby-json.license +57 -0
- data/misc/rack-flash.license +22 -0
- data/script/dbconsole.rb +5 -0
- data/src/edu/vanderbilt/coupler/Main.java +116 -0
- data/src/edu/vanderbilt/coupler/jruby.properties +1 -0
- data/tasks/annotations.rake +84 -0
- data/tasks/db.rake +120 -0
- data/tasks/environment.rake +12 -0
- data/tasks/jeweler.rake +43 -0
- data/tasks/package.rake +58 -0
- data/tasks/rdoc.rake +13 -0
- data/tasks/test.rake +63 -0
- data/tasks/vendor.rake +43 -0
- data/test/README.txt +6 -0
- data/test/config.yml +9 -0
- data/test/coupler/models/test_import.rb +221 -0
- data/test/factories.rb +91 -0
- data/test/fixtures/duplicate-keys.csv +5 -0
- data/test/fixtures/no-headers.csv +50 -0
- data/test/fixtures/people.csv +51 -0
- data/test/fixtures/varying-row-size.csv +4 -0
- data/test/helper.rb +156 -0
- data/test/integration/extensions/test_connections.rb +80 -0
- data/test/integration/extensions/test_imports.rb +94 -0
- data/test/integration/extensions/test_jobs.rb +52 -0
- data/test/integration/extensions/test_matchers.rb +134 -0
- data/test/integration/extensions/test_projects.rb +82 -0
- data/test/integration/extensions/test_resources.rb +150 -0
- data/test/integration/extensions/test_results.rb +89 -0
- data/test/integration/extensions/test_scenarios.rb +88 -0
- data/test/integration/extensions/test_transformations.rb +113 -0
- data/test/integration/extensions/test_transformers.rb +80 -0
- data/test/integration/test_field.rb +45 -0
- data/test/integration/test_import.rb +78 -0
- data/test/integration/test_running_scenarios.rb +379 -0
- data/test/integration/test_transformation.rb +56 -0
- data/test/integration/test_transforming.rb +154 -0
- data/test/table_sets.rb +76 -0
- data/test/unit/models/test_common_model.rb +130 -0
- data/test/unit/models/test_comparison.rb +619 -0
- data/test/unit/models/test_connection.rb +115 -0
- data/test/unit/models/test_field.rb +99 -0
- data/test/unit/models/test_import.rb +130 -0
- data/test/unit/models/test_job.rb +115 -0
- data/test/unit/models/test_matcher.rb +82 -0
- data/test/unit/models/test_project.rb +102 -0
- data/test/unit/models/test_resource.rb +564 -0
- data/test/unit/models/test_result.rb +90 -0
- data/test/unit/models/test_scenario.rb +199 -0
- data/test/unit/models/test_transformation.rb +193 -0
- data/test/unit/models/test_transformer.rb +188 -0
- data/test/unit/test_base.rb +60 -0
- data/test/unit/test_data_uploader.rb +27 -0
- data/test/unit/test_database.rb +23 -0
- data/test/unit/test_helpers.rb +58 -0
- data/test/unit/test_logger.rb +10 -0
- data/test/unit/test_models.rb +12 -0
- data/test/unit/test_runner.rb +76 -0
- data/test/unit/test_scheduler.rb +66 -0
- data/uploads/.gitignore +2 -0
- data/vendor/java/.gitignore +5 -0
- data/webroot/public/css/960.css +1 -0
- data/webroot/public/css/dataTables.css +1057 -0
- data/webroot/public/css/jquery-ui.css +572 -0
- data/webroot/public/css/jquery.treeview.css +68 -0
- data/webroot/public/css/reset.css +1 -0
- data/webroot/public/css/style.css +504 -0
- data/webroot/public/css/text.css +1 -0
- data/webroot/public/favicon.ico +0 -0
- data/webroot/public/images/12_col.gif +0 -0
- data/webroot/public/images/16_col.gif +0 -0
- data/webroot/public/images/add.png +0 -0
- data/webroot/public/images/ajax-loader.gif +0 -0
- data/webroot/public/images/cog.png +0 -0
- data/webroot/public/images/coupler.png +0 -0
- data/webroot/public/images/foo.png +0 -0
- data/webroot/public/images/hammer.png +0 -0
- data/webroot/public/images/header.png +0 -0
- data/webroot/public/images/home.gif +0 -0
- data/webroot/public/images/jobs.gif +0 -0
- data/webroot/public/images/sidebar-bottom.png +0 -0
- data/webroot/public/images/sidebar.png +0 -0
- data/webroot/public/images/treeview-default-line.gif +0 -0
- data/webroot/public/images/treeview-default.gif +0 -0
- data/webroot/public/images/ui-anim_basic_16x16.gif +0 -0
- data/webroot/public/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/webroot/public/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/webroot/public/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/webroot/public/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/webroot/public/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/webroot/public/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/webroot/public/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/webroot/public/images/ui-bg_highlight-hard_30_565356_1x100.png +0 -0
- data/webroot/public/images/ui-bg_highlight-hard_75_888588_1x100.png +0 -0
- data/webroot/public/images/ui-bg_highlight-soft_30_6e3b3a_1x100.png +0 -0
- data/webroot/public/images/ui-bg_highlight-soft_35_8e8b8e_1x100.png +0 -0
- data/webroot/public/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/webroot/public/images/ui-icons_222222_256x240.png +0 -0
- data/webroot/public/images/ui-icons_2e83ff_256x240.png +0 -0
- data/webroot/public/images/ui-icons_454545_256x240.png +0 -0
- data/webroot/public/images/ui-icons_888888_256x240.png +0 -0
- data/webroot/public/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/webroot/public/images/ui-icons_ffffff_256x240.png +0 -0
- data/webroot/public/js/ajaxupload.js +673 -0
- data/webroot/public/js/application.js +40 -0
- data/webroot/public/js/jquery-ui.combobox.js +98 -0
- data/webroot/public/js/jquery-ui.js +9867 -0
- data/webroot/public/js/jquery-ui.min.js +559 -0
- data/webroot/public/js/jquery.dataTables.min.js +587 -0
- data/webroot/public/js/jquery.min.js +154 -0
- data/webroot/public/js/jquery.timeago.js +140 -0
- data/webroot/public/js/jquery.tooltip.min.js +19 -0
- data/webroot/public/js/jquery.treeview.min.js +15 -0
- data/webroot/public/js/resource.js +11 -0
- data/webroot/public/js/results.js +56 -0
- data/webroot/public/js/transformations.js +95 -0
- data/webroot/views/connections/index.erb +5 -0
- data/webroot/views/connections/list.erb +34 -0
- data/webroot/views/connections/new.erb +55 -0
- data/webroot/views/connections/show.erb +36 -0
- data/webroot/views/imports/edit.erb +60 -0
- data/webroot/views/imports/form.erb +81 -0
- data/webroot/views/imports/new.erb +89 -0
- data/webroot/views/index.erb +12 -0
- data/webroot/views/jobs/index.erb +7 -0
- data/webroot/views/jobs/list.erb +24 -0
- data/webroot/views/layout.erb +38 -0
- data/webroot/views/matchers/form.erb +250 -0
- data/webroot/views/matchers/list.erb +32 -0
- data/webroot/views/projects/form.erb +14 -0
- data/webroot/views/projects/index.erb +96 -0
- data/webroot/views/projects/show.erb +24 -0
- data/webroot/views/resources/edit.erb +88 -0
- data/webroot/views/resources/index.erb +5 -0
- data/webroot/views/resources/list.erb +27 -0
- data/webroot/views/resources/new.erb +121 -0
- data/webroot/views/resources/show.erb +86 -0
- data/webroot/views/resources/transform.erb +2 -0
- data/webroot/views/results/csv.erb +12 -0
- data/webroot/views/results/details.erb +15 -0
- data/webroot/views/results/index.erb +2 -0
- data/webroot/views/results/list.erb +22 -0
- data/webroot/views/results/record.erb +24 -0
- data/webroot/views/results/show.erb +68 -0
- data/webroot/views/scenarios/index.erb +5 -0
- data/webroot/views/scenarios/list.erb +20 -0
- data/webroot/views/scenarios/new.erb +99 -0
- data/webroot/views/scenarios/run.erb +2 -0
- data/webroot/views/scenarios/show.erb +50 -0
- data/webroot/views/sidebar.erb +106 -0
- data/webroot/views/transformations/create.erb +115 -0
- data/webroot/views/transformations/for.erb +16 -0
- data/webroot/views/transformations/index.erb +2 -0
- data/webroot/views/transformations/list.erb +29 -0
- data/webroot/views/transformations/new.erb +126 -0
- data/webroot/views/transformations/preview.erb +46 -0
- data/webroot/views/transformers/edit.erb +6 -0
- data/webroot/views/transformers/form.erb +58 -0
- data/webroot/views/transformers/index.erb +2 -0
- data/webroot/views/transformers/list.erb +25 -0
- data/webroot/views/transformers/new.erb +5 -0
- data/webroot/views/transformers/preview.erb +23 -0
- data/webroot/views/transformers/show.erb +0 -0
- metadata +558 -0
data/test/table_sets.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
module TableSets
|
2
|
+
SETS = {
|
3
|
+
:basic_cross_linkage => {
|
4
|
+
:table_name => :records,
|
5
|
+
:data => <<-EOF
|
6
|
+
+-------------+-----------------+-----------------+
|
7
|
+
| id(Integer) | uno_col(String) | dos_col(String) |
|
8
|
+
+=============+=================+=================+
|
9
|
+
| 18 | foo | |
|
10
|
+
| 16 | foo | |
|
11
|
+
| 17 | foo | |
|
12
|
+
| 15 | | foo |
|
13
|
+
| 13 | | foo |
|
14
|
+
| 10 | | foo |
|
15
|
+
| 19 | | foo |
|
16
|
+
| 25 | bar | |
|
17
|
+
| 23 | bar | |
|
18
|
+
| 20 | bar | |
|
19
|
+
| 29 | bar | |
|
20
|
+
| 28 | | bar |
|
21
|
+
| 26 | | bar |
|
22
|
+
| 27 | | bar |
|
23
|
+
| 38 | baz | |
|
24
|
+
| 35 | | baz |
|
25
|
+
| 33 | | baz |
|
26
|
+
| 30 | | baz |
|
27
|
+
| 39 | | baz |
|
28
|
+
| 45 | quux | |
|
29
|
+
| 43 | quux | |
|
30
|
+
| 40 | quux | |
|
31
|
+
| 49 | quux | |
|
32
|
+
| 48 | | quux |
|
33
|
+
| 55 | ditto | ditto |
|
34
|
+
| 53 | ditto | ditto |
|
35
|
+
+-------------+-----------------+-----------------+
|
36
|
+
EOF
|
37
|
+
},
|
38
|
+
:basic_self_linkage => {
|
39
|
+
:data => <<-EOF
|
40
|
+
+-------------+-------------+
|
41
|
+
| id(Integer) | foo(String) |
|
42
|
+
+=============+=============+
|
43
|
+
| 1 | foo |
|
44
|
+
| 2 | foo |
|
45
|
+
| 3 | foo |
|
46
|
+
| 4 | foo |
|
47
|
+
| 5 | foo |
|
48
|
+
| 6 | bar |
|
49
|
+
| 7 | bar |
|
50
|
+
| 8 | bar |
|
51
|
+
| 9 | bar |
|
52
|
+
| 10 | bar |
|
53
|
+
| 11 | baz |
|
54
|
+
| 12 | baz |
|
55
|
+
| 13 | baz |
|
56
|
+
| 14 | baz |
|
57
|
+
| 15 | baz |
|
58
|
+
| 16 | abc |
|
59
|
+
| 17 | def |
|
60
|
+
| 18 | ghi |
|
61
|
+
| 19 | jkl |
|
62
|
+
| 20 | mno |
|
63
|
+
+-------------+-------------+
|
64
|
+
EOF
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
def load_table_set(name)
|
69
|
+
set = SETS[name]
|
70
|
+
TableMaker.new(test_database, set[:table_name] || name, set[:data])
|
71
|
+
end
|
72
|
+
|
73
|
+
def unload_table_set(name)
|
74
|
+
test_database.drop_table(SETS[name][:table_name] || name)
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
module Coupler
|
4
|
+
module Models
|
5
|
+
class TestCommonModel < Coupler::Test::UnitTest
|
6
|
+
def self.startup
|
7
|
+
super
|
8
|
+
db = Coupler::Database.instance
|
9
|
+
db.create_table!(:foos) do
|
10
|
+
primary_key :id
|
11
|
+
String :bar
|
12
|
+
DateTime :created_at
|
13
|
+
DateTime :updated_at
|
14
|
+
DateTime :last_accessed_at
|
15
|
+
Integer :version
|
16
|
+
end
|
17
|
+
db.create_table!(:foos_versions) do
|
18
|
+
primary_key :id
|
19
|
+
String :bar
|
20
|
+
DateTime :created_at
|
21
|
+
DateTime :updated_at
|
22
|
+
DateTime :last_accessed_at
|
23
|
+
Integer :version
|
24
|
+
Integer :current_id
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.teardown
|
29
|
+
db = Coupler::Database.instance
|
30
|
+
db.drop_table(:foos)
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
def setup
|
35
|
+
@klass = Class.new(Sequel::Model(:foos))
|
36
|
+
@klass.send(:include, CommonModel)
|
37
|
+
end
|
38
|
+
|
39
|
+
test "timestamps on create" do
|
40
|
+
now = Time.now
|
41
|
+
Timecop.freeze(now) do
|
42
|
+
foo = @klass.create(:bar => "bar")
|
43
|
+
assert_equal now, foo.created_at
|
44
|
+
assert_equal now, foo.updated_at
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
test "timestamps on update" do
|
49
|
+
foo = @klass.create(:bar => "bar")
|
50
|
+
now = Time.now + 10
|
51
|
+
Timecop.freeze(now) do
|
52
|
+
foo.bar = "baz"
|
53
|
+
foo.save!
|
54
|
+
assert_equal now, foo.updated_at
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
test "versioning new record" do
|
59
|
+
foo = @klass.create(:bar => "bar")
|
60
|
+
assert_equal 1, foo.version
|
61
|
+
|
62
|
+
versions = Database.instance[:foos_versions].filter(:current_id => foo.id)
|
63
|
+
assert_equal 1, versions.count
|
64
|
+
|
65
|
+
data = versions.first
|
66
|
+
foo.values.each_pair do |key, value|
|
67
|
+
next if key == :id
|
68
|
+
assert_equal value, data[key], "#{key} didn't match"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
test "versioning existing record" do
|
73
|
+
foo = @klass.create(:bar => "bar")
|
74
|
+
foo.update(:bar => "baz")
|
75
|
+
assert_equal 2, foo.version
|
76
|
+
|
77
|
+
versions = Database.instance[:foos_versions].filter(:current_id => foo.id, :version => 2)
|
78
|
+
assert_equal 1, versions.count
|
79
|
+
|
80
|
+
data = versions.first
|
81
|
+
foo.values.each_pair do |key, value|
|
82
|
+
next if key == :id
|
83
|
+
if value.is_a?(Time)
|
84
|
+
assert_equal value.to_i, data[key].to_i, "#{key} didn't match"
|
85
|
+
else
|
86
|
+
assert_equal value, data[key], "#{key} didn't match"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
test "as_of_version" do
|
92
|
+
foo = @klass.create(:bar => "bar")
|
93
|
+
foo.update(:bar => "baz")
|
94
|
+
|
95
|
+
hash = @klass.as_of_version(foo.id, 1)
|
96
|
+
assert_equal "bar", hash[:bar]
|
97
|
+
end
|
98
|
+
|
99
|
+
test "as_of_time" do
|
100
|
+
time = Time.now - 3600
|
101
|
+
foo = nil
|
102
|
+
Timecop.freeze(time) do
|
103
|
+
foo = @klass.create(:bar => "bar")
|
104
|
+
end
|
105
|
+
foo.update(:bar => "baz")
|
106
|
+
|
107
|
+
hash = @klass.as_of_time(foo.id, time + 1200)
|
108
|
+
assert_equal "bar", hash[:bar]
|
109
|
+
end
|
110
|
+
|
111
|
+
test "touch!" do
|
112
|
+
foo = @klass.create(:bar => 'bar')
|
113
|
+
version = foo.version
|
114
|
+
time = Time.now - 50
|
115
|
+
Timecop.freeze(time) { foo.touch! }
|
116
|
+
assert_equal time, foo.last_accessed_at
|
117
|
+
assert_equal version, foo.version
|
118
|
+
end
|
119
|
+
|
120
|
+
test "recently_accessed" do
|
121
|
+
now = Time.now
|
122
|
+
foo_1 = @klass.create(:last_accessed_at => now - 50)
|
123
|
+
foo_2 = @klass.create(:last_accessed_at => now - 10)
|
124
|
+
foo_3 = @klass.create(:last_accessed_at => now - 30)
|
125
|
+
foo_4 = @klass.create(:last_accessed_at => now - 20)
|
126
|
+
assert_equal [foo_2, foo_4, foo_3], @klass.recently_accessed
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|