Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nmaas Platform
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
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
nmaas
nmaas Platform
Commits
9ccbc6a8
Commit
9ccbc6a8
authored
1 month ago
by
kbeyro
Browse files
Options
Downloads
Patches
Plain Diff
fix import in test
parent
76a166a6
No related branches found
No related tags found
2 merge requests
!273
Release 1.8.0 update
,
!247
Resolve "Revisit paging mechanism for endpoints providing data for table/list views"
Pipeline
#94920
passed
1 month ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/net/geant/nmaas/portal/service/impl/UserServiceImplTest.java
+9
-5
9 additions, 5 deletions
.../geant/nmaas/portal/service/impl/UserServiceImplTest.java
with
9 additions
and
5 deletions
src/test/java/net/geant/nmaas/portal/service/impl/UserServiceImplTest.java
+
9
−
5
View file @
9ccbc6a8
...
...
@@ -14,6 +14,7 @@ import net.geant.nmaas.portal.persistent.repositories.UserRepository;
import
net.geant.nmaas.portal.persistent.repositories.UserRoleRepository
;
import
net.geant.nmaas.portal.service.ConfigurationManager
;
import
net.geant.nmaas.portal.service.DomainGroupService
;
import
net.geant.nmaas.portal.service.UserLoginRegisterService
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
...
...
@@ -60,11 +61,14 @@ public class UserServiceImplTest {
@Mock
DomainGroupService
domainGroupService
;
@Mock
UserLoginRegisterService
userLoginService
;
UserServiceImpl
userService
;
@BeforeEach
void
setup
()
{
userService
=
new
UserServiceImpl
(
userRepository
,
userRoleRepository
,
new
BCryptPasswordEncoder
(),
configurationManager
,
new
ModelMapper
(),
eventPublisher
,
jwtTokenService
,
domainGroupService
);
userService
=
new
UserServiceImpl
(
userRepository
,
userRoleRepository
,
new
BCryptPasswordEncoder
(),
configurationManager
,
new
ModelMapper
(),
eventPublisher
,
jwtTokenService
,
domainGroupService
,
userLoginService
);
userService
.
setPortalAddress
(
"portalAddress"
);
}
...
...
@@ -183,7 +187,7 @@ public class UserServiceImplTest {
}
@Test
void
findByIdShouldReturnEmptyOptionalWhenNull
(){
void
findByIdShouldReturnEmptyOptionalWhenNull
()
{
assertEquals
(
Optional
.
empty
(),
userService
.
findById
(
null
));
}
...
...
@@ -263,7 +267,7 @@ public class UserServiceImplTest {
@Test
void
shouldRegisterUserWithGlobalGuestRole
()
{
when
(
userRepository
.
existsByUsername
(
anyString
())).
thenReturn
(
false
);
Registration
registration
=
new
Registration
(
"test"
,
"testpass"
,
"test@test.com"
,
"name"
,
"surname"
,
1L
,
true
,
true
);
Registration
registration
=
new
Registration
(
"test"
,
"testpass"
,
"test@test.com"
,
"name"
,
"surname"
,
1L
,
true
,
true
);
Domain
domain
=
new
Domain
(
"GLOBAL"
,
"GLOBAL"
);
when
(
configurationManager
.
getConfiguration
()).
thenReturn
(
new
ConfigurationView
(
1L
,
false
,
false
,
"en"
,
false
,
false
,
new
ArrayList
<>(),
true
,
true
,
false
,
"0 */1 * * * ?"
,
2
,
60
,
10
,
""
,
"0 */1 * * * ?"
));
User
user
=
userService
.
register
(
registration
,
domain
,
null
);
...
...
@@ -277,7 +281,7 @@ public class UserServiceImplTest {
void
shouldRegisterUserWithGlobalGuestRoleAndRoleInDomain
()
{
when
(
userRepository
.
existsByUsername
(
anyString
())).
thenReturn
(
false
);
when
(
configurationManager
.
getConfiguration
()).
thenReturn
(
new
ConfigurationView
(
1L
,
false
,
false
,
"en"
,
false
,
false
,
new
ArrayList
<>(),
true
,
false
,
true
,
"0 */1 * * * ?"
,
2
,
60
,
10
,
""
,
"0 */1 * * * ?"
));
Registration
registration
=
new
Registration
(
"test"
,
"testpass"
,
"test@test.com"
,
"name"
,
"surname"
,
1L
,
true
,
true
);
Registration
registration
=
new
Registration
(
"test"
,
"testpass"
,
"test@test.com"
,
"name"
,
"surname"
,
1L
,
true
,
true
);
Domain
globalDomain
=
new
Domain
(
"GLOBAL"
,
"GLOBAL"
);
Domain
domain
=
new
Domain
(
"Non Global"
,
"NONGLO"
);
User
user
=
userService
.
register
(
registration
,
globalDomain
,
domain
);
...
...
@@ -333,7 +337,7 @@ public class UserServiceImplTest {
}
@Test
void
updateShouldPassCorrectly
(){
void
updateShouldPassCorrectly
()
{
when
(
userRepository
.
existsById
(
anyLong
())).
thenReturn
(
true
);
User
user
=
new
User
(
"test"
,
true
);
user
.
setId
((
long
)
0
);
...
...
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