Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IA2
GMS
Commits
a989ae7c
Commit
a989ae7c
authored
Apr 15, 2020
by
Sonia Zorba
Browse files
Fixed http response status check in gms-client lib
parent
947c53e1
Changes
5
Hide whitespace changes
Inline
Side-by-side
gms-client/gms-client-lib/src/main/java/it/inaf/ia2/gms/client/call/AddMemberCall.java
View file @
a989ae7c
...
...
@@ -19,6 +19,7 @@ public class AddMemberCall extends BaseGmsCall {
HttpRequest
groupsRequest
=
newHttpRequest
(
endpoint
)
.
header
(
"Accept"
,
"text/plain"
)
.
header
(
"Content-Type"
,
"application/x-www-form-urlencoded"
)
.
POST
(
BodyPublishers
.
ofString
(
"user_id="
+
userId
))
.
build
();
...
...
gms-client/gms-client-lib/src/main/java/it/inaf/ia2/gms/client/call/AddPermissionCall.java
View file @
a989ae7c
...
...
@@ -24,6 +24,7 @@ public class AddPermissionCall extends BaseGmsCall {
HttpRequest
groupsRequest
=
newHttpRequest
(
endpoint
)
.
header
(
"Accept"
,
"text/plain"
)
.
header
(
"Content-Type"
,
"application/x-www-form-urlencoded"
)
.
POST
(
requestBody
)
.
build
();
...
...
gms-client/gms-client-lib/src/main/java/it/inaf/ia2/gms/client/call/CreateGroupCall.java
View file @
a989ae7c
...
...
@@ -19,7 +19,7 @@ public class CreateGroupCall extends BaseGmsCall {
return
getClient
().
sendAsync
(
groupsRequest
,
HttpResponse
.
BodyHandlers
.
ofInputStream
())
.
thenApply
(
response
->
{
if
(
response
.
statusCode
()
==
20
0
)
{
if
(
response
.
statusCode
()
==
20
1
)
{
return
true
;
}
logServerErrorInputStream
(
groupsRequest
,
response
);
...
...
gms-client/gms-client-lib/src/test/java/it/inaf/ia2/gms/client/GmsClientTest.java
View file @
a989ae7c
...
...
@@ -82,7 +82,7 @@ public class GmsClientTest {
@Test
public
void
testCreateGroup
()
{
CompletableFuture
response
=
CompletableFuture
.
completedFuture
(
getMockedResponse
(
20
0
));
CompletableFuture
response
=
CompletableFuture
.
completedFuture
(
getMockedResponse
(
20
1
));
when
(
httpClient
.
sendAsync
(
any
(),
any
())).
thenReturn
(
response
);
client
.
createGroup
(
"LBT.INAF"
,
false
);
...
...
gms/src/main/java/it/inaf/ia2/gms/controller/JWTWebServiceController.java
View file @
a989ae7c
...
...
@@ -278,7 +278,7 @@ public class JWTWebServiceController {
for
(
int
i
=
0
;
i
<
index
+
1
;
i
++)
{
String
groupName
=
groupNames
.
get
(
i
);
group
=
groupsDAO
.
findGroupByParentAndName
(
parentPath
,
groupName
)
.
orElseThrow
(()
->
new
IllegalArgumen
tException
(
"Unable to find group "
+
groupName
));
.
orElseThrow
(()
->
new
BadReques
tException
(
"Unable to find group "
+
groupName
));
parentPath
=
group
.
getPath
();
}
if
(
group
==
null
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment