conflict 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/conflict/core.rb +41 -17
- data/lib/conflict/domain.rb +13 -8
- data/lib/conflict/parsers.rb +58 -14
- data/test/common.rb +132 -132
- data/test/negative_test.rb +10 -9
- data/test/parser_test.rb +14 -14
- data/test/round_trip/expiration_test.rb +56 -56
- data/test/round_trip/happy_path_test.rb +105 -105
- data/test/round_trip/multi_diff_test.rb +67 -67
- data/test/round_trip/multiple_actions_test.rb +82 -82
- data/test/round_trip/negative_test.rb +109 -79
- data/test/round_trip/relative_path_test.rb +63 -63
- metadata +20 -19
data/test/negative_test.rb
CHANGED
@@ -43,17 +43,18 @@ class NegativeTest < Test::Unit::TestCase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_diff_parser
|
46
|
+
|
47
|
+
url = "http://foo.com"
|
48
|
+
path = "."
|
49
|
+
|
50
|
+
parser = DiffParser::new({:ttl=>Conflict::TTL})
|
46
51
|
|
47
|
-
|
48
|
-
|
49
|
-
assert_raise { parser.parse "OK",
|
50
|
-
assert_raise { parser.parse "
|
51
|
-
assert_raise { parser.parse nil, "OK" }
|
52
|
-
assert_raise { parser.parse "", "OK" }
|
52
|
+
assert_raise { parser.parse "OK", nil, url, path }
|
53
|
+
assert_raise { parser.parse "OK", "", url, path }
|
54
|
+
assert_raise { parser.parse nil, "OK", url, path }
|
55
|
+
assert_raise { parser.parse "", "OK", url, path }
|
53
56
|
assert_raise { DiffParser::new(nil) }
|
54
57
|
assert_raise { DiffParser::new({}) }
|
55
|
-
assert_raise { DiffParser::new({:url=>nil}) }
|
56
|
-
assert_raise { DiffParser::new({:url=>""}) }
|
57
58
|
end
|
58
59
|
|
59
60
|
def test_info_parser
|
@@ -104,4 +105,4 @@ class NegativeTest < Test::Unit::TestCase
|
|
104
105
|
|
105
106
|
end
|
106
107
|
|
107
|
-
end
|
108
|
+
end
|
data/test/parser_test.rb
CHANGED
@@ -22,7 +22,7 @@ require File.dirname(__FILE__) + '/common.rb'
|
|
22
22
|
|
23
23
|
class ParserTest < Test::Unit::TestCase
|
24
24
|
include ConflictConstants
|
25
|
-
COMMON_PROPERTIES = {:
|
25
|
+
COMMON_PROPERTIES = {:ttl=>Conflict::TTL}
|
26
26
|
|
27
27
|
def test_info_parser
|
28
28
|
|
@@ -39,15 +39,15 @@ class ParserTest < Test::Unit::TestCase
|
|
39
39
|
def test_diff_parser_with_info
|
40
40
|
|
41
41
|
diff = File::new(STOMP_1_DIFF_PATH).to_s
|
42
|
-
parser = DiffParser::new(
|
43
|
-
events = parser.parse diff, CLIENT_ONE
|
42
|
+
parser = DiffParser::new(COMMON_PROPERTIES)
|
43
|
+
events = parser.parse diff, CLIENT_ONE, STOMP_1_URL, "."
|
44
44
|
|
45
45
|
assert_equal 1, events.size
|
46
46
|
first_event = events[0]
|
47
47
|
|
48
48
|
diff = File::new(STOMP_2_DIFF_PATH).to_s
|
49
|
-
parser = DiffParser::new(
|
50
|
-
events = parser.parse diff, CLIENT_ONE
|
49
|
+
parser = DiffParser::new(COMMON_PROPERTIES)
|
50
|
+
events = parser.parse diff, CLIENT_ONE, STOMP_2_URL, "."
|
51
51
|
|
52
52
|
assert_equal 1, events.size
|
53
53
|
second_event = events[0]
|
@@ -57,9 +57,9 @@ class ParserTest < Test::Unit::TestCase
|
|
57
57
|
def test_diff_parser_two_changes_same_file
|
58
58
|
|
59
59
|
url = 'https://svn.apache.org/repos/asf/myfaces/core/trunk/api/src/main/java/javax'
|
60
|
-
parser = DiffParser::new(
|
60
|
+
parser = DiffParser::new(COMMON_PROPERTIES)
|
61
61
|
diff = File.new(DATA_DIR + 'apache_myfaces.diff.txt').to_s
|
62
|
-
events = parser.parse diff, CLIENT_ONE
|
62
|
+
events = parser.parse diff, CLIENT_ONE, url, "."
|
63
63
|
|
64
64
|
assert_equal 1, events.size
|
65
65
|
assert events[0].eql?(Event::new(CLIENT_ONE, "changed", url + "/FacesServlet.java"))
|
@@ -68,9 +68,9 @@ class ParserTest < Test::Unit::TestCase
|
|
68
68
|
def test_diff_parser_deleted_added_changed_in_same_patch
|
69
69
|
|
70
70
|
url = 'http://activemessaging.googlecode.com/svn/trunk/plugins/activemessaging/lib'
|
71
|
-
parser = DiffParser::new(
|
71
|
+
parser = DiffParser::new(COMMON_PROPERTIES)
|
72
72
|
diff = File.new(DATA_DIR + 'a13g.diff.txt').to_s
|
73
|
-
events = parser.parse diff, CLIENT_ONE
|
73
|
+
events = parser.parse diff, CLIENT_ONE, url, "."
|
74
74
|
|
75
75
|
assert_equal 3, events.size
|
76
76
|
assert events[0].eql?(Event::new(CLIENT_ONE, "deleted", url + "/asqs.rb"))
|
@@ -81,18 +81,18 @@ class ParserTest < Test::Unit::TestCase
|
|
81
81
|
def test_diff_parser_deleted_added_changed_in_different_files
|
82
82
|
|
83
83
|
resource = CONFLICT_URL + '/test_data.txt'
|
84
|
-
parser = DiffParser::new(
|
84
|
+
parser = DiffParser::new(COMMON_PROPERTIES)
|
85
85
|
added = File::new(DATA_DIR + "three/added.diff.txt").to_s
|
86
86
|
deleted = File::new(DATA_DIR + "three/deleted.diff.txt").to_s
|
87
87
|
changed = File::new(DATA_DIR + "three/changed.diff.txt").to_s
|
88
88
|
|
89
|
-
events = parser.parse added, CLIENT_ONE
|
89
|
+
events = parser.parse added, CLIENT_ONE, CONFLICT_URL, "."
|
90
90
|
assert events[0].eql?(Event::new(CLIENT_ONE, "added", resource))
|
91
91
|
|
92
|
-
events = parser.parse deleted, CLIENT_ONE
|
92
|
+
events = parser.parse deleted, CLIENT_ONE, CONFLICT_URL, "."
|
93
93
|
assert events[0].eql?(Event::new(CLIENT_ONE, "deleted", resource))
|
94
94
|
|
95
|
-
events = parser.parse changed, CLIENT_ONE
|
95
|
+
events = parser.parse changed, CLIENT_ONE, CONFLICT_URL, "."
|
96
96
|
assert events[0].eql?(Event::new(CLIENT_ONE, "changed", resource))
|
97
97
|
end
|
98
|
-
end
|
98
|
+
end
|
@@ -1,56 +1,56 @@
|
|
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 RoundTripExpirationTest < Test::Unit::TestCase
|
23
|
-
include ConflictConstants
|
24
|
-
|
25
|
-
def test_expiration
|
26
|
-
|
27
|
-
diff = File.new("./test/data/rails.diff.txt").to_s
|
28
|
-
info = File.new("./test/data/rails.info.txt").to_s
|
29
|
-
ttl = 0
|
30
|
-
|
31
|
-
cfg = {:port=>86}
|
32
|
-
thread = Thread.new do
|
33
|
-
Server::new(cfg.merge({:ttl=>ttl})).start
|
34
|
-
end
|
35
|
-
|
36
|
-
client_one = Client::new({:id=>CLIENT_ONE}.merge(cfg))
|
37
|
-
client_two = Client::new({:id=>CLIENT_TWO}.merge(cfg))
|
38
|
-
|
39
|
-
conflicts = client_one.diff diff, info
|
40
|
-
assert_equal 0, conflicts.size
|
41
|
-
assert_equal 1, client_one.count
|
42
|
-
|
43
|
-
sleep(ttl + 1) # let it expire
|
44
|
-
|
45
|
-
assert_equal 1, client_one.count, "server will not dump the event until next request"
|
46
|
-
|
47
|
-
conflicts = client_two.diff diff, info
|
48
|
-
assert_equal 0, conflicts.size, "should not conflict w/ expired event"
|
49
|
-
assert_equal 1, client_one.count, "expired event should be gone"
|
50
|
-
|
51
|
-
thread.kill
|
52
|
-
thread.join(5)
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
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 RoundTripExpirationTest < Test::Unit::TestCase
|
23
|
+
include ConflictConstants
|
24
|
+
|
25
|
+
def test_expiration
|
26
|
+
|
27
|
+
diff = File.new("./test/data/rails.diff.txt").to_s
|
28
|
+
info = File.new("./test/data/rails.info.txt").to_s
|
29
|
+
ttl = 0
|
30
|
+
|
31
|
+
cfg = {:port=>86}
|
32
|
+
thread = Thread.new do
|
33
|
+
Server::new(cfg.merge({:ttl=>ttl})).start
|
34
|
+
end
|
35
|
+
|
36
|
+
client_one = Client::new({:id=>CLIENT_ONE}.merge(cfg))
|
37
|
+
client_two = Client::new({:id=>CLIENT_TWO}.merge(cfg))
|
38
|
+
|
39
|
+
conflicts = client_one.diff diff, info
|
40
|
+
assert_equal 0, conflicts.size
|
41
|
+
assert_equal 1, client_one.count
|
42
|
+
|
43
|
+
sleep(ttl + 1) # let it expire
|
44
|
+
|
45
|
+
assert_equal 1, client_one.count, "server will not dump the event until next request"
|
46
|
+
|
47
|
+
conflicts = client_two.diff diff, info
|
48
|
+
assert_equal 0, conflicts.size, "should not conflict w/ expired event"
|
49
|
+
assert_equal 1, client_one.count, "expired event should be gone"
|
50
|
+
|
51
|
+
thread.kill
|
52
|
+
thread.join(5)
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -1,105 +1,105 @@
|
|
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 RoundTripTest < Test::Unit::TestCase
|
23
|
-
include ConflictConstants
|
24
|
-
RESOURCE = "http://svn.rubyonrails.org/rails/trunk/release.rb"
|
25
|
-
|
26
|
-
def setup
|
27
|
-
@diff = File.new("./test/data/rails.diff.txt").to_s
|
28
|
-
@info = File.new("./test/data/rails.info.txt").to_s
|
29
|
-
|
30
|
-
@first = Event::new(CLIENT_ONE, "changed", RESOURCE)
|
31
|
-
@second = Event::new(CLIENT_TWO, "changed", RESOURCE)
|
32
|
-
@third = Event::new(CLIENT_THREE, "changed", RESOURCE)
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_happy_path_conflict_accumalation
|
37
|
-
happy_path_conflict_accumalation nil
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_happy_path_conflict_accumalation_with_alternate_port_and_url
|
41
|
-
happy_path_conflict_accumalation 81
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
def happy_path_conflict_accumalation port
|
46
|
-
|
47
|
-
cfg = {:port=>port}
|
48
|
-
@thread = Thread.new do
|
49
|
-
Server::new(cfg).start
|
50
|
-
end
|
51
|
-
|
52
|
-
client_one = Client::new({:id=>CLIENT_ONE}.merge(cfg))
|
53
|
-
client_two = Client::new({:id=>CLIENT_TWO}.merge(cfg))
|
54
|
-
client_three = Client::new({:id=>CLIENT_THREE}.merge(cfg))
|
55
|
-
|
56
|
-
response = client_one.diff @diff, @info
|
57
|
-
assert [].eql?(response)
|
58
|
-
assert_equal 1, client_one.count
|
59
|
-
|
60
|
-
response = client_two.diff(@diff, @info)
|
61
|
-
assert [Conflict::Conflict.new(@second, @first)].eql?(response)
|
62
|
-
assert_equal 2, client_one.count
|
63
|
-
|
64
|
-
response = client_three.diff @diff, @info
|
65
|
-
assert [Conflict::Conflict.new(@third, @first), Conflict::Conflict::new(@third, @second)].eql?(response)
|
66
|
-
assert_equal 3, client_one.count
|
67
|
-
|
68
|
-
response = client_one.resend
|
69
|
-
assert [Conflict::Conflict.new(@first, @second), Conflict::Conflict::new(@first, @third)].eql?(response)
|
70
|
-
assert_equal 3, client_one.count
|
71
|
-
|
72
|
-
response = client_two.resend
|
73
|
-
assert [Conflict::Conflict.new(@second, @
|
74
|
-
assert_equal 3, client_one.count
|
75
|
-
|
76
|
-
response = client_three.revert @info
|
77
|
-
assert [].eql?(response)
|
78
|
-
assert_equal 2, client_one.count
|
79
|
-
|
80
|
-
response = client_two.resend
|
81
|
-
assert [Conflict::Conflict.new(@second, @first)].eql?(response)
|
82
|
-
assert_equal 2, client_one.count
|
83
|
-
|
84
|
-
response = client_one.resend
|
85
|
-
assert [Conflict::Conflict.new(@first, @second)].eql?(response)
|
86
|
-
assert_equal 2, client_one.count
|
87
|
-
|
88
|
-
response = client_two.revert @info
|
89
|
-
assert [].eql?(response)
|
90
|
-
assert_equal 1, client_one.count
|
91
|
-
|
92
|
-
response = client_one.resend
|
93
|
-
assert [].eql?(response)
|
94
|
-
assert_equal 1, client_one.count
|
95
|
-
|
96
|
-
response = client_one.revert @info
|
97
|
-
assert [].eql?(response)
|
98
|
-
assert_equal 0, client_one.count
|
99
|
-
|
100
|
-
@thread.kill
|
101
|
-
@thread.join(5)
|
102
|
-
|
103
|
-
end
|
104
|
-
|
105
|
-
end
|
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 RoundTripTest < Test::Unit::TestCase
|
23
|
+
include ConflictConstants
|
24
|
+
RESOURCE = "http://svn.rubyonrails.org/rails/trunk/release.rb"
|
25
|
+
|
26
|
+
def setup
|
27
|
+
@diff = File.new("./test/data/rails.diff.txt").to_s
|
28
|
+
@info = File.new("./test/data/rails.info.txt").to_s
|
29
|
+
|
30
|
+
@first = Event::new(CLIENT_ONE, "changed", RESOURCE)
|
31
|
+
@second = Event::new(CLIENT_TWO, "changed", RESOURCE)
|
32
|
+
@third = Event::new(CLIENT_THREE, "changed", RESOURCE)
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_happy_path_conflict_accumalation
|
37
|
+
happy_path_conflict_accumalation nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_happy_path_conflict_accumalation_with_alternate_port_and_url
|
41
|
+
happy_path_conflict_accumalation 81
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
def happy_path_conflict_accumalation port
|
46
|
+
|
47
|
+
cfg = {:port=>port}
|
48
|
+
@thread = Thread.new do
|
49
|
+
Server::new(cfg).start
|
50
|
+
end
|
51
|
+
|
52
|
+
client_one = Client::new({:id=>CLIENT_ONE}.merge(cfg))
|
53
|
+
client_two = Client::new({:id=>CLIENT_TWO}.merge(cfg))
|
54
|
+
client_three = Client::new({:id=>CLIENT_THREE}.merge(cfg))
|
55
|
+
|
56
|
+
response = client_one.diff @diff, @info
|
57
|
+
assert [].eql?(response)
|
58
|
+
assert_equal 1, client_one.count
|
59
|
+
|
60
|
+
response = client_two.diff(@diff, @info)
|
61
|
+
assert [Conflict::Conflict.new(@second, @first)].eql?(response)
|
62
|
+
assert_equal 2, client_one.count
|
63
|
+
|
64
|
+
response = client_three.diff @diff, @info
|
65
|
+
assert [Conflict::Conflict.new(@third, @first), Conflict::Conflict::new(@third, @second)].eql?(response)
|
66
|
+
assert_equal 3, client_one.count
|
67
|
+
|
68
|
+
response = client_one.resend
|
69
|
+
assert [Conflict::Conflict.new(@first, @second), Conflict::Conflict::new(@first, @third)].eql?(response)
|
70
|
+
assert_equal 3, client_one.count
|
71
|
+
|
72
|
+
response = client_two.resend
|
73
|
+
assert [Conflict::Conflict.new(@second, @first), Conflict::Conflict::new(@second, @third)].eql?(response)
|
74
|
+
assert_equal 3, client_one.count
|
75
|
+
|
76
|
+
response = client_three.revert @info
|
77
|
+
assert [].eql?(response)
|
78
|
+
assert_equal 2, client_one.count
|
79
|
+
|
80
|
+
response = client_two.resend
|
81
|
+
assert [Conflict::Conflict.new(@second, @first)].eql?(response)
|
82
|
+
assert_equal 2, client_one.count
|
83
|
+
|
84
|
+
response = client_one.resend
|
85
|
+
assert [Conflict::Conflict.new(@first, @second)].eql?(response)
|
86
|
+
assert_equal 2, client_one.count
|
87
|
+
|
88
|
+
response = client_two.revert @info
|
89
|
+
assert [].eql?(response)
|
90
|
+
assert_equal 1, client_one.count
|
91
|
+
|
92
|
+
response = client_one.resend
|
93
|
+
assert [].eql?(response)
|
94
|
+
assert_equal 1, client_one.count
|
95
|
+
|
96
|
+
response = client_one.revert @info
|
97
|
+
assert [].eql?(response)
|
98
|
+
assert_equal 0, client_one.count
|
99
|
+
|
100
|
+
@thread.kill
|
101
|
+
@thread.join(5)
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
@@ -1,67 +1,67 @@
|
|
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 RoundTripMultiDiffTest < Test::Unit::TestCase
|
23
|
-
include ConflictConstants
|
24
|
-
|
25
|
-
def test_dev_with_no_conflicts
|
26
|
-
|
27
|
-
@cfg = {:port=>85}
|
28
|
-
@thread = Thread.new do
|
29
|
-
Server::new(@cfg).start
|
30
|
-
end
|
31
|
-
|
32
|
-
rails_diff = File.new("./test/data/rails.diff.txt").to_s
|
33
|
-
rails_info = File.new("./test/data/rails.info.txt").to_s
|
34
|
-
stomp_one_diff = File::new(STOMP_1_DIFF_PATH).to_s
|
35
|
-
stomp_one_info = File.new(STOMP_1_INFO_PATH).to_s
|
36
|
-
stomp_two_diff = File::new(STOMP_2_DIFF_PATH).to_s
|
37
|
-
stomp_two_info = File.new(STOMP_2_INFO_PATH).to_s
|
38
|
-
|
39
|
-
client_one = Client::new({:id=>CLIENT_ONE}.merge(@cfg))
|
40
|
-
client_two = Client::new({:id=>CLIENT_TWO}.merge(@cfg))
|
41
|
-
client_three = Client::new({:id=>CLIENT_THREE}.merge(@cfg))
|
42
|
-
|
43
|
-
response = client_one.multi_diff [rails_diff, stomp_one_diff], [rails_info, stomp_one_info]
|
44
|
-
assert_equal [], response
|
45
|
-
|
46
|
-
response = client_one.multi_diff [stomp_two_diff], [stomp_two_info]
|
47
|
-
assert_equal [], response
|
48
|
-
|
49
|
-
response = client_one.multi_diff [stomp_one_diff], [stomp_one_info]
|
50
|
-
assert_equal [], response
|
51
|
-
|
52
|
-
response = client_three.multi_diff [rails_diff], [rails_info]
|
53
|
-
assert_equal [], response
|
54
|
-
|
55
|
-
client_one.revert rails_info
|
56
|
-
client_two.revert rails_info
|
57
|
-
client_three.revert rails_info
|
58
|
-
@thread.kill
|
59
|
-
@thread.join(5)
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_dev_with_conflicts
|
64
|
-
# this needs to get done
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
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 RoundTripMultiDiffTest < Test::Unit::TestCase
|
23
|
+
include ConflictConstants
|
24
|
+
|
25
|
+
def test_dev_with_no_conflicts
|
26
|
+
|
27
|
+
@cfg = {:port=>85}
|
28
|
+
@thread = Thread.new do
|
29
|
+
Server::new(@cfg).start
|
30
|
+
end
|
31
|
+
|
32
|
+
rails_diff = File.new("./test/data/rails.diff.txt").to_s
|
33
|
+
rails_info = File.new("./test/data/rails.info.txt").to_s
|
34
|
+
stomp_one_diff = File::new(STOMP_1_DIFF_PATH).to_s
|
35
|
+
stomp_one_info = File.new(STOMP_1_INFO_PATH).to_s
|
36
|
+
stomp_two_diff = File::new(STOMP_2_DIFF_PATH).to_s
|
37
|
+
stomp_two_info = File.new(STOMP_2_INFO_PATH).to_s
|
38
|
+
|
39
|
+
client_one = Client::new({:id=>CLIENT_ONE}.merge(@cfg))
|
40
|
+
client_two = Client::new({:id=>CLIENT_TWO}.merge(@cfg))
|
41
|
+
client_three = Client::new({:id=>CLIENT_THREE}.merge(@cfg))
|
42
|
+
|
43
|
+
response = client_one.multi_diff [rails_diff, stomp_one_diff], [rails_info, stomp_one_info]
|
44
|
+
assert_equal [], response
|
45
|
+
|
46
|
+
response = client_one.multi_diff [stomp_two_diff], [stomp_two_info]
|
47
|
+
assert_equal [], response
|
48
|
+
|
49
|
+
response = client_one.multi_diff [stomp_one_diff], [stomp_one_info]
|
50
|
+
assert_equal [], response
|
51
|
+
|
52
|
+
response = client_three.multi_diff [rails_diff], [rails_info]
|
53
|
+
assert_equal [], response
|
54
|
+
|
55
|
+
client_one.revert rails_info
|
56
|
+
client_two.revert rails_info
|
57
|
+
client_three.revert rails_info
|
58
|
+
@thread.kill
|
59
|
+
@thread.join(5)
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_dev_with_conflicts
|
64
|
+
# this needs to get done
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|