Skip to content

Commit

Permalink
add a new test and load only one issueType
Browse files Browse the repository at this point in the history
  • Loading branch information
badetitou committed Jul 25, 2024
1 parent 8d04420 commit c065ea4
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ JPMetamodelGenerator >> defineProperties [
issueType property: #name type: #String.
issueType property: #subtask type: #String.
issueType property: #avatarId type: #String.
issueType withEqualityCheckOn: { #id }.

component property: #id type: #Number.
component property: #name type: #String.
Expand Down
14 changes: 14 additions & 0 deletions src/JiraPharoAPI-Model/JPIssueType.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ JPIssueType class >> annotation [
^ self
]

{ #category : #comparing }
JPIssueType >> = aJPIssueType [

<generated>
^ aJPIssueType id = self id
]

{ #category : #accessing }
JPIssueType >> avatarId [

Expand Down Expand Up @@ -73,6 +80,13 @@ JPIssueType >> description: anObject [
description := anObject
]

{ #category : #comparing }
JPIssueType >> hash [

<generated>
^ self id hash
]

{ #category : #accessing }
JPIssueType >> iconUrl [

Expand Down
46 changes: 46 additions & 0 deletions src/JiraPharoAPI-Tests/JiraPharoImporterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,52 @@ JiraPharoImporterTest >> testLoadIssues [
self assert: model size equals: 1.
]

{ #category : #tests }
JiraPharoImporterTest >> testLoadIssuesWithSameType [

| issueA issueB issueTypeA issueTypeB |
issueTypeA := JPIssueType new
id: 125;
name: 'sub-task';
yourself.
issueTypeB := JPIssueType new
id: 125;
name: 'sub-task';
yourself.
issueA := JPIssue new
id: 1;
type: issueTypeA;
yourself.
issueB := JPIssue new
id: 2;
type: issueTypeB;
yourself.

jpImporter loadIssues: {
issueA.
issueB }.
self assert: model size equals: 3
]

{ #category : #tests }
JiraPharoImporterTest >> testLoadOneIssueWithAIssueType [

| issueA issueTypeA |
issueTypeA := JPIssueType new
id: 125;
name: 'sub-task';
yourself.
issueA := JPIssue new
id: 1;
type: issueTypeA;
yourself.

jpImporter loadIssues: { issueA }.
self assert: model size equals: 2.
self assert: (model allWithType: JPIssue) size equals: 1.
self assert: (model allWithType: JPIssueType) size equals: 1
]

{ #category : #test }
JiraPharoImporterTest >> testLoadSameIssueTwoTimes [

Expand Down
5 changes: 4 additions & 1 deletion src/JiraPharoAPI/JiraPharoImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ JiraPharoImporter >> loadIssues: issues [
issuesToLoad := issues reject: [ :issueProposedForImmport |
(self model allWithType: JPIssue) anySatisfy: [
:issue | issue id = issueProposedForImmport id ] ].
self model addAll: issuesToLoad
self model addAll: issuesToLoad.
self model addAll:
issuesToLoad iterator | [ :issue | issue type ] collectIt
| [ :issueType | issueType isNil ] rejectIt > Set
]

{ #category : #accessing }
Expand Down

0 comments on commit c065ea4

Please sign in to comment.