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