rhoconnect 3.3.2 → 3.3.3
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/CHANGELOG.md +3 -0
- data/Gemfile.lock +17 -17
- data/lib/rhoconnect/api/app/bulk_data.rb +5 -1
- data/lib/rhoconnect/jobs/bulk_data_job.rb +17 -8
- data/lib/rhoconnect/version.rb +1 -1
- data/spec/jobs/bulk_data_job_spec.rb +5 -1
- data/spec/server/server_spec.rb +8 -0
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rhoconnect (3.3.
|
4
|
+
rhoconnect (3.3.3)
|
5
5
|
bundler (~> 1.0)
|
6
6
|
json (~> 1.6.0)
|
7
7
|
rake (~> 0.9.2.2)
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
remote: https://rubygems.org/
|
19
19
|
specs:
|
20
20
|
SystemTimer (1.2.3)
|
21
|
-
addressable (2.2
|
21
|
+
addressable (2.3.2)
|
22
22
|
arr-pm (0.0.7)
|
23
23
|
cabin (> 0)
|
24
24
|
async-rack (0.5.1)
|
@@ -27,11 +27,11 @@ GEM
|
|
27
27
|
builder
|
28
28
|
mime-types
|
29
29
|
xml-simple
|
30
|
-
backports (2.
|
30
|
+
backports (2.6.2)
|
31
31
|
builder (3.0.0)
|
32
32
|
cabin (0.4.4)
|
33
33
|
json
|
34
|
-
childprocess (0.3.
|
34
|
+
childprocess (0.3.5)
|
35
35
|
ffi (~> 1.0, >= 1.0.6)
|
36
36
|
clamp (0.3.1)
|
37
37
|
coffee-script (2.2.0)
|
@@ -39,18 +39,18 @@ GEM
|
|
39
39
|
execjs
|
40
40
|
coffee-script-source (1.3.3)
|
41
41
|
crack (0.3.1)
|
42
|
-
daemons (1.1.
|
42
|
+
daemons (1.1.9)
|
43
43
|
diff-lcs (1.1.3)
|
44
44
|
eventmachine (1.0.0.rc.4)
|
45
|
-
excon (0.
|
45
|
+
excon (0.16.1)
|
46
46
|
execjs (1.4.0)
|
47
47
|
multi_json (~> 1.0)
|
48
48
|
extlib (0.9.15)
|
49
49
|
ffaker (1.14.0)
|
50
|
-
ffi (1.1.
|
51
|
-
fog (1.
|
50
|
+
ffi (1.1.5)
|
51
|
+
fog (1.5.0)
|
52
52
|
builder
|
53
|
-
excon (~> 0.14
|
53
|
+
excon (~> 0.14)
|
54
54
|
formatador (~> 0.2.0)
|
55
55
|
mime-types
|
56
56
|
multi_json (~> 1.0)
|
@@ -59,15 +59,15 @@ GEM
|
|
59
59
|
nokogiri (~> 1.5.0)
|
60
60
|
ruby-hmac
|
61
61
|
formatador (0.2.3)
|
62
|
-
fpm (0.4.
|
62
|
+
fpm (0.4.13)
|
63
63
|
arr-pm (~> 0.0.7)
|
64
|
-
backports (= 2.
|
64
|
+
backports (= 2.6.2)
|
65
65
|
cabin (~> 0.4.3)
|
66
66
|
clamp (= 0.3.1)
|
67
67
|
json (= 1.6.6)
|
68
68
|
highline (1.6.13)
|
69
69
|
hike (1.2.1)
|
70
|
-
jasmine (1.2.
|
70
|
+
jasmine (1.2.1)
|
71
71
|
jasmine-core (>= 1.2.0)
|
72
72
|
rack (~> 1.0)
|
73
73
|
rspec (>= 1.3.1)
|
@@ -80,7 +80,7 @@ GEM
|
|
80
80
|
rainbow
|
81
81
|
sprockets (~> 2)
|
82
82
|
json (1.6.6)
|
83
|
-
libwebsocket (0.1.
|
83
|
+
libwebsocket (0.1.5)
|
84
84
|
addressable
|
85
85
|
mime-types (1.19)
|
86
86
|
multi_json (1.3.6)
|
@@ -114,7 +114,7 @@ GEM
|
|
114
114
|
rspec-core (2.10.1)
|
115
115
|
rspec-expectations (2.10.0)
|
116
116
|
diff-lcs (~> 1.1.3)
|
117
|
-
rspec-mocks (2.10.
|
117
|
+
rspec-mocks (2.10.0)
|
118
118
|
ruby-hmac (0.4.0)
|
119
119
|
rubyzip (0.9.9)
|
120
120
|
selenium-webdriver (2.25.0)
|
@@ -126,7 +126,7 @@ GEM
|
|
126
126
|
multi_json (~> 1.0)
|
127
127
|
simplecov-html (~> 0.5.3)
|
128
128
|
simplecov-html (0.5.3)
|
129
|
-
sinatra (1.3.
|
129
|
+
sinatra (1.3.3)
|
130
130
|
rack (~> 1.3, >= 1.3.6)
|
131
131
|
rack-protection (~> 1.2)
|
132
132
|
tilt (~> 1.3, >= 1.3.3)
|
@@ -149,8 +149,8 @@ GEM
|
|
149
149
|
uuidtools (2.1.3)
|
150
150
|
vegas (0.1.11)
|
151
151
|
rack (>= 1.0.0)
|
152
|
-
webmock (1.8.
|
153
|
-
addressable (
|
152
|
+
webmock (1.8.9)
|
153
|
+
addressable (>= 2.2.7)
|
154
154
|
crack (>= 0.1.7)
|
155
155
|
xml-simple (1.1.1)
|
156
156
|
|
@@ -1,6 +1,10 @@
|
|
1
1
|
Server.api4 :bulk_data, :post, "/rc/#{Rhoconnect::API_VERSION}/app/bulk_data", \
|
2
2
|
false, {:verb => :get, :url => ['/application/bulk_data', '/api/application/bulk_data']} do |params,user,server|
|
3
3
|
server.content_type :json
|
4
|
-
|
4
|
+
sources_param = params[:sources]
|
5
|
+
if sources_param.is_a?String
|
6
|
+
sources_param = sources_param.split(',')
|
7
|
+
end
|
8
|
+
data = ClientSync.bulk_data(params[:partition].to_sym,server.current_client, sources_param)
|
5
9
|
data.to_json
|
6
10
|
end
|
@@ -47,8 +47,9 @@ module Rhoconnect
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
def self.import_data_to_object_values(db,source)
|
51
|
-
data =
|
50
|
+
def self.import_data_to_object_values(db,source,is_selected=true)
|
51
|
+
data = {}
|
52
|
+
data = source.get_data(:md) if is_selected
|
52
53
|
counter = {}
|
53
54
|
db.transaction do |database|
|
54
55
|
database.prepare("insert into object_values
|
@@ -65,8 +66,9 @@ module Rhoconnect
|
|
65
66
|
end
|
66
67
|
|
67
68
|
# Loads data into fixed schema table based on source settings
|
68
|
-
def self.import_data_to_fixed_schema(db,source)
|
69
|
-
data =
|
69
|
+
def self.import_data_to_fixed_schema(db,source,is_selected=true)
|
70
|
+
data = {}
|
71
|
+
data = source.get_data(:md) if is_selected
|
70
72
|
counter = {}
|
71
73
|
columns,qm = [],[]
|
72
74
|
create_table = ["\"object\" varchar(255) PRIMARY KEY"]
|
@@ -136,8 +138,10 @@ module Rhoconnect
|
|
136
138
|
values (?,?,?,?,?,?,?,?,?,?,?,?)") do |stmt|
|
137
139
|
sources_refs.each do |source_name,ref|
|
138
140
|
s = ref[:source]
|
141
|
+
# skipped sources should be marked with sync type :none
|
142
|
+
sync_type = ref[:skip_source] ? 'none' : s.sync_type.to_s
|
139
143
|
stmt.execute(s.source_id,s.name,s.priority,s.partition_type.to_s,
|
140
|
-
|
144
|
+
sync_type,refs_to_s(ref[:refs]),s.get_value(:metadata),s.schema,s.blob_attribs,s.has_many,s.get_value(:md_size).to_i,s.read_state.refresh_time)
|
141
145
|
end
|
142
146
|
end
|
143
147
|
end
|
@@ -154,6 +158,10 @@ module Rhoconnect
|
|
154
158
|
db.execute_batch(File.open(schema,'r').read)
|
155
159
|
|
156
160
|
src_counter = 1
|
161
|
+
selected_sources = {}
|
162
|
+
bulk_data.sources[0, -1].each do |source|
|
163
|
+
selected_sources[source] = true
|
164
|
+
end
|
157
165
|
bulk_data.partition_sources[0, -1].each do |source_name|
|
158
166
|
timer = start_timer("start importing sqlite data for #{source_name}")
|
159
167
|
source = Source.load(source_name,{:app_id => bulk_data.app_id,
|
@@ -161,13 +169,14 @@ module Rhoconnect
|
|
161
169
|
source.source_id = src_counter
|
162
170
|
src_counter += 1
|
163
171
|
source_attrib_refs = nil
|
172
|
+
is_selected_source = selected_sources.has_key?(source_name)
|
164
173
|
if source.schema
|
165
|
-
source_attrib_refs = import_data_to_fixed_schema(db,source)
|
174
|
+
source_attrib_refs = import_data_to_fixed_schema(db,source,is_selected_source)
|
166
175
|
else
|
167
|
-
source_attrib_refs = import_data_to_object_values(db,source)
|
176
|
+
source_attrib_refs = import_data_to_object_values(db,source,is_selected_source)
|
168
177
|
end
|
169
178
|
sources_refs[source_name] =
|
170
|
-
{:source => source, :refs => source_attrib_refs}
|
179
|
+
{:source => source, :refs => source_attrib_refs, :skip_source => !is_selected_source}
|
171
180
|
lap_timer("finished importing sqlite data for #{source_name}",timer)
|
172
181
|
end
|
173
182
|
populate_sources_table(db,sources_refs)
|
data/lib/rhoconnect/version.rb
CHANGED
@@ -48,6 +48,8 @@ describe "BulkDataJob" do
|
|
48
48
|
expected = { @s_fields[:name] => {},
|
49
49
|
'FixedSchemaAdapter' => @data
|
50
50
|
}
|
51
|
+
source_existing_data = {'my_key1' => {'my_attrib1' => 'my_val1'}}
|
52
|
+
@s.put_data(:md, source_existing_data)
|
51
53
|
data = BulkData.create(:name => docname,
|
52
54
|
:state => :inprogress,
|
53
55
|
:app_id => @a.id,
|
@@ -57,7 +59,9 @@ describe "BulkDataJob" do
|
|
57
59
|
do_bulk_data_job("data_name" => data.name)
|
58
60
|
data = BulkData.load(docname)
|
59
61
|
data.completed?.should == true
|
60
|
-
verify_result(@s.docname(:md) =>
|
62
|
+
verify_result(@s.docname(:md) => source_existing_data,@s.docname(:md_copy) => {})
|
63
|
+
# skipped source should have :none in the DB - so we pass it for verification
|
64
|
+
@s.sync_type = :none
|
61
65
|
validate_db_file(data.dbfile,[@s_fields[:name], 'FixedSchemaAdapter'], expected).should == true
|
62
66
|
File.exists?(data.dbfile+'.rzip').should == true
|
63
67
|
File.exists?(data.dbfile+'.gzip').should == true
|
data/spec/server/server_spec.rb
CHANGED
@@ -472,6 +472,14 @@ describe "Server" do
|
|
472
472
|
last_response.body.should == {:result => :wait}.to_json
|
473
473
|
last_response.headers['Warning'].index('deprecated').should_not == nil
|
474
474
|
end
|
475
|
+
|
476
|
+
it "should make old-way initial bulk data request and receive wait along with deprecation warning (Sources sent as String)" do
|
477
|
+
set_state('test_db_storage' => @data)
|
478
|
+
get "/application/bulk_data?sources=FixedSchemaAdapter,SampleAdapter", :partition => :user, :client_id => @c.id
|
479
|
+
last_response.should be_ok
|
480
|
+
last_response.body.should == {:result => :wait}.to_json
|
481
|
+
last_response.headers['Warning'].index('deprecated').should_not == nil
|
482
|
+
end
|
475
483
|
|
476
484
|
it "should receive url when bulk data is available" do
|
477
485
|
set_state('test_db_storage' => @data)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhoconnect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 3.3.
|
9
|
+
- 3
|
10
|
+
version: 3.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rhomobile
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-08-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|