288
|
1 |
"{ Package: 'stx:goodies/monticello' }"
|
|
2 |
|
|
3 |
MCTestCase subclass:#MCRepositoryTest
|
|
4 |
instanceVariableNames:'repository ancestors'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Monticello-Tests'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!MCRepositoryTest class methodsFor:'as yet unclassified'!
|
|
12 |
|
|
13 |
isAbstract
|
|
14 |
^ self = MCRepositoryTest
|
|
15 |
! !
|
|
16 |
|
|
17 |
!MCRepositoryTest methodsFor:'accessing'!
|
|
18 |
|
|
19 |
snapshotAt: aVersionInfo
|
|
20 |
^ (repository versionWithInfo: aVersionInfo) snapshot
|
|
21 |
! !
|
|
22 |
|
|
23 |
!MCRepositoryTest methodsFor:'actions'!
|
|
24 |
|
|
25 |
addVersion: aVersion
|
|
26 |
self subclassResponsibility
|
|
27 |
!
|
|
28 |
|
|
29 |
addVersionWithSnapshot: aSnapshot name: aString
|
|
30 |
| version |
|
|
31 |
version := self versionWithSnapshot: aSnapshot name: aString.
|
|
32 |
self addVersion: version.
|
|
33 |
^ version info
|
|
34 |
!
|
|
35 |
|
|
36 |
saveSnapshot1
|
|
37 |
^ self saveSnapshot: self snapshot1 named: 'rev1'
|
|
38 |
!
|
|
39 |
|
|
40 |
saveSnapshot2
|
|
41 |
^ self saveSnapshot: self snapshot2 named: 'rev2'
|
|
42 |
!
|
|
43 |
|
|
44 |
saveSnapshot: aSnapshot named: aString
|
|
45 |
| version |
|
|
46 |
version := self versionWithSnapshot: aSnapshot name: aString.
|
|
47 |
repository storeVersion: version.
|
|
48 |
^ version info
|
|
49 |
|
|
50 |
! !
|
|
51 |
|
|
52 |
!MCRepositoryTest methodsFor:'asserting'!
|
|
53 |
|
|
54 |
assertMissing: aVersionInfo
|
|
55 |
self assert: (repository versionWithInfo: aVersionInfo) isNil
|
|
56 |
!
|
|
57 |
|
|
58 |
assertVersionInfos: aCollection
|
|
59 |
self assert: repository allVersionInfos asSet = aCollection asSet
|
|
60 |
! !
|
|
61 |
|
|
62 |
!MCRepositoryTest methodsFor:'building'!
|
|
63 |
|
|
64 |
snapshot1
|
|
65 |
^ (MCSnapshot fromDefinitions: (Array with: (MCOrganizationDefinition categories: #('y'))))
|
|
66 |
!
|
|
67 |
|
|
68 |
snapshot2
|
|
69 |
^ (MCSnapshot fromDefinitions: (Array with: (MCOrganizationDefinition categories: #('x'))))
|
|
70 |
!
|
|
71 |
|
|
72 |
versionWithSnapshot: aSnapshot name: aString
|
|
73 |
| info |
|
|
74 |
info := self mockVersionInfo: aString.
|
|
75 |
^ MCVersion
|
|
76 |
package: (MCPackage new name: aString)
|
|
77 |
info: info
|
|
78 |
snapshot: aSnapshot
|
|
79 |
! !
|
|
80 |
|
|
81 |
!MCRepositoryTest methodsFor:'tests'!
|
|
82 |
|
|
83 |
testAddAndLoad
|
|
84 |
| node |
|
|
85 |
node := self addVersionWithSnapshot: self snapshot1 name: 'rev1'.
|
|
86 |
self assert: (self snapshotAt: node) = self snapshot1.
|
|
87 |
|
|
88 |
!
|
|
89 |
|
|
90 |
testIncludesName
|
|
91 |
self deny: (repository includesVersionNamed: 'MonticelloTest-xxx.1-rev1').
|
|
92 |
self saveSnapshot1.
|
|
93 |
self assert: (repository includesVersionNamed: 'MonticelloTest-xxx.1-rev1').
|
|
94 |
self deny: (repository includesVersionNamed: 'MonticelloTest-xxx.1-rev2').
|
|
95 |
self saveSnapshot2.
|
|
96 |
self assert: (repository includesVersionNamed: 'MonticelloTest-xxx.1-rev2').
|
|
97 |
!
|
|
98 |
|
|
99 |
testLoadMissingNode
|
|
100 |
| node |
|
|
101 |
node := MCVersionInfo new.
|
|
102 |
self assertMissing: node
|
|
103 |
!
|
|
104 |
|
|
105 |
testStoreAndLoad
|
|
106 |
| node node2 |
|
|
107 |
node := self saveSnapshot1.
|
|
108 |
node2 := self saveSnapshot2.
|
|
109 |
self assert: (self snapshotAt: node) = self snapshot1.
|
|
110 |
self assert: (self snapshotAt: node2) = self snapshot2.
|
|
111 |
! !
|
|
112 |
|
|
113 |
!MCRepositoryTest class methodsFor:'documentation'!
|
|
114 |
|
|
115 |
version
|
294
|
116 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCRepositoryTest.st,v 1.2 2011-08-20 12:06:01 cg Exp $'
|
288
|
117 |
!
|
|
118 |
|
|
119 |
version_CVS
|
294
|
120 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCRepositoryTest.st,v 1.2 2011-08-20 12:06:01 cg Exp $'
|
288
|
121 |
!
|
|
122 |
|
|
123 |
version_SVN
|
|
124 |
^ '§Id: MCRepositoryTest.st 5 2010-08-29 07:30:29Z vranyj1 §'
|
|
125 |
! !
|