package test.spot;
import java.net.URL;
import java.util.List;
import org.apache.log4j.PropertyConfigurator;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.skyline.base.type.SpotRefrenceType;
import com.skyline.common.bean.Page;
import com.skyline.spot.model.SpotRefrence;
import com.skyline.spot.service.SpotRefrenceService;
public class SpotRefrenceTest {
static SpotRefrenceService spotRefrenceService = null;
static {
URL url = SpotRefrenceService.class.getClassLoader().getResource(
"config/logger/log4j.properties");
PropertyConfigurator.configure(url);
}
@BeforeClass
public static void before() {
ApplicationContext ctx = new ClassPathXmlApplicationContext(
"config/context/applicationContext.xml");
spotRefrenceService = (SpotRefrenceService) ctx
.getBean("spotRefrenceService");
}
@Test
public void testInsert() {
spotRefrenceService.postToSpot(Long.valueOf(2), "testing", "default","testTitle",
SpotRefrenceType.TRAVELNOTE, Long.valueOf(2), "雁荡山","default", Long.valueOf(1),
"test", "testportrait", "test@test.com");
}
@Test
public void testget() {
Page page=new Page();
page.setSize(5);
List<SpotRefrence> list = spotRefrenceService
.getRefrenceByRefrenceIdAndSpotId(Long.valueOf(1),
Long.valueOf(1),page);
// list = spotRefrenceService
// .getRefrenceByRefrenceType(SpotRefrenceType.TRAVELNOTE);
// list = spotRefrenceService.getRefrenceBySpotNameAndType("测试",
// SpotRefrenceType.TRAVELNOTE);
// list = spotRefrenceService.getRefrencesBySpotId(Long.valueOf(1));
list = spotRefrenceService.getRefrencesBySpotIdAndType(
Long.valueOf(2), SpotRefrenceType.TRAVELNOTE,page);
// spotRefrenceService.postToSpot(Long.valueOf(1), "测试", "测试摘要",
// SpotRefrenceType.TRAVELNOTE, Long.valueOf(1), "西湖", Long.valueOf(1),
// "test", "testportrait", "test@test.com");
list.toString();
}
// @Test
public void testDelete() {
spotRefrenceService.recoverRefrenceFromSpot(Long.valueOf(1),
Long.valueOf(1));
spotRefrenceService.recoverRefrenceFromSpotByProviderIdAndType(
Long.valueOf(1), SpotRefrenceType.TRAVELNOTE, Long.valueOf(1));
}
}