Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vospace-rest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VOSpace INAF
vospace-rest
Commits
3cec0ef7
Commit
3cec0ef7
authored
Jan 17, 2021
by
Nicola Fulvio Calabria
Browse files
Options
Downloads
Patches
Plain Diff
Bug #3612 - Fixed method getParentPath() in CreateNodeController class.
Passes testSubPath() test in CreateNodeControllerTest now.
parent
02fdc3b5
No related branches found
No related tags found
No related merge requests found
Pipeline
#875
passed
Jan 17, 2021
Stage: build
Stage: test
Stage: dockerize
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/it/inaf/oats/vospace/CreateNodeController.java
+18
-5
18 additions, 5 deletions
src/main/java/it/inaf/oats/vospace/CreateNodeController.java
src/test/java/it/inaf/oats/vospace/CreateNodeControllerTest.java
+1
-1
1 addition, 1 deletion
...t/java/it/inaf/oats/vospace/CreateNodeControllerTest.java
with
19 additions
and
6 deletions
src/main/java/it/inaf/oats/vospace/CreateNodeController.java
+
18
−
5
View file @
3cec0ef7
...
@@ -63,8 +63,8 @@ public class CreateNodeController extends BaseNodeController {
...
@@ -63,8 +63,8 @@ public class CreateNodeController extends BaseNodeController {
List
<
String
>
nodeGroups
List
<
String
>
nodeGroups
=
Arrays
.
asList
(
groupWritePropValues
.
get
(
0
).
split
(
" "
,
-
1
));
=
Arrays
.
asList
(
groupWritePropValues
.
get
(
0
).
split
(
" "
,
-
1
));
if
(
userGroups
==
null
||
if
(
userGroups
==
null
!
nodeGroups
.
stream
().
anyMatch
((
i
)
->
userGroups
.
contains
(
i
)))
{
||
!
nodeGroups
.
stream
().
anyMatch
((
i
)
->
userGroups
.
contains
(
i
)))
{
// If groups don't match check ownership at least
// If groups don't match check ownership at least
List
<
String
>
nodeOwner
List
<
String
>
nodeOwner
=
getNodePropertyByURI
(
parentNode
,
"ivo://ivoa.net/vospace/core#creator"
);
=
getNodePropertyByURI
(
parentNode
,
"ivo://ivoa.net/vospace/core#creator"
);
...
@@ -114,13 +114,26 @@ public class CreateNodeController extends BaseNodeController {
...
@@ -114,13 +114,26 @@ public class CreateNodeController extends BaseNodeController {
}
}
// This method assumes that URL is in the format /node1/node2/...
// multiple slashes as a single separator are allowed
// But the output has only single slash separators
private
String
getParentPath
(
String
path
)
{
private
String
getParentPath
(
String
path
)
{
String
[]
parsedPath
=
path
.
split
(
"/"
);
String
[]
parsedPath
=
path
.
split
(
"[/]+"
);
if
(
parsedPath
.
length
<
2
||
!
parsedPath
[
0
].
isEmpty
())
{
throw
new
IllegalArgumentException
();
}
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"/"
);
for
(
int
i
=
0
;
i
<
parsedPath
.
length
-
1
;
i
++)
{
System
.
out
.
println
(
parsedPath
.
length
);
sb
.
append
(
"/"
).
append
(
parsedPath
[
i
]);
for
(
int
i
=
1
;
i
<
parsedPath
.
length
-
1
;
i
++)
{
sb
.
append
(
parsedPath
[
i
]);
if
(
i
<
parsedPath
.
length
-
2
)
{
sb
.
append
(
"/"
);
}
}
}
return
sb
.
toString
();
return
sb
.
toString
();
...
...
This diff is collapsed.
Click to expand it.
src/test/java/it/inaf/oats/vospace/CreateNodeControllerTest.java
+
1
−
1
View file @
3cec0ef7
...
@@ -278,7 +278,7 @@ public class CreateNodeControllerTest {
...
@@ -278,7 +278,7 @@ public class CreateNodeControllerTest {
verifyArguments
();
verifyArguments
();
}
}
//
@Test
@Test
public
void
testSubPath
()
throws
Exception
{
public
void
testSubPath
()
throws
Exception
{
String
requestBody
=
getResourceFileContent
(
"create-unstructured-data-node.xml"
)
String
requestBody
=
getResourceFileContent
(
"create-unstructured-data-node.xml"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
sign in
to comment