This is the codeAbility Sharing Platform! Learn more about the
codeAbility Sharing Platform
.
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
codeAbility Sharing Platform
Manage
Activity
Members
Labels
Plan
Issues
43
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
development
sharing
codeAbility Sharing Platform
Commits
2d9282e4
Commit
2d9282e4
authored
3 years ago
by
Michael Breu
Browse files
Options
Downloads
Patches
Plain Diff
Repairing Likes tests
parent
d319a813
Branches
Branches containing commit
2 merge requests
!91
Bringing JHipster7.6.0 to production
,
!89
Resolve "Restore Gitsearch Integration Tests"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/java/at/ac/uibk/gitsearch/web/rest/LikesResourceIT.java
+14
-4
14 additions, 4 deletions
...t/java/at/ac/uibk/gitsearch/web/rest/LikesResourceIT.java
src/test/resources/config/application.yml
+8
-0
8 additions, 0 deletions
src/test/resources/config/application.yml
with
22 additions
and
4 deletions
src/test/java/at/ac/uibk/gitsearch/web/rest/LikesResourceIT.java
+
14
−
4
View file @
2d9282e4
...
...
@@ -36,7 +36,9 @@ import org.springframework.transaction.annotation.Transactional;
import
at.ac.uibk.gitsearch.GitsearchApp
;
import
at.ac.uibk.gitsearch.domain.Likes
;
import
at.ac.uibk.gitsearch.domain.User
;
import
at.ac.uibk.gitsearch.repository.LikesRepository
;
import
at.ac.uibk.gitsearch.repository.UserRepository
;
import
at.ac.uibk.gitsearch.repository.search.LikesSearchRepository
;
import
at.ac.uibk.gitsearch.security.AuthoritiesConstants
;
import
at.ac.uibk.gitsearch.service.LikesService
;
...
...
@@ -47,7 +49,7 @@ import at.ac.uibk.gitsearch.service.LikesService;
@SpringBootTest
(
classes
=
GitsearchApp
.
class
)
@ExtendWith
(
MockitoExtension
.
class
)
@AutoConfigureMockMvc
@WithMockUser
(
value
=
TEST_USER_LOGIN
,
authorities
=
{
"sharing"
,
AuthoritiesConstants
.
ADMIN
})
@WithMockUser
(
value
=
"user"
,
authorities
=
{
"sharing"
,
AuthoritiesConstants
.
ADMIN
})
public
class
LikesResourceIT
{
private
static
final
LocalDate
DEFAULT_DATE
=
LocalDate
.
ofEpochDay
(
0L
);
...
...
@@ -78,6 +80,8 @@ public class LikesResourceIT {
@Autowired
private
LikesSearchRepository
mockLikesSearchRepository
;
@Autowired
private
UserRepository
userRepo
;
@Autowired
private
EntityManager
em
;
...
...
@@ -130,7 +134,8 @@ public class LikesResourceIT {
assertThat
(
testLikes
.
getExerciseID
()).
isEqualTo
(
DEFAULT_EXERCISE_ID
);
// Validate the Likes in Elasticsearch
verify
(
mockLikesSearchRepository
,
times
(
1
)).
save
(
testLikes
);
// we do not store likes in ES!
//verify(mockLikesSearchRepository, times(1)).save(testLikes);
}
@Test
...
...
@@ -246,6 +251,8 @@ public class LikesResourceIT {
@Test
@Transactional
public
void
testLikeWorkflowWithAuthorities
()
throws
Exception
{
List
<
User
>
userList
=
userRepo
.
findAll
();
// Initialize the database
likesRepository
.
saveAndFlush
(
likes
);
...
...
@@ -626,7 +633,9 @@ public class LikesResourceIT {
assertThat
(
testLikes
.
getExerciseID
()).
isEqualTo
(
UPDATED_EXERCISE_ID
);
// Validate the Likes in Elasticsearch
verify
(
mockLikesSearchRepository
,
times
(
2
)).
save
(
testLikes
);
// We do not use Elasticsearch for saving Likes Entities
// verify(mockLikesSearchRepository, times(2)).save(testLikes);
}
@Test
...
...
@@ -664,7 +673,8 @@ public class LikesResourceIT {
assertThat
(
likesList
).
hasSize
(
databaseSizeBeforeDelete
-
1
);
// Validate the Likes in Elasticsearch
verify
(
mockLikesSearchRepository
,
times
(
1
)).
deleteById
(
likes
.
getId
());
// We do not use Elasticsearch for saving Likes Entities
// verify(mockLikesSearchRepository, times(1)).deleteById(likes.getId());
}
// @Test
...
...
This diff is collapsed.
Click to expand it.
src/test/resources/config/application.yml
+
8
−
0
View file @
2d9282e4
...
...
@@ -12,6 +12,14 @@
# Full reference is available at:
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ===================================================================
logging
:
level
:
ROOT
:
DEBUG
tech.jhipster
:
DEBUG
org.hibernate.SQL
:
DEBUG
at.ac.uibk.gitsearch
:
DEBUG
org.glassfish.jersey.client.ClientExecutorProvidersConfigurator
:
INFO
javax.management.mbeanserver
:
INFO
spring
:
profiles
:
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment