rhoconnect 4.0.0.beta.24 → 4.0.0
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 +20 -0
- data/Gemfile.lock +22 -23
- data/README.md +0 -2
- data/bench/benchapp/spec/spec_helper.rb +2 -2
- data/bench/blobapp/spec/spec_helper.rb +2 -2
- data/commands/rhoconnect/start.rb +8 -1
- data/doc/bulk-sync.txt +1 -23
- data/doc/push-client-setup-ios.txt +3 -3
- data/doc/push-client-setup-rps.txt +7 -7
- data/doc/push-client-setup.txt +18 -30
- data/doc/push-server-setup.txt +0 -14
- data/doc/push.txt +3 -5
- data/doc/source-adapters.txt +3 -2
- data/doc/supported-platforms.txt +6 -6
- data/generators/templates/application/spec/spec_helper.rb +2 -2
- data/install.sh +7 -2
- data/installer/unix-like/rho_connect_install_constants.rb +3 -3
- data/installer/utils/nix_install_test.rb +12 -4
- data/js-adapters/node.rb +1 -1
- data/lib/rhoconnect/bulk_data/bulk_data.rb +0 -5
- data/lib/rhoconnect/controller/js_base.rb +1 -0
- data/lib/rhoconnect/jobs/bulk_data_job.rb +0 -18
- data/lib/rhoconnect/ping/apple.rb +9 -6
- data/lib/rhoconnect/ping.rb +0 -2
- data/lib/rhoconnect/version.rb +1 -1
- data/lib/rhoconnect.rb +1 -14
- data/spec/controllers/js_base_spec.rb +20 -0
- data/spec/jobs/bulk_data_job_spec.rb +0 -42
- data/spec/jobs/ping_job_spec.rb +6 -30
- data/spec/rhoconnect_spec.rb +0 -1
- data/spec/server/server_spec.rb +4 -11
- data/spec/spec_helper.rb +4 -0
- data/spec/support/shared_examples.rb +2 -1
- metadata +4 -11
- data/doc/push-client-setup-bb.txt +0 -81
- data/lib/rhoconnect/ping/android.rb +0 -116
- data/lib/rhoconnect/ping/blackberry.rb +0 -56
- data/spec/ping/android_spec.rb +0 -121
- data/spec/ping/blackberry_spec.rb +0 -71
@@ -14,8 +14,6 @@ module Rhoconnect
|
|
14
14
|
create_sqlite_data_file(bulk_data,ts)
|
15
15
|
timer = lap_timer('create_sqlite_data_file',timer)
|
16
16
|
log "bulk_data.dbfile: #{bulk_data.dbfile}"
|
17
|
-
create_hsql_data_file(bulk_data,ts) if Rhoconnect.blackberry_bulk_sync
|
18
|
-
lap_timer('create_hsql_data_file',timer)
|
19
17
|
log "finished bulk data process"
|
20
18
|
end
|
21
19
|
end
|
@@ -189,22 +187,6 @@ module Rhoconnect
|
|
189
187
|
gzip_compress("#{bulk_data.dbfile}.gzip",bulk_data.dbfile)
|
190
188
|
end
|
191
189
|
|
192
|
-
def self.create_hsql_data_file(bulk_data,ts)
|
193
|
-
schema,index,dbfile = get_file_args(bulk_data.name,ts)
|
194
|
-
hsql_file = dbfile + ".hsqldb"
|
195
|
-
cmd = ['java','-cp', File.join(File.expand_path(Rhoconnect.vendor_directory),'hsqldata.jar'),
|
196
|
-
'com.rhomobile.hsqldata.HsqlData', dbfile, hsql_file].join(" ")
|
197
|
-
log "Running hsqldata: #{cmd.to_s}"
|
198
|
-
raise Exception.new("Error running hsqldata") unless
|
199
|
-
system(
|
200
|
-
'java','-cp',
|
201
|
-
File.join(File.expand_path(Rhoconnect.vendor_directory),'hsqldata.jar'),
|
202
|
-
'com.rhomobile.hsqldata.HsqlData',
|
203
|
-
dbfile, hsql_file
|
204
|
-
)
|
205
|
-
gzip_compress("#{hsql_file}.data.gzip","#{hsql_file}.data")
|
206
|
-
end
|
207
|
-
|
208
190
|
def self.get_file_args(bulk_data_name,ts)
|
209
191
|
schema = BulkData.schema_file
|
210
192
|
index = BulkData.index_file
|
@@ -9,7 +9,7 @@ module Rhoconnect
|
|
9
9
|
passphrase = settings[:iphonepassphrase]
|
10
10
|
host = settings[:iphoneserver]
|
11
11
|
port = settings[:iphoneport]
|
12
|
-
if(cert and host and port)
|
12
|
+
if(cert and host and port)
|
13
13
|
begin
|
14
14
|
ssl_ctx = OpenSSL::SSL::SSLContext.new
|
15
15
|
ssl_ctx.key = OpenSSL::PKey::RSA.new(cert, passphrase)
|
@@ -20,21 +20,24 @@ module Rhoconnect
|
|
20
20
|
ssl_socket.sync = true
|
21
21
|
ssl_socket.connect
|
22
22
|
|
23
|
-
ssl_socket.write(apn_message(params))
|
23
|
+
res = ssl_socket.write(apn_message(params))
|
24
24
|
ssl_socket.close
|
25
25
|
socket.close
|
26
26
|
rescue SocketError => error
|
27
27
|
log "Error while sending ping: #{error}"
|
28
28
|
raise error
|
29
29
|
end
|
30
|
-
|
30
|
+
else
|
31
|
+
log "Invalid APNS settings: ping is ignored."
|
32
|
+
log "cert_file: #{cert_file}, host: #{host}, port: #{port}"
|
33
|
+
end
|
31
34
|
end
|
32
35
|
|
33
36
|
# Generates APNS package
|
34
37
|
def self.apn_message(params)
|
35
38
|
data = {}
|
36
39
|
data['aps'] = {}
|
37
|
-
data['aps']['alert'] = params['message'] if params['message']
|
40
|
+
data['aps']['alert'] = params['message'] if params['message']
|
38
41
|
data['aps']['badge'] = params['badge'].to_i if params['badge']
|
39
42
|
data['aps']['sound'] = params['sound'] if params['sound']
|
40
43
|
data['aps']['vibrate'] = params['vibrate'] if params['vibrate']
|
@@ -43,9 +46,9 @@ module Rhoconnect
|
|
43
46
|
"\0\0 #{[params['device_pin'].delete(' ')].pack('H*')}\0#{json.length.chr}#{json}"
|
44
47
|
end
|
45
48
|
end
|
46
|
-
|
49
|
+
|
47
50
|
# Deprecated - use Apple instead
|
48
|
-
class Iphone < Apple
|
51
|
+
class Iphone < Apple
|
49
52
|
def self.ping(params)
|
50
53
|
log "DEPRECATION WARNING: 'iphone' is a deprecated device_type, use 'apple' instead"
|
51
54
|
super(params)
|
data/lib/rhoconnect/ping.rb
CHANGED
data/lib/rhoconnect/version.rb
CHANGED
data/lib/rhoconnect.rb
CHANGED
@@ -51,8 +51,7 @@ module Rhoconnect
|
|
51
51
|
extend self
|
52
52
|
|
53
53
|
class << self
|
54
|
-
attr_accessor :base_directory, :app_directory, :data_directory,
|
55
|
-
:vendor_directory, :blackberry_bulk_sync, :redis,
|
54
|
+
attr_accessor :base_directory, :app_directory, :data_directory, :vendor_directory, :redis,
|
56
55
|
:log_disabled, :license, :bulk_sync_poll_interval, :stats, :appserver, :api_token,
|
57
56
|
:raise_on_expired_lock, :lock_duration, :cookie_expire, :predefined_sources,
|
58
57
|
:connection_pool_size, :connection_pool_timeout, :redis_timeout, :store_key_ttl,
|
@@ -95,7 +94,6 @@ module Rhoconnect
|
|
95
94
|
Rhoconnect.app_directory = get_setting(config,environment,:app_directory)
|
96
95
|
Rhoconnect.data_directory = get_setting(config,environment,:data_directory)
|
97
96
|
Rhoconnect.vendor_directory = get_setting(config,environment,:vendor_directory)
|
98
|
-
Rhoconnect.blackberry_bulk_sync = get_setting(config,environment,:blackberry_bulk_sync,false)
|
99
97
|
Rhoconnect.bulk_sync_poll_interval = get_setting(config,environment,:bulk_sync_poll_interval,3600)
|
100
98
|
Rhoconnect.redis = get_setting(config,environment,:redis,false)
|
101
99
|
Rhoconnect.connection_pool_size ||= get_setting(config,environment,:connection_pool_size,5)
|
@@ -142,7 +140,6 @@ _MIGRATE_TO_NEW_RHOCONNECT
|
|
142
140
|
check_and_add(File.join(Rhoconnect.app_directory,'models','ruby'))
|
143
141
|
start_app(config)
|
144
142
|
create_admin_user
|
145
|
-
check_hsql_lib! if Rhoconnect.blackberry_bulk_sync
|
146
143
|
end
|
147
144
|
|
148
145
|
def environment
|
@@ -318,16 +315,6 @@ _MIGRATE_TO_NEW_RHOCONNECT
|
|
318
315
|
end
|
319
316
|
end
|
320
317
|
|
321
|
-
def check_hsql_lib!
|
322
|
-
unless File.exists?(File.join(Rhoconnect.vendor_directory,'hsqldata.jar'))
|
323
|
-
log "*"*60
|
324
|
-
log ""
|
325
|
-
log "WARNING: Missing vendor/hsqldata.jar, please install it for BlackBerry bulk sync support."
|
326
|
-
log ""
|
327
|
-
log "*"*60
|
328
|
-
end
|
329
|
-
end
|
330
|
-
|
331
318
|
def expire_bulk_data(username, partition = :user)
|
332
319
|
name = BulkData.get_name(partition,username)
|
333
320
|
data = BulkData.load(name)
|
@@ -95,6 +95,26 @@ describe "Rhoconnect::Controller::JsBase" do
|
|
95
95
|
json[5]['delete'].should == { "blob_created" => { "name" => "hello", "txtfile-rhoblob" => "blob_created" } }
|
96
96
|
end
|
97
97
|
|
98
|
+
it "should push_objects to js controller" do
|
99
|
+
s = Source.load('JsSample', @s_params)
|
100
|
+
data = {'1' => @product1, '2' => @product2, '3' => @product3}
|
101
|
+
post "/app/#{Rhoconnect::API_VERSION}/JsSample/push_objects",
|
102
|
+
{:user_id => @u.id, :objects => data}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
103
|
+
last_response.should be_ok
|
104
|
+
verify_doc_result(s, {:md => data, :md_size=>'3'})
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should push_deletes to js controller" do
|
108
|
+
data = {'1' => @product1, '2' => @product2, '3' => @product3}
|
109
|
+
s = Source.load('JsSample',@s_params)
|
110
|
+
set_doc_state(s, {:md => data, :md_size => '3'})
|
111
|
+
data.delete('2')
|
112
|
+
post "/app/#{Rhoconnect::API_VERSION}/JsSample/push_deletes",
|
113
|
+
{:user_id => @u.id, :objects => ['2']}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
|
114
|
+
last_response.should be_ok
|
115
|
+
verify_doc_result(s, {:md => data, :md_size=>'2'})
|
116
|
+
end
|
117
|
+
|
98
118
|
it "should register deprecated_route"
|
99
119
|
end
|
100
120
|
end
|
@@ -3,9 +3,6 @@ require File.join(File.dirname(__FILE__),'..','spec_helper')
|
|
3
3
|
describe "BulkDataJob" do
|
4
4
|
it_behaves_like "SharedRhoconnectHelper", :rhoconnect_data => true do
|
5
5
|
|
6
|
-
before(:each) do
|
7
|
-
Rhoconnect.blackberry_bulk_sync = true
|
8
|
-
end
|
9
6
|
after(:each) do
|
10
7
|
delete_data_directory
|
11
8
|
end
|
@@ -32,10 +29,6 @@ describe "BulkDataJob" do
|
|
32
29
|
validate_db(data,expected).should == true
|
33
30
|
File.exists?(data.dbfile+'.rzip').should == true
|
34
31
|
File.exists?(data.dbfile+'.gzip').should == true
|
35
|
-
File.exists?(data.dbfile+'.hsqldb.data').should == true
|
36
|
-
File.exists?(data.dbfile+'.hsqldb.data.gzip').should == true
|
37
|
-
File.exists?(data.dbfile+'.hsqldb.script').should == true
|
38
|
-
File.exists?(data.dbfile+'.hsqldb.properties').should == true
|
39
32
|
path = File.join(File.dirname(data.dbfile),'tmp')
|
40
33
|
FileUtils.mkdir_p path
|
41
34
|
unzip_file("#{data.dbfile}.rzip",path)
|
@@ -67,10 +60,6 @@ describe "BulkDataJob" do
|
|
67
60
|
validate_db_file(data.dbfile,[@s_fields[:name], 'FixedSchemaAdapter'], expected).should == true
|
68
61
|
File.exists?(data.dbfile+'.rzip').should == true
|
69
62
|
File.exists?(data.dbfile+'.gzip').should == true
|
70
|
-
File.exists?(data.dbfile+'.hsqldb.data').should == true
|
71
|
-
File.exists?(data.dbfile+'.hsqldb.data.gzip').should == true
|
72
|
-
File.exists?(data.dbfile+'.hsqldb.script').should == true
|
73
|
-
File.exists?(data.dbfile+'.hsqldb.properties').should == true
|
74
63
|
path = File.join(File.dirname(data.dbfile),'tmp')
|
75
64
|
FileUtils.mkdir_p path
|
76
65
|
unzip_file("#{data.dbfile}.rzip",path)
|
@@ -78,26 +67,6 @@ describe "BulkDataJob" do
|
|
78
67
|
validate_db_file(data.dbfile,[@s_fields[:name], 'FixedSchemaAdapter'], expected).should == true
|
79
68
|
end
|
80
69
|
|
81
|
-
it "should not create hsql db files if blackberry_bulk_sync is disabled" do
|
82
|
-
Rhoconnect.blackberry_bulk_sync = false
|
83
|
-
set_state('test_db_storage' => @data)
|
84
|
-
docname = bulk_data_docname(@a.id,@u.id)
|
85
|
-
data = BulkData.create(:name => docname,
|
86
|
-
:state => :inprogress,
|
87
|
-
:app_id => @a.id,
|
88
|
-
:user_id => @u.id,
|
89
|
-
:partition_sources => [@s_fields[:name]],
|
90
|
-
:sources => [@s_fields[:name]])
|
91
|
-
do_bulk_data_job("data_name" => data.name)
|
92
|
-
data = BulkData.load(docname)
|
93
|
-
data.completed?.should == true
|
94
|
-
verify_doc_result(@s, {:md => @data,
|
95
|
-
:md_copy => @data})
|
96
|
-
validate_db(data,@s.name => @data).should == true
|
97
|
-
File.exists?(data.dbfile+'.hsqldb.script').should == false
|
98
|
-
File.exists?(data.dbfile+'.hsqldb.properties').should == false
|
99
|
-
end
|
100
|
-
|
101
70
|
it "should create sqlite data with source metadata" do
|
102
71
|
set_state('test_db_storage' => @data)
|
103
72
|
mock_metadata_method([SampleAdapter]) do
|
@@ -138,17 +107,6 @@ describe "BulkDataJob" do
|
|
138
107
|
end
|
139
108
|
end
|
140
109
|
|
141
|
-
it "should raise exception if hsqldata fails" do
|
142
|
-
data = BulkData.create(:name => bulk_data_docname(@a.id,@u.id),
|
143
|
-
:state => :inprogress,
|
144
|
-
:app_id => @a.id,
|
145
|
-
:user_id => @u.id,
|
146
|
-
:partition_sources => [@s_fields[:name]],
|
147
|
-
:sources => [@s_fields[:name]])
|
148
|
-
lambda { BulkDataJob.create_hsql_data_file(data,Time.now.to_i.to_s)
|
149
|
-
}.should raise_error(Exception,"Error running hsqldata")
|
150
|
-
end
|
151
|
-
|
152
110
|
it "should delete bulk data if exception is raised" do
|
153
111
|
lambda {
|
154
112
|
do_bulk_data_job("data_name" => 'broken')
|
data/spec/jobs/ping_job_spec.rb
CHANGED
@@ -31,20 +31,6 @@ describe "PingJob" do
|
|
31
31
|
PingJob.perform(params)
|
32
32
|
end
|
33
33
|
|
34
|
-
it "should perform blackberry ping with integer parameters" do
|
35
|
-
params = {"user_id" => @u.id, "api_token" => @api_token,
|
36
|
-
"sources" => [@s.name], "message" => 'hello world',
|
37
|
-
"vibrate" => 5, "badge" => '5', "sound" => 'hello.mp3',"phone_id"=>nil}
|
38
|
-
|
39
|
-
scrubbed_params = params.dup
|
40
|
-
scrubbed_params['vibrate'] = '5'
|
41
|
-
|
42
|
-
@c.device_type = 'blackberry'
|
43
|
-
Blackberry.should_receive(:ping).once.with({'device_pin' => @c.device_pin,
|
44
|
-
'device_port' => @c.device_port}.merge!(scrubbed_params))
|
45
|
-
PingJob.perform(params)
|
46
|
-
end
|
47
|
-
|
48
34
|
it "should perform apple ping" do
|
49
35
|
params = {"user_id" => @u.id, "api_token" => @api_token,
|
50
36
|
"sources" => [@s.name], "message" => 'hello world',
|
@@ -54,16 +40,6 @@ describe "PingJob" do
|
|
54
40
|
PingJob.perform(params)
|
55
41
|
end
|
56
42
|
|
57
|
-
it "should perform blackberry ping" do
|
58
|
-
params = {"user_id" => @u.id, "api_token" => @api_token,
|
59
|
-
"sources" => [@s.name], "message" => 'hello world',
|
60
|
-
"vibrate" => '5', "badge" => '5', "sound" => 'hello.mp3',"phone_id"=>nil}
|
61
|
-
@c.device_type = 'blackberry'
|
62
|
-
Blackberry.should_receive(:ping).once.with({'device_pin' => @c.device_pin,
|
63
|
-
'device_port' => @c.device_port}.merge!(params))
|
64
|
-
PingJob.perform(params)
|
65
|
-
end
|
66
|
-
|
67
43
|
it "should skip ping for the unknown platform" do
|
68
44
|
params = {"user_id" => @u.id, "api_token" => @api_token,
|
69
45
|
"sources" => [@s.name], "message" => 'hello world',
|
@@ -86,7 +62,7 @@ describe "PingJob" do
|
|
86
62
|
params = {"user_id" => @u.id, "api_token" => @api_token,
|
87
63
|
"sources" => [@s.name], "message" => 'hello world',
|
88
64
|
"vibrate" => '5', "badge" => '5', "sound" => 'hello.mp3'}
|
89
|
-
@c.device_type = '
|
65
|
+
@c.device_type = 'Android'
|
90
66
|
@c.device_pin = nil
|
91
67
|
PingJob.should_receive(:log).once.with("Skipping ping for non-registered client_id '#{@c.id}'...")
|
92
68
|
lambda { PingJob.perform(params) }.should_not raise_error
|
@@ -126,7 +102,7 @@ describe "PingJob" do
|
|
126
102
|
lambda { PingJob.perform(params) }.should_not raise_error
|
127
103
|
end
|
128
104
|
|
129
|
-
it "should ping two different users from two different devices - Apple and
|
105
|
+
it "should ping two different users from two different devices - Apple and GCM" do
|
130
106
|
params = {"user_id" => [ @u.id, @u1.id], "api_token" => @api_token,
|
131
107
|
"sources" => [@s.name], "message" => 'hello world',
|
132
108
|
"vibrate" => '5', "badge" => '5', "sound" => 'hello.mp3', 'phone_id' => nil }
|
@@ -134,10 +110,10 @@ describe "PingJob" do
|
|
134
110
|
|
135
111
|
scrubbed_params = params.dup
|
136
112
|
scrubbed_params['vibrate'] = '5'
|
137
|
-
@c1.
|
113
|
+
@c1.device_push_type = 'Gcm'
|
138
114
|
|
139
115
|
Apple.should_receive(:ping).with(params.merge!({'device_pin' => @c.device_pin, 'phone_id' => @c.phone_id, 'device_port' => @c.device_port}))
|
140
|
-
|
116
|
+
Gcm.should_receive(:ping).with({'device_pin' => @c1.device_pin, 'device_port' => @c1.device_port}.merge!(scrubbed_params))
|
141
117
|
PingJob.perform(params)
|
142
118
|
end
|
143
119
|
|
@@ -172,10 +148,10 @@ describe "PingJob" do
|
|
172
148
|
|
173
149
|
scrubbed_params = params.dup
|
174
150
|
scrubbed_params['vibrate'] = '5'
|
175
|
-
@c1.
|
151
|
+
@c1.device_push_type = 'Gcm'
|
176
152
|
|
177
153
|
Apple.should_receive(:ping).with(params.merge!({'device_pin' => @c.device_pin, 'phone_id' => @c.phone_id, 'device_port' => @c.device_port})).and_return { raise SocketError.new("Socket failure") }
|
178
|
-
|
154
|
+
Gcm.should_receive(:ping).with({'device_pin' => @c1.device_pin, 'device_port' => @c1.device_port}.merge!(scrubbed_params))
|
179
155
|
exception_raised = false
|
180
156
|
begin
|
181
157
|
PingJob.perform(params)
|
data/spec/rhoconnect_spec.rb
CHANGED
@@ -18,7 +18,6 @@ describe "Rhoconnect" do
|
|
18
18
|
File.expand_path(Rhoconnect.app_directory).should == path
|
19
19
|
File.expand_path(Rhoconnect.data_directory).should == File.join(path,'data')
|
20
20
|
Rhoconnect.vendor_directory.should == 'foo'
|
21
|
-
Rhoconnect.blackberry_bulk_sync.should == false
|
22
21
|
Rhoconnect.bulk_sync_poll_interval.should == 3600
|
23
22
|
Rhoconnect.environment.should == :test
|
24
23
|
Rhoconnect.stats.should == false
|
data/spec/server/server_spec.rb
CHANGED
@@ -70,12 +70,6 @@ describe "Server" do
|
|
70
70
|
Rhoconnect::Server.set :secret, "secure!"
|
71
71
|
end
|
72
72
|
|
73
|
-
it "should complain about hsqldata.jar missing" do
|
74
|
-
Rhoconnect.vendor_directory = 'missing'
|
75
|
-
Rhoconnect::Server.should_receive(:log).any_number_of_times.with(any_args())
|
76
|
-
check_hsql_lib!
|
77
|
-
end
|
78
|
-
|
79
73
|
describe "helpers" do
|
80
74
|
before(:each) do
|
81
75
|
do_post "/rc/#{Rhoconnect::API_VERSION}/app/login", "login" => @u.login, "password" => 'testpass'
|
@@ -205,7 +199,7 @@ describe "Server" do
|
|
205
199
|
end
|
206
200
|
|
207
201
|
it "should respond to clientcreate" do
|
208
|
-
do_post "/rc/#{Rhoconnect::API_VERSION}/clients", 'device_type' => '
|
202
|
+
do_post "/rc/#{Rhoconnect::API_VERSION}/clients", 'device_type' => 'Android'
|
209
203
|
last_response.should be_ok
|
210
204
|
last_response.content_type.should =~ /application\/json/
|
211
205
|
id = JSON.parse(last_response.body)['client']['client_id']
|
@@ -214,11 +208,11 @@ describe "Server" do
|
|
214
208
|
{"client"=>{"client_id"=>id}}
|
215
209
|
c = Client.load(id,{:source_name => '*'})
|
216
210
|
c.user_id.should == 'testuser'
|
217
|
-
c.device_type.should == '
|
211
|
+
c.device_type.should == 'Android'
|
218
212
|
end
|
219
213
|
|
220
214
|
it "should respond to clientcreate with old route and deprecation warning" do
|
221
|
-
get "/application/clientcreate?device_type=
|
215
|
+
get "/application/clientcreate?device_type=Android"
|
222
216
|
last_response.should be_ok
|
223
217
|
last_response.headers["Warning"].index('deprecated').should_not == nil
|
224
218
|
last_response.content_type.should =~ /application\/json/
|
@@ -228,7 +222,7 @@ describe "Server" do
|
|
228
222
|
{"client"=>{"client_id"=>id}}
|
229
223
|
c = Client.load(id,{:source_name => '*'})
|
230
224
|
c.user_id.should == 'testuser'
|
231
|
-
c.device_type.should == '
|
225
|
+
c.device_type.should == 'Android'
|
232
226
|
end
|
233
227
|
|
234
228
|
it "should respond to clientregister" do
|
@@ -733,7 +727,6 @@ describe "Server" do
|
|
733
727
|
|
734
728
|
it "should create bulk data job if no file exists" do
|
735
729
|
set_state('test_db_storage' => @data)
|
736
|
-
Rhoconnect.blackberry_bulk_sync = true
|
737
730
|
post "/rc/#{Rhoconnect::API_VERSION}/app/bulk_data", {:partition => :user}, {Rhoconnect::CLIENT_ID_HEADER => @c.id}
|
738
731
|
do_bulk_data_job("data_name" => bulk_data_docname(@a.id,@u.id))
|
739
732
|
data = BulkData.load(bulk_data_docname(@a.id,@u.id))
|
data/spec/spec_helper.rb
CHANGED
@@ -75,6 +75,10 @@ module TestHelpers
|
|
75
75
|
File.expand_path(File.join(File.dirname(__FILE__),'apps','emptyapp'))
|
76
76
|
end
|
77
77
|
|
78
|
+
def get_api_token
|
79
|
+
User.load('rhoadmin').token_id
|
80
|
+
end
|
81
|
+
|
78
82
|
def do_post(url,params,headers = {})
|
79
83
|
headers.merge!('CONTENT_TYPE'=>'application/json')
|
80
84
|
post url, params.to_json, headers
|
@@ -64,6 +64,7 @@ shared_examples_for "SharedRhoconnectHelper" do |params|
|
|
64
64
|
@a.sources << @s3.id
|
65
65
|
Source.update_associations(@a.sources)
|
66
66
|
@a.users << @u.id
|
67
|
+
@api_token = get_api_token
|
67
68
|
|
68
69
|
# "RhoconnectDataHelper"
|
69
70
|
if params && params[:rhoconnect_data]
|
@@ -121,7 +122,6 @@ shared_examples_for "ApiHelper" do
|
|
121
122
|
Rhoconnect::Server.set :environment, :test
|
122
123
|
Rhoconnect::Server.set :run, false
|
123
124
|
Rhoconnect::Server.set :secret, "secure!"
|
124
|
-
@api_token = User.load('rhoadmin').token_id
|
125
125
|
|
126
126
|
@a_fields = { :name => test_app_name }
|
127
127
|
@a = (App.load(test_app_name) || App.create(@a_fields))
|
@@ -165,6 +165,7 @@ shared_examples_for "ApiHelper" do
|
|
165
165
|
@a.sources << @s1.id
|
166
166
|
Source.update_associations(@a.sources)
|
167
167
|
@a.users << @u.id
|
168
|
+
@api_token = get_api_token
|
168
169
|
|
169
170
|
@source = 'Product'
|
170
171
|
@user_id = 5
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhoconnect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0
|
5
|
-
prerelease:
|
4
|
+
version: 4.0.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Rhomobile
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -388,7 +388,6 @@ files:
|
|
388
388
|
- doc/licensing.txt
|
389
389
|
- doc/net-plugin.txt
|
390
390
|
- doc/client-java.txt
|
391
|
-
- doc/push-client-setup-bb.txt
|
392
391
|
- doc/extending-rhoconnect-server.txt
|
393
392
|
- doc/preparing-production.txt
|
394
393
|
- doc/push-backend-setup.txt
|
@@ -610,9 +609,7 @@ files:
|
|
610
609
|
- lib/rhoconnect/generator.rb
|
611
610
|
- lib/rhoconnect/ping/rhoconnect_push.rb
|
612
611
|
- lib/rhoconnect/ping/gcm.rb
|
613
|
-
- lib/rhoconnect/ping/blackberry.rb
|
614
612
|
- lib/rhoconnect/ping/apple.rb
|
615
|
-
- lib/rhoconnect/ping/android.rb
|
616
613
|
- lib/rhoconnect.rb
|
617
614
|
- js-adapters/node.rb
|
618
615
|
- js-adapters/ballroom.js
|
@@ -732,9 +729,7 @@ files:
|
|
732
729
|
- spec/test_methods_spec.rb
|
733
730
|
- spec/spec.opts
|
734
731
|
- spec/ping/rhoconnect_push_spec.rb
|
735
|
-
- spec/ping/android_spec.rb
|
736
732
|
- spec/ping/apple_spec.rb
|
737
|
-
- spec/ping/blackberry_spec.rb
|
738
733
|
- spec/ping/gcm_spec.rb
|
739
734
|
- spec/license_spec.rb
|
740
735
|
- spec/apps/emptyapp/application.rb
|
@@ -775,7 +770,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
775
770
|
version: '0'
|
776
771
|
segments:
|
777
772
|
- 0
|
778
|
-
hash:
|
773
|
+
hash: -2978824811517012826
|
779
774
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
780
775
|
none: false
|
781
776
|
requirements:
|
@@ -896,9 +891,7 @@ test_files:
|
|
896
891
|
- spec/test_methods_spec.rb
|
897
892
|
- spec/spec.opts
|
898
893
|
- spec/ping/rhoconnect_push_spec.rb
|
899
|
-
- spec/ping/android_spec.rb
|
900
894
|
- spec/ping/apple_spec.rb
|
901
|
-
- spec/ping/blackberry_spec.rb
|
902
895
|
- spec/ping/gcm_spec.rb
|
903
896
|
- spec/license_spec.rb
|
904
897
|
- spec/apps/emptyapp/application.rb
|
@@ -1,81 +0,0 @@
|
|
1
|
-
Setting Up RhoConnect Push-Based Synchronization with BlackBerry Enterprise Server
|
2
|
-
===
|
3
|
-
|
4
|
-
This chapter contains the steps you need to set up your BlackBerry Rhodes client and RhoConnect server for push messaging. After you perform the steps in this chapter, you will finish by performing the [client setup that is needed for all platforms](/rhoconnect/push-client-setup).
|
5
|
-
|
6
|
-
## Setting up RhoConnect Server Application for Push to Blackberry Clients
|
7
|
-
|
8
|
-
To set up your RhoConnect application for pushing to a BlackBerry client, you will need to update `settings/settings.yml` to include the following:
|
9
|
-
|
10
|
-
:::yaml
|
11
|
-
:development:
|
12
|
-
:redis: localhost:6379
|
13
|
-
:mdsserver: 192.168.1.110
|
14
|
-
:mdsserverport: 8080
|
15
|
-
:syncserver: http://localhost:9292/application/
|
16
|
-
:licensefile: settings/license.key
|
17
|
-
|
18
|
-
Replace `:mdsserver:` and `:mdsserverport:` with the hostname/IP and port of your machine (default port is 8080).
|
19
|
-
|
20
|
-
## Enabling Rhodes Client for RhoConnect Server Push
|
21
|
-
|
22
|
-
Enable push in your rhodes application in build.yml.
|
23
|
-
|
24
|
-
:::yaml
|
25
|
-
capabilities:
|
26
|
-
- push
|
27
|
-
|
28
|
-
## Setting up the Rhodes Blackberry Client for Push
|
29
|
-
|
30
|
-
Notifications to BlackBerry are sent using PAP 2.0 message through a BES/MDS server.
|
31
|
-
|
32
|
-
On the simulator, this is done via the MDS simulator tool (which you've probably already seen in the form of a console window every time you do 'rake run:bb'). On the device, this is done through the BES/MDS server that the phone is configured to use.
|
33
|
-
|
34
|
-
These instructions assume you are familiar with BES/MDS concepts (for more information please see [here](http://na.blackberry.com/eng/services/business/server/full/)).
|
35
|
-
|
36
|
-
In case of Blackberry, if the application is in the background, an alert operation will bring the application upfront; other operations will not.
|
37
|
-
|
38
|
-
### Setup MDS Simulator
|
39
|
-
|
40
|
-
<i>Make sure you close the BlackBerry simulator and MDS simulator before continuing for your changes to take effect!</i>
|
41
|
-
|
42
|
-
To enable the push port in your MDS simulator, edit the following file:
|
43
|
-
|
44
|
-
C:\Program Files\Research In Motion\BlackBerry JDE <VERSION YOU ARE BUILDING>\MDS\config\rimpublic.property
|
45
|
-
|
46
|
-
Uncomment the last line of the file, which should be 'push.application.reliable.ports=100':
|
47
|
-
|
48
|
-
push.application.reliable.ports=100
|
49
|
-
|
50
|
-
### Setup BlackBerry Simulator
|
51
|
-
|
52
|
-
To listen for incoming messages on BlackBerry, the Rhodes application will start when the device powers on, and will run a listener thread in the background. You will use the "push_port" option in the [rhoconfig.txt](configuration#run-time-configuration) to specify the listening port for incoming push messages. If "push_port" is not specified, default will be 100 as shown in the previous section.
|
53
|
-
|
54
|
-
For testing push on the BlackBerry simulator, you should preform the following 'kickstart' process. When the simulator starts, open the web browser on the simulator and navigate to any web page (i.e. http://m.google.com/). Now your simulator is ready to receive push messages.
|
55
|
-
|
56
|
-
### Setup BlackBerry Device
|
57
|
-
|
58
|
-
To test push on a BlackBerry device, you will need to use a device that is configured with a BES server. Then, [build your Rhodes application for the device](build#build-for-blackberry).
|
59
|
-
|
60
|
-
### BlackBerry 5.0 Push service
|
61
|
-
|
62
|
-
Rhodes 2.2 and higher supports the [Blackberry Push Service](http://na.blackberry.com/eng/developers/javaappdev/pushapi.jsp).
|
63
|
-
|
64
|
-
Define in [rhoconfig.txt](configuration#run-time-configuration) which push to use (if empty or missed, only MDS push is supported).
|
65
|
-
|
66
|
-
push_options = 'mds;push_service'
|
67
|
-
|
68
|
-
The following parameters are from [PushApplicationDescriptor](http://www.blackberry.com/developers/docs/5.0.0api/net/rim/blackberry/api/push/PushApplicationDescriptor.html). Set them in [rhoconfig.txt](configuration#run-time-configuration):
|
69
|
-
|
70
|
-
push_service_url = 'https://pushapi.eval.blackberry.com/'
|
71
|
-
push_service_port = 20558
|
72
|
-
push_service_appname = 'RhoTest'
|
73
|
-
push_service_type = 'BPAS'
|
74
|
-
|
75
|
-
### Alert Audio File Setup for Blackberry
|
76
|
-
|
77
|
-
In case of Blackberry Rhodes client, if the audio file is in the public folder, the file name will be `/apps/public/alerts/test-file.mp3`.
|
78
|
-
|
79
|
-
## Finishing Client Setup
|
80
|
-
|
81
|
-
Once you have completed the above steps for setting up push on Blackberry client and RhoConnect server, you must still [perform the client setup that is needed for all platforms](/rhoconnect/push-client-setup).
|