package test.attention;
import java.util.List;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.skyline.base.dao.impl.BaseDaoImpl;
import com.skyline.base.type.Activity;
import com.skyline.base.type.AttentionType;
import com.skyline.base.type.IdolType;
import com.skyline.common.bean.Page;
import com.skyline.user.model.Fan;
import com.skyline.user.service.AttentionService;
public class TestAttention {
static AttentionService attentionservice = null;
static {
// URL url =
// AttentionService.class.getClassLoader().getResource("config/logger/log4j.properties");
// PropertyConfigurator.configure(url);
}
@BeforeClass
public static void before() {
ApplicationContext ctx = new ClassPathXmlApplicationContext(
"config/context/applicationContext.xml");
attentionservice = (AttentionService) ctx.getBean("attentionService");
}
// @Test
public void add() {
attentionservice.payAttention(Long.valueOf(6), "burningcl@163.com",
"default", Long.valueOf(5), "burningcl@gmail.com", "default",
IdolType.USER);
attentionservice.payAttention(Long.valueOf(7), "a@b.c", "default",
Long.valueOf(5), "burningcl@gmail.com", "default",
IdolType.USER);
}
// @Test
public void queryByIdol() {
Page page = new Page();
page.setSize(2);
List<Fan> fanList = attentionservice.queryAttentionByType(
Long.valueOf(5), IdolType.USER, page);
// System.out.println(fanList.size());
fanList.toString();
}
// @Test
public void testExist() {
try {
boolean is = attentionservice.isFan(Long.valueOf(1),
Long.valueOf(2));
System.out.println(is);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testdel() {
attentionservice.payAttention(Long.valueOf(14), null, null,
Long.valueOf(1), null, null, null);
// attentionservice.cancelAttention(Long.valueOf(14), Long.valueOf(1));
// attentionservice(Long.valueOf(4), Long.valueOf(14));
}
// @Test
public void cout() {
try {
int count = attentionservice.countAttentionByType(Long.valueOf(5),
IdolType.USER);
System.out.println(count);
} catch (Exception e) {
e.printStackTrace();
}
}
}