Skip to content

Commit

Permalink
remove mongodb and rabbitmq
Browse files Browse the repository at this point in the history
  • Loading branch information
Zephery committed Jul 8, 2018
1 parent 1e8ec66 commit 547e90c
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 101 deletions.
32 changes: 16 additions & 16 deletions src/test/java/BaseTest.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import org.junit.runner.RunWith;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
* Created with IntelliJ IDEA.
* User: Zephery
* Time: 2018/4/14 0:13
* Description:
*/
@ContextConfiguration(locations = {"classpath:testContext.xml"})
@ActiveProfiles("develop")
@RunWith(SpringJUnit4ClassRunner.class)
public abstract class BaseTest {
}
//import org.junit.runner.RunWith;
//import org.springframework.test.context.ActiveProfiles;
//import org.springframework.test.context.ContextConfiguration;
//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
//
///**
// * Created with IntelliJ IDEA.
// * User: Zephery
// * Time: 2018/4/14 0:13
// * Description:
// */
//@ContextConfiguration(locations = {"classpath:testContext.xml"})
//@ActiveProfiles("develop")
//@RunWith(SpringJUnit4ClassRunner.class)
//public abstract class BaseTest {
//}
46 changes: 23 additions & 23 deletions src/test/java/CacheTest.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import com.myblog.service.IBlogService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import javax.annotation.Resource;

/**
* Created with IntelliJ IDEA.
* User: Zephery
* Time: 2018/4/8 23:36
* Description:
*/

@Slf4j
public class CacheTest extends BaseTest{
@Resource
private IBlogService blogService;

@Test
public void test() {
blogService.getBlogDetail(615);
}
}
//import com.myblog.service.IBlogService;
//import lombok.extern.slf4j.Slf4j;
//import org.junit.Test;
//
//import javax.annotation.Resource;
//
///**
// * Created with IntelliJ IDEA.
// * User: Zephery
// * Time: 2018/4/8 23:36
// * Description:
// */
//
//@Slf4j
//public class CacheTest extends BaseTest{
// @Resource
// private IBlogService blogService;
//
// @Test
// public void test() {
// blogService.getBlogDetail(615);
// }
//}
34 changes: 17 additions & 17 deletions src/test/java/MyBatisTest.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

/**
* @author Zephery
* @since 2018/1/20 15:41
*/
public class MyBatisTest {
@Test
public void oneCache() throws Exception {
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(Resources.getResourceAsReader("mybatis-config.xml"));
SqlSession session = sqlSessionFactory.openSession();
}
}
//import org.apache.ibatis.io.Resources;
//import org.apache.ibatis.session.SqlSession;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.apache.ibatis.session.SqlSessionFactoryBuilder;
//import org.junit.Test;
//
///**
// * @author Zephery
// * @since 2018/1/20 15:41
// */
//public class MyBatisTest {
// @Test
// public void oneCache() throws Exception {
// SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(Resources.getResourceAsReader("mybatis-config.xml"));
// SqlSession session = sqlSessionFactory.openSession();
// }
//}
90 changes: 45 additions & 45 deletions src/test/java/SpringTest.java
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
import com.myblog.service.IBlogService;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
* @author Zephery
* @since 2018/1/17 15:12
*/
public class SpringTest {
//logger
private static final Logger logger = LoggerFactory.getLogger(SpringTest.class);
private ApplicationContext ctx;

@Before
public void before() {
ctx = new FileSystemXmlApplicationContext("classpath:spring-test.xml");
}

@Test
public void cacheTest() {
IBlogService blogService = (IBlogService) ctx.getBean("blogService");

long startTime = System.currentTimeMillis();
try {
Thread.sleep(5 * 1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
for (int i = 0; i < 100; i++) {
blogService.getBlogDetail(615);
}
System.out.print("========使用了缓存=======");
System.out.println(System.currentTimeMillis() - startTime);
}

@Test
public void aop() {
IBlogService blogService = (IBlogService) ctx.getBean("blogService");
blogService.getBlogDetail(615);
}
}
//import com.myblog.service.IBlogService;
//import org.junit.Before;
//import org.junit.Test;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.support.FileSystemXmlApplicationContext;
//
///**
// * @author Zephery
// * @since 2018/1/17 15:12
// */
//public class SpringTest {
// //logger
// private static final Logger logger = LoggerFactory.getLogger(SpringTest.class);
// private ApplicationContext ctx;
//
// @Before
// public void before() {
// ctx = new FileSystemXmlApplicationContext("classpath:spring-test.xml");
// }
//
// @Test
// public void cacheTest() {
// IBlogService blogService = (IBlogService) ctx.getBean("blogService");
//
// long startTime = System.currentTimeMillis();
// try {
// Thread.sleep(5 * 1000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// for (int i = 0; i < 100; i++) {
// blogService.getBlogDetail(615);
// }
// System.out.print("========使用了缓存=======");
// System.out.println(System.currentTimeMillis() - startTime);
// }
//
// @Test
// public void aop() {
// IBlogService blogService = (IBlogService) ctx.getBean("blogService");
// blogService.getBlogDetail(615);
// }
//}

0 comments on commit 547e90c

Please sign in to comment.