rhosync 2.0.0.beta7 → 2.0.0.beta8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Rakefile +3 -2
- data/bench/benchapp/Rakefile +3 -3
- data/bench/benchapp/application.rb +14 -0
- data/bench/benchapp/config.ru +5 -1
- data/bench/lib/bench/statistics.rb +1 -1
- data/bench/lib/bench.rb +11 -11
- data/bench/lib/testdata/5-data.txt +8 -10
- data/bench/scripts/cud_script.rb +6 -10
- data/bench/scripts/helpers.rb +4 -4
- data/bench/scripts/query_md_script.rb +3 -4
- data/bench/scripts/query_script.rb +4 -5
- data/doc/protocol.html +81 -81
- data/examples/simple/application.rb +14 -0
- data/lib/rhosync/app.rb +0 -13
- data/lib/rhosync/console/rhosync_api.rb +3 -2
- data/lib/rhosync/version.rb +1 -1
- data/tasks/redis.rake +17 -16
- metadata +62 -8
- data/bench/benchapp/vendor/rhosync/lib/rhosync.rb +0 -7
- data/examples/simple/vendor/rhosync/lib/rhosync.rb +0 -7
data/CHANGELOG
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
+
== 2.0.0.beta8
|
2
|
+
* #3685476 - CGI escape api cookies
|
3
|
+
|
1
4
|
== 2.0.0.beta7
|
2
5
|
* #3651932 - support redis:* tasks on windows and linux/mac
|
6
|
+
* #3663335 - don't need ENV['PWD'] in tasks.rb
|
3
7
|
|
4
8
|
== 2.0.0.beta6
|
5
9
|
* no new changes, rubygems.org upload failed for 2.0.0.beta5
|
data/Rakefile
CHANGED
@@ -54,8 +54,8 @@ begin
|
|
54
54
|
|
55
55
|
Jeweler::Tasks.new do |gemspec|
|
56
56
|
gemspec.name = "rhosync"
|
57
|
-
gemspec.summary = %q{
|
58
|
-
gemspec.description = %q{
|
57
|
+
gemspec.summary = %q{RhoSync Synchronization Framework}
|
58
|
+
gemspec.description = %q{RhoSync Synchronization Framework and related command-line utilities}
|
59
59
|
gemspec.homepage = %q{http://rhomobile.com/products/rhosync}
|
60
60
|
gemspec.authors = ["Rhomobile"]
|
61
61
|
gemspec.email = %q{dev@rhomobile.com}
|
@@ -79,6 +79,7 @@ begin
|
|
79
79
|
gemspec.add_development_dependency "rcov", ">=0.9.8"
|
80
80
|
gemspec.add_development_dependency "faker", ">=0.3.1"
|
81
81
|
gemspec.add_development_dependency "rack-test", ">=0.5.3"
|
82
|
+
gemspec.add_development_dependency "thor", ">=0.13.6"
|
82
83
|
end
|
83
84
|
rescue LoadError
|
84
85
|
puts "Jeweler not available. Install it with: "
|
data/bench/benchapp/Rakefile
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__),'..','..','lib')
|
2
2
|
require 'rhosync/tasks'
|
3
3
|
|
4
|
+
ROOT_PATH = File.expand_path(File.dirname(__FILE__))
|
5
|
+
|
4
6
|
begin
|
5
7
|
require 'resque/tasks'
|
6
|
-
|
7
8
|
task "resque:setup" do
|
8
|
-
require 'rhosync'
|
9
9
|
require 'application'
|
10
10
|
end
|
11
11
|
rescue LoadError
|
12
12
|
puts "Resque not available. Install it with: "
|
13
13
|
puts "gem install resque\n\n"
|
14
|
-
end
|
14
|
+
end
|
@@ -4,9 +4,23 @@ class Application < Rhosync::Base
|
|
4
4
|
true # do some interesting authentication here...
|
5
5
|
end
|
6
6
|
|
7
|
+
# Add hooks for application startup here
|
8
|
+
# Don't forget to call super at the end!
|
7
9
|
def initializer(path)
|
8
10
|
super
|
9
11
|
end
|
12
|
+
|
13
|
+
# Calling super here returns rack tempfile path:
|
14
|
+
# i.e. /var/folders/J4/J4wGJ-r6H7S313GEZ-Xx5E+++TI
|
15
|
+
# Note: This tempfile is removed when server stops or crashes...
|
16
|
+
# See http://rack.rubyforge.org/doc/Multipart.html for more info
|
17
|
+
#
|
18
|
+
# Override this by creating a copy of the file somewhere
|
19
|
+
# and returning the path to that file (then don't call super!):
|
20
|
+
# i.e. /mnt/myimages/soccer.png
|
21
|
+
def store_blob(blob)
|
22
|
+
super #=> returns blob[:tempfile]
|
23
|
+
end
|
10
24
|
end
|
11
25
|
end
|
12
26
|
|
data/bench/benchapp/config.ru
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
path = File.join(File.dirname(__FILE__),'..','..','lib')
|
4
|
+
$:.unshift path
|
5
|
+
|
3
6
|
# Try to load vendor-ed rhosync, otherwise load the gem
|
4
7
|
begin
|
5
|
-
require 'vendor/rhosync/lib/rhosync'
|
8
|
+
require 'vendor/rhosync/lib/rhosync/server'
|
9
|
+
require 'vendor/rhosync/lib/rhosync/console/server'
|
6
10
|
rescue LoadError
|
7
11
|
require 'rhosync/server'
|
8
12
|
require 'rhosync/console/server'
|
@@ -44,7 +44,7 @@ module Bench
|
|
44
44
|
@rows.each do |marker,row|
|
45
45
|
logger.info "Request %-15s: min: %0.4f, max: %0.4f, avg: %0.4f, err: %d, verification err: %d" % [marker, row[:min], row[:max], average(row), row[:errors], row[:verification_errors]]
|
46
46
|
end
|
47
|
-
logger.info "
|
47
|
+
logger.info "State of MD : #{Bench.verify_error == 0 ? true : false}"
|
48
48
|
logger.info "Concurrency : #{@concurrency}"
|
49
49
|
logger.info "Iterations : #{@iterations}"
|
50
50
|
logger.info "Total Count : #{@total_count}"
|
data/bench/lib/bench.rb
CHANGED
@@ -25,13 +25,13 @@ module Bench
|
|
25
25
|
include Utils
|
26
26
|
|
27
27
|
attr_accessor :concurrency, :iterations, :admin_login
|
28
|
-
attr_accessor :admin_password, :user_name
|
28
|
+
attr_accessor :admin_password, :user_name
|
29
29
|
attr_accessor :password, :host, :base_url, :token
|
30
30
|
attr_accessor :total_time, :sessions, :verify_error
|
31
31
|
|
32
32
|
def config
|
33
33
|
begin
|
34
|
-
@verify_error ||=
|
34
|
+
@verify_error ||= 0
|
35
35
|
yield self
|
36
36
|
rescue Exception => e
|
37
37
|
puts "error in config: #{e.inspect}"
|
@@ -50,13 +50,13 @@ module Bench
|
|
50
50
|
RestClient.post("#{@host}/api/reset",{:api_token => get_token}.to_json, :content_type => :json)
|
51
51
|
end
|
52
52
|
|
53
|
-
def create_user
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
53
|
+
# def create_user
|
54
|
+
# token = get_token
|
55
|
+
# RestClient.post("#{@host}/api/create_user",
|
56
|
+
# {:api_token => token, :app_name => @app_name,
|
57
|
+
# :attributes => {:login => @user_name, :password => @password}}.to_json,
|
58
|
+
# :content_type => :json)
|
59
|
+
# end
|
60
60
|
|
61
61
|
def set_server_state(doc,data)
|
62
62
|
token = get_token
|
@@ -68,7 +68,7 @@ module Bench
|
|
68
68
|
token = get_token
|
69
69
|
RestClient.post("#{@host}/api/set_refresh_time",
|
70
70
|
{:api_token => token, :source_name => source_name,
|
71
|
-
:
|
71
|
+
:user_name => @user_name,
|
72
72
|
:poll_interval => poll_interval}.to_json,
|
73
73
|
:content_type => :json)
|
74
74
|
end
|
@@ -83,7 +83,7 @@ module Bench
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def get_test_server
|
86
|
-
load_settings(File.join(File.dirname(__FILE__),'..'
|
86
|
+
load_settings(File.join(File.dirname(__FILE__),'..','benchapp','settings','settings.yml'))
|
87
87
|
@base_url = $settings[:development][:syncserver].gsub(/\/$/,'')
|
88
88
|
uri = URI.parse(@base_url)
|
89
89
|
port = (uri.port and uri.port != 80) ? ":"+uri.port.to_s : ""
|
@@ -1,11 +1,9 @@
|
|
1
1
|
{
|
2
|
-
"%
|
3
|
-
|
4
|
-
"
|
5
|
-
|
6
|
-
"
|
7
|
-
|
8
|
-
"
|
9
|
-
|
10
|
-
"Administrative Supervisor@"
|
11
|
-
Robyn@"(159)270-6914 x9311@"Lakin and Sons@"%9828dd87b59a479a8e7488a5e44eef2e@"simone.torphy@yahoo.com
|
2
|
+
"%0b2cad915eb44b7c8bccf098beee8c3a{"
|
3
|
+
Swift"
|
4
|
+
Email"kristian@yahoo.com"%67afa749e7e2465dae7e387a0650bd02{@"
|
5
|
+
"!Environmental Superintendent@"
|
6
|
+
Erwin@"(135)166-9749@"Schowalter-Fisher@"%67afa749e7e2465dae7e387a0650bd02@"dale@yahoo.com"%5437a251c3ad48249b9a4e5000bf8bd3{@"Shields@
|
7
|
+
"Account Recruiter@"Dorothy@"174-253-0093 x87634@"Kutch Inc@"%5437a251c3ad48249b9a4e5000bf8bd3@"stephania@hotmail.com"%ce7c0264b8f44aaa9f0cc9b07278cdc2{@"Graham@
|
8
|
+
"Financial Recruiter@"Hal@"834-932-4377 x87106@"Gleichner-Bailey@"%ce7c0264b8f44aaa9f0cc9b07278cdc2@"tom@hotmail.com"%0c40d2f6f1f54481af682cee463aa042{@"Jacobs@
|
9
|
+
"Environmental Sales@"Hailey@"1-743-017-6816 x72645@"White Group@"%0c40d2f6f1f54481af682cee463aa042@"bethany_daniel@yahoo.com
|
data/bench/scripts/cud_script.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
|
-
# Simulate creating multiple objects
|
2
1
|
include BenchHelpers
|
2
|
+
logger.info "Simulate creating multiple objects"
|
3
3
|
|
4
4
|
Bench.config do |config|
|
5
|
-
config.concurrency =
|
6
|
-
config.iterations =
|
5
|
+
config.concurrency = 1
|
6
|
+
config.iterations = 1
|
7
7
|
config.user_name = "benchuser"
|
8
8
|
config.password = "password"
|
9
|
-
config.app_name = "benchapp"
|
10
9
|
config.get_test_server
|
11
10
|
config.reset_app
|
12
|
-
config.create_user
|
13
11
|
config.reset_refresh_time('MockAdapter',0)
|
14
|
-
config.set_server_state("test_db_storage:
|
12
|
+
config.set_server_state("test_db_storage:application:#{config.user_name}",{})
|
15
13
|
@create_objects = []
|
16
14
|
@create_count = 5
|
17
15
|
config.concurrency.times do |i|
|
@@ -61,8 +59,7 @@ Bench.verify do |config,sessions|
|
|
61
59
|
|
62
60
|
sessions.each do |session|
|
63
61
|
actual = config.get_server_state(
|
64
|
-
client_docname(config.
|
65
|
-
config.user_name,
|
62
|
+
client_docname(config.user_name,
|
66
63
|
session.client_id,
|
67
64
|
'MockAdapter',:cd))
|
68
65
|
session.results['create-object'][0].verification_error +=
|
@@ -70,8 +67,7 @@ Bench.verify do |config,sessions|
|
|
70
67
|
end
|
71
68
|
|
72
69
|
master_doc = config.get_server_state(
|
73
|
-
source_docname(config.
|
74
|
-
config.user_name,
|
70
|
+
source_docname(config.user_name,
|
75
71
|
'MockAdapter',:md))
|
76
72
|
Bench.verify_error = Bench.compare_and_log(@expected_md,master_doc,current_line)
|
77
73
|
end
|
data/bench/scripts/helpers.rb
CHANGED
@@ -2,12 +2,12 @@ module BenchHelpers
|
|
2
2
|
include Bench::Logging
|
3
3
|
include Bench::Utils
|
4
4
|
|
5
|
-
def client_docname(
|
6
|
-
"client:#{
|
5
|
+
def client_docname(user_id,client_id,source_name,doctype)
|
6
|
+
"client:application:#{user_id}:#{client_id}:#{source_name}:#{doctype}"
|
7
7
|
end
|
8
8
|
|
9
|
-
def source_docname(
|
10
|
-
"source:#{
|
9
|
+
def source_docname(user_id,source_name,doctype)
|
10
|
+
"source:application:#{user_id}:#{source_name}:#{doctype}"
|
11
11
|
end
|
12
12
|
|
13
13
|
def verify_presence_of_keys(expected,actual,session,caller)
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
include BenchHelpers
|
2
|
+
logger.info "Run sync session, forces source adapter query on every sync request"
|
2
3
|
|
3
4
|
@datasize = 100
|
4
5
|
@expected = Bench.get_test_data(@datasize)
|
@@ -10,11 +11,9 @@ Bench.config do |config|
|
|
10
11
|
config.iterations = 5
|
11
12
|
config.user_name = "benchuser"
|
12
13
|
config.password = "password"
|
13
|
-
config.app_name = "benchapp"
|
14
14
|
config.get_test_server
|
15
15
|
config.reset_app
|
16
|
-
config.
|
17
|
-
config.set_server_state("test_db_storage:benchapp:#{config.user_name}",@expected)
|
16
|
+
config.set_server_state("test_db_storage:application:#{config.user_name}",@expected)
|
18
17
|
config.reset_refresh_time('MockAdapter',0)
|
19
18
|
end
|
20
19
|
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
include BenchHelpers
|
2
|
+
logger.info "Runs simple login,clientcreate,sync session and validates response"
|
2
3
|
|
3
4
|
@datasize = 100
|
4
5
|
@expected = Bench.get_test_data(@datasize)
|
@@ -7,14 +8,12 @@
|
|
7
8
|
|
8
9
|
Bench.config do |config|
|
9
10
|
config.concurrency = 5
|
10
|
-
config.iterations =
|
11
|
+
config.iterations = 2
|
11
12
|
config.user_name = "benchuser"
|
12
13
|
config.password = "password"
|
13
|
-
config.app_name = "benchapp"
|
14
14
|
config.get_test_server
|
15
15
|
config.reset_app
|
16
|
-
config.
|
17
|
-
config.set_server_state("test_db_storage:benchapp:#{config.user_name}",@expected)
|
16
|
+
config.set_server_state("test_db_storage:application:#{config.user_name}",@expected)
|
18
17
|
config.reset_refresh_time('MockAdapter')
|
19
18
|
end
|
20
19
|
|