-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrated testMoveTo, fix testRead, chg ICSetUpTestHelper
- Loading branch information
Showing
43 changed files
with
163 additions
and
91 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
packages/IMAPClient-Core.package/ICEmail.class/instance/transferAttributesFrom..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
converting | ||
transferAttributesFrom: anICEmail | ||
|
||
self id: anICEmail id; | ||
body: anICEmail body; | ||
header: anICEmail header; | ||
folder: anICEmail folder; | ||
messageID: anICEmail messageID; | ||
uniqueID: anICEmail uniqueID | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/IMAPClient-Core.package/ICEndPoint.class/instance/collectAllFolders.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
collectAllFolders | ||
|
||
^ self rootFolder collectAllFolders |
2 changes: 1 addition & 1 deletion
2
packages/IMAPClient-Core.package/ICEndPoint.class/instance/unlinkAllEmails.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
accessing | ||
unlinkAllEmails | ||
|
||
^ self rootFolder unlink | ||
^ self rootFolder unlinkAllEmails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 11 additions & 3 deletions
14
packages/IMAPClient-Core.package/ICFileReadWriter.class/instance/directoryVisitor.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
read file | ||
directoryVisitor | ||
|
||
^ [:directory | | currentFolder | | ||
|
||
^ [:directory | | currentFolder folderName matchingFolder | | ||
self directoryToFolderDictionary at: directory ifAbsent:[ | ||
directory = self rootDirectory ifFalse: [ | ||
currentFolder := ICFolder | ||
folderName :=directory pathParts last. | ||
matchingFolder:= self loadedFolders select: [:f | f folderName = folderName]. | ||
|
||
matchingFolder isEmpty | ||
ifTrue: [currentFolder := ICFolder | ||
named: directory pathParts last | ||
in: (self directoryToFolderDictionary at: directory containingDirectory) | ||
with: self endpoint | ||
of: #Generic. | ||
of: #Generic.] | ||
ifFalse: [ | ||
self assert: matchingFolder size = 1 description: 'Crutical Error. FolderName is not Unique! You should change the name to id ;)'. | ||
currentFolder:= matchingFolder first]. | ||
self directoryToFolderDictionary at: directory put: currentFolder]]] |
4 changes: 4 additions & 0 deletions
4
packages/IMAPClient-Core.package/ICFileReadWriter.class/instance/loadedFolders..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
loadedFolders: anOrderdCollection | ||
|
||
loadedFolders := anOrderdCollection |
3 changes: 3 additions & 0 deletions
3
packages/IMAPClient-Core.package/ICFileReadWriter.class/instance/loadedFolders.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
loadedFolders | ||
^ loadedFolders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/IMAPClient-Core.package/ICFolder.class/instance/collectAllFolders.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
accessing | ||
collectAllFolders | ||
|
||
|allFolders | | ||
|
||
allFolders:= OrderedCollection new. | ||
allFolders addAll: {self}. | ||
self childFolders do:[:folder| | ||
allFolders addAll: folder collectAllFolders]. | ||
|
||
^ allFolders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/IMAPClient-Tests.package/ICEndPointOfflineTest.class/instance/helper..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
helper: anICSetUpTestHelper | ||
|
||
helper := anICSetUpTestHelper |
3 changes: 3 additions & 0 deletions
3
packages/IMAPClient-Tests.package/ICEndPointOfflineTest.class/instance/helper.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
helper | ||
^ helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...ages/IMAPClient-Tests.package/ICEndPointOfflineTest.class/instance/testUnlinkAllEmails.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
constants | ||
testUnlinkAllEmails | ||
|
||
| folder mail | | ||
|
||
folder:= self helper createAFolder: 'folder'. | ||
|
||
mail := self helper createAnEmail: folder. | ||
self assert: (folder emails contains: [:e| e = mail]). | ||
self helper endpoint unlinkAllEmails. | ||
|
||
self assert: folder emails isEmpty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 10 additions & 4 deletions
14
packages/IMAPClient-Tests.package/ICFileReadWriterTest.class/instance/testDelete.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
delteFile | ||
testDelete | ||
|
||
self createFileWith: self deleteUID. | ||
self assert: (FileDirectory default / (self endpoint maildirFileName: self endpoint rootFolder folderName) / self deleteUID asString) exists. | ||
self readWriter delete: (self class expectedMailObjectFor: self deleteUID in: self endpoint rootFolder). | ||
self assert: (FileDirectory default / self endpoint maildirFileName / self deleteUID asString) exists not | ||
| folder mail | | ||
"self createFileWith: self deleteUID." | ||
folder := self helper createAFolder: 'folder'. | ||
mail := self helper createAnEmail: folder. | ||
|
||
self assert: (FileDirectory default / (self endpoint maildirFileName: self helper endpoint rootFolder folderName) / mail uniqueID asString) exists. | ||
|
||
|
||
"self readWriter delete: (self class expectedMailObjectFor: self deleteUID in: self endpoint rootFolder). | ||
self assert: (FileDirectory default / self endpoint maildirFileName / self deleteUID asString) exists not" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 9 additions & 5 deletions
14
packages/IMAPClient-Tests.package/ICFileReadWriterTest.class/instance/testRead.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
UIDs | ||
testRead | ||
|
||
self createFileWith: self readUID. | ||
self readWriter readEmailsFromDisk. | ||
self | ||
assert: {self class expectedMailObjectFor: self readUID in: self endpoint rootFolder} | ||
equals: self endpoint rootFolder emails asArray | ||
| folder mail | | ||
|
||
self readWriter: (ICFileReadWriter new endpoint: self helper endpoint)."remove this, should be in SetUP!" | ||
folder := self helper createAFolder: 'folder'. | ||
mail := self helper createAnEmail: folder. | ||
folder emails: OrderedCollection new. | ||
|
||
self readWriter syncFromDisk. | ||
self assert: (folder emails contains: [:e | e id = mail id ]). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
An ICSetUpTestHelper is an extension for the unit tests. Its purpose is to help create clean and consistent setUps. | ||
The class creates a clean endpoint. It also provides methods for creating folders and emails. Each object is written to disk. The SetUpTestHelper ensure an empty TestEnvironment. | ||
To be independet from the FileReadWriter, the class has its own IO-operations. | ||
|
||
Instance Variables | ||
currentMailID: <Number> | ||
endpoint: <ICEndPont> | ||
|
||
currentMailID | ||
- A Number which gets increased with each call. Needed for unique email uids. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/IMAPClient-Tests.package/ICSetUpTestHelper.class/instance/createAFolder..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
createAFolder: anName | ||
|
||
^ self createAFolder: anName in: self endpoint rootFolder |
2 changes: 1 addition & 1 deletion
2
...lper.class/instance/createAnFolder.in..st → ...elper.class/instance/createAFolder.in..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
packages/IMAPClient-Tests.package/ICSetUpTestHelper.class/instance/createAnFolder..st
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.