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
Jean-Francois Leveque
2017-03-08 12:08:32 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d0f416fb5e34ffe5565b2d2a0ca50976ec1947c1
d0f416fb
1 parent
f92b003c
Nommage plus clair et uniformisation des commentaires
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
75 additions
and
20 deletions
src/main/java/org/legrog/web/account/AccountService.java
src/main/java/org/legrog/web/account/AccountServiceDefault.java
src/main/java/org/legrog/web/publisher/PublisherService.java
src/main/java/org/legrog/web/publisher/PublisherServiceDefault.java
src/main/java/org/legrog/web/xyz/ReindexView.java
src/main/java/org/legrog/web/xyz/reindex.xhtml
src/test/java/org/legrog/web/account/AccountServiceDefaultTest.java
src/test/java/org/legrog/web/publisher/PublisherServiceDefaultTest.java
src/test/java/org/legrog/web/xyz/ReindexViewTest.java
src/main/java/org/legrog/web/account/AccountService.java
View file @
d0f416f
...
...
@@ -26,7 +26,7 @@ public interface AccountService {
/**
*
* @param indexedAccounts IndexedAccount to convert
* @return Account
s
* @return Account
List
*/
List
<
Account
>
convert
(
List
<
IndexedAccount
>
indexedAccounts
);
List
<
Account
>
convert
IndexedAccountsIntoAccounts
(
List
<
IndexedAccount
>
indexedAccounts
);
}
...
...
src/main/java/org/legrog/web/account/AccountServiceDefault.java
View file @
d0f416f
...
...
@@ -48,11 +48,11 @@ public class AccountServiceDefault implements AccountService {
@Override
public
List
<
Account
>
search
(
@NotNull
String
string
)
throws
SearchingException
{
return
convert
(
accountSearchRepository
.
search
(
string
));
return
convert
IndexedAccountsIntoAccounts
(
accountSearchRepository
.
search
(
string
));
}
@Override
public
List
<
Account
>
convert
(
List
<
IndexedAccount
>
indexedAccounts
)
{
public
List
<
Account
>
convert
IndexedAccountsIntoAccounts
(
List
<
IndexedAccount
>
indexedAccounts
)
{
List
<
Integer
>
integers
=
new
ArrayList
<>(
indexedAccounts
.
size
());
indexedAccounts
.
forEach
(
indexedAccount
->
integers
.
add
(
indexedAccount
.
getUserId
()));
...
...
src/main/java/org/legrog/web/publisher/PublisherService.java
View file @
d0f416f
...
...
@@ -80,8 +80,8 @@ public interface PublisherService {
/**
*
* @param indexedPublishers
IndexedPublisher Lis
t
* @param indexedPublishers
to conver
t
* @return PublisherVersion List
*/
List
<
PublisherVersion
>
convert
(
List
<
IndexedPublisher
>
indexedPublishers
);
List
<
PublisherVersion
>
convert
IndexedPublishersIntoPublisherVersions
(
List
<
IndexedPublisher
>
indexedPublishers
);
}
\ No newline at end of file
...
...
src/main/java/org/legrog/web/publisher/PublisherServiceDefault.java
View file @
d0f416f
...
...
@@ -138,11 +138,11 @@ public class PublisherServiceDefault implements PublisherService {
@Override
public
List
<
PublisherVersion
>
search
(
@NotNull
String
string
)
throws
SearchingException
{
return
convert
(
publisherSearchRepository
.
search
(
string
));
return
convert
IndexedPublishersIntoPublisherVersions
(
publisherSearchRepository
.
search
(
string
));
}
@Override
public
List
<
PublisherVersion
>
convert
(
List
<
IndexedPublisher
>
indexedPublishers
)
{
public
List
<
PublisherVersion
>
convert
IndexedPublishersIntoPublisherVersions
(
List
<
IndexedPublisher
>
indexedPublishers
)
{
List
<
Integer
>
integers
=
new
ArrayList
<>(
indexedPublishers
.
size
());
indexedPublishers
.
forEach
(
indexedPublisher
->
integers
.
add
(
indexedPublisher
.
getPublisherId
()));
...
...
src/main/java/org/legrog/web/xyz/ReindexView.java
0 → 100644
View file @
d0f416f
package
org
.
legrog
.
web
.
xyz
;
import
javax.enterprise.context.RequestScoped
;
import
javax.inject.Named
;
import
java.io.Serializable
;
/**
* View for reindex.xhtml
*/
@Named
@RequestScoped
public
class
ReindexView
implements
Serializable
{
private
int
indexedAccountsNumber
;
private
int
indexedPublishersNumber
;
ReindexView
()
{
//no args constructor to make it proxyable
}
public
int
getIndexedAccountsNumber
()
{
return
indexedAccountsNumber
;
}
public
void
setIndexedAccountsNumber
(
int
indexedAccountsNumber
)
{
this
.
indexedAccountsNumber
=
indexedAccountsNumber
;
}
public
int
getIndexedPublishersNumber
()
{
return
indexedPublishersNumber
;
}
public
void
setIndexedPublishersNumber
(
int
indexedPublishersNumber
)
{
this
.
indexedPublishersNumber
=
indexedPublishersNumber
;
}
}
src/main/java/org/legrog/web/xyz/reindex.xhtml
0 → 100644
View file @
d0f416f
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:h=
"http://xmlns.jcp.org/jsf/html"
xmlns:ui=
"http://xmlns.jcp.org/jsf/facelets"
xmlns:f=
"http://xmlns.jcp.org/jsf/core"
>
<f:view>
<h:outputLabel
value=
"Hello, world"
/>
</f:view>
</html>
src/test/java/org/legrog/web/account/AccountServiceDefaultTest.java
View file @
d0f416f
...
...
@@ -40,22 +40,22 @@ public class AccountServiceDefaultTest {
}
@DisplayName
(
"When getting IndexedAccounts from search, should convert them"
)
@DisplayName
(
"When getting IndexedAccounts from search, should convert
IndexedAccountsIntoAccounts
them"
)
@Test
public
void
testConvertReturnedIndexedAccounts
(
@Mock
AccountSearchRepository
accountSearchRepository
)
throws
SearchingException
{
List
<
IndexedAccount
>
indexedAccounts
=
new
ArrayList
<>();
when
(
accountSearchRepository
.
search
(
"4"
)).
thenReturn
(
indexedAccounts
);
accountServiceDefault
.
search
(
"4"
);
verify
(
accountServiceDefault
,
times
(
1
)).
convert
(
indexedAccounts
);
verify
(
accountServiceDefault
,
times
(
1
)).
convert
IndexedAccountsIntoAccounts
(
indexedAccounts
);
}
@DisplayName
(
"When called, should return the Accounts it gets from convert"
)
@DisplayName
(
"When called, should return the Accounts it gets from convert
IndexedAccountsIntoAccounts
"
)
@Test
public
void
testReturnFromConvert
(
@Mock
AccountSearchRepository
accountSearchRepository
)
throws
SearchingException
{
List
<
Account
>
accounts
=
new
ArrayList
<>();
List
<
IndexedAccount
>
indexedAccounts
=
new
ArrayList
<>();
Mockito
.
doReturn
(
accounts
).
when
(
accountServiceDefault
).
convert
(
indexedAccounts
);
Mockito
.
doReturn
(
accounts
).
when
(
accountServiceDefault
).
convert
IndexedAccountsIntoAccounts
(
indexedAccounts
);
when
(
accountSearchRepository
.
search
(
"5"
)).
thenReturn
(
indexedAccounts
);
assertThat
(
accountServiceDefault
.
search
(
"5"
)).
isEqualTo
(
accounts
);
}
...
...
@@ -63,7 +63,7 @@ public class AccountServiceDefaultTest {
}
@Nested
@DisplayName
(
"convert method"
)
@DisplayName
(
"convert
IndexedAccountsIntoAccounts
method"
)
class
ConvertTests
{
@DisplayName
(
"When called, should return the Accounts it gets from findByUserIdIn"
)
@Test
...
...
@@ -71,7 +71,7 @@ public class AccountServiceDefaultTest {
List
<
Account
>
accounts
=
new
ArrayList
<>();
List
<
IndexedAccount
>
indexedAccounts
=
new
ArrayList
<>();
when
(
accountRepository
.
findByUserIdIn
(
Mockito
.
any
())).
thenReturn
(
accounts
);
assertThat
(
accountServiceDefault
.
convert
(
indexedAccounts
)).
isEqualTo
(
accounts
);
assertThat
(
accountServiceDefault
.
convert
IndexedAccountsIntoAccounts
(
indexedAccounts
)).
isEqualTo
(
accounts
);
}
}
...
...
src/test/java/org/legrog/web/publisher/PublisherServiceDefaultTest.java
View file @
d0f416f
...
...
@@ -170,22 +170,22 @@ public class PublisherServiceDefaultTest {
}
@DisplayName
(
"When getting IndexedPublishers from search, should convert them"
)
@DisplayName
(
"When getting IndexedPublishers from search, should convert
IndexedAccountsIntoAccounts
them"
)
@Test
public
void
testConvertReturnedIndexedPublishers
(
@Mock
PublisherSearchRepository
publisherSearchRepository
)
throws
SearchingException
{
List
<
IndexedPublisher
>
indexedPublishers
=
new
ArrayList
<>();
when
(
publisherSearchRepository
.
search
(
"4"
)).
thenReturn
(
indexedPublishers
);
publisherServiceDefault
.
search
(
"4"
);
verify
(
publisherServiceDefault
,
times
(
1
)).
convert
(
indexedPublishers
);
verify
(
publisherServiceDefault
,
times
(
1
)).
convert
IndexedPublishersIntoPublisherVersions
(
indexedPublishers
);
}
@DisplayName
(
"When called, should return the PublisherVersions it gets from convert"
)
@DisplayName
(
"When called, should return the PublisherVersions it gets from convert
IndexedAccountsIntoAccounts
"
)
@Test
public
void
testReturnFromConvert
(
@Mock
PublisherSearchRepository
publisherSearchRepository
)
throws
SearchingException
{
List
<
PublisherVersion
>
publisherVersions
=
new
ArrayList
<>();
List
<
IndexedPublisher
>
indexedPublishers
=
new
ArrayList
<>();
Mockito
.
doReturn
(
publisherVersions
).
when
(
publisherServiceDefault
).
convert
(
indexedPublishers
);
Mockito
.
doReturn
(
publisherVersions
).
when
(
publisherServiceDefault
).
convert
IndexedPublishersIntoPublisherVersions
(
indexedPublishers
);
when
(
publisherSearchRepository
.
search
(
"5"
)).
thenReturn
(
indexedPublishers
);
assertThat
(
publisherServiceDefault
.
search
(
"5"
)).
isEqualTo
(
publisherVersions
);
}
...
...
@@ -193,7 +193,7 @@ public class PublisherServiceDefaultTest {
}
@Nested
@DisplayName
(
"convert method"
)
@DisplayName
(
"convert
IndexedAccountsIntoAccounts
method"
)
class
ConvertTests
{
@DisplayName
(
"When called, should return the PublisherVersions it gets from findByPublisherVersionIdIn"
)
@Test
...
...
@@ -201,7 +201,7 @@ public class PublisherServiceDefaultTest {
List
<
PublisherVersion
>
publisherVersions
=
new
ArrayList
<>();
List
<
IndexedPublisher
>
indexedPublishers
=
new
ArrayList
<>();
when
(
publisherVersionRepository
.
findByPublisherVersionIdIn
(
Mockito
.
any
())).
thenReturn
(
publisherVersions
);
assertThat
(
publisherServiceDefault
.
convert
(
indexedPublishers
)).
isEqualTo
(
publisherVersions
);
assertThat
(
publisherServiceDefault
.
convert
IndexedPublishersIntoPublisherVersions
(
indexedPublishers
)).
isEqualTo
(
publisherVersions
);
}
}
...
...
src/test/java/org/legrog/web/xyz/ReindexViewTest.java
0 → 100644
View file @
d0f416f
package
org
.
legrog
.
web
.
xyz
;
/**
* Classe testing ReindexView
*/
public
class
ReindexViewTest
{
}
Please
register
or
login
to post a comment