spring-oauth-server/src/test/java/cc/wdcy/ContextTest.java

39 lines
1.4 KiB
Java

/*
* Copyright (c) 2013 Honyee Industry Group Co., Ltd
* www.honyee.biz
* All rights reserved.
*
* This software is the confidential and proprietary information of
* Honyee Industry Group Co., Ltd ("Confidential Information").
* You shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement you
* entered into with Honyee Industry Group Co., Ltd.
*/
package cc.wdcy;
import cc.wdcy.domain.shared.BeanProvider;
import cc.wdcy.domain.shared.security.HonyeeUserDetails;
import cc.wdcy.domain.shared.security.SecurityUtils;
import cc.wdcy.web.context.SpringSecurityHolder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
import org.springframework.test.context.transaction.BeforeTransaction;
/**
* @author Shengzhao Li
*/
@ContextConfiguration(locations = {"classpath:testApplicationContext.xml"})
public abstract class ContextTest extends AbstractTransactionalTestNGSpringContextTests {
@BeforeTransaction
public void beforeTest() {
BeanProvider.initialize(applicationContext);
SecurityUtils securityUtils = new SecurityUtils();
securityUtils.setSecurityHolder(new SpringSecurityHolder() {
@Override
public HonyeeUserDetails userDetails() {
return null;
}
});
}
}