rhosync 2.0.0.beta7 → 2.0.0.beta8

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 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{Rhosync Server}
58
- gemspec.description = %q{Rhosync library and related command-line utilities for using Rhosync}
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: "
@@ -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
 
@@ -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 "Verify Error : #{Bench.verify_error}"
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, :app_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 ||= false
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
- 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
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
- :app_name => @app_name, :user_name => @user_name,
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__),'..',@app_name,'settings','settings.yml'))
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
- "%8fada06e7b56478e90a5348a1c6f3f85{ "
3
- Email"jazmin_mcdermott@yahoo.com"%6144d0c7f9484eeb9c68d2304a9bfb14{ @" Cronin@
4
- "Advertising Scientist@ " Eugene@"1-980-027-5133 x549@"Jacobs-Kilback@"%6144d0c7f9484eeb9c68d2304a9bfb14@"jarvis_parker@gmail.com"%bef9e032a55949919e1ccb409ccbd187{ @"
5
- Boehm@
6
- "Quality Assurance Nurse@ "
7
- Lance@"008.738.6271 x963@"Larson LLC@"%bef9e032a55949919e1ccb409ccbd187@"cayla_marvin@hotmail.com"%ff435a73b11841f7bf0da839538db179{ @"Heathcote@
8
- "Senior Buyer@ "
9
- Raven@"187-409-4543 x1528@"Morar-Huels@"%ff435a73b11841f7bf0da839538db179@"keon_parisian@yahoo.com"%9828dd87b59a479a8e7488a5e44eef2e{ @" Keeling@
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
@@ -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 = 5
6
- config.iterations = 5
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:benchapp:#{config.user_name}",{})
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.app_name,
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.app_name,
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
@@ -2,12 +2,12 @@ module BenchHelpers
2
2
  include Bench::Logging
3
3
  include Bench::Utils
4
4
 
5
- def client_docname(app_id,user_id,client_id,source_name,doctype)
6
- "client:#{app_id}:#{user_id}:#{client_id}:#{source_name}:#{doctype}"
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(app_id,user_id,source_name,doctype)
10
- "source:#{app_id}:#{user_id}:#{source_name}:#{doctype}"
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
- # Run sync session, forces source adapter query on every sync request
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.create_user
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
- # Runs simple login,clientcreate,sync session and validates response
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 = 5
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.create_user
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