rscm-accurev 0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/Rakefile +7 -76
  2. data/TODO +3 -17
  3. data/lib/rscm/accurev.rb +1 -13
  4. data/lib/rscm/scm/accurev/#command.rb# +95 -0
  5. data/lib/rscm/scm/accurev/api.rb +77 -258
  6. data/lib/rscm/scm/accurev/command.rb +40 -97
  7. data/lib/rscm/scm/accurev/filterio.rb +4 -6
  8. data/lib/rscm/scm/accurev/xml.rb +11 -199
  9. data/test/t_command.rb +11 -59
  10. data/test/t_load.rb +0 -1
  11. data/test/t_scrubio.rb +6 -1
  12. data/{apitest.rb → test.rb} +0 -1
  13. data/{test/eg/update-newwksp.xml → testing.log} +138 -0
  14. metadata +15 -57
  15. data/STATUS +0 -63
  16. data/bumprelease.sh +0 -13
  17. data/lib/rscm/scm/accurev/api.rb.mine +0 -382
  18. data/lib/rscm/scm/accurev/api.rb.r263 +0 -364
  19. data/lib/rscm/scm/accurev/api.rb.r265 +0 -393
  20. data/lib/rscm/scm/accurev/exception.rb +0 -38
  21. data/lib/test/unit/ui/xml/testrunner.rb +0 -165
  22. data/lib/test/unit/ui/xml/xmltestrunner.xslt +0 -79
  23. data/test/coverage/analyzer.rb +0 -127
  24. data/test/coverage/c_loader.rb +0 -34
  25. data/test/coverage/cover.rb +0 -91
  26. data/test/coverage/coverage_loader.rb +0 -21
  27. data/test/coverage/coveragetask.rb +0 -38
  28. data/test/coverage/index_tmpl.html +0 -42
  29. data/test/coverage/template.html +0 -36
  30. data/test/eg/ac-files.xml +0 -172
  31. data/test/eg/ac-pop.txt +0 -195
  32. data/test/eg/files-various-states.xml +0 -188
  33. data/test/eg/hist-oneweek-all.xml +0 -1483
  34. data/test/eg/hist-oneweek-external.xml +0 -246
  35. data/test/eg/hist-oneweek-promotes.xml +0 -1092
  36. data/test/eg/info.txt +0 -14
  37. data/test/eg/stat-a-various.xml +0 -1789
  38. data/test/eg/stat-m.xml +0 -13
  39. data/test/eg/stat-overlap.xml +0 -13
  40. data/test/eg/stat-x.xml +0 -20
  41. data/test/eg/update-i-mods-and-updates-and-overlap.xml +0 -73
  42. data/test/eg/update-i-nochanges.xml +0 -8
  43. data/test/eg/update-i-stale.xml +0 -0
  44. data/test/eg/update-i-updates.xml +0 -125
  45. data/test/eg/update-nochanges.xml +0 -7
  46. data/test/eg/update-stale.xml +0 -12
  47. data/test/eg/update-updates.xml +0 -147
  48. data/test/t_api.rb +0 -163
  49. data/test/t_xmlmapper.rb +0 -75
