標籤:ase false contex sys cti ack frame artifact 需要
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)
類裡面加:
@Beforepublic void setUp() throws Exception {ApplicationContext context = new ClassPathXmlApplicationContext("/applicationContext.xml");SpringBeanUtil.initContext(context);}
需要設定的全域變數:
SessionContext.setTenantId(100000000001L); // 全域租戶SessionContext.setOpId(100000000001L); // 全域操作員idSystem.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單元測試