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