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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VOSpace INAF
vospace-rest
Commits
36f26adf
Commit
36f26adf
authored
3 years ago
by
Sonia Zorba
Browse files
Options
Downloads
Patches
Plain Diff
Added test on JobService
parent
1caf43e3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/it/inaf/oats/vospace/JobService.java
+1
-1
1 addition, 1 deletion
src/main/java/it/inaf/oats/vospace/JobService.java
src/test/java/it/inaf/oats/vospace/JobServiceTest.java
+43
-0
43 additions, 0 deletions
src/test/java/it/inaf/oats/vospace/JobServiceTest.java
with
44 additions
and
1 deletion
src/main/java/it/inaf/oats/vospace/JobService.java
+
1
−
1
View file @
36f26adf
This diff is collapsed.
Click to expand it.
src/test/java/it/inaf/oats/vospace/JobServiceTest.java
+
43
−
0
View file @
36f26adf
...
@@ -56,6 +56,12 @@ public class JobServiceTest {
...
@@ -56,6 +56,12 @@ public class JobServiceTest {
@Mock
@Mock
private
MoveService
moveService
;
private
MoveService
moveService
;
@Mock
private
CopyService
copyService
;
@Mock
private
FileServiceClient
fileServiceClient
;
@InjectMocks
@InjectMocks
private
JobService
jobService
;
private
JobService
jobService
;
...
@@ -217,6 +223,43 @@ public class JobServiceTest {
...
@@ -217,6 +223,43 @@ public class JobServiceTest {
assertEquals
(
ExecutionPhase
.
COMPLETED
,
phases
.
get
(
2
));
assertEquals
(
ExecutionPhase
.
COMPLETED
,
phases
.
get
(
2
));
}
}
@Test
public
void
testStartJobCopyNode
()
{
Transfer
copyNode
=
new
Transfer
();
copyNode
.
setDirection
(
"vos://example.com!vospace/myfile"
);
copyNode
.
setKeepBytes
(
true
);
JobSummary
job
=
new
JobSummary
();
setJobInfo
(
job
,
copyNode
);
when
(
uriService
.
getTransfer
(
any
())).
thenReturn
(
copyNode
);
List
<
ExecutionPhase
>
phases
=
new
ArrayList
<>();
doAnswer
(
invocation
->
{
JobSummary
j
=
invocation
.
getArgument
(
0
);
phases
.
add
(
j
.
getPhase
());
return
null
;
}).
when
(
jobDAO
).
updateJob
(
any
(),
any
());
when
(
copyService
.
processCopyNodes
(
any
(),
any
(),
any
())).
thenReturn
(
List
.
of
(
"source"
,
"dest"
));
jobService
.
setJobPhase
(
job
,
"RUN"
);
verify
(
fileServiceClient
,
timeout
(
1000
).
times
(
1
)).
startFileCopyJob
(
eq
(
"source"
),
eq
(
"dest"
),
any
(),
any
());
verify
(
jobDAO
,
timeout
(
1000
).
times
(
3
)).
updateJob
(
any
(),
any
());
try
{
Thread
.
sleep
(
500
);
}
catch
(
InterruptedException
ex
)
{
}
assertEquals
(
ExecutionPhase
.
EXECUTING
,
phases
.
get
(
0
));
assertEquals
(
ExecutionPhase
.
EXECUTING
,
phases
.
get
(
1
));
assertEquals
(
ExecutionPhase
.
EXECUTING
,
phases
.
get
(
2
));
}
private
Transfer
getPullFromVoSpaceHttpTransfer
()
{
private
Transfer
getPullFromVoSpaceHttpTransfer
()
{
Transfer
transfer
=
new
Transfer
();
Transfer
transfer
=
new
Transfer
();
transfer
.
setTarget
(
"vos://example.com!vospace/myfile"
);
transfer
.
setTarget
(
"vos://example.com!vospace/myfile"
);
...
...
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
register
or
sign in
to comment