-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement applications endpoint #16
Conversation
14a5960
to
dace61d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hallo Cosmin,
sehr schön, die wichtigsten Methoden sind getestet und die Coverage von 80% ist erreicht. Inhaltlich ist nur ein Test falsch, über den sprechen wir nochmal zusammen, alle anderen Tests sind inhaltlich gut so, können und sollten aber entsprechend meiner Kommentare nochmal überarbeitet werden.
src/test/java/de/aservo/confapi/crowd/model/util/ApplicationBeanTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/model/util/ApplicationBeanTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/model/util/ApplicationBeanTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/model/util/ApplicationBeanTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/model/util/ApplicationBeanTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/service/ApplicaitonsServiceImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/service/ApplicaitonsServiceImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/service/ApplicaitonsServiceImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/service/ApplicaitonsServiceImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/service/ApplicaitonsServiceImplTest.java
Outdated
Show resolved
Hide resolved
1c80eeb
to
b8c03ff
Compare
src/main/java/de/aservo/confapi/crowd/model/ApplicationBean.java
Outdated
Show resolved
Hide resolved
src/main/java/de/aservo/confapi/crowd/model/ApplicationBean.java
Outdated
Show resolved
Hide resolved
src/main/java/de/aservo/confapi/crowd/rest/ApplicationsResourceImpl.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/model/util/ApplicationBeanTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/service/ApplicaitonsServiceImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/service/ApplicaitonsServiceImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/service/ApplicaitonsServiceImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/service/ApplicaitonsServiceImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/service/ApplicaitonsServiceImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/service/ApplicaitonsServiceImplTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weiß nicht, ob das neue Sachen sind oder ich die letztes mal übersehen habe...
src/test/java/de/aservo/confapi/crowd/model/util/ApplicationBeanTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/model/util/ApplicationBeanTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/model/util/ApplicationBeanTest.java
Outdated
Show resolved
Hide resolved
src/test/java/de/aservo/confapi/crowd/model/util/ApplicationBeanTest.java
Outdated
Show resolved
Hide resolved
0f0773d
to
1dd7a5a
Compare
1dd7a5a
to
0447ffa
Compare
0447ffa
to
e2c5b10
Compare
e2c5b10
to
dbecf77
Compare
try { | ||
final ImmutableApplication.Builder applicationBuilder = new ImmutableApplication.Builder(applicationManager.findById(id)); | ||
|
||
if (applicationBean.getName() != null) { | ||
applicationBuilder.setName(applicationBean.getName()); | ||
} | ||
if (applicationBean.getType() != null) { | ||
applicationBuilder.setType(ApplicationBeanUtil.toApplicationType(applicationBean.getType())); | ||
} | ||
if (applicationBean.getDescription() != null) { | ||
applicationBuilder.setDescription(applicationBean.getDescription()); | ||
} | ||
if (applicationBean.getActive() != null) { | ||
applicationBuilder.setActive(applicationBean.getActive()); | ||
} | ||
if (applicationBean.getPassword() != null) { | ||
applicationBuilder.setPasswordCredential(PasswordCredential.unencrypted(applicationBean.getPassword())); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Siehe meine Fragestellung bzgl PUT und dem POLA principle. Nach einiger Überlegung halte ich es für eine bessere Idee, die props grundsätzlich immer zu übernehmen, auch wenn explizit null gewünscht ist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Die Überlegung ist nicht verkehrt, aber das funktioniert so nicht mit dem JSON Framework, weil wir nicht unterscheiden können, ob der User Beispielsweise für die Description null
als Wert übergeben hat oder die Description im Bean einfach weggelassen hat, weil sie sich nicht ändern soll.
Wie funktioniert denn die Atlassian REST API? Ist das mit dem Werten weglassen, wenn sie sich nicht ändern sollen, dort auch so oder muss man IMMER alles mitschicken?
Wenn es bei Atlassian auch so ist wie bei uns bisher, dann würde ich das so lassen. Für Type und Active macht null
sowieso keinen Sinn, für Name, Description und Password kann man sonst auch einen leeren String schicken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
habe zb. mal PUT mit spaces (nativ REST API) ausprobiert und beim json den name
key weggelassen. Das liefert:
"errors": [
{
"message": {
"translation": "Name is blank. Cannot update space to have no name.",
"args": []
}
}
]
d.h. null Werte werden nicht ignoriert. Wir sollten es daher auch nicht tun. Wie ich vermutet habe checkt das ATL backend ohnehin nochmal auf Plausi.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, ich würde das gerne auch nochmal für Jira testen, aber guter Punkt, dann sollten wir das auch so machen. Hoffe uns fliegen dann nicht die Beans mit den Objekttypen statt primitiven Datentypen um die Ohren...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bei Jira ist es nicht so.
Beispiel:
GET /rest/api/2/issuetype/10001
Response:
{
"self": "http://localhost:2990/jira/rest/api/2/issuetype/10001",
"id": "10001",
"description": "Created by Jira Software - do not edit or delete. Issue type for a user story.",
"iconUrl": "http://localhost:2990/jira/images/icons/issuetypes/story.svg",
"name": "Story",
"subtask": false
}
PUT /rest/api/2/issuetype/10001
Request:
{
"name": "Story",
"description": null
}
oder
{
"name": "Story"
}
Response:
{
"self": "http://localhost:2990/jira/rest/api/2/issuetype/10001",
"id": "10001",
"description": "Created by Jira Software - do not edit or delete. Issue type for a user story.",
"iconUrl": "http://localhost:2990/jira/images/icons/issuetypes/story.svg",
"name": "Story",
"subtask": false
}
...aber...
Request:
{
"name": "Story",
"description": ""
}
Response;
{
"self": "http://localhost:2990/jira/rest/api/2/issuetype/10001",
"id": "10001",
"description": "",
"iconUrl": "http://localhost:2990/jira/images/icons/issuetypes/story.svg",
"name": "Story",
"subtask": false
}
if (ApplicationType.GENERIC_APPLICATION.equals(applicationType)) { | ||
return ApplicationBean.ApplicationType.GENERIC; | ||
} else if (ApplicationType.PLUGIN.equals(applicationType)) { | ||
return ApplicationBean.ApplicationType.PLUGIN; | ||
} else if (ApplicationType.CROWD.equals(applicationType)) { | ||
return ApplicationBean.ApplicationType.CROWD; | ||
} else if (ApplicationType.JIRA.equals(applicationType)) { | ||
return ApplicationBean.ApplicationType.JIRA; | ||
} else if (ApplicationType.CONFLUENCE.equals(applicationType)) { | ||
return ApplicationBean.ApplicationType.CONFLUENCE; | ||
} else if (ApplicationType.STASH.equals(applicationType)) { | ||
return ApplicationBean.ApplicationType.BITBUCKET; | ||
} else if (ApplicationType.FISHEYE.equals(applicationType)) { | ||
return ApplicationBean.ApplicationType.FISHEYE; | ||
} else if (ApplicationType.CRUCIBLE.equals(applicationType)) { | ||
return ApplicationBean.ApplicationType.CRUCIBLE; | ||
} else if (ApplicationType.BAMBOO.equals(applicationType)) { | ||
return ApplicationBean.ApplicationType.BAMBOO; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Da sich die gesamte Application Prodzedur eh nur in Crowd abspielt (und nicht in der commons, wo wir ja atlassian-free bleiben wollen), hätte man doch gleich Atlassian's ApplicationType
anstelle von ApplicationBean.ApplicationType
in die Bean aufnehmen können oder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prinzipiell schon, aber so behalten wir die Kontrolle und Bitbucket darf an unseren Endpoints Bitbucket heißen und nicht Stash.
src/main/java/de/aservo/confapi/crowd/rest/ApplicationsResourceImpl.java
Show resolved
Hide resolved
dbecf77
to
669680c
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
No description provided.