Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
eaea8f98
Unverified
Commit
eaea8f98
authored
Sep 16, 2018
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
#12509 评论时间
parent
351612c3
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
44 additions
and
42 deletions
+44
-42
src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
...ain/java/org/b3log/solo/api/symphony/CommentReceiver.java
+3
-3
src/main/java/org/b3log/solo/model/Comment.java
src/main/java/org/b3log/solo/model/Comment.java
+9
-3
src/main/java/org/b3log/solo/processor/util/Filler.java
src/main/java/org/b3log/solo/processor/util/Filler.java
+2
-2
src/main/java/org/b3log/solo/service/CommentMgmtService.java
src/main/java/org/b3log/solo/service/CommentMgmtService.java
+5
-5
src/main/java/org/b3log/solo/service/CommentQueryService.java
...main/java/org/b3log/solo/service/CommentQueryService.java
+7
-7
src/main/java/org/b3log/solo/service/InitService.java
src/main/java/org/b3log/solo/service/InitService.java
+2
-3
src/main/resources/repository.json
src/main/resources/repository.json
+4
-4
src/test/java/org/b3log/solo/repository/impl/CommentRepositoryImplTestCase.java
...g/solo/repository/impl/CommentRepositoryImplTestCase.java
+9
-12
src/test/java/org/b3log/solo/service/CommentMgmtServiceTestCase.java
...va/org/b3log/solo/service/CommentMgmtServiceTestCase.java
+3
-3
No files found.
src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
View file @
eaea8f98
...
@@ -55,7 +55,7 @@ import java.util.Date;
...
@@ -55,7 +55,7 @@ import java.util.Date;
* Comment receiver (from B3log Symphony).
* Comment receiver (from B3log Symphony).
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.1.1
5, Aug 2
, 2018
* @version 1.1.1.1
6, Sep 16
, 2018
* @since 0.5.5
* @since 0.5.5
*/
*/
@RequestProcessor
@RequestProcessor
...
@@ -202,8 +202,8 @@ public class CommentReceiver {
...
@@ -202,8 +202,8 @@ public class CommentReceiver {
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
commentContent
);
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
commentContent
);
final
Date
date
=
new
Date
();
final
Date
date
=
new
Date
();
comment
.
put
(
Comment
.
COMMENT_
DATE
,
date
);
comment
.
put
(
Comment
.
COMMENT_
CREATED
,
date
.
getTime
()
);
ret
.
put
(
Comment
.
COMMENT_DATE
,
DateFormatUtils
.
format
(
date
,
"yyyy-MM-dd HH:mm:ss"
));
ret
.
put
(
Comment
.
COMMENT_
T_
DATE
,
DateFormatUtils
.
format
(
date
,
"yyyy-MM-dd HH:mm:ss"
));
if
(
StringUtils
.
isNotBlank
(
originalCommentId
))
{
if
(
StringUtils
.
isNotBlank
(
originalCommentId
))
{
originalComment
=
commentRepository
.
get
(
originalCommentId
);
originalComment
=
commentRepository
.
get
(
originalCommentId
);
if
(
null
!=
originalComment
)
{
if
(
null
!=
originalComment
)
{
...
...
src/main/java/org/b3log/solo/model/Comment.java
View file @
eaea8f98
...
@@ -22,7 +22,7 @@ package org.b3log.solo.model;
...
@@ -22,7 +22,7 @@ package org.b3log.solo.model;
* This class defines all comment model relevant keys.
* This class defines all comment model relevant keys.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
0.0.7, Jan 18, 2013
* @version 1.
1.0.0, Sep 16, 2018
* @since 0.3.1
* @since 0.3.1
*/
*/
public
final
class
Comment
{
public
final
class
Comment
{
...
@@ -62,10 +62,15 @@ public final class Comment {
...
@@ -62,10 +62,15 @@ public final class Comment {
*/
*/
public
static
final
String
COMMENT_SHARP_URL
=
"commentSharpURL"
;
public
static
final
String
COMMENT_SHARP_URL
=
"commentSharpURL"
;
/**
* Key of comment created at.
*/
public
static
final
String
COMMENT_CREATED
=
"commentCreated"
;
/**
/**
* Key of comment date.
* Key of comment date.
*/
*/
public
static
final
String
COMMENT_DATE
=
"commentDate"
;
public
static
final
String
COMMENT_
T_
DATE
=
"commentDate"
;
/**
/**
* Key of comment time.
* Key of comment time.
...
@@ -100,5 +105,6 @@ public final class Comment {
...
@@ -100,5 +105,6 @@ public final class Comment {
/**
/**
* Private constructor.
* Private constructor.
*/
*/
private
Comment
()
{}
private
Comment
()
{
}
}
}
src/main/java/org/b3log/solo/processor/util/Filler.java
View file @
eaea8f98
...
@@ -66,7 +66,7 @@ import static org.b3log.solo.model.Article.ARTICLE_CONTENT;
...
@@ -66,7 +66,7 @@ import static org.b3log.solo.model.Article.ARTICLE_CONTENT;
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.6.16.
5, Sep 2
, 2018
* @version 1.6.16.
6, Sep 16
, 2018
* @since 0.3.1
* @since 0.3.1
*/
*/
@Service
@Service
...
@@ -549,7 +549,7 @@ public class Filler {
...
@@ -549,7 +549,7 @@ public class Filler {
comment
.
put
(
Comment
.
COMMENT_URL
,
comment
.
getString
(
Comment
.
COMMENT_URL
));
comment
.
put
(
Comment
.
COMMENT_URL
,
comment
.
getString
(
Comment
.
COMMENT_URL
));
comment
.
put
(
Common
.
IS_REPLY
,
false
);
comment
.
put
(
Common
.
IS_REPLY
,
false
);
comment
.
remove
(
Comment
.
COMMENT_EMAIL
);
// Erases email for security reason
comment
.
remove
(
Comment
.
COMMENT_EMAIL
);
// Erases email for security reason
comment
.
put
(
"commentDate2"
,
comment
.
opt
(
Comment
.
COMMENT_DATE
));
comment
.
put
(
"commentDate2"
,
new
Date
(
comment
.
optLong
(
Comment
.
COMMENT_CREATED
)
));
final
String
email
=
comment
.
optString
(
Comment
.
COMMENT_EMAIL
);
final
String
email
=
comment
.
optString
(
Comment
.
COMMENT_EMAIL
);
final
String
thumbnailURL
=
comment
.
optString
(
Comment
.
COMMENT_THUMBNAIL_URL
);
final
String
thumbnailURL
=
comment
.
optString
(
Comment
.
COMMENT_THUMBNAIL_URL
);
...
...
src/main/java/org/b3log/solo/service/CommentMgmtService.java
View file @
eaea8f98
...
@@ -57,7 +57,7 @@ import java.util.Date;
...
@@ -57,7 +57,7 @@ import java.util.Date;
* Comment management service.
* Comment management service.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.3.
1, Aug 2
, 2018
* @version 1.3.3.
2, Sep 16
, 2018
* @since 0.3.5
* @since 0.3.5
*/
*/
@Service
@Service
...
@@ -426,8 +426,8 @@ public class CommentMgmtService {
...
@@ -426,8 +426,8 @@ public class CommentMgmtService {
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
final
Date
date
=
new
Date
();
final
Date
date
=
new
Date
();
comment
.
put
(
Comment
.
COMMENT_
DATE
,
date
);
comment
.
put
(
Comment
.
COMMENT_
CREATED
,
date
.
getTime
()
);
ret
.
put
(
Comment
.
COMMENT_DATE
,
DateFormatUtils
.
format
(
date
,
"yyyy-MM-dd HH:mm:ss"
));
ret
.
put
(
Comment
.
COMMENT_
T_
DATE
,
DateFormatUtils
.
format
(
date
,
"yyyy-MM-dd HH:mm:ss"
));
ret
.
put
(
"commentDate2"
,
date
);
ret
.
put
(
"commentDate2"
,
date
);
ret
.
put
(
Common
.
COMMENTABLE
,
preference
.
getBoolean
(
Option
.
ID_C_COMMENTABLE
)
&&
page
.
getBoolean
(
Page
.
PAGE_COMMENTABLE
));
ret
.
put
(
Common
.
COMMENTABLE
,
preference
.
getBoolean
(
Option
.
ID_C_COMMENTABLE
)
&&
page
.
getBoolean
(
Page
.
PAGE_COMMENTABLE
));
...
@@ -562,8 +562,8 @@ public class CommentMgmtService {
...
@@ -562,8 +562,8 @@ public class CommentMgmtService {
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
final
Date
date
=
new
Date
();
final
Date
date
=
new
Date
();
comment
.
put
(
Comment
.
COMMENT_
DATE
,
date
);
comment
.
put
(
Comment
.
COMMENT_
CREATED
,
date
.
getTime
()
);
ret
.
put
(
Comment
.
COMMENT_DATE
,
DateFormatUtils
.
format
(
date
,
"yyyy-MM-dd HH:mm:ss"
));
ret
.
put
(
Comment
.
COMMENT_
T_
DATE
,
DateFormatUtils
.
format
(
date
,
"yyyy-MM-dd HH:mm:ss"
));
ret
.
put
(
"commentDate2"
,
date
);
ret
.
put
(
"commentDate2"
,
date
);
ret
.
put
(
Common
.
COMMENTABLE
,
preference
.
getBoolean
(
Option
.
ID_C_COMMENTABLE
)
&&
article
.
getBoolean
(
Article
.
ARTICLE_COMMENTABLE
));
ret
.
put
(
Common
.
COMMENTABLE
,
preference
.
getBoolean
(
Option
.
ID_C_COMMENTABLE
)
&&
article
.
getBoolean
(
Article
.
ARTICLE_COMMENTABLE
));
...
...
src/main/java/org/b3log/solo/service/CommentQueryService.java
View file @
eaea8f98
...
@@ -53,7 +53,7 @@ import java.util.List;
...
@@ -53,7 +53,7 @@ import java.util.List;
* Comment query service.
* Comment query service.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.2.
0, Aug 31, 2017
* @version 1.3.2.
1, Sep 16, 2018
* @since 0.3.5
* @since 0.3.5
*/
*/
@Service
@Service
...
@@ -163,8 +163,8 @@ public class CommentQueryService {
...
@@ -163,8 +163,8 @@ public class CommentQueryService {
final
int
pageSize
=
requestJSONObject
.
getInt
(
Pagination
.
PAGINATION_PAGE_SIZE
);
final
int
pageSize
=
requestJSONObject
.
getInt
(
Pagination
.
PAGINATION_PAGE_SIZE
);
final
int
windowSize
=
requestJSONObject
.
getInt
(
Pagination
.
PAGINATION_WINDOW_SIZE
);
final
int
windowSize
=
requestJSONObject
.
getInt
(
Pagination
.
PAGINATION_WINDOW_SIZE
);
final
Query
query
=
new
Query
().
setCurrentPageNum
(
currentPageNum
).
setPageSize
(
pageSize
).
addSort
(
Comment
.
COMMENT_DATE
,
final
Query
query
=
new
Query
().
setCurrentPageNum
(
currentPageNum
).
setPageSize
(
pageSize
).
SortDirection
.
DESCENDING
);
addSort
(
Comment
.
COMMENT_CREATED
,
SortDirection
.
DESCENDING
);
final
JSONObject
result
=
commentRepository
.
get
(
query
);
final
JSONObject
result
=
commentRepository
.
get
(
query
);
final
JSONArray
comments
=
result
.
getJSONArray
(
Keys
.
RESULTS
);
final
JSONArray
comments
=
result
.
getJSONArray
(
Keys
.
RESULTS
);
...
@@ -196,8 +196,8 @@ public class CommentQueryService {
...
@@ -196,8 +196,8 @@ public class CommentQueryService {
commentContent
=
Jsoup
.
clean
(
commentContent
,
Whitelist
.
relaxed
());
commentContent
=
Jsoup
.
clean
(
commentContent
,
Whitelist
.
relaxed
());
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
commentContent
);
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
commentContent
);
comment
.
put
(
Comment
.
COMMENT_TIME
,
((
Date
)
comment
.
get
(
Comment
.
COMMENT_DATE
)).
getTime
(
));
comment
.
put
(
Comment
.
COMMENT_TIME
,
comment
.
optLong
(
Comment
.
COMMENT_CREATED
));
comment
.
remove
(
Comment
.
COMMENT_
DATE
);
comment
.
remove
(
Comment
.
COMMENT_
CREATED
);
}
}
final
int
pageCount
=
result
.
getJSONObject
(
Pagination
.
PAGINATION
).
getInt
(
Pagination
.
PAGINATION_PAGE_COUNT
);
final
int
pageCount
=
result
.
getJSONObject
(
Pagination
.
PAGINATION
).
getInt
(
Pagination
.
PAGINATION_PAGE_COUNT
);
...
@@ -232,8 +232,8 @@ public class CommentQueryService {
...
@@ -232,8 +232,8 @@ public class CommentQueryService {
final
List
<
JSONObject
>
comments
=
commentRepository
.
getComments
(
onId
,
1
,
Integer
.
MAX_VALUE
);
final
List
<
JSONObject
>
comments
=
commentRepository
.
getComments
(
onId
,
1
,
Integer
.
MAX_VALUE
);
for
(
final
JSONObject
comment
:
comments
)
{
for
(
final
JSONObject
comment
:
comments
)
{
comment
.
put
(
Comment
.
COMMENT_TIME
,
((
Date
)
comment
.
get
(
Comment
.
COMMENT_DATE
)).
getTime
(
));
comment
.
put
(
Comment
.
COMMENT_TIME
,
comment
.
optLong
(
Comment
.
COMMENT_CREATED
));
comment
.
put
(
"commentDate2"
,
comment
.
get
(
Comment
.
COMMENT_DATE
));
// 1.9.0 向后兼容
comment
.
put
(
"commentDate2"
,
new
Date
(
comment
.
optLong
(
Comment
.
COMMENT_CREATED
)
));
// 1.9.0 向后兼容
comment
.
put
(
Comment
.
COMMENT_NAME
,
comment
.
getString
(
Comment
.
COMMENT_NAME
));
comment
.
put
(
Comment
.
COMMENT_NAME
,
comment
.
getString
(
Comment
.
COMMENT_NAME
));
String
url
=
comment
.
getString
(
Comment
.
COMMENT_URL
);
String
url
=
comment
.
getString
(
Comment
.
COMMENT_URL
);
if
(
StringUtils
.
contains
(
url
,
"<"
))
{
// legacy issue https://github.com/b3log/solo/issues/12091
if
(
StringUtils
.
contains
(
url
,
"<"
))
{
// legacy issue https://github.com/b3log/solo/issues/12091
...
...
src/main/java/org/b3log/solo/service/InitService.java
View file @
eaea8f98
...
@@ -57,7 +57,7 @@ import java.util.Set;
...
@@ -57,7 +57,7 @@ import java.util.Set;
* Solo initialization service.
* Solo initialization service.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.5.2.2
1, Aug 2
, 2018
* @version 1.5.2.2
2, Sep 16
, 2018
* @since 0.4.0
* @since 0.4.0
*/
*/
@Service
@Service
...
@@ -305,7 +305,6 @@ public class InitService {
...
@@ -305,7 +305,6 @@ public class InitService {
final
String
articleId
=
addHelloWorldArticle
(
article
);
final
String
articleId
=
addHelloWorldArticle
(
article
);
final
JSONObject
comment
=
new
JSONObject
();
final
JSONObject
comment
=
new
JSONObject
();
comment
.
put
(
Keys
.
OBJECT_ID
,
articleId
);
comment
.
put
(
Keys
.
OBJECT_ID
,
articleId
);
comment
.
put
(
Comment
.
COMMENT_NAME
,
"Daniel"
);
comment
.
put
(
Comment
.
COMMENT_NAME
,
"Daniel"
);
comment
.
put
(
Comment
.
COMMENT_EMAIL
,
"d@b3log.org"
);
comment
.
put
(
Comment
.
COMMENT_EMAIL
,
"d@b3log.org"
);
...
@@ -314,7 +313,7 @@ public class InitService {
...
@@ -314,7 +313,7 @@ public class InitService {
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
,
""
);
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
,
""
);
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_NAME
,
""
);
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_NAME
,
""
);
comment
.
put
(
Comment
.
COMMENT_THUMBNAIL_URL
,
Solos
.
GRAVATAR
+
"59a5e8209c780307dbe9c9ba728073f5??s=60&r=G"
);
comment
.
put
(
Comment
.
COMMENT_THUMBNAIL_URL
,
Solos
.
GRAVATAR
+
"59a5e8209c780307dbe9c9ba728073f5??s=60&r=G"
);
comment
.
put
(
Comment
.
COMMENT_
DATE
,
date
);
comment
.
put
(
Comment
.
COMMENT_
CREATED
,
date
.
getTime
()
);
comment
.
put
(
Comment
.
COMMENT_ON_ID
,
articleId
);
comment
.
put
(
Comment
.
COMMENT_ON_ID
,
articleId
);
comment
.
put
(
Comment
.
COMMENT_ON_TYPE
,
Article
.
ARTICLE
);
comment
.
put
(
Comment
.
COMMENT_ON_TYPE
,
Article
.
ARTICLE
);
final
String
commentId
=
Ids
.
genTimeMillisId
();
final
String
commentId
=
Ids
.
genTimeMillisId
();
...
...
src/main/resources/repository.json
View file @
eaea8f98
{
{
"description"
:
"Description of repository structures, for generation of the relational database table and persistence validation."
,
"description"
:
"Description of repository structures, for generation of the relational database table and persistence validation."
,
"version"
:
"3.2.1.
0, Apr 18
, 2018"
,
"version"
:
"3.2.1.
1, Sep 16
, 2018"
,
"authors"
:
[
"authors"
:
[
"Liang Ding"
"Liang Ding"
],
],
...
@@ -138,9 +138,9 @@
...
@@ -138,9 +138,9 @@
"length"
:
2000
"length"
:
2000
},
},
{
{
"name"
:
"comment
Date
"
,
"name"
:
"comment
Created
"
,
"description"
:
"评论时间"
,
"description"
:
"评论时间
戳
"
,
"type"
:
"
Date
"
"type"
:
"
long
"
},
},
{
{
"name"
:
"commentEmail"
,
"name"
:
"commentEmail"
,
...
...
src/test/java/org/b3log/solo/repository/impl/CommentRepositoryImplTestCase.java
View file @
eaea8f98
...
@@ -17,8 +17,6 @@
...
@@ -17,8 +17,6 @@
*/
*/
package
org
.
b3log
.
solo
.
repository
.
impl
;
package
org
.
b3log
.
solo
.
repository
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.solo.AbstractTestCase
;
import
org.b3log.solo.AbstractTestCase
;
import
org.b3log.solo.model.Comment
;
import
org.b3log.solo.model.Comment
;
...
@@ -27,18 +25,21 @@ import org.json.JSONObject;
...
@@ -27,18 +25,21 @@ import org.json.JSONObject;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* {@link ArticleRepositoryImpl} test case.
* {@link ArticleRepositoryImpl} test case.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
1, Jan 7, 2012
* @version 1.0.0.
2, Sep 16, 2018
*/
*/
@Test
(
suiteName
=
"repository"
)
@Test
(
suiteName
=
"repository"
)
public
class
CommentRepositoryImplTestCase
extends
AbstractTestCase
{
public
class
CommentRepositoryImplTestCase
extends
AbstractTestCase
{
/**
/**
* Adds successfully.
* Adds successfully.
*
*
* @throws Exception exception
* @throws Exception exception
*/
*/
@Test
@Test
...
@@ -48,7 +49,7 @@ public class CommentRepositoryImplTestCase extends AbstractTestCase {
...
@@ -48,7 +49,7 @@ public class CommentRepositoryImplTestCase extends AbstractTestCase {
final
JSONObject
comment
=
new
JSONObject
();
final
JSONObject
comment
=
new
JSONObject
();
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
"comment1 content"
);
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
"comment1 content"
);
comment
.
put
(
Comment
.
COMMENT_
DATE
,
new
Dat
e
());
comment
.
put
(
Comment
.
COMMENT_
CREATED
,
new
Date
().
getTim
e
());
comment
.
put
(
Comment
.
COMMENT_EMAIL
,
"test@gmail.com"
);
comment
.
put
(
Comment
.
COMMENT_EMAIL
,
"test@gmail.com"
);
comment
.
put
(
Comment
.
COMMENT_NAME
,
"comment1 name"
);
comment
.
put
(
Comment
.
COMMENT_NAME
,
"comment1 name"
);
comment
.
put
(
Comment
.
COMMENT_ON_ID
,
"comment1 on id"
);
comment
.
put
(
Comment
.
COMMENT_ON_ID
,
"comment1 on id"
);
...
@@ -63,16 +64,12 @@ public class CommentRepositoryImplTestCase extends AbstractTestCase {
...
@@ -63,16 +64,12 @@ public class CommentRepositoryImplTestCase extends AbstractTestCase {
commentRepository
.
add
(
comment
);
commentRepository
.
add
(
comment
);
transaction
.
commit
();
transaction
.
commit
();
final
List
<
JSONObject
>
comments
=
final
List
<
JSONObject
>
comments
=
commentRepository
.
getComments
(
"comment1 on id"
,
1
,
Integer
.
MAX_VALUE
);
commentRepository
.
getComments
(
"comment1 on id"
,
1
,
Integer
.
MAX_VALUE
);
Assert
.
assertNotNull
(
comments
);
Assert
.
assertNotNull
(
comments
);
Assert
.
assertEquals
(
comments
.
size
(),
1
);
Assert
.
assertEquals
(
comments
.
size
(),
1
);
Assert
.
assertEquals
(
Assert
.
assertEquals
(
commentRepository
.
getComments
(
"not found"
,
1
,
Integer
.
MAX_VALUE
).
size
(),
0
);
commentRepository
.
getComments
(
"not found"
,
1
,
Integer
.
MAX_VALUE
).
size
(),
0
);
Assert
.
assertEquals
(
commentRepository
.
getRecentComments
(
3
).
size
(),
1
);
Assert
.
assertEquals
(
commentRepository
.
getRecentComments
(
3
).
size
(),
1
);
}
}
}
}
src/test/java/org/b3log/solo/service/CommentMgmtServiceTestCase.java
View file @
eaea8f98
...
@@ -33,7 +33,7 @@ import org.testng.annotations.Test;
...
@@ -33,7 +33,7 @@ import org.testng.annotations.Test;
* {@link CommentMgmtService} test case.
* {@link CommentMgmtService} test case.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
2, Sep 11, 2012
* @version 1.0.0.
3, Sep 16, 2018
*/
*/
@Test
(
suiteName
=
"service"
)
@Test
(
suiteName
=
"service"
)
public
class
CommentMgmtServiceTestCase
extends
AbstractTestCase
{
public
class
CommentMgmtServiceTestCase
extends
AbstractTestCase
{
...
@@ -91,7 +91,7 @@ public class CommentMgmtServiceTestCase extends AbstractTestCase {
...
@@ -91,7 +91,7 @@ public class CommentMgmtServiceTestCase extends AbstractTestCase {
final
JSONObject
addResult
=
commentMgmtService
.
addArticleComment
(
requestJSONObject
);
final
JSONObject
addResult
=
commentMgmtService
.
addArticleComment
(
requestJSONObject
);
Assert
.
assertNotNull
(
addResult
);
Assert
.
assertNotNull
(
addResult
);
Assert
.
assertNotNull
(
addResult
.
getString
(
Keys
.
OBJECT_ID
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Keys
.
OBJECT_ID
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Comment
.
COMMENT_DATE
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Comment
.
COMMENT_
T_
DATE
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Comment
.
COMMENT_THUMBNAIL_URL
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Comment
.
COMMENT_THUMBNAIL_URL
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Comment
.
COMMENT_SHARP_URL
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Comment
.
COMMENT_SHARP_URL
));
...
@@ -140,7 +140,7 @@ public class CommentMgmtServiceTestCase extends AbstractTestCase {
...
@@ -140,7 +140,7 @@ public class CommentMgmtServiceTestCase extends AbstractTestCase {
final
JSONObject
addResult
=
commentMgmtService
.
addPageComment
(
requestJSONObject
);
final
JSONObject
addResult
=
commentMgmtService
.
addPageComment
(
requestJSONObject
);
Assert
.
assertNotNull
(
addResult
);
Assert
.
assertNotNull
(
addResult
);
Assert
.
assertNotNull
(
addResult
.
getString
(
Keys
.
OBJECT_ID
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Keys
.
OBJECT_ID
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Comment
.
COMMENT_DATE
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Comment
.
COMMENT_
T_
DATE
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Comment
.
COMMENT_THUMBNAIL_URL
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Comment
.
COMMENT_THUMBNAIL_URL
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Comment
.
COMMENT_SHARP_URL
));
Assert
.
assertNotNull
(
addResult
.
getString
(
Comment
.
COMMENT_SHARP_URL
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment