conflict 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +174 -0
- data/README +23 -0
- data/Rakefile +63 -0
- data/bin/conflict +13 -0
- data/lib/conflict.rb +27 -0
- data/lib/conflict/core.rb +170 -0
- data/lib/conflict/domain.rb +89 -0
- data/lib/conflict/parsers.rb +130 -0
- data/lib/run_conflict +26 -0
- data/test/common.rb +132 -0
- data/test/data/a13g.diff.txt +379 -0
- data/test/data/apache_myfaces.diff.txt +22 -0
- data/test/data/rails.diff.txt +13 -0
- data/test/data/rails.info.txt +11 -0
- data/test/data/stomp/stomp.1.diff.txt +21 -0
- data/test/data/stomp/stomp.1.info.txt +11 -0
- data/test/data/stomp/stomp.2.diff.txt +21 -0
- data/test/data/stomp/stomp.2.info.txt +11 -0
- data/test/data/three/added.diff.txt +11 -0
- data/test/data/three/changed.diff.txt +12 -0
- data/test/data/three/conflict.info.txt +11 -0
- data/test/data/three/deleted.diff.txt +11 -0
- data/test/database_test.rb +130 -0
- data/test/equality_test.rb +60 -0
- data/test/event_test.rb +40 -0
- data/test/negative_test.rb +107 -0
- data/test/parser_test.rb +98 -0
- data/test/round_trip/expiration_test.rb +56 -0
- data/test/round_trip/happy_path_test.rb +105 -0
- data/test/round_trip/multi_diff_test.rb +67 -0
- data/test/round_trip/multiple_actions_test.rb +82 -0
- data/test/round_trip/negative_test.rb +79 -0
- data/test/round_trip/relative_path_test.rb +63 -0
- metadata +86 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
Index: FacesServlet.java
|
2
|
+
===================================================================
|
3
|
+
--- FacesServlet.java (revision 539518)
|
4
|
+
+++ FacesServlet.java (working copy)
|
5
|
+
@@ -122,7 +122,7 @@
|
6
|
+
|
7
|
+
log.warn(buffer.toString());
|
8
|
+
|
9
|
+
- // Why does RI return a 404 and not a 403, SC_FORBIDDEN ?
|
10
|
+
+ // Why does RI return a 404 and not a 403, SC_FORBIDDEN ? ask Ed
|
11
|
+
|
12
|
+
((HttpServletResponse) response)
|
13
|
+
.sendError(HttpServletResponse.SC_NOT_FOUND);
|
14
|
+
@@ -137,7 +137,7 @@
|
15
|
+
_lifecycle);
|
16
|
+
try {
|
17
|
+
_lifecycle.execute(facesContext);
|
18
|
+
- _lifecycle.render(facesContext);
|
19
|
+
+ _lifecycle.render(facesContext); // this is here for portlets
|
20
|
+
}
|
21
|
+
catch (Throwable e)
|
22
|
+
{
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Index: release.rb
|
2
|
+
===================================================================
|
3
|
+
--- release.rb (revision 6859)
|
4
|
+
+++ release.rb (working copy)
|
5
|
+
@@ -2,7 +2,7 @@
|
6
|
+
|
7
|
+
VERSION = ARGV.first
|
8
|
+
PACKAGES = %w( activesupport activerecord actionpack actionmailer actionwebservice )
|
9
|
+
-
|
10
|
+
+# edit
|
11
|
+
# Checkout source
|
12
|
+
`rm -rf release && svn export http://dev.rubyonrails.org/svn/rails/trunk release`
|
13
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Path: .
|
2
|
+
URL: http://svn.rubyonrails.org/rails/trunk
|
3
|
+
Repository Root: http://svn.rubyonrails.org/rails
|
4
|
+
Repository UUID: 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
5
|
+
Revision: 6859
|
6
|
+
Node Kind: directory
|
7
|
+
Schedule: normal
|
8
|
+
Last Changed Author: bitsweat
|
9
|
+
Last Changed Rev: 6859
|
10
|
+
Last Changed Date: 2007-05-26 01:26:50 -0500 (Sat, 26 May 2007)
|
11
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Index: lib/stomp.rb
|
2
|
+
===================================================================
|
3
|
+
--- lib/stomp.rb (revision 83)
|
4
|
+
+++ lib/stomp.rb (working copy)
|
5
|
+
@@ -6,7 +6,6 @@
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
-#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
@@ -229,7 +228,7 @@
|
14
|
+
@transmit_semaphore.synchronize do
|
15
|
+
s.puts command
|
16
|
+
headers.each {|k,v| s.puts "#{k}:#{v}" }
|
17
|
+
- s.puts "content-length: #{body.length}"
|
18
|
+
+ s.puts "content-length: #{body.nil? ? 0 : body.length}"
|
19
|
+
s.puts "content-type: text/plain; charset=UTF-8"
|
20
|
+
s.puts
|
21
|
+
s.write body
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Path: .
|
2
|
+
URL: http://svn.codehaus.org/stomp/ruby/trunk
|
3
|
+
Repository Root: http://svn.codehaus.org/stomp
|
4
|
+
Repository UUID: fd4e7336-3dff-0310-b68a-b6615a75f13b
|
5
|
+
Revision: 83
|
6
|
+
Node Kind: directory
|
7
|
+
Schedule: normal
|
8
|
+
Last Changed Author: kookster
|
9
|
+
Last Changed Rev: 81
|
10
|
+
Last Changed Date: 2007-05-09 14:49:19 -0500 (Wed, 09 May 2007)
|
11
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Index: stomp.rb
|
2
|
+
===================================================================
|
3
|
+
--- stomp.rb (revision 83)
|
4
|
+
+++ stomp.rb (working copy)
|
5
|
+
@@ -6,7 +6,6 @@
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
-#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
@@ -229,7 +228,7 @@
|
14
|
+
@transmit_semaphore.synchronize do
|
15
|
+
s.puts command
|
16
|
+
headers.each {|k,v| s.puts "#{k}:#{v}" }
|
17
|
+
- s.puts "content-length: #{body.length}"
|
18
|
+
+ s.puts "content-length: #{body.nil? ? 0 : body.length}"
|
19
|
+
s.puts "content-type: text/plain; charset=UTF-8"
|
20
|
+
s.puts
|
21
|
+
s.write body
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Path: .
|
2
|
+
URL: http://svn.codehaus.org/stomp/ruby/trunk/lib
|
3
|
+
Repository Root: http://svn.codehaus.org/stomp
|
4
|
+
Repository UUID: fd4e7336-3dff-0310-b68a-b6615a75f13b
|
5
|
+
Revision: 83
|
6
|
+
Node Kind: directory
|
7
|
+
Schedule: normal
|
8
|
+
Last Changed Author: brianm
|
9
|
+
Last Changed Rev: 48
|
10
|
+
Last Changed Date: 2007-02-01 17:09:57 -0600 (Thu, 01 Feb 2007)
|
11
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Path: .
|
2
|
+
URL: https://conflict.svn.sourceforge.net/svnroot/conflict/src/ruby
|
3
|
+
Repository Root: https://conflict.svn.sourceforge.net/svnroot/conflict
|
4
|
+
Repository UUID: 458fecf6-5234-0410-8a5b-9d2fc9e9e673
|
5
|
+
Revision: 38
|
6
|
+
Node Kind: directory
|
7
|
+
Schedule: normal
|
8
|
+
Last Changed Author: dennisbyrne
|
9
|
+
Last Changed Rev: 38
|
10
|
+
Last Changed Date: 2007-07-05 20:29:17 -0500 (Thu, 05 Jul 2007)
|
11
|
+
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
require 'test/unit'
|
19
|
+
require 'conflict'
|
20
|
+
include Conflict
|
21
|
+
require File.dirname(__FILE__) + '/common.rb'
|
22
|
+
|
23
|
+
class DataBaseTest < Test::Unit::TestCase
|
24
|
+
include ConflictConstants
|
25
|
+
|
26
|
+
def setup
|
27
|
+
@db = DataBase::new
|
28
|
+
@db.clear
|
29
|
+
@db.insert @history_one = Event.new(CLIENT_ONE, "added", CONTROLLER)
|
30
|
+
@db.insert @history_two = Event.new(CLIENT_TWO, "changed", VIEW)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_dev_with_no_history_and_no_events_should_not_change_db
|
34
|
+
|
35
|
+
body = @db.find_conflicts(CLIENT_THREE, [])
|
36
|
+
|
37
|
+
assert_equal [], body
|
38
|
+
assert_equal 2, @db.size
|
39
|
+
assert @db.presence_of(@history_one)
|
40
|
+
assert @db.presence_of(@history_two)
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_devs_with_history_and_no_events_should_be_removed_from_db
|
45
|
+
|
46
|
+
body = @db.find_conflicts(CLIENT_TWO, [])
|
47
|
+
|
48
|
+
assert_equal [], body
|
49
|
+
assert_equal 1, @db.size
|
50
|
+
assert @db.presence_of(@history_one)
|
51
|
+
|
52
|
+
body = @db.find_conflicts(CLIENT_ONE, [])
|
53
|
+
assert_equal [], body
|
54
|
+
assert_equal 0, @db.size
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_dev_with_history_conflicts_with_dev_with_history_should_make_collision
|
58
|
+
|
59
|
+
event = Event.new(CLIENT_TWO, "added", CONTROLLER)
|
60
|
+
body = @db.find_conflicts(CLIENT_TWO, [event])
|
61
|
+
|
62
|
+
assert [Conflict::Conflict::new(event, @history_one)].eql?(body)
|
63
|
+
assert_equal 2, @db.size
|
64
|
+
assert @db.presence_of(@history_one)
|
65
|
+
assert @db.presence_of(event)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_dev_with_history_and_one_event_but_no_conflict_should_produce_no_conflict
|
69
|
+
|
70
|
+
event = Event.new(CLIENT_TWO, "added", MODEL)
|
71
|
+
body = @db.find_conflicts(CLIENT_TWO, [event])
|
72
|
+
|
73
|
+
assert_equal [], body
|
74
|
+
assert_equal 2, @db.size
|
75
|
+
assert @db.presence_of(@history_one) # keep first
|
76
|
+
assert @db.presence_of(event) # lose second, add new
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_dev_with_no_history_has_no_conflict_should_add_one_event_to_db
|
81
|
+
|
82
|
+
event = Event.new(CLIENT_THREE, "added", MODEL)
|
83
|
+
body = @db.find_conflicts(CLIENT_THREE, [event])
|
84
|
+
|
85
|
+
assert_equal [], body
|
86
|
+
assert_equal 3, @db.size
|
87
|
+
[@history_one, @history_two, event].each do | e | assert @db.presence_of(e) end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_dev_with_no_history_has_no_conflict_then_does_have_conflict
|
92
|
+
|
93
|
+
event = Event.new(CLIENT_THREE, "added", MODEL)
|
94
|
+
body = @db.find_conflicts(CLIENT_THREE, [event])
|
95
|
+
|
96
|
+
assert_equal [], body
|
97
|
+
assert_equal 3, @db.size
|
98
|
+
[@history_one, @history_two, event].each do | e | assert @db.presence_of(e) end
|
99
|
+
|
100
|
+
# in a second request
|
101
|
+
second_event = Event.new(CLIENT_THREE, "changed", VIEW)
|
102
|
+
body = @db.find_conflicts(CLIENT_THREE, [second_event])
|
103
|
+
|
104
|
+
assert [Conflict::Conflict::new(second_event, @history_two)].eql?(body)
|
105
|
+
assert_equal 3, @db.size
|
106
|
+
[@history_one, @history_two, second_event].each do | e | assert @db.presence_of(e) end
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_conflict_should_only_be_reported_for_the_client_sending_request
|
110
|
+
|
111
|
+
first = Event.new(CLIENT_ONE, "changed", VIEW)
|
112
|
+
second = Event.new(CLIENT_ONE, "added", CONTROLLER)
|
113
|
+
body = @db.find_conflicts(CLIENT_ONE, [first, second])
|
114
|
+
|
115
|
+
assert [Conflict::Conflict::new(first, @history_two)].eql?(body)
|
116
|
+
assert_equal 3, @db.size
|
117
|
+
[first, @history_two, second].each do |e| assert @db.presence_of(e) end
|
118
|
+
|
119
|
+
# in a second request
|
120
|
+
third = Event.new(CLIENT_THREE, "changed", VIEW)
|
121
|
+
conflicts = @db.find_conflicts(CLIENT_THREE, [third])
|
122
|
+
|
123
|
+
assert_equal 2, conflicts.size
|
124
|
+
assert conflicts[1].eql?(Conflict::Conflict::new(third, first))
|
125
|
+
assert conflicts[0].eql?(Conflict::Conflict::new(third, @history_two))
|
126
|
+
assert_equal 4, @db.size
|
127
|
+
[first, @history_two, second, third].each do |e| assert @db.presence_of(e) end
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
require 'test/unit'
|
19
|
+
require 'conflict'
|
20
|
+
include Conflict
|
21
|
+
require File.dirname(__FILE__) + '/common.rb'
|
22
|
+
|
23
|
+
class ConflictTest < Test::Unit::TestCase
|
24
|
+
include ConflictConstants
|
25
|
+
|
26
|
+
def test_conflict_eql
|
27
|
+
|
28
|
+
local = Event::new(CLIENT_ONE, "changed", CONTROLLER)
|
29
|
+
remote = Event::new(CLIENT_TWO, "changed", CONTROLLER)
|
30
|
+
|
31
|
+
conflict = Conflict::Conflict::new(local, remote)
|
32
|
+
|
33
|
+
assert conflict.eql?(Conflict::Conflict::new(local, remote))
|
34
|
+
assert ! conflict.eql?(Conflict::Conflict::new(local, Event::new(CLIENT_TWO, "deleted", CONTROLLER)))
|
35
|
+
assert ! conflict.eql?(Conflict::Conflict::new(local, Event::new("not" + CLIENT_TWO, "changed", CONTROLLER)))
|
36
|
+
assert ! conflict.eql?(Conflict::Conflict::new(Event::new(CLIENT_ONE, "deleted", CONTROLLER), remote))
|
37
|
+
assert ! conflict.eql?(Conflict::Conflict::new(Event::new("not" + CLIENT_ONE, "changed", CONTROLLER), remote))
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_event_eql
|
41
|
+
|
42
|
+
first = Event::new(CLIENT_ONE, "changed", CONTROLLER)
|
43
|
+
second = Event::new(CLIENT_ONE, "changed", CONTROLLER)
|
44
|
+
third = Event::new(CLIENT_TWO, "changed", CONTROLLER)
|
45
|
+
forth = Event::new(CLIENT_ONE, "changed", VIEW)
|
46
|
+
fifth = Event::new(CLIENT_ONE, "added", CONTROLLER)
|
47
|
+
|
48
|
+
assert first.eql?(second)
|
49
|
+
assert second.eql?(first)
|
50
|
+
|
51
|
+
assert ! first.eql?(third)
|
52
|
+
assert ! second.eql?(third)
|
53
|
+
|
54
|
+
assert ! first.eql?(forth)
|
55
|
+
assert ! second.eql?(forth)
|
56
|
+
|
57
|
+
assert ! first.eql?(fifth)
|
58
|
+
assert ! second.eql?(fifth)
|
59
|
+
end
|
60
|
+
end
|
data/test/event_test.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
require 'test/unit'
|
19
|
+
require 'conflict'
|
20
|
+
include Conflict
|
21
|
+
|
22
|
+
class EventTest < Test::Unit::TestCase
|
23
|
+
|
24
|
+
def test_expires_quick
|
25
|
+
|
26
|
+
created = Time.now
|
27
|
+
event = Event::new("dev", "changed", "resource", created, 0)
|
28
|
+
assert_equal created, event.expires
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_expires
|
33
|
+
|
34
|
+
created = Time.now
|
35
|
+
event = Event::new("dev", "changed", "resource", created, 1)
|
36
|
+
assert_equal created + 1, event.expires
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
require 'test/unit'
|
19
|
+
require 'conflict'
|
20
|
+
include Conflict
|
21
|
+
|
22
|
+
class NegativeTest < Test::Unit::TestCase
|
23
|
+
include ConflictConstants
|
24
|
+
|
25
|
+
def test_collision
|
26
|
+
|
27
|
+
local = Event::new(CLIENT_ONE, "changed", VIEW)
|
28
|
+
remote = Event::new(CLIENT_TWO, "changed", MODEL)
|
29
|
+
|
30
|
+
assert_raise { Conflict::Conflict::new nil, nil }
|
31
|
+
assert_raise { Conflict::Conflict::new local, nil }
|
32
|
+
assert_raise { Conflict::Conflict::new nil, local }
|
33
|
+
assert_raise { Conflict::Conflict::new remote, local } # they have different resources
|
34
|
+
assert_raise { Conflict::Conflict::new local, local }
|
35
|
+
assert_raise { Conflict::Conflict::new local, Event::new(CLIENT_ONE, "changed", VIEW) }
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_client
|
39
|
+
|
40
|
+
assert_raise { Client::new().resend }
|
41
|
+
assert_raise { Client::new().diff "", nil }
|
42
|
+
assert_raise { Client::new().diff "", "" }
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_diff_parser
|
46
|
+
|
47
|
+
parser = DiffParser::new({:url=>"http://foo.com", :path=>".", :ttl=>Conflict::TTL})
|
48
|
+
|
49
|
+
assert_raise { parser.parse "OK", nil }
|
50
|
+
assert_raise { parser.parse "OK", "" }
|
51
|
+
assert_raise { parser.parse nil, "OK" }
|
52
|
+
assert_raise { parser.parse "", "OK" }
|
53
|
+
assert_raise { DiffParser::new(nil) }
|
54
|
+
assert_raise { DiffParser::new({}) }
|
55
|
+
assert_raise { DiffParser::new({:url=>nil}) }
|
56
|
+
assert_raise { DiffParser::new({:url=>""}) }
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_info_parser
|
60
|
+
|
61
|
+
parser = InfoParser::new
|
62
|
+
|
63
|
+
assert_raise { parser.parse nil }
|
64
|
+
assert_raise { parser.parse "" }
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_database
|
68
|
+
|
69
|
+
db = DataBase::new
|
70
|
+
|
71
|
+
assert_raise { db.find_conflicts "", [] }
|
72
|
+
assert_raise { db.find_conflicts nil, [] }
|
73
|
+
assert_raise { db.find_conflicts "DEV", [Event::new("NOT_DEV", "added", "foo")] }
|
74
|
+
assert_raise { db.find_conflicts "DEV", nil }
|
75
|
+
assert_raise { db.find_conflicts "DEV", [Event::new("DEV", "added", "foo"), Event::new("DEV", "changed", "foo")] }
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_event
|
80
|
+
|
81
|
+
assert_raise { Event.new("", "", "OK") }
|
82
|
+
assert_raise { Event.new("", "added", "") }
|
83
|
+
assert_raise { Event.new("", "added", VIEW) }
|
84
|
+
assert_raise { Event.new(CLIENT_ONE, "", "") }
|
85
|
+
assert_raise { Event.new(CLIENT_ONE, "", VIEW) }
|
86
|
+
assert_raise { Event.new(CLIENT_ONE, "added", "") }
|
87
|
+
|
88
|
+
assert_raise { Event.new(nil, nil, "OK") }
|
89
|
+
assert_raise { Event.new(nil, "added", nil) }
|
90
|
+
assert_raise { Event.new(nil, "added", VIEW) }
|
91
|
+
assert_raise { Event.new(CLIENT_ONE, nil, nil) }
|
92
|
+
assert_raise { Event.new(CLIENT_ONE, nil, VIEW) }
|
93
|
+
assert_raise { Event.new(CLIENT_ONE, "added", nil) }
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
def assert_raise # replace this w/ built in assert_raise
|
98
|
+
|
99
|
+
begin
|
100
|
+
yield
|
101
|
+
assert false
|
102
|
+
rescue ConflictException
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|