Commit 645b162f authored by Liang Ding's avatar Liang Ding

#12042

将对 Preference.Default 的引用重构引用 Option.Default
parent 902727ae
...@@ -41,7 +41,7 @@ import org.b3log.solo.event.plugin.PluginRefresher; ...@@ -41,7 +41,7 @@ import org.b3log.solo.event.plugin.PluginRefresher;
import org.b3log.solo.event.rhythm.ArticleSender; import org.b3log.solo.event.rhythm.ArticleSender;
import org.b3log.solo.event.rhythm.ArticleUpdater; import org.b3log.solo.event.rhythm.ArticleUpdater;
import org.b3log.solo.event.symphony.CommentSender; 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.model.Skin;
import org.b3log.solo.repository.OptionRepository; import org.b3log.solo.repository.OptionRepository;
import org.b3log.solo.repository.impl.OptionRepositoryImpl; import org.b3log.solo.repository.impl.OptionRepositoryImpl;
...@@ -56,7 +56,7 @@ import org.json.JSONObject; ...@@ -56,7 +56,7 @@ import org.json.JSONObject;
* Solo Servlet listener. * Solo Servlet listener.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @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 * @since 0.3.1
*/ */
public final class SoloServletListener extends AbstractServletListener { public final class SoloServletListener extends AbstractServletListener {
...@@ -122,7 +122,7 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -122,7 +122,7 @@ public final class SoloServletListener extends AbstractServletListener {
upgradeService.upgrade(); upgradeService.upgrade();
// Set default skin, loads from preference later // 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); final OptionRepository optionRepository = beanManager.getReference(OptionRepositoryImpl.class);
......
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
*/ */
package org.b3log.solo.model; 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. * This class defines option model relevant keys.
* *
...@@ -184,7 +190,7 @@ public final class Option { ...@@ -184,7 +190,7 @@ public final class Option {
* Key of allow visit draft via permalink. * Key of allow visit draft via permalink.
*/ */
public static final String ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK = "allowVisitDraftViaPermalink"; public static final String ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK = "allowVisitDraftViaPermalink";
/** /**
* Key of allow register. * Key of allow register.
*/ */
...@@ -291,6 +297,216 @@ public final class Option { ...@@ -291,6 +297,216 @@ public final class Option {
*/ */
public static final String CATEGORY_C_PREFERENCE = "preference"; 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. * Private constructor.
*/ */
......
...@@ -15,18 +15,15 @@ ...@@ -15,18 +15,15 @@
*/ */
package org.b3log.solo.model; 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. * 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.3.0.10, Nov 20, 2015 * @version 1.3.0.11, Nov 23, 2015
* @since 0.3.1 * @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 { public final class Preference {
...@@ -41,213 +38,4 @@ public final class Preference { ...@@ -41,213 +38,4 @@ public final class Preference {
private 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() {
}
}
} }
...@@ -249,7 +249,7 @@ public class RepairProcessor { ...@@ -249,7 +249,7 @@ public class RepairProcessor {
final JSONObject preference = preferenceQueryService.getPreference(); final JSONObject preference = preferenceQueryService.getPreference();
final String originalSigns = preference.getString(Option.ID_C_SIGNS); 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); preferenceMgmtService.updatePreference(preference);
......
...@@ -25,7 +25,8 @@ import org.b3log.latke.repository.Repository; ...@@ -25,7 +25,8 @@ import org.b3log.latke.repository.Repository;
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Aug 14, 2010 * @version 1.0.0.0, Aug 14, 2010
* @since 0.3.1 * @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 * for more details
*/ */
public interface PreferenceRepository extends Repository {} public interface PreferenceRepository extends Repository {}
...@@ -48,7 +48,7 @@ import org.b3log.latke.util.MD5; ...@@ -48,7 +48,7 @@ import org.b3log.latke.util.MD5;
import org.b3log.latke.util.freemarker.Templates; import org.b3log.latke.util.freemarker.Templates;
import org.b3log.solo.SoloServletListener; import org.b3log.solo.SoloServletListener;
import org.b3log.solo.model.*; 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.ArchiveDateArticleRepository;
import org.b3log.solo.repository.ArchiveDateRepository; import org.b3log.solo.repository.ArchiveDateRepository;
import org.b3log.solo.repository.ArticleRepository; import org.b3log.solo.repository.ArticleRepository;
...@@ -538,7 +538,7 @@ public class InitService { ...@@ -538,7 +538,7 @@ public class InitService {
private void initReplyNotificationTemplate() throws Exception { private void initReplyNotificationTemplate() throws Exception {
LOGGER.info("Initializing reply notification template"); 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"); replyNotificationTemplate.put(Keys.OBJECT_ID, "replyNotificationTemplate");
......
...@@ -34,7 +34,6 @@ import org.b3log.latke.util.Stopwatchs; ...@@ -34,7 +34,6 @@ import org.b3log.latke.util.Stopwatchs;
import org.b3log.latke.util.freemarker.Templates; import org.b3log.latke.util.freemarker.Templates;
import org.b3log.solo.SoloServletListener; import org.b3log.solo.SoloServletListener;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.model.Preference;
import org.b3log.solo.model.Skin; import org.b3log.solo.model.Skin;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -49,7 +48,7 @@ import static org.b3log.solo.util.Skins.setDirectoryForTemplateLoading; ...@@ -49,7 +48,7 @@ import static org.b3log.solo.util.Skins.setDirectoryForTemplateLoading;
* Preference management service. * Preference 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.1.10, Nov 20, 2015 * @version 1.3.1.11, Nov 23, 2015
* @since 0.4.0 * @since 0.4.0
*/ */
@Service @Service
...@@ -121,18 +120,18 @@ public class PreferenceMgmtService { ...@@ -121,18 +120,18 @@ public class PreferenceMgmtService {
if (!skinDirNames.contains(currentSkinDirName)) { if (!skinDirNames.contains(currentSkinDirName)) {
LOGGER.log(Level.WARN, "Configred skin[dirName={0}] can not find, try to use " + "default skin[dirName=" 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); currentSkinDirName);
if (!skinDirNames.contains(Preference.Default.DEFAULT_SKIN_DIR_NAME)) { if (!skinDirNames.contains(Option.Default.DEFAULT_SKIN_DIR_NAME)) {
LOGGER.log(Level.ERROR, "Can not find skin[dirName=" + Preference.Default.DEFAULT_SKIN_DIR_NAME + "]"); LOGGER.log(Level.ERROR, "Can not find skin[dirName=" + Option.Default.DEFAULT_SKIN_DIR_NAME + "]");
throw new IllegalStateException( 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!"); + "], 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_DIR_NAME, Option.Default.DEFAULT_SKIN_DIR_NAME);
preference.put(SKIN_NAME, Latkes.getSkinName(Preference.Default.DEFAULT_SKIN_DIR_NAME)); preference.put(SKIN_NAME, Latkes.getSkinName(Option.Default.DEFAULT_SKIN_DIR_NAME));
updatePreference(preference); updatePreference(preference);
} }
......
...@@ -44,7 +44,7 @@ import org.json.JSONObject; ...@@ -44,7 +44,7 @@ import org.json.JSONObject;
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="mailto:dongxu.wang@acm.org">Dongxu Wang</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 * @since 1.2.0
*/ */
@Service @Service
...@@ -402,7 +402,7 @@ public class UpgradeService { ...@@ -402,7 +402,7 @@ public class UpgradeService {
final JSONObject footerContentOpt = new JSONObject(); final JSONObject footerContentOpt = new JSONObject();
footerContentOpt.put(Keys.OBJECT_ID, Option.ID_C_FOOTER_CONTENT); footerContentOpt.put(Keys.OBJECT_ID, Option.ID_C_FOOTER_CONTENT);
footerContentOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE); 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); optionRepository.add(footerContentOpt);
final JSONObject replyNotificationTemplate = preferenceRepository.get("replyNotificationTemplate"); final JSONObject replyNotificationTemplate = preferenceRepository.get("replyNotificationTemplate");
...@@ -430,7 +430,7 @@ public class UpgradeService { ...@@ -430,7 +430,7 @@ public class UpgradeService {
final JSONObject allowRegisterOpt = new JSONObject(); final JSONObject allowRegisterOpt = new JSONObject();
allowRegisterOpt.put(Keys.OBJECT_ID, Option.ID_C_ALLOW_REGISTER); allowRegisterOpt.put(Keys.OBJECT_ID, Option.ID_C_ALLOW_REGISTER);
allowRegisterOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE); 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); optionRepository.add(allowRegisterOpt);
preference.put(Option.ID_C_VERSION, TO_VER); preference.put(Option.ID_C_VERSION, TO_VER);
......
...@@ -18,7 +18,6 @@ package org.b3log.solo.service; ...@@ -18,7 +18,6 @@ package org.b3log.solo.service;
import org.b3log.latke.model.User; import org.b3log.latke.model.User;
import org.b3log.solo.AbstractTestCase; import org.b3log.solo.AbstractTestCase;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.model.Preference;
import org.json.JSONObject; import org.json.JSONObject;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
...@@ -27,7 +26,7 @@ import org.testng.annotations.Test; ...@@ -27,7 +26,7 @@ import org.testng.annotations.Test;
* {@link PreferenceMgmtService} test case. * {@link PreferenceMgmtService} 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, Nov 20, 2015 * @version 1.0.0.3, Nov 23, 2015
*/ */
@Test(suiteName = "service") @Test(suiteName = "service")
public class PreferenceMgmtServiceTestCase extends AbstractTestCase { public class PreferenceMgmtServiceTestCase extends AbstractTestCase {
...@@ -64,7 +63,7 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase { ...@@ -64,7 +63,7 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase {
JSONObject preference = preferenceQueryService.getPreference(); JSONObject preference = preferenceQueryService.getPreference();
Assert.assertEquals(preference.getString(Option.ID_C_BLOG_TITLE), 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"); preference.put(Option.ID_C_BLOG_TITLE, "updated blog title");
preferenceMgmtService.updatePreference(preference); preferenceMgmtService.updatePreference(preference);
...@@ -84,7 +83,7 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase { ...@@ -84,7 +83,7 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase {
final PreferenceQueryService preferenceQueryService = getPreferenceQueryService(); final PreferenceQueryService preferenceQueryService = getPreferenceQueryService();
JSONObject replyNotificationTemplate = preferenceQueryService.getReplyNotificationTemplate(); 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"); replyNotificationTemplate.put("subject", "updated subject");
preferenceMgmtService.updateReplyNotificationTemplate(replyNotificationTemplate); preferenceMgmtService.updateReplyNotificationTemplate(replyNotificationTemplate);
......
...@@ -18,7 +18,6 @@ package org.b3log.solo.service; ...@@ -18,7 +18,6 @@ package org.b3log.solo.service;
import org.b3log.latke.model.User; import org.b3log.latke.model.User;
import org.b3log.solo.AbstractTestCase; import org.b3log.solo.AbstractTestCase;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.model.Preference;
import org.json.JSONObject; import org.json.JSONObject;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
...@@ -27,7 +26,7 @@ import org.testng.annotations.Test; ...@@ -27,7 +26,7 @@ import org.testng.annotations.Test;
* {@link PreferenceQueryService} test case. * {@link PreferenceQueryService} 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, Nov 20, 2015 * @version 1.0.0.3, Nov 23, 2015
*/ */
@Test(suiteName = "service") @Test(suiteName = "service")
public class PreferenceQueryServiceTestCase extends AbstractTestCase { public class PreferenceQueryServiceTestCase extends AbstractTestCase {
...@@ -63,7 +62,7 @@ public class PreferenceQueryServiceTestCase extends AbstractTestCase { ...@@ -63,7 +62,7 @@ public class PreferenceQueryServiceTestCase extends AbstractTestCase {
= getPreferenceQueryService(); = getPreferenceQueryService();
final JSONObject preference = preferenceQueryService.getPreference(); 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 { ...@@ -78,6 +77,6 @@ public class PreferenceQueryServiceTestCase extends AbstractTestCase {
final JSONObject replyNotificationTemplate final JSONObject replyNotificationTemplate
= preferenceQueryService.getReplyNotificationTemplate(); = preferenceQueryService.getReplyNotificationTemplate();
Assert.assertEquals(replyNotificationTemplate.toString(), Preference.Default.DEFAULT_REPLY_NOTIFICATION_TEMPLATE); Assert.assertEquals(replyNotificationTemplate.toString(), Option.Default.DEFAULT_REPLY_NOTIFICATION_TEMPLATE);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment