Commit 45a95850 authored by Liang Ding's avatar Liang Ding

#12319 清理缓存

parent a1327710
......@@ -16,6 +16,7 @@
package org.b3log.solo;
import org.b3log.latke.Latkes;
import org.b3log.latke.cache.CacheFactory;
import org.b3log.latke.ioc.LatkeBeanManager;
import org.b3log.latke.ioc.Lifecycle;
import org.b3log.latke.ioc.config.Discoverer;
......@@ -35,7 +36,7 @@ import java.util.Locale;
* Abstract test case.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.2.0.9, Apr 12, 2017
* @version 2.3.0.9, Jul 16, 2017
* @see #beforeClass()
*/
public abstract class AbstractTestCase {
......@@ -47,12 +48,10 @@ public abstract class AbstractTestCase {
/**
* Before class.
* <p>
* <ol>
* <li>Initializes Latke runtime</li>
* <li>Instantiates repositories</li>
* </ol>
* </p>
*
* @throws Exception exception
*/
......@@ -72,6 +71,19 @@ public abstract class AbstractTestCase {
JdbcRepositories.initAllTables();
}
/**
* After class.
* <ul>
* <li>Clears all caches</li>
* </ul>
*
* @throws Exception
*/
@BeforeClass
public void afterClass() throws Exception {
CacheFactory.clearAll();
}
/**
* Gets category-tag repository.
*
......
......@@ -34,7 +34,7 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
/**
* Add.
*
*
* @throws Exception exception
*/
@Test
......@@ -49,11 +49,14 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
final String id = optionMgmtService.addOrUpdateOption(option);
System.out.println(id);
Assert.assertNotNull(id);
final JSONObject opt = getOptionQueryService().getOptionById(Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
Assert.assertEquals(opt.getInt(Option.OPTION_VALUE), 0L);
}
/**
* Update.
*
*
* @throws Exception exception
*/
@Test
......@@ -73,17 +76,16 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST);
option.put(Option.OPTION_VALUE, 1L);
optionMgmtService.addOrUpdateOption(option); // Update
final JSONObject opt = getOptionQueryService().getOptionById(Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
Assert.assertEquals(opt.getInt(Option.OPTION_VALUE), 1L);
}
/**
* Remove.
*
*
* @throws Exception exception
*/
@Test
......
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