data/test/eg/stat-m.xml DELETED
@@ -1,13 +0,0 @@
1
- <AcResponse
2
- Command="stat"
3
- Directory="/home/gfast/dev/orbitz-host-gt3-0-impl">
4
- <element
5
- location="./conf/gt3/GT3Beans.xml"
6
- dir="no"
7
- id="256"
8
- elemType="text"
9
- Virtual="7/3"
10
- namedVersion="orbitz-host-gt3-0-impl/3"
11
- Real="8/3"
12
- status="(modified)"/>
13
- </AcResponse>
@@ -1,13 +0,0 @@
1
- <AcResponse
2
- Command="stat"
3
- Directory="/home/gfast/dev/orbitz-host-gt3-0-impl">
4
- <element
5
- location="./build/buildfiles/install.xml"
6
- dir="no"
7
- id="46"
8
- elemType="text"
9
- Virtual="7/3"
10
- namedVersion="orbitz-host-gt3-0-impl/3"
11
- Real="8/4"
12
- status="(overlap)(modified)"/>
13
- </AcResponse>
data/test/eg/stat-x.xml DELETED
@@ -1,20 +0,0 @@
1
- <AcResponse
2
- Command="stat"
3
- Directory="/home/gfast/dev/orbitz-host-gt3-0-impl">
4
- <element
5
- location="./src/java/com/orbitz/misc"
6
- dir="yes"
7
- status="(external)"/>
8
- <element
9
- location="./src/java/com/orbitz/misc/ClassToDot.java"
10
- dir="no"
11
- status="(external)"/>
12
- <element
13
- location="./gt3soap.dot"
14
- dir="no"
15
- status="(external)"/>
16
- <element
17
- location="./gt3soap.ps"
18
- dir="no"
19
- status="(external)"/>
20
- </AcResponse>
@@ -1,73 +0,0 @@
1
- <acResponse
2
- command="update"Scanning entire workspace for files touched since last scan - ok
3
- ok
4
- >
5
- <message
6
- error="true">
7
- Some of the elements in your workspace have been modified
8
- and are not in your default group. Use &apos;accurev stat -n&apos; to
9
- get a list of these files. Then resolve all modifications
10
- with anchor, keep, or purge before trying update again.
11
- </message>
12
- <progress
13
- phase="Calculating changes"
14
- increment="100"/>
15
- <progress
16
- phase="results"
17
- number="11"/>
18
- <message>Would replace content of &quot;build-deps.xml&quot; .
19
- </message>
20
- <element
21
- location="build-deps.xml"/>
22
- <checkpoint/>
23
- <message>Would replace content of &quot;build/buildfiles/install.xml&quot; .
24
- </message>
25
- <element
26
- location="build/buildfiles/install.xml"/>
27
- <checkpoint/>
28
- <message>Would replace content of &quot;conf/gt3/gt3.development.properties&quot; .
29
- </message>
30
- <element
31
- location="conf/gt3/gt3.development.properties"/>
32
- <checkpoint/>
33
- <message>Would replace content of &quot;conf/gt3/gt3.server.properties&quot; .
34
- </message>
35
- <element
36
- location="conf/gt3/gt3.server.properties"/>
37
- <checkpoint/>
38
- <message>Would replace content of &quot;src/java/com/orbitz/dc/host/gt3/util/GT3Connection.java&quot; .
39
- </message>
40
- <element
41
- location="src/java/com/orbitz/dc/host/gt3/util/GT3Connection.java"/>
42
- <checkpoint/>
43
- <message>Would replace content of &quot;conf/gt3/OrbitzBeans.xml&quot; .
44
- </message>
45
- <element
46
- location="conf/gt3/OrbitzBeans.xml"/>
47
- <checkpoint/>
48
- <message>Would replace content of &quot;src/java/com/orbitz/dc/host/otxn/HcSearchTxn.java&quot; .
49
- </message>
50
- <element
51
- location="src/java/com/orbitz/dc/host/otxn/HcSearchTxn.java"/>
52
- <checkpoint/>
53
- <message>Would replace content of &quot;conf/gt3/GT3Beans.xml&quot; .
54
- </message>
55
- <element
56
- location="conf/gt3/GT3Beans.xml"/>
57
- <checkpoint/>
58
- <message>Would replace content of &quot;src/java/com/orbitz/dc/host/gt3/adaptor/SearchRequestAdaptor.java&quot; .
59
- </message>
60
- <element
61
- location="src/java/com/orbitz/dc/host/gt3/adaptor/SearchRequestAdaptor.java"/>
62
- <checkpoint/>
63
- <message>Would replace content of &quot;src/java/com/orbitz/dc/host/gt3/adaptor/SearchResponseAdaptor.java&quot; .
64
- </message>
65
- <element
66
- location="src/java/com/orbitz/dc/host/gt3/adaptor/SearchResponseAdaptor.java"/>
67
- <checkpoint/>
68
- <message>Would replace content of &quot;src/java/com/orbitz/dc/host/otxn/HcBookReservationTxn.java&quot; .
69
- </message>
70
- <element
71
- location="src/java/com/orbitz/dc/host/otxn/HcBookReservationTxn.java"/>
72
- <checkpoint/>
73
- </acResponse>
@@ -1,8 +0,0 @@
1
- <acResponse
2
- command="update"Scanning entire workspace for files touched since last scan - ok
3
- >
4
- <progress
5
- phase="Calculating changes"
6
- increment="100"/>
7
- <message>Transaction high-water mark would be updated</message>
8
- </acResponse>
File without changes
@@ -1,125 +0,0 @@
1
- <acResponse
2
- command="update"Scanning entire workspace for files touched since last scan - ok
3
- >
4
- <progress
5
- phase="Calculating changes"
6
- increment="100"/>
7
- <progress
8
- phase="results"
9
- number="23"/>
10
- <message>Would remove &quot;src/java/com/orbitz/dc/service/hc/HcItinerary.java&quot; .
11
- </message>
12
- <element
13
- location="src/java/com/orbitz/dc/service/hc/HcItinerary.java"/>
14
- <checkpoint/>
15
- <message>Would replace content of &quot;src/java/com/orbitz/dc/core/Pricing.java&quot; .
16
- </message>
17
- <element
18
- location="src/java/com/orbitz/dc/core/Pricing.java"/>
19
- <checkpoint/>
20
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcSearchRequest.java&quot; .
21
- </message>
22
- <element
23
- location="src/java/com/orbitz/dc/service/hc/HcSearchRequest.java"/>
24
- <checkpoint/>
25
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcCreateReservationRequest.java&quot; .
26
- </message>
27
- <element
28
- location="src/java/com/orbitz/dc/service/hc/HcCreateReservationRequest.java"/>
29
- <checkpoint/>
30
- <message>Would replace content of &quot;src/java/com/orbitz/dc/core/HcJourney.java&quot; .
31
- </message>
32
- <element
33
- location="src/java/com/orbitz/dc/core/HcJourney.java"/>
34
- <checkpoint/>
35
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcCreateReservationResponse.java&quot; .
36
- </message>
37
- <element
38
- location="src/java/com/orbitz/dc/service/hc/HcCreateReservationResponse.java"/>
39
- <checkpoint/>
40
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcCancelReservationRequest.java&quot; .
41
- </message>
42
- <element
43
- location="src/java/com/orbitz/dc/service/hc/HcCancelReservationRequest.java"/>
44
- <checkpoint/>
45
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcCancelReservationResponse.java&quot; .
46
- </message>
47
- <element
48
- location="src/java/com/orbitz/dc/service/hc/HcCancelReservationResponse.java"/>
49
- <checkpoint/>
50
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcModifyReservationResponse.java&quot; .
51
- </message>
52
- <element
53
- location="src/java/com/orbitz/dc/service/hc/HcModifyReservationResponse.java"/>
54
- <checkpoint/>
55
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcModifyReservationRequest.java&quot; .
56
- </message>
57
- <element
58
- location="src/java/com/orbitz/dc/service/hc/HcModifyReservationRequest.java"/>
59
- <checkpoint/>
60
- <message>Would replace content of &quot;src/java/com/orbitz/dc/core/RateInfo.java&quot; .
61
- </message>
62
- <element
63
- location="src/java/com/orbitz/dc/core/RateInfo.java"/>
64
- <checkpoint/>
65
- <message>Would replace content of &quot;src/java/com/orbitz/dc/core/VariableRateInfo.java&quot; .
66
- </message>
67
- <element
68
- location="src/java/com/orbitz/dc/core/VariableRateInfo.java"/>
69
- <checkpoint/>
70
- <message>Would replace content of &quot;src/java/com/orbitz/dc/core/RATE_CATEGORY.java&quot; .
71
- </message>
72
- <element
73
- location="src/java/com/orbitz/dc/core/RATE_CATEGORY.java"/>
74
- <checkpoint/>
75
- <message>Would replace content of &quot;src/java/com/orbitz/dc/core/RATE_COVERAGE.java&quot; .
76
- </message>
77
- <element
78
- location="src/java/com/orbitz/dc/core/RATE_COVERAGE.java"/>
79
- <checkpoint/>
80
- <message>Would replace content of &quot;src/java/com/orbitz/dc/core/FlatRateInfo.java&quot; .
81
- </message>
82
- <element
83
- location="src/java/com/orbitz/dc/core/FlatRateInfo.java"/>
84
- <checkpoint/>
85
- <message>Would replace content of &quot;src/java/com/orbitz/dc/core/HcItinerary.java&quot; .
86
- </message>
87
- <element
88
- location="src/java/com/orbitz/dc/core/HcItinerary.java"/>
89
- <checkpoint/>
90
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcSearch.java&quot; .
91
- </message>
92
- <element
93
- location="src/java/com/orbitz/dc/service/hc/HcSearch.java"/>
94
- <checkpoint/>
95
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcCreateReservation.java&quot; .
96
- </message>
97
- <element
98
- location="src/java/com/orbitz/dc/service/hc/HcCreateReservation.java"/>
99
- <checkpoint/>
100
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcModifyReservation.java&quot; .
101
- </message>
102
- <element
103
- location="src/java/com/orbitz/dc/service/hc/HcModifyReservation.java"/>
104
- <checkpoint/>
105
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcCancelReservation.java&quot; .
106
- </message>
107
- <element
108
- location="src/java/com/orbitz/dc/service/hc/HcCancelReservation.java"/>
109
- <checkpoint/>
110
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcRetrieveItinerary.java&quot; .
111
- </message>
112
- <element
113
- location="src/java/com/orbitz/dc/service/hc/HcRetrieveItinerary.java"/>
114
- <checkpoint/>
115
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcRetrieveItineraryRequest.java&quot; .
116
- </message>
117
- <element
118
- location="src/java/com/orbitz/dc/service/hc/HcRetrieveItineraryRequest.java"/>
119
- <checkpoint/>
120
- <message>Would replace content of &quot;src/java/com/orbitz/dc/service/hc/HcRetrieveItineraryResponse.java&quot; .
121
- </message>
122
- <element
123
- location="src/java/com/orbitz/dc/service/hc/HcRetrieveItineraryResponse.java"/>
124
- <checkpoint/>
125
- </acResponse>
@@ -1,7 +0,0 @@
1
- <acResponse
2
- command="update"Scanning entire workspace for files touched since last scan - ok
3
- >
4
- <progress
5
- phase="Calculating changes"
6
- increment="100"/>
7
- </acResponse>
@@ -1,12 +0,0 @@
1
- <acResponse
2
- command="update"Scanning entire workspace for files touched since last scan - ok
3
- ok
4
- >
5
- <message
6
- error="true">
7
- Some of the elements in your workspace have been modified
8
- and are not in your default group. Use &apos;accurev stat -n&apos; to
9
- get a list of these files. Then resolve all modifications
10
- with anchor, keep, or purge before trying update again.
11
- </message>
12
- </acResponse>
@@ -1,147 +0,0 @@
1
- <acResponse
2
- command="update"Scanning entire workspace for files touched since last scan - ok
3
- >
4
- <progress
5
- phase="Calculating changes"
6
- increment="100"/>
7
- <progress
8
- phase="results"
9
- number="23"/>
10
- <message>Removing &quot;src/java/com/orbitz/dc/service/hc/HcItinerary.java&quot; .
11
- </message>
12
- <element
13
- location="src/java/com/orbitz/dc/service/hc/HcItinerary.java"/>
14
- <checkpoint/>
15
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/core/Pricing.java&quot; - ok
16
- </message>
17
- <element
18
- location="src/java/com/orbitz/dc/core/Pricing.java"
19
- size="1398"/>
20
- <checkpoint/>
21
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcSearchRequest.java&quot; - ok
22
- </message>
23
- <element
24
- location="src/java/com/orbitz/dc/service/hc/HcSearchRequest.java"
25
- size="793"/>
26
- <checkpoint/>
27
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcCreateReservationRequest.java&quot; - ok
28
- </message>
29
- <element
30
- location="src/java/com/orbitz/dc/service/hc/HcCreateReservationRequest.java"
31
- size="1712"/>
32
- <checkpoint/>
33
- <message>Content (3 K) of &quot;src/java/com/orbitz/dc/core/HcJourney.java&quot; - ok
34
- </message>
35
- <element
36
- location="src/java/com/orbitz/dc/core/HcJourney.java"
37
- size="3846"/>
38
- <checkpoint/>
39
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcCreateReservationResponse.java&quot; - ok
40
- </message>
41
- <element
42
- location="src/java/com/orbitz/dc/service/hc/HcCreateReservationResponse.java"
43
- size="849"/>
44
- <checkpoint/>
45
- <message>Content (3 K) of &quot;src/java/com/orbitz/dc/service/hc/HcCancelReservationRequest.java&quot; - ok
46
- </message>
47
- <element
48
- location="src/java/com/orbitz/dc/service/hc/HcCancelReservationRequest.java"
49
- size="3046"/>
50
- <checkpoint/>
51
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcCancelReservationResponse.java&quot; - ok
52
- </message>
53
- <element
54
- location="src/java/com/orbitz/dc/service/hc/HcCancelReservationResponse.java"
55
- size="756"/>
56
- <checkpoint/>
57
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcModifyReservationResponse.java&quot; - ok
58
- </message>
59
- <element
60
- location="src/java/com/orbitz/dc/service/hc/HcModifyReservationResponse.java"
61
- size="849"/>
62
- <checkpoint/>
63
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcModifyReservationRequest.java&quot; - ok
64
- </message>
65
- <element
66
- location="src/java/com/orbitz/dc/service/hc/HcModifyReservationRequest.java"
67
- size="1806"/>
68
- <checkpoint/>
69
- <message>Content (3 K) of &quot;src/java/com/orbitz/dc/core/RateInfo.java&quot; - ok
70
- </message>
71
- <element
72
- location="src/java/com/orbitz/dc/core/RateInfo.java"
73
- size="3495"/>
74
- <checkpoint/>
75
- <message>Content (2 K) of &quot;src/java/com/orbitz/dc/core/VariableRateInfo.java&quot; - ok
76
- </message>
77
- <element
78
- location="src/java/com/orbitz/dc/core/VariableRateInfo.java"
79
- size="2523"/>
80
- <checkpoint/>
81
- <message>Content (2 K) of &quot;src/java/com/orbitz/dc/core/RATE_CATEGORY.java&quot; - ok
82
- </message>
83
- <element
84
- location="src/java/com/orbitz/dc/core/RATE_CATEGORY.java"
85
- size="2513"/>
86
- <checkpoint/>
87
- <message>Content (2 K) of &quot;src/java/com/orbitz/dc/core/RATE_COVERAGE.java&quot; - ok
88
- </message>
89
- <element
90
- location="src/java/com/orbitz/dc/core/RATE_COVERAGE.java"
91
- size="2537"/>
92
- <checkpoint/>
93
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/core/FlatRateInfo.java&quot; - ok
94
- </message>
95
- <element
96
- location="src/java/com/orbitz/dc/core/FlatRateInfo.java"
97
- size="975"/>
98
- <checkpoint/>
99
- <message>Content (2 K) of &quot;src/java/com/orbitz/dc/core/HcItinerary.java&quot; - ok
100
- </message>
101
- <element
102
- location="src/java/com/orbitz/dc/core/HcItinerary.java"
103
- size="2707"/>
104
- <checkpoint/>
105
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcSearch.java&quot; - ok
106
- </message>
107
- <element
108
- location="src/java/com/orbitz/dc/service/hc/HcSearch.java"
109
- size="1123"/>
110
- <checkpoint/>
111
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcCreateReservation.java&quot; - ok
112
- </message>
113
- <element
114
- location="src/java/com/orbitz/dc/service/hc/HcCreateReservation.java"
115
- size="1146"/>
116
- <checkpoint/>
117
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcModifyReservation.java&quot; - ok
118
- </message>
119
- <element
120
- location="src/java/com/orbitz/dc/service/hc/HcModifyReservation.java"
121
- size="1156"/>
122
- <checkpoint/>
123
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcCancelReservation.java&quot; - ok
124
- </message>
125
- <element
126
- location="src/java/com/orbitz/dc/service/hc/HcCancelReservation.java"
127
- size="1150"/>
128
- <checkpoint/>
129
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcRetrieveItinerary.java&quot; - ok
130
- </message>
131
- <element
132
- location="src/java/com/orbitz/dc/service/hc/HcRetrieveItinerary.java"
133
- size="1150"/>
134
- <checkpoint/>
135
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcRetrieveItineraryRequest.java&quot; - ok
136
- </message>
137
- <element
138
- location="src/java/com/orbitz/dc/service/hc/HcRetrieveItineraryRequest.java"
139
- size="1477"/>
140
- <checkpoint/>
141
- <message>Content (1 K) of &quot;src/java/com/orbitz/dc/service/hc/HcRetrieveItineraryResponse.java&quot; - ok
142
- </message>
143
- <element
144
- location="src/java/com/orbitz/dc/service/hc/HcRetrieveItineraryResponse.java"
145
- size="756"/>
146
- <checkpoint/>
147
- </acResponse>
data/test/t_api.rb DELETED
@@ -1,163 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'test/unit'
4
- require 'rubygems'
5
- require 'rscm/accurev'
6
- require 'fileutils'
7
- require 'tmpdir'
8
- include RSCM::Accurev
9
-
10
- class AccurevAPITest < Test::Unit::TestCase
11
-
12
- #def test_deduce_backing_workspace_streams()
13
- # flunk( "XXX implement me" )
14
- #end
15
-
16
- def test_ac_hist()
17
- Command.instance do |cmd|
18
- cmd.accurev_bin = "./acreplay.rb eg/hist-oneweek-promotes.xml"
19
- end
20
- api = API.new( "test" )
21
- # test array returns
22
- txns = api.ac_hist( Time.utc(1980) ) # bound don't matter for this test
23
- txns.each do |t|
24
- assert_not_nil( t['version'], "Txn #{t} has no versions" )
25
- end
26
- assert_equal( txns.length, 9 )
27
- # block yield
28
- txncount = 0
29
- api.ac_hist( Time.utc(1974) ) do |txn|
30
- txncount+=1
31
- assert_not_nil( txn['version'], "Txn #{txn} has no versions" )
32
- end
33
- assert_equal( txncount, 9 )
34
- end
35
-
36
- def test_ac_files()
37
- Command.instance do |cmd|
38
- cmd.accurev_bin = "./acreplay.rb eg/ac-files.xml"
39
- end
40
- api = API.new( "test", "test-bogus-depot", "test-bogus-depot-0-impl" )
41
- # test array returns
42
- files = api.ac_files( "." )
43
- assert( files.length > 0, "Should get some stat-ed files" )
44
- assert_equal( files.length, 23 )
45
- files.each do |fd|
46
- assert( fd.respond_to?( :location ) )
47
- end
48
- # test block yield
49
- count = 0
50
- api.ac_files( "." ) do |fd|
51
- assert( fd.respond_to?( :location ) )
52
- count += 1
53
- end
54
- assert_equal( count, 23 )
55
- end
56
-
57
- def test_update_stale()
58
- Command.instance do |cmd|
59
- cmd.accurev_bin = "./acreplay.rb eg/update-stale.xml"
60
- end
61
- api = API.new( "test", "test-bogus-depot", "test-bogus-depot-0-impl" )
62
- begin
63
- u_elements = api.update()
64
- flunk( "Simulated update with stale data should throw exception" )
65
- rescue StaleWorkspaceException => e
66
- assert( true, "Caught expected exception" )
67
- assert( e.error_msg =~ /workspace have been modified/ )
68
- end
69
- end
70
-
71
- def test_update_nochanges()
72
- Command.instance do |cmd|
73
- cmd.accurev_bin = "./acreplay.rb eg/update-nochanges.xml"
74
- end
75
- api = API.new( "test", "test-bogus-depot", "test-bogus-depot-0-impl" )
76
- u_elements = api.update()
77
- assert_not_nil( u_elements )
78
- assert( u_elements.size == 0 )
79
- end
80
-
81
- def test_update_newwksp()
82
- Command.instance do |cmd|
83
- cmd.accurev_bin = "./acreplay.rb eg/update-newwksp.xml"
84
- end
85
- api = API.new( "test", "test-bogus-depot", "test-bogus-depot-0-impl" )
86
- u_elements = api.update()
87
- assert_not_nil( u_elements )
88
- assert_equal( 44, u_elements.length )
89
- u_elements.each do |location|
90
- # api.update returns a list of relative filenames
91
- assert( location =~ /^[^\/]/, "Location '#{location}' should be a relpath" )
92
- end
93
- # test yield and array return XXX
94
- updated = 0
95
- api.update().each do |location|
96
- updated += 1
97
- assert( location =~ /^[^\/]/, "Location '#{location}' should be a relpath" )
98
- end
99
- assert_equal( 44, updated )
100
- end
101
-
102
- # update-updates.xml - update with updated files
103
- def test_update_updates()
104
- Command.instance do |cmd|
105
- cmd.accurev_bin = "./acreplay.rb eg/update-updates.xml"
106
- end
107
- api = API.new( "test", "test-bogus-depot", "test-bogus-depot-0-impl" )
108
- # XXX elements in elements list are just "modified" -
109
- # may have been removed!
110
- # XXX update() should return only filenames, right? eliminate dirs
111
- ue = api.update()
112
- assert_not_nil( ue )
113
- assert_equal( 23, ue.length )
114
- ue.each do |location|
115
- assert( location =~ /^[^\/]/, "Location '#{location}' should be a relpath" )
116
- end
117
- # yielding behavior
118
- updated = 0
119
- api.update().each do |location|
120
- updated += 1
121
- assert( location =~ /^[^\/]/, "Location '#{location}' should be a relpath" )
122
- end
123
- assert_equal( 23, updated )
124
- end
125
-
126
- def test_info()
127
- Command.instance do |cmd|
128
- cmd.accurev_bin = "./acreplay.rb eg/info.txt"
129
- end
130
- api = API.new( "test", "depot", "stream" )
131
- info = api.ac_info()
132
- assert( info.size == 13 )
133
- # some crap
134
- assert_equal( "gfast", info['Principal'] )
135
- assert_equal( "5050", info['port'] )
136
- assert_equal( "/usr/local/accurev/bin", info['ACCUREV_BIN'] )
137
- # the interesting stuff:
138
- # - depot name
139
- assert_equal( "orbitz-api-hiredcar", info['Depot'] )
140
- # - workspace or reference stream name
141
- assert_equal( "orbitz-api-hiredcar-0-rc-testing_gfast", info['ws/ref'] )
142
- # - basis stream name
143
- assert_equal( "orbitz-api-hiredcar-1-rc", info['Basis'] )
144
- # - workspace checkout location
145
- assert_equal( "/home/gfast/dev/orbitz-api-hirdcar-0-rc", info['Top'] )
146
- end
147
-
148
- def test_pop()
149
- pwd = FileUtils.pwd
150
- # want to use a tempdir since checkout_pop does a mkdir
151
- tmpdir = "#{Dir.tmpdir}/#{$$}.test"
152
- Command.instance do |cmd|
153
- cmd.accurev_bin = "#{pwd}/test/acreplay.rb #{pwd}/test/eg/ac-pop.txt"
154
- end
155
- api = API.new( tmpdir, "depot" )
156
- files = api.checkout_pop()
157
- assert_equal( 162, files.size() )
158
- files.each do |f|
159
- assert( !(f =~ /^\//), "Location '#{f}' should not start with '/'" )
160
- end
161
- end
162
-
163
- end
data/test/t_xmlmapper.rb DELETED
@@ -1,75 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'test/unit'
3
- require 'stringio'
4
- require 'rexml/document'
5
- require 'rubygems'
6
- require 'rscm/scm/accurev/xml'
7
- include REXML
8
- include RSCM::Accurev
9
-
10
- class ReadQueue < ElementBackedClass
11
- element_name 'readqueue'
12
- attr_accessor :owner
13
- end
14
-
15
- class Book < ElementBackedClass
16
- element_name 'book'
17
- attr_accessor :title, :author
18
- end
19
-
20
- class Paper < ElementBackedClass
21
- element_name 'paper'
22
- attr_accessor :uri
23
- end
24
-
25
- class Note < ElementBackedClass
26
- element_name 'note'
27
- attr_accessor :text, :text_content
28
- end
29
-
30
- INPUT = <<-EOI
31
- <?xml version="1.0"?>
32
- <readqueue owner="gdf">
33
- <book title="Iron Council" author="China Mieville" />
34
- <paper uri="http://svk.elixus.org?SVKTutorial">
35
- <note text="re-read" />
36
- </paper>
37
- <book title="Someone Comes to Town, Someone Leaves Town"
38
- author="Cory Doctorow" />
39
- <book title="Concurrent Programming in Java" author="Doug Lea">
40
- <note>Need Brains</note>
41
- </book>
42
- </readqueue>
43
- EOI
44
-
45
- class XMLMapperTest < Test::Unit::TestCase
46
- def testmap
47
- d = Document.new( StringIO.new( INPUT ) )
48
- assert_equal( "readqueue", d.root.name )
49
- mapper = XMLMapper.new
50
- o = mapper.map( d.root )
51
- assert( o.kind_of?( ElementBackedClass ) )
52
- assert( o.kind_of?( ReadQueue ) )
53
- assert_equal( 3, o.children['book'].length )
54
- assert_equal( 1, o.children['paper'].length )
55
- paper = o.children['paper'][0]
56
- assert( paper.kind_of?( Paper ) )
57
- assert_equal( "paper", paper.class.element_name )
58
- assert_equal( "http://svk.elixus.org?SVKTutorial", paper.uri )
59
- assert_equal( 1, paper.children['note'].length )
60
- note = paper.children['note'][0]
61
- assert_equal( "re-read", note.text )
62
- b = nil
63
- o.children['book'].each do |book|
64
- b = book if book.author == "Doug Lea"
65
- end
66
- assert_equal( "Concurrent Programming in Java", b.title )
67
- note = b.children['note'][0]
68
- assert( note.text.nil? )
69
- assert_equal( "Need Brains", note.text_content )
70
-
71
- # test []
72
- assert_equal( 3, o['book'].length )
73
- end
74
-
75
- end