package test.album;
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.common.bean.Page;
import com.skyline.wo.dao.AlbumDao;
import com.skyline.wo.dao.PhotoDao;
import com.skyline.wo.model.Album;
import com.skyline.wo.model.Photo;
public class TestAlbumAndPhotoDao {
static AlbumDao albumDao = null;
static PhotoDao photoDao = null;
static {
URL url = TestAlbumAndPhotoDao.class.getClassLoader().getResource("config/logger/log4j.properties");
PropertyConfigurator.configure(url);
}
@BeforeClass
public static void before() {
ApplicationContext ctx = new ClassPathXmlApplicationContext(
"config/context/applicationContext.xml");
albumDao = (AlbumDao) ctx.getBean("albumDao");
photoDao = (PhotoDao) ctx.getBean("photoDao");
}
@Test
public void queryAlbumsByUserIdWithPortrait() {
Page page = new Page();
page.setSize(10);
List<Album> albums = albumDao.queryAlbumDetailsByUserIdWithPortrait(1, 0,
page);
System.out.println(albums.size());
}
// @Test
// public void queryActiveAlbumsByUserId() {
// Page page = new Page();
// page.setSize(10);
// List<Album> albums = albumDao.queryActiveAlbumsByUserId(1, 0, page);
// System.out.println(albums.size());
// }
@Test
public void addAlbumVisitCount() {
Page page = new Page();
page.setSize(10);
// albumDao.addVisitCount(1);
}
@Test
public void queryPhotosWithDetailOfAlbum() {
Page page = new Page();
page.setSize(20);
List<Photo> photos = photoDao.queryPhotosWithDetailOfAlbum(1, 0,page);
System.out.println(photos.size());
}
}