Skip to content

Commit

Permalink
Fixes #96 #100 project default
Browse files Browse the repository at this point in the history
added simple test as well.
Cleaned up JadeiteTestResource. Wasn't getting proper session with RowanSample1 test class.
  • Loading branch information
Eric Winger authored and Eric Winger committed Aug 24, 2018
1 parent 2c3cf8f commit cc37422
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 37 deletions.
22 changes: 17 additions & 5 deletions sources/JadeiteProjectBrowserTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ selectRowanSample1Class
self selectServicesNamed: (Array with: self class sampleClass) in: self classListPresenter!

selectServicesNamed: anArray in: presenter
presenter resetSelection.
anArray do:
[:name |
| service |
Expand All @@ -125,10 +126,7 @@ tearDown
browser ifNotNil: [browser destroy]!

test_addRemoveCategory
"This test will fail if RowanSample1 project has not been cloned in ROWAN_PROJECTS_HOME."

self rowanFixMe. "Ideally, get RowanSample1 project from git hub automatically"
self ensureRowanSample1Attached.
self selectRowanSample1Class.
self deny: (self categoryListPresenter list includes: 'jadeite test').
self projectsPresenter basicAddMethodCategory: 'jadeite test'.
Expand All @@ -137,6 +135,21 @@ test_addRemoveCategory
self projectsPresenter basicRemoveMethodCategories.
self deny: (self categoryListPresenter list includes: 'jadeite test')!

test_markDirty
| nonDefaultService |
self selectServicesNamed: (Array with: 'RowanSample1') in: self projectListPresenter.
self projectsPresenter makeDefault.
self assert: self projectListPresenter selection displayName = 'RowanSample1*'.
nonDefaultService := self projectListPresenter list
detect: [:projectService | projectService name = 'Rowan'].
self assert: nonDefaultService displayName = 'Rowan'.
self assert: self projectListPresenter selection displayName = 'RowanSample1*'.
self selectServicesNamed: (Array with: 'Rowan') in: self projectListPresenter.
self projectsPresenter makeDefault.
nonDefaultService := self projectListPresenter list
detect: [:projectService | projectService name = 'RowanSample1'].
self assert: self projectListPresenter selection displayName = 'Rowan*'!

test_openProjectsBrowser
"project browser opened in setup"
self assert: browser class equals: JadeiteProjectsSystemBrowser.
Expand All @@ -153,8 +166,6 @@ test_packagesShownInMultipleProjects
self denyIsNil: (self serviceNamed: 'JadeServer' in: self classListPresenter)!

test_saveMethod
self rowanFixMe. "incomplete test"
self ensureRowanSample1Attached.
self selectRowanSample1Class.
self deny: (self categoryListPresenter list includes: 'test_saveMethod').
self projectsPresenter basicAddMethodCategory: 'test_saveMethod'.
Expand Down Expand Up @@ -202,6 +213,7 @@ waitForPresenter: presenter
!JadeiteProjectBrowserTestCase categoriesFor: #setUp!private!setup teardown! !
!JadeiteProjectBrowserTestCase categoriesFor: #tearDown!private!setup teardown! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_addRemoveCategory!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_markDirty!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_openProjectsBrowser!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_packagesShownInMultipleProjects!public!test! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_saveMethod!public!test! !
Expand Down
16 changes: 11 additions & 5 deletions sources/JadeiteProjectsBrowserPresenter.cls

Large diffs are not rendered by default.

21 changes: 15 additions & 6 deletions sources/JadeiteTestResource.cls
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,32 @@ JadeiteTestResource comment: ''!
!JadeiteTestResource methodsFor!

isAvailable
session ifNil:[^false].
transcript ifNil:[^false].
^session executeString: '(System myUserProfile resolveSymbol: #', JadeiteProjectBrowserTestCase sampleClass, ') notNil'!
^session notNil and: [transcript notNil]!

isSampleClassPresentIn: aSession
^
[aSession
executeString: '(System myUserProfile resolveSymbol: #' , JadeiteProjectBrowserTestCase sampleClass
, ') notNil']
on: Error
do: [:ex | false]!

session

^session!

setUp
setUp
super setUp.
session := GciSession allInstances detect: [:each | each isValidSession] ifNone: [].
transcript := RowanTranscript allInstances detect: [:tran | tran gciSession == session] ifNone:[]. !
session := GciSession allInstances
detect: [:each | each isValidSession and: [self isSampleClassPresentIn: each]]
ifNone: [].
transcript := RowanTranscript allInstances detect: [:tran | tran gciSession == session] ifNone: []!

transcript

^transcript! !
!JadeiteTestResource categoriesFor: #isAvailable!public!testing! !
!JadeiteTestResource categoriesFor: #isSampleClassPresentIn:!public!testing! !
!JadeiteTestResource categoriesFor: #session!accessing!public! !
!JadeiteTestResource categoriesFor: #setUp!public! !
!JadeiteTestResource categoriesFor: #transcript!accessing!public! !
Expand Down
7 changes: 6 additions & 1 deletion sources/RowanProjectListPresenter.cls
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ loadProject
selection loadProjectFrom: self!

makeDefault
(RowanProjectService on: gciSession) defaultProjectName: projectListPresenter selection name!
"the server is the gold copy"
| projectService |
projectService := projectListPresenter selection.
projectService command: #setDefaultProject.
self issueCommand: (Array with: projectService).
RowanProjectService defaultProjectName: projectService name!

newService
^(RowanProjectService on: gciSession) name: projectListPresenter selection name!
Expand Down
21 changes: 1 addition & 20 deletions sources/RowanProjectService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,6 @@ commitWithMessage: message
defaultProjectName
^self class defaultProjectName!

defaultProjectName: aString
"The server is the gold copy"

transport
send: #defaultProjectName:
to: remoteService
withAll: (Array with: aString).
self class defaultProjectName: aString!

displayName
"display with dirty indication * and/or default indication (default)"

Expand Down Expand Up @@ -130,14 +121,6 @@ loadProjectFrom: presenter
self command: #reloadProject.
presenter issueCommand: (Array with: self).!

loadProjectNamed: aString

transport
send: #loadProjectNamed:
to: remoteService
withAll: (Array with: aString).
self class defaultProjectName: aString!

newTextView
| edit |
Shell create view
Expand Down Expand Up @@ -255,16 +238,14 @@ sha: anObject
!RowanProjectService categoriesFor: #checkoutUsing:!presenter support!public! !
!RowanProjectService categoriesFor: #commitWithMessage:!public!rowan! !
!RowanProjectService categoriesFor: #defaultProjectName!accessing!public! !
!RowanProjectService categoriesFor: #defaultProjectName:!accessing!public! !
!RowanProjectService categoriesFor: #displayName!accessing!public! !
!RowanProjectService categoriesFor: #displayName!accessing!displaying!public! !
!RowanProjectService categoriesFor: #displayStringFor:!displaying!public! !
!RowanProjectService categoriesFor: #hash!comparing!public! !
!RowanProjectService categoriesFor: #isLoaded!public!testing! !
!RowanProjectService categoriesFor: #isProjectService!public!testing! !
!RowanProjectService categoriesFor: #isSkew!accessing!private! !
!RowanProjectService categoriesFor: #isSkew:!accessing!private! !
!RowanProjectService categoriesFor: #loadProjectFrom:!presenter support!public! !
!RowanProjectService categoriesFor: #loadProjectNamed:!public!rowan! !
!RowanProjectService categoriesFor: #newTextView!displaying!private! !
!RowanProjectService categoriesFor: #packageNames!public!rowan! !
!RowanProjectService categoriesFor: #packageNameString!public!rowan! !
Expand Down

0 comments on commit cc37422

Please sign in to comment.