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
645b162f
Commit
645b162f
authored
Nov 23, 2015
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#12042
将对 Preference.Default 的引用重构引用 Option.Default
parent
902727ae
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
245 additions
and
243 deletions
+245
-243
src/main/java/org/b3log/solo/SoloServletListener.java
src/main/java/org/b3log/solo/SoloServletListener.java
+3
-3
src/main/java/org/b3log/solo/model/Option.java
src/main/java/org/b3log/solo/model/Option.java
+217
-1
src/main/java/org/b3log/solo/model/Preference.java
src/main/java/org/b3log/solo/model/Preference.java
+4
-216
src/main/java/org/b3log/solo/processor/RepairProcessor.java
src/main/java/org/b3log/solo/processor/RepairProcessor.java
+1
-1
src/main/java/org/b3log/solo/repository/PreferenceRepository.java
.../java/org/b3log/solo/repository/PreferenceRepository.java
+2
-1
src/main/java/org/b3log/solo/service/InitService.java
src/main/java/org/b3log/solo/service/InitService.java
+2
-2
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
...in/java/org/b3log/solo/service/PreferenceMgmtService.java
+7
-8
src/main/java/org/b3log/solo/service/UpgradeService.java
src/main/java/org/b3log/solo/service/UpgradeService.java
+3
-3
src/test/java/org/b3log/solo/service/PreferenceMgmtServiceTestCase.java
...org/b3log/solo/service/PreferenceMgmtServiceTestCase.java
+3
-4
src/test/java/org/b3log/solo/service/PreferenceQueryServiceTestCase.java
...rg/b3log/solo/service/PreferenceQueryServiceTestCase.java
+3
-4
No files found.
src/main/java/org/b3log/solo/SoloServletListener.java
View file @
645b162f
...
...
@@ -41,7 +41,7 @@ import org.b3log.solo.event.plugin.PluginRefresher;
import
org.b3log.solo.event.rhythm.ArticleSender
;
import
org.b3log.solo.event.rhythm.ArticleUpdater
;
import
org.b3log.solo.event.symphony.CommentSender
;
import
org.b3log.solo.model.
Preference
;
import
org.b3log.solo.model.
Option
;
import
org.b3log.solo.model.Skin
;
import
org.b3log.solo.repository.OptionRepository
;
import
org.b3log.solo.repository.impl.OptionRepositoryImpl
;
...
...
@@ -56,7 +56,7 @@ import org.json.JSONObject;
* Solo Servlet listener.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.7.0.
9, Nov 8
, 2015
* @version 1.7.0.
10, Nov 23
, 2015
* @since 0.3.1
*/
public
final
class
SoloServletListener
extends
AbstractServletListener
{
...
...
@@ -122,7 +122,7 @@ public final class SoloServletListener extends AbstractServletListener {
upgradeService
.
upgrade
();
// Set default skin, loads from preference later
Skins
.
setDirectoryForTemplateLoading
(
Preference
.
Default
.
DEFAULT_SKIN_DIR_NAME
);
Skins
.
setDirectoryForTemplateLoading
(
Option
.
Default
.
DEFAULT_SKIN_DIR_NAME
);
final
OptionRepository
optionRepository
=
beanManager
.
getReference
(
OptionRepositoryImpl
.
class
);
...
...
src/main/java/org/b3log/solo/model/Option.java
View file @
645b162f
...
...
@@ -15,6 +15,12 @@
*/
package
org
.
b3log
.
solo
.
model
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
/**
* This class defines option model relevant keys.
*
...
...
@@ -184,7 +190,7 @@ public final class Option {
* Key of allow visit draft via permalink.
*/
public
static
final
String
ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK
=
"allowVisitDraftViaPermalink"
;
/**
* Key of allow register.
*/
...
...
@@ -291,6 +297,216 @@ public final class Option {
*/
public
static
final
String
CATEGORY_C_PREFERENCE
=
"preference"
;
/**
* Default preference.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.1.0.9, Nov 23, 2015
* @since 0.3.1
*/
public
static
final
class
Default
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
Default
.
class
.
getName
());
/**
* Default recent article display count.
*/
public
static
final
int
DEFAULT_RECENT_ARTICLE_DISPLAY_COUNT
=
10
;
/**
* Default recent comment display count.
*/
public
static
final
int
DEFAULT_RECENT_COMMENT_DISPLAY_COUNT
=
10
;
/**
* Default most used tag display count.
*/
public
static
final
int
DEFAULT_MOST_USED_TAG_DISPLAY_COUNT
=
20
;
/**
* Default article list display count.
*/
public
static
final
int
DEFAULT_ARTICLE_LIST_DISPLAY_COUNT
=
20
;
/**
* Default article list pagination window size.
*/
public
static
final
int
DEFAULT_ARTICLE_LIST_PAGINATION_WINDOW_SIZE
=
15
;
/**
* Default most comment article display count.
*/
public
static
final
int
DEFAULT_MOST_COMMENT_ARTICLE_DISPLAY_COUNT
=
5
;
/**
* Default blog title.
*/
public
static
final
String
DEFAULT_BLOG_TITLE
=
"Solo 示例"
;
/**
* Default blog subtitle.
*/
public
static
final
String
DEFAULT_BLOG_SUBTITLE
=
"Java 开源博客"
;
/**
* Default skin directory name.
*/
public
static
final
String
DEFAULT_SKIN_DIR_NAME
=
"yilia"
;
/**
* Default language.
*/
public
static
final
String
DEFAULT_LANGUAGE
=
"zh_CN"
;
/**
* Default time zone.
*
* @see java.util.TimeZone#getAvailableIDs()
*/
public
static
final
String
DEFAULT_TIME_ZONE
=
"Asia/Shanghai"
;
/**
* Default enable article update hint.
*/
public
static
final
String
DEFAULT_ENABLE_ARTICLE_UPDATE_HINT
=
"true"
;
/**
* Default notice board.
*/
public
static
final
String
DEFAULT_NOTICE_BOARD
=
"Open Source, Open Mind, <br/>Open Sight, Open Future!"
;
/**
* Default meta keywords..
*/
public
static
final
String
DEFAULT_META_KEYWORDS
=
"Java 博客,GAE,b3log"
;
/**
* Default meta description..
*/
public
static
final
String
DEFAULT_META_DESCRIPTION
=
"An open source blog with Java. Java 开源博客"
;
/**
* Default HTML head to append.
*/
public
static
final
String
DEFAULT_HTML_HEAD
=
""
;
/**
* Default footer content.
*/
public
static
final
String
DEFAULT_FOOTER_CONTENT
=
""
;
/**
* Default relevant articles display count.
*/
public
static
final
int
DEFAULT_RELEVANT_ARTICLES_DISPLAY_COUNT
=
5
;
/**
* Default random articles display count.
*/
public
static
final
int
DEFAULT_RANDOM_ARTICLES_DISPLAY_COUNT
=
5
;
/**
* Default external relevant articles display count.
*/
public
static
final
int
DEFAULT_EXTERNAL_RELEVANT_ARTICLES_DISPLAY_COUNT
=
5
;
/**
* Most view articles display count.
*/
public
static
final
int
DEFAULT_MOST_VIEW_ARTICLES_DISPLAY_COUNT
=
5
;
/**
* Default signs.
*/
public
static
final
String
DEFAULT_SIGNS
;
/**
* Default allow visit draft via permalink.
*/
public
static
final
String
DEFAULT_ALLOW_VISIT_DRAFT_VIA_PERMALINK
=
"false"
;
/**
* Default allow register.
*/
public
static
final
String
DEFAULT_ALLOW_REGISTER
=
"false"
;
/**
* Default allow comment article/page.
*/
public
static
final
String
DEFAULT_COMMENTABLE
=
"true"
;
/**
* Default article list display style.
*/
public
static
final
String
DEFAULT_ARTICLE_LIST_STYLE
=
"titleAndAbstract"
;
/**
* Default key of solo.
*/
public
static
final
String
DEFAULT_KEY_OF_SOLO
=
"Your key"
;
/**
* Default reply notification template.
*/
public
static
final
String
DEFAULT_REPLY_NOTIFICATION_TEMPLATE
;
/**
* Default feed output mode.
*/
public
static
final
String
DEFAULT_FEED_OUTPUT_MODE
=
"abstract"
;
/**
* Default feed output entry count.
*/
public
static
final
int
DEFAULT_FEED_OUTPUT_CNT
=
10
;
/**
* Default editor type.
*/
public
static
final
String
DEFAULT_EDITOR_TYPE
=
"tinyMCE"
;
static
{
final
JSONArray
signs
=
new
JSONArray
();
final
int
signLength
=
4
;
try
{
for
(
int
i
=
0
;
i
<
signLength
;
i
++)
{
final
JSONObject
sign
=
new
JSONObject
();
sign
.
put
(
Keys
.
OBJECT_ID
,
i
);
signs
.
put
(
sign
);
sign
.
put
(
Sign
.
SIGN_HTML
,
""
);
}
// Sign(id=0) is the 'empty' sign, used for article user needn't
// a sign
DEFAULT_SIGNS
=
signs
.
toString
();
final
JSONObject
replyNotificationTemplate
=
new
JSONObject
();
replyNotificationTemplate
.
put
(
"subject"
,
"${blogTitle}: New reply of your comment"
);
replyNotificationTemplate
.
put
(
"body"
,
"Your comment on post[<a href='${postLink}'>"
+
"${postTitle}</a>] received an reply: <p>${replier}"
+
": <span><a href='${replyURL}'>${replyContent}</a></span></p>"
);
DEFAULT_REPLY_NOTIFICATION_TEMPLATE
=
replyNotificationTemplate
.
toString
();
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
"Creates sign error!"
,
e
);
throw
new
IllegalStateException
(
e
);
}
}
/**
* Private default constructor.
*/
private
Default
()
{
}
}
/**
* Private constructor.
*/
...
...
src/main/java/org/b3log/solo/model/Preference.java
View file @
645b162f
...
...
@@ -15,18 +15,15 @@
*/
package
org
.
b3log
.
solo
.
model
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
/**
* This class defines all comment model relevant keys.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.0.1
0, Nov 20
, 2015
* @version 1.3.0.1
1, Nov 23
, 2015
* @since 0.3.1
* @deprecated this class will be removed in 1.3.0, see issue
* <a href="https://github.com/b3log/solo/issues/12042">#12042</a>
* for more details
*/
public
final
class
Preference
{
...
...
@@ -41,213 +38,4 @@ public final class Preference {
private
Preference
()
{
}
/**
* Default preference.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.0.9, May 17, 2013
* @since 0.3.1
*/
public
static
final
class
Default
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
Default
.
class
.
getName
());
/**
* Default recent article display count.
*/
public
static
final
int
DEFAULT_RECENT_ARTICLE_DISPLAY_COUNT
=
10
;
/**
* Default recent comment display count.
*/
public
static
final
int
DEFAULT_RECENT_COMMENT_DISPLAY_COUNT
=
10
;
/**
* Default most used tag display count.
*/
public
static
final
int
DEFAULT_MOST_USED_TAG_DISPLAY_COUNT
=
20
;
/**
* Default article list display count.
*/
public
static
final
int
DEFAULT_ARTICLE_LIST_DISPLAY_COUNT
=
20
;
/**
* Default article list pagination window size.
*/
public
static
final
int
DEFAULT_ARTICLE_LIST_PAGINATION_WINDOW_SIZE
=
15
;
/**
* Default most comment article display count.
*/
public
static
final
int
DEFAULT_MOST_COMMENT_ARTICLE_DISPLAY_COUNT
=
5
;
/**
* Default blog title.
*/
public
static
final
String
DEFAULT_BLOG_TITLE
=
"Solo 示例"
;
/**
* Default blog subtitle.
*/
public
static
final
String
DEFAULT_BLOG_SUBTITLE
=
"Java 开源博客"
;
/**
* Default skin directory name.
*/
public
static
final
String
DEFAULT_SKIN_DIR_NAME
=
"yilia"
;
/**
* Default language.
*/
public
static
final
String
DEFAULT_LANGUAGE
=
"zh_CN"
;
/**
* Default time zone.
*
* @see java.util.TimeZone#getAvailableIDs()
*/
public
static
final
String
DEFAULT_TIME_ZONE
=
"Asia/Shanghai"
;
/**
* Default enable article update hint.
*/
public
static
final
String
DEFAULT_ENABLE_ARTICLE_UPDATE_HINT
=
"true"
;
/**
* Default notice board.
*/
public
static
final
String
DEFAULT_NOTICE_BOARD
=
"Open Source, Open Mind, <br/>Open Sight, Open Future!"
;
/**
* Default meta keywords..
*/
public
static
final
String
DEFAULT_META_KEYWORDS
=
"Java 博客,GAE,b3log"
;
/**
* Default meta description..
*/
public
static
final
String
DEFAULT_META_DESCRIPTION
=
"An open source blog with Java. Java 开源博客"
;
/**
* Default HTML head to append.
*/
public
static
final
String
DEFAULT_HTML_HEAD
=
""
;
/**
* Default footer content.
*/
public
static
final
String
DEFAULT_FOOTER_CONTENT
=
""
;
/**
* Default relevant articles display count.
*/
public
static
final
int
DEFAULT_RELEVANT_ARTICLES_DISPLAY_COUNT
=
5
;
/**
* Default random articles display count.
*/
public
static
final
int
DEFAULT_RANDOM_ARTICLES_DISPLAY_COUNT
=
5
;
/**
* Default external relevant articles display count.
*/
public
static
final
int
DEFAULT_EXTERNAL_RELEVANT_ARTICLES_DISPLAY_COUNT
=
5
;
/**
* Most view articles display count.
*/
public
static
final
int
DEFAULT_MOST_VIEW_ARTICLES_DISPLAY_COUNT
=
5
;
/**
* Default signs.
*/
public
static
final
String
DEFAULT_SIGNS
;
/**
* Default allow visit draft via permalink.
*/
public
static
final
String
DEFAULT_ALLOW_VISIT_DRAFT_VIA_PERMALINK
=
"false"
;
/**
* Default allow register.
*/
public
static
final
String
DEFAULT_ALLOW_REGISTER
=
"false"
;
/**
* Default allow comment article/page.
*/
public
static
final
String
DEFAULT_COMMENTABLE
=
"true"
;
/**
* Default article list display style.
*/
public
static
final
String
DEFAULT_ARTICLE_LIST_STYLE
=
"titleAndAbstract"
;
/**
* Default key of solo.
*/
public
static
final
String
DEFAULT_KEY_OF_SOLO
=
"Your key"
;
/**
* Default reply notification template.
*/
public
static
final
String
DEFAULT_REPLY_NOTIFICATION_TEMPLATE
;
/**
* Default feed output mode.
*/
public
static
final
String
DEFAULT_FEED_OUTPUT_MODE
=
"abstract"
;
/**
* Default feed output entry count.
*/
public
static
final
int
DEFAULT_FEED_OUTPUT_CNT
=
10
;
/**
* Default editor type.
*/
public
static
final
String
DEFAULT_EDITOR_TYPE
=
"tinyMCE"
;
static
{
final
JSONArray
signs
=
new
JSONArray
();
final
int
signLength
=
4
;
try
{
for
(
int
i
=
0
;
i
<
signLength
;
i
++)
{
final
JSONObject
sign
=
new
JSONObject
();
sign
.
put
(
Keys
.
OBJECT_ID
,
i
);
signs
.
put
(
sign
);
sign
.
put
(
Sign
.
SIGN_HTML
,
""
);
}
// Sign(id=0) is the 'empty' sign, used for article user needn't
// a sign
DEFAULT_SIGNS
=
signs
.
toString
();
final
JSONObject
replyNotificationTemplate
=
new
JSONObject
();
replyNotificationTemplate
.
put
(
"subject"
,
"${blogTitle}: New reply of your comment"
);
replyNotificationTemplate
.
put
(
"body"
,
"Your comment on post[<a href='${postLink}'>"
+
"${postTitle}</a>] received an reply: <p>${replier}"
+
": <span><a href='${replyURL}'>${replyContent}</a></span></p>"
);
DEFAULT_REPLY_NOTIFICATION_TEMPLATE
=
replyNotificationTemplate
.
toString
();
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
"Creates sign error!"
,
e
);
throw
new
IllegalStateException
(
e
);
}
}
/**
* Private default constructor.
*/
private
Default
()
{
}
}
}
src/main/java/org/b3log/solo/processor/RepairProcessor.java
View file @
645b162f
...
...
@@ -249,7 +249,7 @@ public class RepairProcessor {
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
final
String
originalSigns
=
preference
.
getString
(
Option
.
ID_C_SIGNS
);
preference
.
put
(
Option
.
ID_C_SIGNS
,
Preference
.
Default
.
DEFAULT_SIGNS
);
preference
.
put
(
Option
.
ID_C_SIGNS
,
Option
.
Default
.
DEFAULT_SIGNS
);
preferenceMgmtService
.
updatePreference
(
preference
);
...
...
src/main/java/org/b3log/solo/repository/PreferenceRepository.java
View file @
645b162f
...
...
@@ -25,7 +25,8 @@ import org.b3log.latke.repository.Repository;
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Aug 14, 2010
* @since 0.3.1
* @deprecated this class will be removed in 1.3.0, see issue <a href="https://github.com/b3log/solo/issues/12042">#12042</a>
* @deprecated this class will be removed in 1.3.0, see issue
* <a href="https://github.com/b3log/solo/issues/12042">#12042</a>
* for more details
*/
public
interface
PreferenceRepository
extends
Repository
{}
src/main/java/org/b3log/solo/service/InitService.java
View file @
645b162f
...
...
@@ -48,7 +48,7 @@ import org.b3log.latke.util.MD5;
import
org.b3log.latke.util.freemarker.Templates
;
import
org.b3log.solo.SoloServletListener
;
import
org.b3log.solo.model.*
;
import
org.b3log.solo.model.
Preference
.Default
;
import
org.b3log.solo.model.
Option
.Default
;
import
org.b3log.solo.repository.ArchiveDateArticleRepository
;
import
org.b3log.solo.repository.ArchiveDateRepository
;
import
org.b3log.solo.repository.ArticleRepository
;
...
...
@@ -538,7 +538,7 @@ public class InitService {
private
void
initReplyNotificationTemplate
()
throws
Exception
{
LOGGER
.
info
(
"Initializing reply notification template"
);
final
JSONObject
replyNotificationTemplate
=
new
JSONObject
(
Preference
.
Default
.
DEFAULT_REPLY_NOTIFICATION_TEMPLATE
);
final
JSONObject
replyNotificationTemplate
=
new
JSONObject
(
Default
.
DEFAULT_REPLY_NOTIFICATION_TEMPLATE
);
replyNotificationTemplate
.
put
(
Keys
.
OBJECT_ID
,
"replyNotificationTemplate"
);
...
...
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
View file @
645b162f
...
...
@@ -34,7 +34,6 @@ import org.b3log.latke.util.Stopwatchs;
import
org.b3log.latke.util.freemarker.Templates
;
import
org.b3log.solo.SoloServletListener
;
import
org.b3log.solo.model.Option
;
import
org.b3log.solo.model.Preference
;
import
org.b3log.solo.model.Skin
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
...
...
@@ -49,7 +48,7 @@ import static org.b3log.solo.util.Skins.setDirectoryForTemplateLoading;
* Preference management service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.1.1
0, Nov 20
, 2015
* @version 1.3.1.1
1, Nov 23
, 2015
* @since 0.4.0
*/
@Service
...
...
@@ -121,18 +120,18 @@ public class PreferenceMgmtService {
if
(!
skinDirNames
.
contains
(
currentSkinDirName
))
{
LOGGER
.
log
(
Level
.
WARN
,
"Configred skin[dirName={0}] can not find, try to use "
+
"default skin[dirName="
+
Preference
.
Default
.
DEFAULT_SKIN_DIR_NAME
+
"] instead."
,
+
Option
.
Default
.
DEFAULT_SKIN_DIR_NAME
+
"] instead."
,
currentSkinDirName
);
if
(!
skinDirNames
.
contains
(
Preference
.
Default
.
DEFAULT_SKIN_DIR_NAME
))
{
LOGGER
.
log
(
Level
.
ERROR
,
"Can not find skin[dirName="
+
Preference
.
Default
.
DEFAULT_SKIN_DIR_NAME
+
"]"
);
if
(!
skinDirNames
.
contains
(
Option
.
Default
.
DEFAULT_SKIN_DIR_NAME
))
{
LOGGER
.
log
(
Level
.
ERROR
,
"Can not find skin[dirName="
+
Option
.
Default
.
DEFAULT_SKIN_DIR_NAME
+
"]"
);
throw
new
IllegalStateException
(
"Can not find default skin[dirName="
+
Preference
.
Default
.
DEFAULT_SKIN_DIR_NAME
"Can not find default skin[dirName="
+
Option
.
Default
.
DEFAULT_SKIN_DIR_NAME
+
"], please redeploy your Solo and make sure contains this default skin!"
);
}
preference
.
put
(
SKIN_DIR_NAME
,
Preference
.
Default
.
DEFAULT_SKIN_DIR_NAME
);
preference
.
put
(
SKIN_NAME
,
Latkes
.
getSkinName
(
Preference
.
Default
.
DEFAULT_SKIN_DIR_NAME
));
preference
.
put
(
SKIN_DIR_NAME
,
Option
.
Default
.
DEFAULT_SKIN_DIR_NAME
);
preference
.
put
(
SKIN_NAME
,
Latkes
.
getSkinName
(
Option
.
Default
.
DEFAULT_SKIN_DIR_NAME
));
updatePreference
(
preference
);
}
...
...
src/main/java/org/b3log/solo/service/UpgradeService.java
View file @
645b162f
...
...
@@ -44,7 +44,7 @@ import org.json.JSONObject;
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="mailto:dongxu.wang@acm.org">Dongxu Wang</a>
* @version 1.1.0.
2, Nov 20
, 2015
* @version 1.1.0.
3, Nov 23
, 2015
* @since 1.2.0
*/
@Service
...
...
@@ -402,7 +402,7 @@ public class UpgradeService {
final
JSONObject
footerContentOpt
=
new
JSONObject
();
footerContentOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_FOOTER_CONTENT
);
footerContentOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
footerContentOpt
.
put
(
Option
.
OPTION_VALUE
,
Preference
.
Default
.
DEFAULT_FOOTER_CONTENT
);
footerContentOpt
.
put
(
Option
.
OPTION_VALUE
,
Option
.
Default
.
DEFAULT_FOOTER_CONTENT
);
optionRepository
.
add
(
footerContentOpt
);
final
JSONObject
replyNotificationTemplate
=
preferenceRepository
.
get
(
"replyNotificationTemplate"
);
...
...
@@ -430,7 +430,7 @@ public class UpgradeService {
final
JSONObject
allowRegisterOpt
=
new
JSONObject
();
allowRegisterOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_ALLOW_REGISTER
);
allowRegisterOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
allowRegisterOpt
.
put
(
Option
.
OPTION_VALUE
,
Preference
.
Default
.
DEFAULT_ALLOW_REGISTER
);
allowRegisterOpt
.
put
(
Option
.
OPTION_VALUE
,
Option
.
Default
.
DEFAULT_ALLOW_REGISTER
);
optionRepository
.
add
(
allowRegisterOpt
);
preference
.
put
(
Option
.
ID_C_VERSION
,
TO_VER
);
...
...
src/test/java/org/b3log/solo/service/PreferenceMgmtServiceTestCase.java
View file @
645b162f
...
...
@@ -18,7 +18,6 @@ package org.b3log.solo.service;
import
org.b3log.latke.model.User
;
import
org.b3log.solo.AbstractTestCase
;
import
org.b3log.solo.model.Option
;
import
org.b3log.solo.model.Preference
;
import
org.json.JSONObject
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
...
...
@@ -27,7 +26,7 @@ import org.testng.annotations.Test;
* {@link PreferenceMgmtService} test case.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
2, Nov 20
, 2015
* @version 1.0.0.
3, Nov 23
, 2015
*/
@Test
(
suiteName
=
"service"
)
public
class
PreferenceMgmtServiceTestCase
extends
AbstractTestCase
{
...
...
@@ -64,7 +63,7 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase {
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
Assert
.
assertEquals
(
preference
.
getString
(
Option
.
ID_C_BLOG_TITLE
),
Preference
.
Default
.
DEFAULT_BLOG_TITLE
);
Option
.
Default
.
DEFAULT_BLOG_TITLE
);
preference
.
put
(
Option
.
ID_C_BLOG_TITLE
,
"updated blog title"
);
preferenceMgmtService
.
updatePreference
(
preference
);
...
...
@@ -84,7 +83,7 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase {
final
PreferenceQueryService
preferenceQueryService
=
getPreferenceQueryService
();
JSONObject
replyNotificationTemplate
=
preferenceQueryService
.
getReplyNotificationTemplate
();
Assert
.
assertEquals
(
replyNotificationTemplate
.
toString
(),
Preference
.
Default
.
DEFAULT_REPLY_NOTIFICATION_TEMPLATE
);
Assert
.
assertEquals
(
replyNotificationTemplate
.
toString
(),
Option
.
Default
.
DEFAULT_REPLY_NOTIFICATION_TEMPLATE
);
replyNotificationTemplate
.
put
(
"subject"
,
"updated subject"
);
preferenceMgmtService
.
updateReplyNotificationTemplate
(
replyNotificationTemplate
);
...
...
src/test/java/org/b3log/solo/service/PreferenceQueryServiceTestCase.java
View file @
645b162f
...
...
@@ -18,7 +18,6 @@ package org.b3log.solo.service;
import
org.b3log.latke.model.User
;
import
org.b3log.solo.AbstractTestCase
;
import
org.b3log.solo.model.Option
;
import
org.b3log.solo.model.Preference
;
import
org.json.JSONObject
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
...
...
@@ -27,7 +26,7 @@ import org.testng.annotations.Test;
* {@link PreferenceQueryService} test case.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
2, Nov 20
, 2015
* @version 1.0.0.
3, Nov 23
, 2015
*/
@Test
(
suiteName
=
"service"
)
public
class
PreferenceQueryServiceTestCase
extends
AbstractTestCase
{
...
...
@@ -63,7 +62,7 @@ public class PreferenceQueryServiceTestCase extends AbstractTestCase {
=
getPreferenceQueryService
();
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
Assert
.
assertEquals
(
preference
.
getString
(
Option
.
ID_C_BLOG_TITLE
),
Preference
.
Default
.
DEFAULT_BLOG_TITLE
);
Assert
.
assertEquals
(
preference
.
getString
(
Option
.
ID_C_BLOG_TITLE
),
Option
.
Default
.
DEFAULT_BLOG_TITLE
);
}
/**
...
...
@@ -78,6 +77,6 @@ public class PreferenceQueryServiceTestCase extends AbstractTestCase {
final
JSONObject
replyNotificationTemplate
=
preferenceQueryService
.
getReplyNotificationTemplate
();
Assert
.
assertEquals
(
replyNotificationTemplate
.
toString
(),
Preference
.
Default
.
DEFAULT_REPLY_NOTIFICATION_TEMPLATE
);
Assert
.
assertEquals
(
replyNotificationTemplate
.
toString
(),
Option
.
Default
.
DEFAULT_REPLY_NOTIFICATION_TEMPLATE
);
}
}
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