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

#12319 清理缓存

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