From 0d4efcd4c661435229294608d427bf69d349d88d Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 28 Jun 2020 22:51:18 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E8=B0=83=E6=95=B4=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/b3log/solo/service/InitService.java | 14 +++++--------- src/test/java/org/b3log/solo/AbstractTestCase.java | 5 +---- .../solo/processor/ArticleProcessorTestCase.java | 6 +++--- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/b3log/solo/service/InitService.java b/src/main/java/org/b3log/solo/service/InitService.java index 54fe23c8c..d95a7c63e 100644 --- a/src/main/java/org/b3log/solo/service/InitService.java +++ b/src/main/java/org/b3log/solo/service/InitService.java @@ -47,7 +47,7 @@ * Solo initialization service. * * @author Liang Ding - * @version 1.5.2.42, Jun 16, 2020 + * @version 1.5.2.43, Jun 28, 2020 * @since 0.4.0 */ @Service @@ -288,8 +288,6 @@ private void helloWorld() throws Exception { comment.put(Comment.COMMENT_SHARP_URL, commentSharpURL); commentRepository.add(comment); - - LOGGER.info("Hello World!"); } /** @@ -313,10 +311,8 @@ private String addHelloWorldArticle(final JSONObject article) throws RepositoryE articleRepository.add(article); } catch (final RepositoryException e) { LOGGER.log(Level.ERROR, "Adds an article failed", e); - throw new RepositoryException(e); } - return ret; } @@ -417,7 +413,7 @@ private void initAdmin(final JSONObject requestJSONObject) throws Exception { admin.put(UserExt.USER_GITHUB_ID, requestJSONObject.optString(UserExt.USER_GITHUB_ID)); userRepository.add(admin); - LOGGER.info("Initialized admin"); + LOGGER.debug("Initialized admin"); } /** @@ -436,7 +432,7 @@ private void initLink() throws Exception { final int maxOrder = linkRepository.getMaxOrder(); link.put(Link.LINK_ORDER, maxOrder + 1); linkRepository.add(link); - LOGGER.info("Initialized link"); + LOGGER.debug("Initialized link"); } /** @@ -454,7 +450,7 @@ private void initStatistic() throws RepositoryException, JSONException { statisticBlogViewCountOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_STATISTIC); optionRepository.add(statisticBlogViewCountOpt); - LOGGER.info("Initialized statistic"); + LOGGER.debug("Initialized statistic"); } /** @@ -736,6 +732,6 @@ private void initOptions(final JSONObject requestJSONObject) throws Exception { mobileSkinDirNameOpt.put(Option.OPTION_VALUE, DefaultPreference.DEFAULT_MOBILE_SKIN_DIR_NAME); optionRepository.add(mobileSkinDirNameOpt); - LOGGER.info("Initialized preference"); + LOGGER.debug("Initialized preference"); } } diff --git a/src/test/java/org/b3log/solo/AbstractTestCase.java b/src/test/java/org/b3log/solo/AbstractTestCase.java index 22b7fdb3d..9ae9e31af 100644 --- a/src/test/java/org/b3log/solo/AbstractTestCase.java +++ b/src/test/java/org/b3log/solo/AbstractTestCase.java @@ -44,7 +44,7 @@ * Abstract test case. * * @author Liang Ding - * @version 4.0.0.1, Apr 30, 2020 + * @version 4.0.0.2, Jun 28, 2020 * @since 2.9.7 */ public abstract class AbstractTestCase { @@ -70,7 +70,6 @@ public abstract class AbstractTestCase { */ @BeforeClass public void beforeClass() throws Exception { - System.out.println("before class"); beanManager = BeanManager.getInstance(); final Connection connection = Connections.getConnection(); @@ -113,9 +112,7 @@ private void initSolo() { final JSONObject requestJSONObject = new JSONObject(); requestJSONObject.put(User.USER_NAME, "Solo"); requestJSONObject.put(UserExt.USER_B3_KEY, "pass"); - System.out.println("before init"); initService.init(requestJSONObject); - System.out.println("after init"); final ErrorProcessor errorProcessor = beanManager.getReference(ErrorProcessor.class); Dispatcher.error("/error/{statusCode}", errorProcessor::showErrorPage); final UserQueryService userQueryService = getUserQueryService(); diff --git a/src/test/java/org/b3log/solo/processor/ArticleProcessorTestCase.java b/src/test/java/org/b3log/solo/processor/ArticleProcessorTestCase.java index f08599199..d9e602aec 100644 --- a/src/test/java/org/b3log/solo/processor/ArticleProcessorTestCase.java +++ b/src/test/java/org/b3log/solo/processor/ArticleProcessorTestCase.java @@ -28,7 +28,7 @@ * {@link ArticleProcessor} test case. * * @author Liang Ding - * @version 1.0.1.4, Feb 22, 2019 + * @version 1.0.1.5, Jun 28, 2020 * @since 1.7.0 */ @Test(suiteName = "processor") @@ -110,8 +110,8 @@ public void getAuthorsArticlesByPage() throws Exception { @Test public void getRandomArticles() { final MockRequest request = mockRequest(); - request.setRequestURI("/articles/random"); - request.setMethod("POST"); + request.setRequestURI("/articles/random.json"); + request.setMethod("GET"); final MockResponse response = mockResponse(); mockDispatcher(request, response);