ltr func top code except false app https ini
pom.xml中:
- <!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>4.3.6.RELEASE</version>
- <!--<scope>test</scope>-->
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <!--<scope>test</scope>-->
- </dependency>
createTest:
- @RunWith(SpringJUnit4ClassRunner.class)
- @ContextConfiguration("classpath:applicationContext.xml")
- @Transactional
- @TransactionConfiguration(defaultRollback = false)
- @Before
- public void setUp() throws Exception {
- ApplicationContext context = new ClassPathXmlApplicationContext("/applicationContext.xml");
- SpringBeanUtil.initContext(context);
- }
- SessionContext.setTenantId(100000000001L); // 全局租户
- SessionContext.setOpId(100000000001L); // 全局操作员id
- System.setProperty("MQ_HOST_LIST","192.168.70.250");
- System.setProperty("MQ_USER_NAME","admin");
- System.setProperty("MQ_PASS_WORD","123456");
- System.setProperty("hub.configure.type","DataBase");
Java单元测试
来源: http://www.bubuko.com/infodetail-2337037.html