Toggle navigation
Toggle navigation
This project
Loading...
Sign in
grogv3
/
grog-cubi
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
JR Utily
2017-02-07 08:32:14 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
978a4054f9d34feed86cc43471e92ff52789a165
978a4054
1 parent
55b911f2
remove Spring from implementations names
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
24 deletions
src/main/java/org/legrog/web/publisher/PublisherServiceSpring.java → src/main/java/org/legrog/web/publisher/PublisherServiceDefault.java
src/main/java/org/legrog/web/user/UserServiceSpring.java → src/main/java/org/legrog/web/user/UserServiceDefault.java
src/main/java/org/legrog/web/xyz/SharedServiceSpring.java → src/main/java/org/legrog/web/xyz/SharedServiceDefault.java
src/test/java/org/legrog/web/publisher/PublisherServiceSpringTest.java → src/test/java/org/legrog/web/publisher/PublisherServiceDefaultTest.java
src/main/java/org/legrog/web/publisher/PublisherService
Spring
.java
→
src/main/java/org/legrog/web/publisher/PublisherService
Default
.java
View file @
978a405
...
...
@@ -19,7 +19,7 @@ import java.util.Set;
*/
@Stateless
public
class
PublisherService
Spring
implements
PublisherService
{
public
class
PublisherService
Default
implements
PublisherService
{
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
PublisherRepository
publisherRepository
;
...
...
@@ -29,11 +29,11 @@ public class PublisherServiceSpring implements PublisherService {
SharedService
sharedService
;
@Inject
public
PublisherService
Spring
(
PublisherRepository
publisherRepository
,
PublisherVersionRepository
publisherVersionRepository
,
PublisherActionRepository
publisherActionRepository
,
PublisherSearchRepository
publisherSearchRepository
,
SharedService
sharedService
)
{
public
PublisherService
Default
(
PublisherRepository
publisherRepository
,
PublisherVersionRepository
publisherVersionRepository
,
PublisherActionRepository
publisherActionRepository
,
PublisherSearchRepository
publisherSearchRepository
,
SharedService
sharedService
)
{
this
.
publisherRepository
=
publisherRepository
;
this
.
publisherVersionRepository
=
publisherVersionRepository
;
this
.
publisherActionRepository
=
publisherActionRepository
;
...
...
@@ -42,7 +42,7 @@ public class PublisherServiceSpring implements PublisherService {
}
//no args constructor to make it proxyable
PublisherService
Spring
()
{
PublisherService
Default
()
{
}
public
PublisherVersion
addNewPublisher
(
PublisherVersion
publisherVersion
)
{
...
...
src/main/java/org/legrog/web/user/UserService
Spring
.java
→
src/main/java/org/legrog/web/user/UserService
Default
.java
View file @
978a405
...
...
@@ -8,7 +8,7 @@ import javax.inject.Inject;
import
java.util.List
;
@Stateless
public
class
UserService
Spring
implements
UserService
{
public
class
UserService
Default
implements
UserService
{
@Inject
AccountRepository
accountRepository
;
...
...
src/main/java/org/legrog/web/xyz/SharedService
Spring
.java
→
src/main/java/org/legrog/web/xyz/SharedService
Default
.java
View file @
978a405
...
...
@@ -12,7 +12,7 @@ import java.util.Random;
import
java.util.Vector
;
@Stateless
public
class
SharedService
Spring
implements
SharedService
{
public
class
SharedService
Default
implements
SharedService
{
CountryRepository
countryRepository
;
AccountRoleRepository
accountRoleRepository
;
...
...
@@ -20,8 +20,8 @@ public class SharedServiceSpring implements SharedService {
UserService
userService
;
@Inject
public
SharedService
Spring
(
CountryRepository
countryRepository
,
AccountRoleRepository
accountRoleRepository
,
AccountPropertyRepository
accountPropertyRepository
,
UserService
userService
)
{
public
SharedService
Default
(
CountryRepository
countryRepository
,
AccountRoleRepository
accountRoleRepository
,
AccountPropertyRepository
accountPropertyRepository
,
UserService
userService
)
{
this
.
countryRepository
=
countryRepository
;
this
.
accountRoleRepository
=
accountRoleRepository
;
this
.
accountPropertyRepository
=
accountPropertyRepository
;
...
...
src/test/java/org/legrog/web/publisher/PublisherService
Spring
Test.java
→
src/test/java/org/legrog/web/publisher/PublisherService
Default
Test.java
View file @
978a405
...
...
@@ -14,24 +14,21 @@ import org.mockito.Captor;
import
org.mockito.Mock
;
import
org.mockito.Mockito
;
import
javax.inject.Inject
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.*;
/**
* Classe testant PublisherService
Spring
.
* Classe testant PublisherService
Default
.
*/
@RunWith
(
JUnitPlatform
.
class
)
@ExtendWith
(
MockitoExtension
.
class
)
@DisplayName
(
"Service layer for all publisher-related data"
)
public
class
PublisherService
Spring
Test
{
public
class
PublisherService
Default
Test
{
PublisherService
Spring
publisherServiceSpring
;
PublisherService
Default
publisherServiceDefault
;
PublisherVersion
publisherVersion
;
PublisherVersion
publisherVersion1
;
Publisher
publisher
;
...
...
@@ -50,7 +47,7 @@ public class PublisherServiceSpringTest {
@Mock
PublisherActionRepository
publisherActionRepository
,
@Mock
PublisherSearchRepository
publisherSearchRepository
,
@Mock
SharedService
sharedService
)
throws
Exception
{
publisherService
Spring
=
new
PublisherServiceSpring
(
publisherRepository
,
publisherService
Default
=
new
PublisherServiceDefault
(
publisherRepository
,
publisherVersionRepository
,
publisherActionRepository
,
publisherSearchRepository
,
sharedService
);
publisherVersion
=
new
PublisherVersion
();
publisherVersion1
=
new
PublisherVersion
();
...
...
@@ -60,7 +57,7 @@ public class PublisherServiceSpringTest {
@DisplayName
(
"When a new publisher is added, both Publisher and PublisherVersion should be saved in the right state"
)
@Test
public
void
testAddNewPublisher
(
@Mock
PublisherVersionRepository
publisherVersionRepository
)
{
publisherService
Spring
.
addNewPublisher
(
publisherVersion
);
publisherService
Default
.
addNewPublisher
(
publisherVersion
);
publisher
=
publisherVersion
.
getPublisher
();
assertThat
(
publisher
.
getVersions
()).
containsExactly
(
publisherVersion
);
assertThat
(
publisherVersion
.
getPublisher
()).
isEqualTo
(
publisher
);
...
...
@@ -72,9 +69,9 @@ public class PublisherServiceSpringTest {
@Test
public
void
testAddVersionToPublisher
(
@Mock
PublisherRepository
publisherRepository
,
@Mock
PublisherVersionRepository
publisherVersionRepository
)
{
publisherService
Spring
.
addNewPublisher
(
publisherVersion
);
publisherService
Default
.
addNewPublisher
(
publisherVersion
);
publisher
=
publisherVersion
.
getPublisher
();
publisherService
Spring
.
addVersionToPublisher
(
publisher
,
publisherVersion1
);
publisherService
Default
.
addVersionToPublisher
(
publisher
,
publisherVersion1
);
assertThat
(
publisherVersion1
.
getPublisher
()).
isEqualTo
(
publisher
);
assertThat
(
publisher
.
getVersions
()).
contains
(
publisherVersion
,
publisherVersion1
);
verify
(
publisherRepository
,
times
(
2
)).
save
(
publisher
);
...
...
@@ -94,7 +91,7 @@ public class PublisherServiceSpringTest {
publisher
.
setVersions
(
publisherVersions
);
when
(
publisherVersionMock
.
getPublisher
()).
thenReturn
(
publisher
);
publisherService
Spring
.
validatePublisherVersion
(
publisherVersionMock
);
publisherService
Default
.
validatePublisherVersion
(
publisherVersionMock
);
assertThat
(
publisher
.
getValidatedVersion
()).
isEqualTo
(
publisherVersionMock
);
}
...
...
@@ -108,7 +105,7 @@ public class PublisherServiceSpringTest {
when
(
publisherVersionMock
.
getPublisher
()).
thenReturn
(
publisher
);
when
(
publisherVersionMock
.
getPublisherName
()).
thenReturn
(
"nom"
);
when
(
publisherVersionMock
.
getPublisherHistory
()).
thenReturn
(
"histoire"
);
publisherService
Spring
.
validatePublisherVersion
(
publisherVersionMock
);
publisherService
Default
.
validatePublisherVersion
(
publisherVersionMock
);
try
{
Mockito
.
verify
(
publisherSearchRepository
).
save
(
indexedPublisherArgumentCaptor
.
capture
());
}
catch
(
IndexingException
e
)
{
...
...
@@ -129,7 +126,7 @@ public class PublisherServiceSpringTest {
publisher
=
new
Publisher
();
when
(
publisherVersionMock
.
getPublisher
()).
thenReturn
(
publisher
);
publisherAction
=
publisherService
Spring
.
validatePublisherVersion
(
publisherVersionMock
);
publisherAction
=
publisherService
Default
.
validatePublisherVersion
(
publisherVersionMock
);
verify
(
publisherActionRepository
).
save
(
publisherAction
);
assertThat
(
publisherAction
.
getPublisherVersion
()).
isEqualTo
(
publisherVersionMock
);
assertThat
(
publisherAction
.
getPublisher
()).
isEqualTo
(
publisher
);
...
...
Please
register
or
login
to post a comment